mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/alpha/ffi.c0000644000175000017500000001632311545150464021625 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. Alpha Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; all further uses in this file will refer to the 128-bit type. */ #if defined(__LONG_DOUBLE_128__) # if FFI_TYPE_LONGDOUBLE != 4 # error FFI_TYPE_LONGDOUBLE out of date # endif #else # undef FFI_TYPE_LONGDOUBLE # define FFI_TYPE_LONGDOUBLE 4 #endif extern void ffi_call_osf(void *, unsigned long, unsigned, void *, void (*)(void)) FFI_HIDDEN; extern void ffi_closure_osf(void) FFI_HIDDEN; ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { /* Adjust cif->bytes to represent a minimum 6 words for the temporary register argument loading area. */ if (cif->bytes < 6*FFI_SIZEOF_ARG) cif->bytes = 6*FFI_SIZEOF_ARG; /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_STRUCT: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags = cif->rtype->type; break; case FFI_TYPE_LONGDOUBLE: /* 128-bit long double is returned in memory, like a struct. */ cif->flags = FFI_TYPE_STRUCT; break; default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { unsigned long *stack, *argp; long i, avn; ffi_type **arg_types; /* If the return value is a struct and we don't have a return value address then we need to make one. */ if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT) rvalue = alloca(cif->rtype->size); /* Allocate the space for the arguments, plus 4 words of temp space for ffi_call_osf. */ argp = stack = alloca(cif->bytes + 4*FFI_SIZEOF_ARG); if (cif->flags == FFI_TYPE_STRUCT) *(void **) argp++ = rvalue; i = 0; avn = cif->nargs; arg_types = cif->arg_types; while (i < avn) { size_t size = (*arg_types)->size; switch ((*arg_types)->type) { case FFI_TYPE_SINT8: *(SINT64 *) argp = *(SINT8 *)(* avalue); break; case FFI_TYPE_UINT8: *(SINT64 *) argp = *(UINT8 *)(* avalue); break; case FFI_TYPE_SINT16: *(SINT64 *) argp = *(SINT16 *)(* avalue); break; case FFI_TYPE_UINT16: *(SINT64 *) argp = *(UINT16 *)(* avalue); break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: /* Note that unsigned 32-bit quantities are sign extended. */ *(SINT64 *) argp = *(SINT32 *)(* avalue); break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_POINTER: *(UINT64 *) argp = *(UINT64 *)(* avalue); break; case FFI_TYPE_FLOAT: if (argp - stack < 6) { /* Note the conversion -- all the fp regs are loaded as doubles. The in-register format is the same. */ *(double *) argp = *(float *)(* avalue); } else *(float *) argp = *(float *)(* avalue); break; case FFI_TYPE_DOUBLE: *(double *) argp = *(double *)(* avalue); break; case FFI_TYPE_LONGDOUBLE: /* 128-bit long double is passed by reference. */ *(long double **) argp = (long double *)(* avalue); size = sizeof (long double *); break; case FFI_TYPE_STRUCT: memcpy(argp, *avalue, (*arg_types)->size); break; default: FFI_ASSERT(0); } argp += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; i++, arg_types++, avalue++; } ffi_call_osf(stack, cif->bytes, cif->flags, rvalue, fn); } ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp; tramp = (unsigned int *) &closure->tramp[0]; tramp[0] = 0x47fb0401; /* mov $27,$1 */ tramp[1] = 0xa77b0010; /* ldq $27,16($27) */ tramp[2] = 0x6bfb0000; /* jmp $31,($27),0 */ tramp[3] = 0x47ff041f; /* nop */ *(void **) &tramp[4] = ffi_closure_osf; closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Flush the Icache. Tru64 UNIX as doesn't understand the imb mnemonic, so use call_pal instead, since both Compaq as and gas can handle it. 0x86 is PAL_imb in Tru64 UNIX . */ asm volatile ("call_pal 0x86" : : : "memory"); return FFI_OK; } long FFI_HIDDEN ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp) { ffi_cif *cif; void **avalue; ffi_type **arg_types; long i, avn, argn; cif = closure->cif; avalue = alloca(cif->nargs * sizeof(void *)); argn = 0; /* Copy the caller's structure return address to that the closure returns the data directly to the caller. */ if (cif->flags == FFI_TYPE_STRUCT) { rvalue = (void *) argp[0]; argn = 1; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) { size_t size = arg_types[i]->size; switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_POINTER: case FFI_TYPE_STRUCT: avalue[i] = &argp[argn]; break; case FFI_TYPE_FLOAT: if (argn < 6) { /* Floats coming from registers need conversion from double back to float format. */ *(float *)&argp[argn - 6] = *(double *)&argp[argn - 6]; avalue[i] = &argp[argn - 6]; } else avalue[i] = &argp[argn]; break; case FFI_TYPE_DOUBLE: avalue[i] = &argp[argn - (argn < 6 ? 6 : 0)]; break; case FFI_TYPE_LONGDOUBLE: /* 128-bit long double is passed by reference. */ avalue[i] = (long double *) argp[argn]; size = sizeof (long double *); break; default: abort (); } argn += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; i++; } /* Invoke the closure. */ closure->fun (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_osf how to perform return type promotions. */ return cif->rtype->type; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/alpha/ffitarget.h0000644000175000017500000000335311545150464023040 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for Alpha. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_OSF, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_OSF } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 24 #define FFI_NATIVE_RAW_API 0 #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/alpha/osf.S0000644000175000017500000001716011545150464021630 0ustar chr1schr1s/* ----------------------------------------------------------------------- osf.S - Copyright (c) 1998, 2001, 2007, 2008 Red Hat Alpha/OSF Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .arch ev6 .text /* ffi_call_osf (void *args, unsigned long bytes, unsigned flags, void *raddr, void (*fnaddr)(void)); Bit o trickiness here -- ARGS+BYTES is the base of the stack frame for this function. This has been allocated by ffi_call. We also deallocate some of the stack that has been alloca'd. */ .align 3 .globl ffi_call_osf .ent ffi_call_osf FFI_HIDDEN(ffi_call_osf) ffi_call_osf: .frame $15, 32, $26, 0 .mask 0x4008000, -32 $LFB1: addq $16,$17,$1 mov $16, $30 stq $26, 0($1) stq $15, 8($1) stq $18, 16($1) mov $1, $15 $LCFI1: .prologue 0 stq $19, 24($1) mov $20, $27 # Load up all of the (potential) argument registers. ldq $16, 0($30) ldt $f16, 0($30) ldt $f17, 8($30) ldq $17, 8($30) ldt $f18, 16($30) ldq $18, 16($30) ldt $f19, 24($30) ldq $19, 24($30) ldt $f20, 32($30) ldq $20, 32($30) ldt $f21, 40($30) ldq $21, 40($30) # Deallocate the register argument area. lda $30, 48($30) jsr $26, ($27), 0 ldgp $29, 0($26) # If the return value pointer is NULL, assume no return value. ldq $19, 24($15) ldq $18, 16($15) ldq $26, 0($15) $LCFI2: beq $19, $noretval # Store the return value out in the proper type. cmpeq $18, FFI_TYPE_INT, $1 bne $1, $retint cmpeq $18, FFI_TYPE_FLOAT, $2 bne $2, $retfloat cmpeq $18, FFI_TYPE_DOUBLE, $3 bne $3, $retdouble .align 3 $noretval: ldq $15, 8($15) ret .align 4 $retint: stq $0, 0($19) nop ldq $15, 8($15) ret .align 4 $retfloat: sts $f0, 0($19) nop ldq $15, 8($15) ret .align 4 $retdouble: stt $f0, 0($19) nop ldq $15, 8($15) ret $LFE1: .end ffi_call_osf /* ffi_closure_osf(...) Receives the closure argument in $1. */ .align 3 .globl ffi_closure_osf .ent ffi_closure_osf FFI_HIDDEN(ffi_closure_osf) ffi_closure_osf: .frame $30, 16*8, $26, 0 .mask 0x4000000, -16*8 $LFB2: ldgp $29, 0($27) subq $30, 16*8, $30 $LCFI5: stq $26, 0($30) $LCFI6: .prologue 1 # Store all of the potential argument registers in va_list format. stt $f16, 4*8($30) stt $f17, 5*8($30) stt $f18, 6*8($30) stt $f19, 7*8($30) stt $f20, 8*8($30) stt $f21, 9*8($30) stq $16, 10*8($30) stq $17, 11*8($30) stq $18, 12*8($30) stq $19, 13*8($30) stq $20, 14*8($30) stq $21, 15*8($30) # Call ffi_closure_osf_inner to do the bulk of the work. mov $1, $16 lda $17, 2*8($30) lda $18, 10*8($30) jsr $26, ffi_closure_osf_inner ldgp $29, 0($26) ldq $26, 0($30) # Load up the return value in the proper type. lda $1, $load_table s4addq $0, $1, $1 ldl $1, 0($1) addq $1, $29, $1 jmp $31, ($1), $load_32 .align 4 $load_none: addq $30, 16*8, $30 ret .align 4 $load_float: lds $f0, 16($30) nop addq $30, 16*8, $30 ret .align 4 $load_double: ldt $f0, 16($30) nop addq $30, 16*8, $30 ret .align 4 $load_u8: #ifdef __alpha_bwx__ ldbu $0, 16($30) nop #else ldq $0, 16($30) and $0, 255, $0 #endif addq $30, 16*8, $30 ret .align 4 $load_s8: #ifdef __alpha_bwx__ ldbu $0, 16($30) sextb $0, $0 #else ldq $0, 16($30) sll $0, 56, $0 sra $0, 56, $0 #endif addq $30, 16*8, $30 ret .align 4 $load_u16: #ifdef __alpha_bwx__ ldwu $0, 16($30) nop #else ldq $0, 16($30) zapnot $0, 3, $0 #endif addq $30, 16*8, $30 ret .align 4 $load_s16: #ifdef __alpha_bwx__ ldwu $0, 16($30) sextw $0, $0 #else ldq $0, 16($30) sll $0, 48, $0 sra $0, 48, $0 #endif addq $30, 16*8, $30 ret .align 4 $load_32: ldl $0, 16($30) nop addq $30, 16*8, $30 ret .align 4 $load_64: ldq $0, 16($30) nop addq $30, 16*8, $30 ret $LFE2: .end ffi_closure_osf #ifdef __ELF__ .section .rodata #else .rdata #endif $load_table: .gprel32 $load_none # FFI_TYPE_VOID .gprel32 $load_32 # FFI_TYPE_INT .gprel32 $load_float # FFI_TYPE_FLOAT .gprel32 $load_double # FFI_TYPE_DOUBLE .gprel32 $load_none # FFI_TYPE_LONGDOUBLE .gprel32 $load_u8 # FFI_TYPE_UINT8 .gprel32 $load_s8 # FFI_TYPE_SINT8 .gprel32 $load_u16 # FFI_TYPE_UINT16 .gprel32 $load_s16 # FFI_TYPE_SINT16 .gprel32 $load_32 # FFI_TYPE_UINT32 .gprel32 $load_32 # FFI_TYPE_SINT32 .gprel32 $load_64 # FFI_TYPE_UINT64 .gprel32 $load_64 # FFI_TYPE_SINT64 .gprel32 $load_none # FFI_TYPE_STRUCT .gprel32 $load_64 # FFI_TYPE_POINTER /* Assert that the table above is in sync with ffi.h. */ #if FFI_TYPE_FLOAT != 2 \ || FFI_TYPE_DOUBLE != 3 \ || FFI_TYPE_UINT8 != 5 \ || FFI_TYPE_SINT8 != 6 \ || FFI_TYPE_UINT16 != 7 \ || FFI_TYPE_SINT16 != 8 \ || FFI_TYPE_UINT32 != 9 \ || FFI_TYPE_SINT32 != 10 \ || FFI_TYPE_UINT64 != 11 \ || FFI_TYPE_SINT64 != 12 \ || FFI_TYPE_STRUCT != 13 \ || FFI_TYPE_POINTER != 14 \ || FFI_TYPE_LAST != 14 #error "osf.S out of sync with ffi.h" #endif #ifdef __ELF__ .section .eh_frame,EH_FRAME_FLAGS,@progbits __FRAME_BEGIN__: .4byte $LECIE1-$LSCIE1 # Length of Common Information Entry $LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor .byte 0x78 # sleb128 -8; CIE Data Alignment Factor .byte 26 # CIE RA Column .byte 0x1 # uleb128 0x1; Augmentation size .byte 0x1b # FDE Encoding (pcrel sdata4) .byte 0xc # DW_CFA_def_cfa .byte 30 # uleb128 column 30 .byte 0 # uleb128 offset 0 .align 3 $LECIE1: $LSFDE1: .4byte $LEFDE1-$LASFDE1 # FDE Length $LASFDE1: .4byte $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset .4byte $LFB1-. # FDE initial location .4byte $LFE1-$LFB1 # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI1-$LFB1 .byte 0x9a # DW_CFA_offset, column 26 .byte 4 # uleb128 4*-8 .byte 0x8f # DW_CFA_offset, column 15 .byte 0x3 # uleb128 3*-8 .byte 0xc # DW_CFA_def_cfa .byte 15 # uleb128 column 15 .byte 32 # uleb128 offset 32 .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI2-$LCFI1 .byte 0xda # DW_CFA_restore, column 26 .align 3 $LEFDE1: $LSFDE3: .4byte $LEFDE3-$LASFDE3 # FDE Length $LASFDE3: .4byte $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset .4byte $LFB2-. # FDE initial location .4byte $LFE2-$LFB2 # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI5-$LFB2 .byte 0xe # DW_CFA_def_cfa_offset .byte 0x80,0x1 # uleb128 128 .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI6-$LCFI5 .byte 0x9a # DW_CFA_offset, column 26 .byte 16 # uleb128 offset 16*-8 .align 3 $LEFDE3: #ifdef __linux__ .section .note.GNU-stack,"",@progbits #endif #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/arm/ffi.c0000644000175000017500000003115311545150464021315 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998, 2008 Red Hat, Inc. ARM Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* Forward declares. */ static int vfp_type_p (ffi_type *); static void layout_vfp_args (ffi_cif *); /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments The vfp_space parameter is the load area for VFP regs, the return value is cif->vfp_used (word bitset of VFP regs used for passing arguments). These are only used for the VFP hard-float ABI. */ int ffi_prep_args(char *stack, extended_cif *ecif, float *vfp_space) { register unsigned int i, vi = 0; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { *(void **) argp = ecif->rvalue; argp += 4; } p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; /* Allocated in VFP registers. */ if (ecif->cif->abi == FFI_VFP && vi < ecif->cif->vfp_nargs && vfp_type_p (*p_arg)) { float* vfp_slot = vfp_space + ecif->cif->vfp_args[vi++]; if ((*p_arg)->type == FFI_TYPE_FLOAT) *((float*)vfp_slot) = *((float*)*p_argv); else if ((*p_arg)->type == FFI_TYPE_DOUBLE) *((double*)vfp_slot) = *((double*)*p_argv); else memcpy(vfp_slot, *p_argv, (*p_arg)->size); p_argv++; continue; } /* Align if necessary */ if (((*p_arg)->alignment - 1) & (unsigned) argp) { argp = (char *) ALIGN(argp, (*p_arg)->alignment); } if ((*p_arg)->type == FFI_TYPE_STRUCT) argp = (char *) ALIGN(argp, 4); z = (*p_arg)->size; if (z < sizeof(int)) { z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; case FFI_TYPE_STRUCT: memcpy(argp, *p_argv, (*p_arg)->size); break; default: FFI_ASSERT(0); } } else if (z == sizeof(int)) { *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); } else { memcpy(argp, *p_argv, z); } p_argv++; argp += z; } /* Indicate the VFP registers used. */ return ecif->cif->vfp_used; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { int type_code; /* Round the stack up to a multiple of 8 bytes. This isn't needed everywhere, but it is on some platforms, and it doesn't harm anything when it isn't needed. */ cif->bytes = (cif->bytes + 7) & ~7; /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = (unsigned) FFI_TYPE_SINT64; break; case FFI_TYPE_STRUCT: if (cif->abi == FFI_VFP && (type_code = vfp_type_p (cif->rtype)) != 0) { /* A Composite Type passed in VFP registers, either FFI_TYPE_STRUCT_VFP_FLOAT or FFI_TYPE_STRUCT_VFP_DOUBLE. */ cif->flags = (unsigned) type_code; } else if (cif->rtype->size <= 4) /* A Composite Type not larger than 4 bytes is returned in r0. */ cif->flags = (unsigned)FFI_TYPE_INT; else /* A Composite Type larger than 4 bytes, or whose size cannot be determined statically ... is stored in memory at an address passed [in r0]. */ cif->flags = (unsigned)FFI_TYPE_STRUCT; break; default: cif->flags = FFI_TYPE_INT; break; } /* Map out the register placements of VFP register args. The VFP hard-float calling conventions are slightly more sophisticated than the base calling conventions, so we do it here instead of in ffi_prep_args(). */ if (cif->abi == FFI_VFP) layout_vfp_args (cif); return FFI_OK; } /* Prototypes for assembly functions, in sysv.S */ extern void ffi_call_SYSV (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); extern void ffi_call_VFP (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; int small_struct = (cif->flags == FFI_TYPE_INT && cif->rtype->type == FFI_TYPE_STRUCT); int vfp_struct = (cif->flags == FFI_TYPE_STRUCT_VFP_FLOAT || cif->flags == FFI_TYPE_STRUCT_VFP_DOUBLE); ecif.cif = cif; ecif.avalue = avalue; unsigned int temp; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->flags == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else if (small_struct) ecif.rvalue = &temp; else if (vfp_struct) { /* Largest case is double x 4. */ ecif.rvalue = alloca(32); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); break; case FFI_VFP: ffi_call_VFP (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); break; default: FFI_ASSERT(0); break; } if (small_struct) memcpy (rvalue, &temp, cif->rtype->size); else if (vfp_struct) memcpy (rvalue, ecif.rvalue, cif->rtype->size); } /** private members **/ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, void** args, ffi_cif* cif, float *vfp_stack); void ffi_closure_SYSV (ffi_closure *); void ffi_closure_VFP (ffi_closure *); /* This function is jumped to by the trampoline */ unsigned int ffi_closure_SYSV_inner (closure, respp, args, vfp_args) ffi_closure *closure; void **respp; void *args; void *vfp_args; { // our various things... ffi_cif *cif; void **arg_area; cif = closure->cif; arg_area = (void**) alloca (cif->nargs * sizeof (void*)); /* this call will initialize ARG_AREA, such that each * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will re-set RESP to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args); (closure->fun) (cif, *respp, arg_area, closure->user_data); return cif->flags; } /*@-exportheader@*/ static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, ffi_cif *cif, /* Used only under VFP hard-float ABI. */ float *vfp_stack) /*@=exportheader@*/ { register unsigned int i, vi = 0; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; if ( cif->flags == FFI_TYPE_STRUCT ) { *rvalue = *(void **) argp; argp += 4; } p_argv = avalue; for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { size_t z; size_t alignment; if (cif->abi == FFI_VFP && vi < cif->vfp_nargs && vfp_type_p (*p_arg)) { *p_argv++ = (void*)(vfp_stack + cif->vfp_args[vi++]); continue; } alignment = (*p_arg)->alignment; if (alignment < 4) alignment = 4; /* Align if necessary */ if ((alignment - 1) & (unsigned) argp) { argp = (char *) ALIGN(argp, alignment); } z = (*p_arg)->size; /* because we're little endian, this is what it turns into. */ *p_argv = (void*) argp; p_argv++; argp += z; } return; } /* How to make a trampoline. */ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ unsigned int __ctx = (unsigned int)(CTX); \ *(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */ \ *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \ *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \ *(unsigned int*) &__tramp[12] = __ctx; \ *(unsigned int*) &__tramp[16] = __fun; \ __clear_cache((&__tramp[0]), (&__tramp[19])); \ }) /* the cif must already be prep'ed */ ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { void (*closure_func)(ffi_closure*) = NULL; if (cif->abi == FFI_SYSV) closure_func = &ffi_closure_SYSV; else if (cif->abi == FFI_VFP) closure_func = &ffi_closure_VFP; else FFI_ASSERT (0); FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ closure_func, \ codeloc); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } /* Below are routines for VFP hard-float support. */ static int rec_vfp_type_p (ffi_type *t, int *elt, int *elnum) { switch (t->type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: *elt = (int) t->type; *elnum = 1; return 1; case FFI_TYPE_STRUCT_VFP_FLOAT: *elt = FFI_TYPE_FLOAT; *elnum = t->size / sizeof (float); return 1; case FFI_TYPE_STRUCT_VFP_DOUBLE: *elt = FFI_TYPE_DOUBLE; *elnum = t->size / sizeof (double); return 1; case FFI_TYPE_STRUCT:; { int base_elt = 0, total_elnum = 0; ffi_type **el = t->elements; while (*el) { int el_elt = 0, el_elnum = 0; if (! rec_vfp_type_p (*el, &el_elt, &el_elnum) || (base_elt && base_elt != el_elt) || total_elnum + el_elnum > 4) return 0; base_elt = el_elt; total_elnum += el_elnum; el++; } *elnum = total_elnum; *elt = base_elt; return 1; } default: ; } return 0; } static int vfp_type_p (ffi_type *t) { int elt, elnum; if (rec_vfp_type_p (t, &elt, &elnum)) { if (t->type == FFI_TYPE_STRUCT) { if (elnum == 1) t->type = elt; else t->type = (elt == FFI_TYPE_FLOAT ? FFI_TYPE_STRUCT_VFP_FLOAT : FFI_TYPE_STRUCT_VFP_DOUBLE); } return (int) t->type; } return 0; } static void place_vfp_arg (ffi_cif *cif, ffi_type *t) { int reg = cif->vfp_reg_free; int nregs = t->size / sizeof (float); int align = ((t->type == FFI_TYPE_STRUCT_VFP_FLOAT || t->type == FFI_TYPE_FLOAT) ? 1 : 2); /* Align register number. */ if ((reg & 1) && align == 2) reg++; while (reg + nregs <= 16) { int s, new_used = 0; for (s = reg; s < reg + nregs; s++) { new_used |= (1 << s); if (cif->vfp_used & (1 << s)) { reg += align; goto next_reg; } } /* Found regs to allocate. */ cif->vfp_used |= new_used; cif->vfp_args[cif->vfp_nargs++] = reg; /* Update vfp_reg_free. */ if (cif->vfp_used & (1 << cif->vfp_reg_free)) { reg += nregs; while (cif->vfp_used & (1 << reg)) reg += 1; cif->vfp_reg_free = reg; } return; next_reg: ; } } static void layout_vfp_args (ffi_cif *cif) { int i; /* Init VFP fields */ cif->vfp_used = 0; cif->vfp_nargs = 0; cif->vfp_reg_free = 0; memset (cif->vfp_args, -1, 16); /* Init to -1. */ for (i = 0; i < cif->nargs; i++) { ffi_type *t = cif->arg_types[i]; if (vfp_type_p (t)) place_vfp_arg (cif, t); } } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/arm/ffitarget.h0000644000175000017500000000406611545150464022534 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for ARM. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_VFP, FFI_LAST_ABI, #ifdef __ARM_PCS_VFP FFI_DEFAULT_ABI = FFI_VFP #else FFI_DEFAULT_ABI = FFI_SYSV #endif } ffi_abi; #endif #define FFI_EXTRA_CIF_FIELDS \ int vfp_used; \ short vfp_reg_free, vfp_nargs; \ signed char vfp_args[16] \ /* Internally used. */ #define FFI_TYPE_STRUCT_VFP_FLOAT (FFI_TYPE_LAST + 1) #define FFI_TYPE_STRUCT_VFP_DOUBLE (FFI_TYPE_LAST + 2) /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 20 #define FFI_NATIVE_RAW_API 0 #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/arm/sysv.S0000644000175000017500000002333011545150464021533 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 1998, 2008 Red Hat, Inc. ARM Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef HAVE_MACHINE_ASM_H #include #else #ifdef __USER_LABEL_PREFIX__ #define CONCAT1(a, b) CONCAT2(a, b) #define CONCAT2(a, b) a ## b /* Use the right prefix for global labels. */ #define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) #else #define CNAME(x) x #endif #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): #endif #ifdef __ELF__ #define LSYM(x) .x #else #define LSYM(x) x #endif /* We need a better way of testing for this, but for now, this is all we can do. */ @ This selects the minimum architecture level required. #define __ARM_ARCH__ 3 #if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) # undef __ARM_ARCH__ # define __ARM_ARCH__ 4 #endif #if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ || defined(__ARM_ARCH_5TEJ__) # undef __ARM_ARCH__ # define __ARM_ARCH__ 5 #endif #if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \ || defined(__ARM_ARCH_6M__) # undef __ARM_ARCH__ # define __ARM_ARCH__ 6 #endif #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \ || defined(__ARM_ARCH_7EM__) # undef __ARM_ARCH__ # define __ARM_ARCH__ 7 #endif #if __ARM_ARCH__ >= 5 # define call_reg(x) blx x #elif defined (__ARM_ARCH_4T__) # define call_reg(x) mov lr, pc ; bx x # if defined(__thumb__) || defined(__THUMB_INTERWORK__) # define __INTERWORKING__ # endif #else # define call_reg(x) mov lr, pc ; mov pc, x #endif /* Conditionally compile unwinder directives. */ #ifdef __ARM_EABI__ #define UNWIND #else #define UNWIND @ #endif #if defined(__thumb__) && !defined(__THUMB_INTERWORK__) .macro ARM_FUNC_START name .text .align 0 .thumb .thumb_func ENTRY(\name) bx pc nop .arm UNWIND .fnstart /* A hook to tell gdb that we've switched to ARM mode. Also used to call directly from other local arm routines. */ _L__\name: .endm #else .macro ARM_FUNC_START name .text .align 0 .arm ENTRY(\name) UNWIND .fnstart .endm #endif .macro RETLDM regs=, cond=, dirn=ia #if defined (__INTERWORKING__) .ifc "\regs","" ldr\cond lr, [sp], #4 .else ldm\cond\dirn sp!, {\regs, lr} .endif bx\cond lr #else .ifc "\regs","" ldr\cond pc, [sp], #4 .else ldm\cond\dirn sp!, {\regs, pc} .endif #endif .endm @ r0: fn @ r1: &ecif @ r2: cif->bytes @ r3: fig->flags @ sp+0: ecif.rvalue @ This assumes we are using gas. ARM_FUNC_START ffi_call_SYSV @ Save registers stmfd sp!, {r0-r3, fp, lr} UNWIND .save {r0-r3, fp, lr} mov fp, sp UNWIND .setfp fp, sp @ Make room for all of the new args. sub sp, fp, r2 @ Place all of the ffi_prep_args in position mov r0, sp @ r1 already set @ Call ffi_prep_args(stack, &ecif) bl ffi_prep_args @ move first 4 parameters in registers ldmia sp, {r0-r3} @ and adjust stack sub lr, fp, sp @ cif->bytes == fp - sp ldr ip, [fp] @ load fn() in advance cmp lr, #16 movhs lr, #16 add sp, sp, lr @ call (fn) (...) call_reg(ip) @ Remove the space we pushed for the args mov sp, fp @ Load r2 with the pointer to storage for the return value ldr r2, [sp, #24] @ Load r3 with the return type code ldr r3, [sp, #12] @ If the return value pointer is NULL, assume no return value. cmp r2, #0 beq LSYM(Lepilogue) @ return INT cmp r3, #FFI_TYPE_INT #if defined(__SOFTFP__) || defined(__ARM_EABI__) cmpne r3, #FFI_TYPE_FLOAT #endif streq r0, [r2] beq LSYM(Lepilogue) @ return INT64 cmp r3, #FFI_TYPE_SINT64 #if defined(__SOFTFP__) || defined(__ARM_EABI__) cmpne r3, #FFI_TYPE_DOUBLE #endif stmeqia r2, {r0, r1} #if !defined(__SOFTFP__) && !defined(__ARM_EABI__) beq LSYM(Lepilogue) @ return FLOAT cmp r3, #FFI_TYPE_FLOAT stfeqs f0, [r2] beq LSYM(Lepilogue) @ return DOUBLE or LONGDOUBLE cmp r3, #FFI_TYPE_DOUBLE stfeqd f0, [r2] #endif LSYM(Lepilogue): RETLDM "r0-r3,fp" .ffi_call_SYSV_end: UNWIND .fnend .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) @ r0: fn @ r1: &ecif @ r2: cif->bytes @ r3: fig->flags @ sp+0: ecif.rvalue ARM_FUNC_START ffi_call_VFP @ Save registers stmfd sp!, {r0-r3, fp, lr} UNWIND .save {r0-r3, fp, lr} mov fp, sp UNWIND .setfp fp, sp @ Make room for all of the new args. sub sp, sp, r2 @ Make room for loading VFP args sub sp, sp, #64 @ Place all of the ffi_prep_args in position mov r0, sp @ r1 already set sub r2, fp, #64 @ VFP scratch space @ Call ffi_prep_args(stack, &ecif, vfp_space) bl ffi_prep_args @ Load VFP register args if needed cmp r0, #0 beq LSYM(Lbase_args) @ Load only d0 if possible cmp r0, #3 sub ip, fp, #64 flddle d0, [ip] fldmiadgt ip, {d0-d7} LSYM(Lbase_args): @ move first 4 parameters in registers ldmia sp, {r0-r3} @ and adjust stack sub lr, ip, sp @ cif->bytes == (fp - 64) - sp ldr ip, [fp] @ load fn() in advance cmp lr, #16 movhs lr, #16 add sp, sp, lr @ call (fn) (...) call_reg(ip) @ Remove the space we pushed for the args mov sp, fp @ Load r2 with the pointer to storage for @ the return value ldr r2, [sp, #24] @ Load r3 with the return type code ldr r3, [sp, #12] @ If the return value pointer is NULL, @ assume no return value. cmp r2, #0 beq LSYM(Lepilogue_vfp) cmp r3, #FFI_TYPE_INT streq r0, [r2] beq LSYM(Lepilogue_vfp) cmp r3, #FFI_TYPE_SINT64 stmeqia r2, {r0, r1} beq LSYM(Lepilogue_vfp) cmp r3, #FFI_TYPE_FLOAT fstseq s0, [r2] beq LSYM(Lepilogue_vfp) cmp r3, #FFI_TYPE_DOUBLE fstdeq d0, [r2] beq LSYM(Lepilogue_vfp) cmp r3, #FFI_TYPE_STRUCT_VFP_FLOAT cmpne r3, #FFI_TYPE_STRUCT_VFP_DOUBLE fstmiadeq r2, {d0-d3} LSYM(Lepilogue_vfp): RETLDM "r0-r3,fp" .ffi_call_VFP_end: UNWIND .fnend .size CNAME(ffi_call_VFP),.ffi_call_VFP_end-CNAME(ffi_call_VFP) /* unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (closure, respp, args) ffi_closure *closure; void **respp; void *args; */ ARM_FUNC_START ffi_closure_SYSV UNWIND .pad #16 add ip, sp, #16 stmfd sp!, {ip, lr} UNWIND .save {r0, lr} add r2, sp, #8 .pad #16 sub sp, sp, #16 str sp, [sp, #8] add r1, sp, #8 bl ffi_closure_SYSV_inner cmp r0, #FFI_TYPE_INT beq .Lretint cmp r0, #FFI_TYPE_FLOAT #if defined(__SOFTFP__) || defined(__ARM_EABI__) beq .Lretint #else beq .Lretfloat #endif cmp r0, #FFI_TYPE_DOUBLE #if defined(__SOFTFP__) || defined(__ARM_EABI__) beq .Lretlonglong #else beq .Lretdouble #endif cmp r0, #FFI_TYPE_LONGDOUBLE #if defined(__SOFTFP__) || defined(__ARM_EABI__) beq .Lretlonglong #else beq .Lretlongdouble #endif cmp r0, #FFI_TYPE_SINT64 beq .Lretlonglong .Lclosure_epilogue: add sp, sp, #16 ldmfd sp, {sp, pc} .Lretint: ldr r0, [sp] b .Lclosure_epilogue .Lretlonglong: ldr r0, [sp] ldr r1, [sp, #4] b .Lclosure_epilogue #if !defined(__SOFTFP__) && !defined(__ARM_EABI__) .Lretfloat: ldfs f0, [sp] b .Lclosure_epilogue .Lretdouble: ldfd f0, [sp] b .Lclosure_epilogue .Lretlongdouble: ldfd f0, [sp] b .Lclosure_epilogue #endif .ffi_closure_SYSV_end: UNWIND .fnend .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) ARM_FUNC_START ffi_closure_VFP fstmfdd sp!, {d0-d7} @ r0-r3, then d0-d7 UNWIND .pad #80 add ip, sp, #80 stmfd sp!, {ip, lr} UNWIND .save {r0, lr} add r2, sp, #72 add r3, sp, #8 .pad #72 sub sp, sp, #72 str sp, [sp, #64] add r1, sp, #64 bl ffi_closure_SYSV_inner cmp r0, #FFI_TYPE_INT beq .Lretint_vfp cmp r0, #FFI_TYPE_FLOAT beq .Lretfloat_vfp cmp r0, #FFI_TYPE_DOUBLE cmpne r0, #FFI_TYPE_LONGDOUBLE beq .Lretdouble_vfp cmp r0, #FFI_TYPE_SINT64 beq .Lretlonglong_vfp cmp r0, #FFI_TYPE_STRUCT_VFP_FLOAT beq .Lretfloat_struct_vfp cmp r0, #FFI_TYPE_STRUCT_VFP_DOUBLE beq .Lretdouble_struct_vfp .Lclosure_epilogue_vfp: add sp, sp, #72 ldmfd sp, {sp, pc} .Lretfloat_vfp: flds s0, [sp] b .Lclosure_epilogue_vfp .Lretdouble_vfp: fldd d0, [sp] b .Lclosure_epilogue_vfp .Lretint_vfp: ldr r0, [sp] b .Lclosure_epilogue_vfp .Lretlonglong_vfp: ldmia sp, {r0, r1} b .Lclosure_epilogue_vfp .Lretfloat_struct_vfp: fldmiad sp, {d0-d1} b .Lclosure_epilogue_vfp .Lretdouble_struct_vfp: fldmiad sp, {d0-d3} b .Lclosure_epilogue_vfp .ffi_closure_VFP_end: UNWIND .fnend .size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP) #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",%progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/avr32/ffi.c0000644000175000017500000003005211545150464021470 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2009 Bradley Smith AVR32 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include #include #include /* #define DEBUG */ extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned int, unsigned int, unsigned int*, unsigned int, void (*fn)(void)); extern void ffi_closure_SYSV (ffi_closure *); unsigned int pass_struct_on_stack(ffi_type *type) { if(type->type != FFI_TYPE_STRUCT) return 0; if(type->alignment < type->size && !(type->size == 4 || type->size == 8) && !(type->size == 8 && type->alignment >= 4)) return 1; if(type->size == 3 || type->size == 5 || type->size == 6 || type->size == 7) return 1; return 0; } /* ffi_prep_args is called by the assembly routine once stack space * has been allocated for the function's arguments * * This is annoyingly complex since we need to keep track of used * registers. */ void ffi_prep_args(char *stack, extended_cif *ecif) { unsigned int i; void **p_argv; ffi_type **p_arg; char *reg_base = stack; char *stack_base = stack + 20; unsigned int stack_offset = 0; unsigned int reg_mask = 0; p_argv = ecif->avalue; /* If cif->flags is struct then we know it's not passed in registers */ if(ecif->cif->flags == FFI_TYPE_STRUCT) { *(void**)reg_base = ecif->rvalue; reg_mask |= 1; } for(i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; i++, p_arg++) { size_t z = (*p_arg)->size; int alignment = (*p_arg)->alignment; int type = (*p_arg)->type; char *addr = 0; if(z % 4 != 0) z += (4 - z % 4); if(reg_mask != 0x1f) { if(pass_struct_on_stack(*p_arg)) { addr = stack_base + stack_offset; stack_offset += z; } else if(z == sizeof(int)) { char index = 0; while((reg_mask >> index) & 1) index++; addr = reg_base + (index * 4); reg_mask |= (1 << index); } else if(z == 2 * sizeof(int)) { if(!((reg_mask >> 1) & 1)) { addr = reg_base + 4; reg_mask |= (3 << 1); } else if(!((reg_mask >> 3) & 1)) { addr = reg_base + 12; reg_mask |= (3 << 3); } } } if(!addr) { addr = stack_base + stack_offset; stack_offset += z; } if(type == FFI_TYPE_STRUCT && (*p_arg)->elements[1] == NULL) type = (*p_arg)->elements[0]->type; switch(type) { case FFI_TYPE_UINT8: *(unsigned int *)addr = (unsigned int)*(UINT8 *)(*p_argv); break; case FFI_TYPE_SINT8: *(signed int *)addr = (signed int)*(SINT8 *)(*p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *)addr = (unsigned int)*(UINT16 *)(*p_argv); break; case FFI_TYPE_SINT16: *(signed int *)addr = (signed int)*(SINT16 *)(*p_argv); break; default: memcpy(addr, *p_argv, z); } p_argv++; } #ifdef DEBUG /* Debugging */ for(i = 0; i < 5; i++) { if((reg_mask & (1 << i)) == 0) printf("r%d: (unused)\n", 12 - i); else printf("r%d: 0x%08x\n", 12 - i, ((unsigned int*)reg_base)[i]); } for(i = 0; i < stack_offset / 4; i++) { printf("sp+%d: 0x%08x\n", i*4, ((unsigned int*)stack_base)[i]); } #endif } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { /* Round the stack up to a multiple of 8 bytes. This isn't needed * everywhere, but it is on some platforms, and it doesn't harm * anything when it isn't needed. */ cif->bytes = (cif->bytes + 7) & ~7; /* Flag to indicate that he return value is in fact a struct */ cif->rstruct_flag = 0; /* Set the return type flag */ switch(cif->rtype->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: cif->flags = (unsigned)FFI_TYPE_UINT8; break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: cif->flags = (unsigned)FFI_TYPE_UINT16; break; case FFI_TYPE_FLOAT: case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_POINTER: cif->flags = (unsigned)FFI_TYPE_UINT32; break; case FFI_TYPE_DOUBLE: case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = (unsigned)FFI_TYPE_UINT64; break; case FFI_TYPE_STRUCT: cif->rstruct_flag = 1; if(!pass_struct_on_stack(cif->rtype)) { if(cif->rtype->size <= 1) cif->flags = (unsigned)FFI_TYPE_UINT8; else if(cif->rtype->size <= 2) cif->flags = (unsigned)FFI_TYPE_UINT16; else if(cif->rtype->size <= 4) cif->flags = (unsigned)FFI_TYPE_UINT32; else if(cif->rtype->size <= 8) cif->flags = (unsigned)FFI_TYPE_UINT64; else cif->flags = (unsigned)cif->rtype->type; } else cif->flags = (unsigned)cif->rtype->type; break; default: cif->flags = (unsigned)cif->rtype->type; break; } return FFI_OK; } void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; unsigned int size = 0, i = 0; ffi_type **p_arg; ecif.cif = cif; ecif.avalue = avalue; for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) size += (*p_arg)->size + (4 - (*p_arg)->size % 4); /* If the return value is a struct and we don't have a return value * address then we need to make one */ /* If cif->flags is struct then it's not suitable for registers */ if((rvalue == NULL) && (cif->flags == FFI_TYPE_STRUCT)) ecif.rvalue = alloca(cif->rtype->size); else ecif.rvalue = rvalue; switch(cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, size, cif->flags, ecif.rvalue, cif->rstruct_flag, fn); break; default: FFI_ASSERT(0); break; } } static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, ffi_cif *cif) { register unsigned int i, reg_mask = 0; register void **p_argv; register ffi_type **p_arg; register char *reg_base = stack; register char *stack_base = stack + 20; register unsigned int stack_offset = 0; #ifdef DEBUG /* Debugging */ for(i = 0; i < cif->nargs + 7; i++) { printf("sp+%d: 0x%08x\n", i*4, ((unsigned int*)stack)[i]); } #endif /* If cif->flags is struct then we know it's not passed in registers */ if(cif->flags == FFI_TYPE_STRUCT) { *rvalue = *(void **)reg_base; reg_mask |= 1; } p_argv = avalue; for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) { size_t z = (*p_arg)->size; int alignment = (*p_arg)->alignment; *p_argv = 0; if(z % 4 != 0) z += (4 - z % 4); if(reg_mask != 0x1f) { if(pass_struct_on_stack(*p_arg)) { *p_argv = (void*)stack_base + stack_offset; stack_offset += z; } else if(z <= sizeof(int)) { char index = 0; while((reg_mask >> index) & 1) index++; *p_argv = (void*)reg_base + (index * 4); reg_mask |= (1 << index); } else if(z == 2 * sizeof(int)) { if(!((reg_mask >> 1) & 1)) { *p_argv = (void*)reg_base + 4; reg_mask |= (3 << 1); } else if(!((reg_mask >> 3) & 1)) { *p_argv = (void*)reg_base + 12; reg_mask |= (3 << 3); } } } if(!*p_argv) { *p_argv = (void*)stack_base + stack_offset; stack_offset += z; } if((*p_arg)->type != FFI_TYPE_STRUCT || (*p_arg)->elements[1] == NULL) { if(alignment == 1) **(unsigned int**)p_argv <<= 24; else if(alignment == 2) **(unsigned int**)p_argv <<= 16; } p_argv++; } #ifdef DEBUG /* Debugging */ for(i = 0; i < cif->nargs; i++) { printf("sp+%d: 0x%08x\n", i*4, *(((unsigned int**)avalue)[i])); } #endif } /* This function is jumped to by the trampoline */ unsigned int ffi_closure_SYSV_inner(ffi_closure *closure, void **respp, void *args) { ffi_cif *cif; void **arg_area; unsigned int i, size = 0; ffi_type **p_arg; cif = closure->cif; for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) size += (*p_arg)->size + (4 - (*p_arg)->size % 4); arg_area = (void **)alloca(size); /* this call will initialize ARG_AREA, such that each element in that * array points to the corresponding value on the stack; and if the * function returns a structure, it will re-set RESP to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); (closure->fun)(cif, *respp, arg_area, closure->user_data); return cif->flags; } ffi_status ffi_prep_closure_loc(ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { FFI_ASSERT(cif->abi == FFI_SYSV); unsigned char *__tramp = (unsigned char*)(&closure->tramp[0]); unsigned int __fun = (unsigned int)(&ffi_closure_SYSV); unsigned int __ctx = (unsigned int)(codeloc); unsigned int __rstruct_flag = (unsigned int)(cif->rstruct_flag); unsigned int __inner = (unsigned int)(&ffi_closure_SYSV_inner); *(unsigned int*) &__tramp[0] = 0xebcd1f00; /* pushm r8-r12 */ *(unsigned int*) &__tramp[4] = 0xfefc0010; /* ld.w r12, pc[16] */ *(unsigned int*) &__tramp[8] = 0xfefb0010; /* ld.w r11, pc[16] */ *(unsigned int*) &__tramp[12] = 0xfefa0010; /* ld.w r10, pc[16] */ *(unsigned int*) &__tramp[16] = 0xfeff0010; /* ld.w pc, pc[16] */ *(unsigned int*) &__tramp[20] = __ctx; *(unsigned int*) &__tramp[24] = __rstruct_flag; *(unsigned int*) &__tramp[28] = __inner; *(unsigned int*) &__tramp[32] = __fun; syscall(__NR_cacheflush, 0, (&__tramp[0]), 36); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/avr32/ffitarget.h0000644000175000017500000000341111545150464022703 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 2009 Bradley Smith Target configuration macros for AVR32. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif #define FFI_EXTRA_CIF_FIELDS unsigned int rstruct_flag /* Definitions for closures */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 36 #define FFI_NATIVE_RAW_API 0 #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/avr32/sysv.S0000644000175000017500000001135011545150464021710 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2009 Bradley Smith AVR32 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include /* r12: ffi_prep_args * r11: &ecif * r10: size * r9: cif->flags * r8: ecif.rvalue * sp+0: cif->rstruct_flag * sp+4: fn */ .text .align 1 .globl ffi_call_SYSV .type ffi_call_SYSV, @function ffi_call_SYSV: stm --sp, r0,r1,lr stm --sp, r8-r12 mov r0, sp /* Make room for all of the new args. */ sub sp, r10 /* Pad to make way for potential skipped registers */ sub sp, 20 /* Call ffi_prep_args(stack, &ecif). */ /* r11 already set */ mov r1, r12 mov r12, sp icall r1 /* Save new argument size */ mov r1, r12 /* Move first 5 parameters in registers. */ ldm sp++, r8-r12 /* call (fn) (...). */ ld.w r1, r0[36] icall r1 /* Remove the space we pushed for the args. */ mov sp, r0 /* Load r1 with the rstruct flag. */ ld.w r1, sp[32] /* Load r9 with the return type code. */ ld.w r9, sp[12] /* Load r8 with the return value pointer. */ ld.w r8, sp[16] /* If the return value pointer is NULL, assume no return value. */ cp.w r8, 0 breq .Lend /* Check if return type is actually a struct */ cp.w r1, 0 breq 1f /* Return 8bit */ cp.w r9, FFI_TYPE_UINT8 breq .Lstore8 /* Return 16bit */ cp.w r9, FFI_TYPE_UINT16 breq .Lstore16 1: /* Return 32bit */ cp.w r9, FFI_TYPE_UINT32 breq .Lstore32 cp.w r9, FFI_TYPE_UINT16 breq .Lstore32 cp.w r9, FFI_TYPE_UINT8 breq .Lstore32 /* Return 64bit */ cp.w r9, FFI_TYPE_UINT64 breq .Lstore64 /* Didn't match anything */ bral .Lend .Lstore64: st.w r8[0], r11 st.w r8[4], r10 bral .Lend .Lstore32: st.w r8[0], r12 bral .Lend .Lstore16: st.h r8[0], r12 bral .Lend .Lstore8: st.b r8[0], r12 bral .Lend .Lend: sub sp, -20 ldm sp++, r0,r1,pc .size ffi_call_SYSV, . - ffi_call_SYSV /* r12: __ctx * r11: __rstruct_flag * r10: __inner */ .align 1 .globl ffi_closure_SYSV .type ffi_closure_SYSV, @function ffi_closure_SYSV: stm --sp, r0,lr mov r0, r11 mov r8, r10 sub r10, sp, -8 sub sp, 12 st.w sp[8], sp sub r11, sp, -8 icall r8 /* Check if return type is actually a struct */ cp.w r0, 0 breq 1f /* Return 8bit */ cp.w r12, FFI_TYPE_UINT8 breq .Lget8 /* Return 16bit */ cp.w r12, FFI_TYPE_UINT16 breq .Lget16 1: /* Return 32bit */ cp.w r12, FFI_TYPE_UINT32 breq .Lget32 cp.w r12, FFI_TYPE_UINT16 breq .Lget32 cp.w r12, FFI_TYPE_UINT8 breq .Lget32 /* Return 64bit */ cp.w r12, FFI_TYPE_UINT64 breq .Lget64 /* Didn't match anything */ bral .Lclend .Lget64: ld.w r11, sp[0] ld.w r10, sp[4] bral .Lclend .Lget32: ld.w r12, sp[0] bral .Lclend .Lget16: ld.uh r12, sp[0] bral .Lclend .Lget8: ld.ub r12, sp[0] bral .Lclend .Lclend: sub sp, -12 ldm sp++, r0,lr sub sp, -20 mov pc, lr .size ffi_closure_SYSV, . - ffi_closure_SYSV #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/cris/ffi.c0000644000175000017500000002266211545150464021503 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Cygnus Solutions Copyright (c) 2004 Simon Posnjak Copyright (c) 2005 Axis Communications AB Copyright (C) 2007 Free Software Foundation, Inc. CRIS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) static ffi_status initialize_aggregate_packed_struct (ffi_type * arg) { ffi_type **ptr; FFI_ASSERT (arg != NULL); FFI_ASSERT (arg->elements != NULL); FFI_ASSERT (arg->size == 0); FFI_ASSERT (arg->alignment == 0); ptr = &(arg->elements[0]); while ((*ptr) != NULL) { if (((*ptr)->size == 0) && (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; FFI_ASSERT (ffi_type_test ((*ptr))); arg->size += (*ptr)->size; arg->alignment = (arg->alignment > (*ptr)->alignment) ? arg->alignment : (*ptr)->alignment; ptr++; } if (arg->size == 0) return FFI_BAD_TYPEDEF; else return FFI_OK; } int ffi_prep_args (char *stack, extended_cif * ecif) { unsigned int i; unsigned int struct_count = 0; void **p_argv; char *argp; ffi_type **p_arg; argp = stack; p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; switch ((*p_arg)->type) { case FFI_TYPE_STRUCT: { z = (*p_arg)->size; if (z <= 4) { memcpy (argp, *p_argv, z); z = 4; } else if (z <= 8) { memcpy (argp, *p_argv, z); z = 8; } else { unsigned int uiLocOnStack; z = sizeof (void *); uiLocOnStack = 4 * ecif->cif->nargs + struct_count; struct_count = struct_count + (*p_arg)->size; *(unsigned int *) argp = (unsigned int) (UINT32 *) (stack + uiLocOnStack); memcpy ((stack + uiLocOnStack), *p_argv, (*p_arg)->size); } break; } default: z = (*p_arg)->size; if (z < sizeof (int)) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int) *(SINT8 *) (*p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int) *(UINT8 *) (*p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int) *(SINT16 *) (*p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int) *(UINT16 *) (*p_argv); break; default: FFI_ASSERT (0); } z = sizeof (int); } else if (z == sizeof (int)) *(unsigned int *) argp = (unsigned int) *(UINT32 *) (*p_argv); else memcpy (argp, *p_argv, z); break; } p_argv++; argp += z; } return (struct_count); } ffi_status ffi_prep_cif (ffi_cif * cif, ffi_abi abi, unsigned int nargs, ffi_type * rtype, ffi_type ** atypes) { unsigned bytes = 0; unsigned int i; ffi_type **ptr; FFI_ASSERT (cif != NULL); FFI_ASSERT (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI); cif->abi = abi; cif->arg_types = atypes; cif->nargs = nargs; cif->rtype = rtype; cif->flags = 0; if ((cif->rtype->size == 0) && (initialize_aggregate_packed_struct (cif->rtype) != FFI_OK)) return FFI_BAD_TYPEDEF; FFI_ASSERT_VALID_TYPE (cif->rtype); for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { if (((*ptr)->size == 0) && (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; FFI_ASSERT_VALID_TYPE (*ptr); if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN (bytes, (*ptr)->alignment); if ((*ptr)->type == FFI_TYPE_STRUCT) { if ((*ptr)->size > 8) { bytes += (*ptr)->size; bytes += sizeof (void *); } else { if ((*ptr)->size > 4) bytes += 8; else bytes += 4; } } else bytes += STACK_ARG_SIZE ((*ptr)->size); } cif->bytes = bytes; return ffi_prep_cif_machdep (cif); } ffi_status ffi_prep_cif_machdep (ffi_cif * cif) { switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_STRUCT: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = (unsigned) cif->rtype->type; break; default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } extern void ffi_call_SYSV (int (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn) ()) __attribute__ ((__visibility__ ("hidden"))); void ffi_call (ffi_cif * cif, void (*fn) (), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca (cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV (ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT (0); break; } } /* Because the following variables are not exported outside libffi, we mark them hidden. */ /* Assembly code for the jump stub. */ extern const char ffi_cris_trampoline_template[] __attribute__ ((__visibility__ ("hidden"))); /* Offset into ffi_cris_trampoline_template of where to put the ffi_prep_closure_inner function. */ extern const int ffi_cris_trampoline_fn_offset __attribute__ ((__visibility__ ("hidden"))); /* Offset into ffi_cris_trampoline_template of where to put the closure data. */ extern const int ffi_cris_trampoline_closure_offset __attribute__ ((__visibility__ ("hidden"))); /* This function is sibling-called (jumped to) by the closure trampoline. We get R10..R13 at PARAMS[0..3] and a copy of [SP] at PARAMS[4] to simplify handling of a straddling parameter. A copy of R9 is at PARAMS[5] and SP at PARAMS[6]. These parameters are put at the appropriate place in CLOSURE which is then executed and the return value is passed back to the caller. */ static unsigned long long ffi_prep_closure_inner (void **params, ffi_closure* closure) { char *register_args = (char *) params; void *struct_ret = params[5]; char *stack_args = params[6]; char *ptr = register_args; ffi_cif *cif = closure->cif; ffi_type **arg_types = cif->arg_types; /* Max room needed is number of arguments as 64-bit values. */ void **avalue = alloca (closure->cif->nargs * sizeof(void *)); int i; int doing_regs; long long llret = 0; /* Find the address of each argument. */ for (i = 0, doing_regs = 1; i < cif->nargs; i++) { /* Types up to and including 8 bytes go by-value. */ if (arg_types[i]->size <= 4) { avalue[i] = ptr; ptr += 4; } else if (arg_types[i]->size <= 8) { avalue[i] = ptr; ptr += 8; } else { FFI_ASSERT (arg_types[i]->type == FFI_TYPE_STRUCT); /* Passed by-reference, so copy the pointer. */ avalue[i] = *(void **) ptr; ptr += 4; } /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. Step over the first one if we had a straddling parameter. */ if (doing_regs && ptr >= register_args + 4*4) { ptr = stack_args + ((ptr > register_args + 4*4) ? 4 : 0); doing_regs = 0; } } /* Invoke the closure. */ (closure->fun) (cif, cif->rtype->type == FFI_TYPE_STRUCT /* The caller allocated space for the return structure, and passed a pointer to this space in R9. */ ? struct_ret /* We take advantage of being able to ignore that the high part isn't set if the return value is not in R10:R11, but in R10 only. */ : (void *) &llret, avalue, closure->user_data); return llret; } /* API function: Prepare the trampoline. */ ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif *, void *, void **, void*), void *user_data, void *codeloc) { void *innerfn = ffi_prep_closure_inner; FFI_ASSERT (cif->abi == FFI_SYSV); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; memcpy (closure->tramp, ffi_cris_trampoline_template, FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE); memcpy (closure->tramp + ffi_cris_trampoline_fn_offset, &innerfn, sizeof (void *)); memcpy (closure->tramp + ffi_cris_trampoline_closure_offset, &codeloc, sizeof (void *)); return FFI_OK; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/cris/ffitarget.h0000644000175000017500000000362511545150464022715 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for CRIS. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE 36 #define FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE (7*4) #define FFI_TRAMPOLINE_SIZE \ (FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE + FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE) #define FFI_NATIVE_RAW_API 0 #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/cris/sysv.S0000644000175000017500000001254711545150464021724 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2004 Simon Posnjak Copyright (c) 2005 Axis Communications AB CRIS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #define CONCAT(x,y) x ## y #define XCONCAT(x,y) CONCAT (x, y) #define L(x) XCONCAT (__USER_LABEL_PREFIX__, x) .text ;; OK, when we get called we should have this (according to ;; AXIS ETRAX 100LX Programmer's Manual chapter 6.3). ;; ;; R10: ffi_prep_args (func. pointer) ;; R11: &ecif ;; R12: cif->bytes ;; R13: fig->flags ;; sp+0: ecif.rvalue ;; sp+4: fn (function pointer to the function that we need to call) .globl L(ffi_call_SYSV) .type L(ffi_call_SYSV),@function .hidden L(ffi_call_SYSV) L(ffi_call_SYSV): ;; Save the regs to the stack. push $srp ;; Used for stack pointer saving. push $r6 ;; Used for function address pointer. push $r7 ;; Used for stack pointer saving. push $r8 ;; We save fig->flags to stack we will need them after we ;; call The Function. push $r13 ;; Saving current stack pointer. move.d $sp,$r8 move.d $sp,$r6 ;; Move address of ffi_prep_args to r13. move.d $r10,$r13 ;; Make room on the stack for the args of fn. sub.d $r12,$sp ;; Function void ffi_prep_args(char *stack, extended_cif *ecif) parameters are: ;; r10 <-- stack pointer ;; r11 <-- &ecif (already there) move.d $sp,$r10 ;; Call the function. jsr $r13 ;; Save the size of the structures which are passed on stack. move.d $r10,$r7 ;; Move first four args in to r10..r13. move.d [$sp+0],$r10 move.d [$sp+4],$r11 move.d [$sp+8],$r12 move.d [$sp+12],$r13 ;; Adjust the stack and check if any parameters are given on stack. addq 16,$sp sub.d $r7,$r6 cmp.d $sp,$r6 bpl go_on nop go_on_no_params_on_stack: move.d $r6,$sp go_on: ;; Discover if we need to put rval address in to r9. move.d [$r8+0],$r7 cmpq FFI_TYPE_STRUCT,$r7 bne call_now nop ;; Move rval address to $r9. move.d [$r8+20],$r9 call_now: ;; Move address of The Function in to r7. move.d [$r8+24],$r7 ;; Call The Function. jsr $r7 ;; Reset stack. move.d $r8,$sp ;; Load rval type (fig->flags) in to r13. pop $r13 ;; Detect rval type. cmpq FFI_TYPE_VOID,$r13 beq epilogue cmpq FFI_TYPE_STRUCT,$r13 beq epilogue cmpq FFI_TYPE_DOUBLE,$r13 beq return_double_or_longlong cmpq FFI_TYPE_UINT64,$r13 beq return_double_or_longlong cmpq FFI_TYPE_SINT64,$r13 beq return_double_or_longlong nop ;; Just return the 32 bit value. ba return nop return_double_or_longlong: ;; Load half of the rval to r10 and the other half to r11. move.d [$sp+16],$r13 move.d $r10,[$r13] addq 4,$r13 move.d $r11,[$r13] ba epilogue nop return: ;; Load the rval to r10. move.d [$sp+16],$r13 move.d $r10,[$r13] epilogue: pop $r8 pop $r7 pop $r6 Jump [$sp+] .size ffi_call_SYSV,.-ffi_call_SYSV /* Save R10..R13 into an array, somewhat like varargs. Copy the next argument too, to simplify handling of any straddling parameter. Save R9 and SP after those. Jump to function handling the rest. Since this is a template, copied and the main function filled in by the user. */ .globl L(ffi_cris_trampoline_template) .type L(ffi_cris_trampoline_template),@function .hidden L(ffi_cris_trampoline_template) L(ffi_cris_trampoline_template): 0: /* The value we get for "PC" is right after the prefix instruction, two bytes from the beginning, i.e. 0b+2. */ move.d $r10,[$pc+2f-(0b+2)] move.d $pc,$r10 1: addq 2f-1b+4,$r10 move.d $r11,[$r10+] move.d $r12,[$r10+] move.d $r13,[$r10+] move.d [$sp],$r11 move.d $r11,[$r10+] move.d $r9,[$r10+] move.d $sp,[$r10+] subq FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE,$r10 move.d 0,$r11 3: jump 0 2: .size ffi_cris_trampoline_template,.-0b /* This macro create a constant usable as "extern const int \name" in C from within libffi, when \name has no prefix decoration. */ .macro const name,value .globl \name .type \name,@object .hidden \name \name: .dword \value .size \name,4 .endm /* Constants for offsets within the trampoline. We could do this with just symbols, avoiding memory contents and memory accesses, but the C usage code would look a bit stranger. */ const L(ffi_cris_trampoline_fn_offset),2b-4-0b const L(ffi_cris_trampoline_closure_offset),3b-4-0b mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/frv/eabi.S0000644000175000017500000000652611545150464021455 0ustar chr1schr1s/* ----------------------------------------------------------------------- eabi.S - Copyright (c) 2004 Anthony Green FR-V Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .globl ffi_prep_args_EABI .text .p2align 4 .globl ffi_call_EABI .type ffi_call_EABI, @function # gr8 : ffi_prep_args # gr9 : &ecif # gr10: cif->bytes # gr11: fig->flags # gr12: ecif.rvalue # gr13: fn ffi_call_EABI: addi sp, #-80, sp sti fp, @(sp, #24) addi sp, #24, fp movsg lr, gr5 /* Make room for the new arguments. */ /* subi sp, fp, gr10 */ /* Store return address and incoming args on stack. */ sti gr5, @(fp, #8) sti gr8, @(fp, #-4) sti gr9, @(fp, #-8) sti gr10, @(fp, #-12) sti gr11, @(fp, #-16) sti gr12, @(fp, #-20) sti gr13, @(fp, #-24) sub sp, gr10, sp /* Call ffi_prep_args. */ ldi @(fp, #-4), gr4 addi sp, #0, gr8 ldi @(fp, #-8), gr9 #ifdef __FRV_FDPIC__ ldd @(gr4, gr0), gr14 calll @(gr14, gr0) #else calll @(gr4, gr0) #endif /* ffi_prep_args returns the new stack pointer. */ mov gr8, gr4 ldi @(sp, #0), gr8 ldi @(sp, #4), gr9 ldi @(sp, #8), gr10 ldi @(sp, #12), gr11 ldi @(sp, #16), gr12 ldi @(sp, #20), gr13 /* Always copy the return value pointer into the hidden parameter register. This is only strictly necessary when we're returning an aggregate type, but it doesn't hurt to do this all the time, and it saves a branch. */ ldi @(fp, #-20), gr3 /* Use the ffi_prep_args return value for the new sp. */ mov gr4, sp /* Call the target function. */ ldi @(fp, -24), gr4 #ifdef __FRV_FDPIC__ ldd @(gr4, gr0), gr14 calll @(gr14, gr0) #else calll @(gr4, gr0) #endif /* Store the result. */ ldi @(fp, #-16), gr10 /* fig->flags */ ldi @(fp, #-20), gr4 /* ecif.rvalue */ /* Is the return value stored in two registers? */ cmpi gr10, #8, icc0 bne icc0, 0, .L2 /* Yes, save them. */ sti gr8, @(gr4, #0) sti gr9, @(gr4, #4) bra .L3 .L2: /* Is the return value a structure? */ cmpi gr10, #-1, icc0 beq icc0, 0, .L3 /* No, save a 4 byte return value. */ sti gr8, @(gr4, #0) .L3: /* Restore the stack, and return. */ ldi @(fp, 8), gr5 ld @(fp, gr0), fp addi sp,#80,sp jmpl @(gr5,gr0) .size ffi_call_EABI, .-ffi_call_EABI mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/frv/ffi.c0000644000175000017500000002040011545150464021324 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (C) 2004 Anthony Green Copyright (C) 2007 Free Software Foundation, Inc. Copyright (C) 2008 Red Hat, Inc. FR-V Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void *ffi_prep_args(char *stack, extended_cif *ecif) { register unsigned int i; register void **p_argv; register char *argp; register ffi_type **p_arg; register int count = 0; p_argv = ecif->avalue; argp = stack; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; z = (*p_arg)->size; if ((*p_arg)->type == FFI_TYPE_STRUCT) { z = sizeof(void*); *(void **) argp = *p_argv; } /* if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (count > 24) { // This is going on the stack. Turn it into a double. *(double *) argp = (double) *(float*)(* p_argv); z = sizeof(double); } else *(void **) argp = *(void **)(* p_argv); } */ else if (z < sizeof(int)) { z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; default: FFI_ASSERT(0); } } else if (z == sizeof(int)) { *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); } else { memcpy(argp, *p_argv, z); } p_argv++; argp += z; count += z; } return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8))); } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { if (cif->rtype->type == FFI_TYPE_STRUCT) cif->flags = -1; else cif->flags = cif->rtype->size; cif->bytes = ALIGN (cif->bytes, 8); return FFI_OK; } extern void ffi_call_EABI(void *(*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_EABI: ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT(0); break; } } void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3, unsigned arg4, unsigned arg5, unsigned arg6) { /* This function is called by a trampoline. The trampoline stows a pointer to the ffi_closure object in gr7. We must save this pointer in a place that will persist while we do our work. */ register ffi_closure *creg __asm__ ("gr7"); ffi_closure *closure = creg; /* Arguments that don't fit in registers are found on the stack at a fixed offset above the current frame pointer. */ register char *frame_pointer __asm__ ("fp"); char *stack_args = frame_pointer + 16; /* Lay the register arguments down in a continuous chunk of memory. */ unsigned register_args[6] = { arg1, arg2, arg3, arg4, arg5, arg6 }; ffi_cif *cif = closure->cif; ffi_type **arg_types = cif->arg_types; void **avalue = alloca (cif->nargs * sizeof(void *)); char *ptr = (char *) register_args; int i; /* Find the address of each argument. */ for (i = 0; i < cif->nargs; i++) { switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = ptr + 3; break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = ptr + 2; break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_FLOAT: avalue[i] = ptr; break; case FFI_TYPE_STRUCT: avalue[i] = *(void**)ptr; break; default: /* This is an 8-byte value. */ avalue[i] = ptr; ptr += 4; break; } ptr += 4; /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. */ if (ptr == ((char *)register_args + (6*4))) ptr = stack_args; } /* Invoke the closure. */ if (cif->rtype->type == FFI_TYPE_STRUCT) { /* The caller allocates space for the return structure, and passes a pointer to this space in gr3. Use this value directly as the return value. */ register void *return_struct_ptr __asm__("gr3"); (closure->fun) (cif, return_struct_ptr, avalue, closure->user_data); } else { /* Allocate space for the return value and call the function. */ long long rvalue; (closure->fun) (cif, &rvalue, avalue, closure->user_data); /* Functions return 4-byte or smaller results in gr8. 8-byte values also use gr9. We fill the both, even for small return values, just to avoid a branch. */ asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); } } ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp = (unsigned int *) &closure->tramp[0]; unsigned long fn = (long) ffi_closure_eabi; unsigned long cls = (long) codeloc; #ifdef __FRV_FDPIC__ register void *got __asm__("gr15"); #endif int i; fn = (unsigned long) ffi_closure_eabi; #ifdef __FRV_FDPIC__ tramp[0] = &((unsigned int *)codeloc)[2]; tramp[1] = got; tramp[2] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ tramp[3] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ tramp[4] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ tramp[5] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ tramp[6] = 0x9cc86000; /* ldi @(gr6, #0), gr14 */ tramp[7] = 0x8030e000; /* jmpl @(gr14, gr0) */ #else tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ #endif closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Cache flushing. */ for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++) __asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i), "r" (codeloc)); return FFI_OK; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/frv/ffitarget.h0000644000175000017500000000375011545150464022551 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2004 Red Hat, Inc. Target configuration macros for FR-V Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_EABI, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_EABI } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 #ifdef __FRV_FDPIC__ /* Trampolines are 8 4-byte instructions long. */ #define FFI_TRAMPOLINE_SIZE (8*4) #else /* Trampolines are 5 4-byte instructions long. */ #define FFI_TRAMPOLINE_SIZE (5*4) #endif #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/ia64/ffi.c0000644000175000017500000003573511545150464021313 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998, 2007, 2008 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company IA64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include #include #include "ia64_flags.h" /* A 64-bit pointer value. In LP64 mode, this is effectively a plain pointer. In ILP32 mode, it's a pointer that's been extended to 64 bits by "addp4". */ typedef void *PTR64 __attribute__((mode(DI))); /* Memory image of fp register contents. This is the implementation specific format used by ldf.fill/stf.spill. All we care about is that it wants a 16 byte aligned slot. */ typedef struct { UINT64 x[2] __attribute__((aligned(16))); } fpreg; /* The stack layout given to ffi_call_unix and ffi_closure_unix_inner. */ struct ia64_args { fpreg fp_regs[8]; /* Contents of 8 fp arg registers. */ UINT64 gp_regs[8]; /* Contents of 8 gp arg registers. */ UINT64 other_args[]; /* Arguments passed on stack, variable size. */ }; /* Adjust ADDR, a pointer to an 8 byte slot, to point to the low LEN bytes. */ static inline void * endian_adjust (void *addr, size_t len) { #ifdef __BIG_ENDIAN__ return addr + (8 - len); #else return addr; #endif } /* Store VALUE to ADDR in the current cpu implementation's fp spill format. This is a macro instead of a function, so that it works for all 3 floating point types without type conversions. Type conversion to long double breaks the denorm support. */ #define stf_spill(addr, value) \ asm ("stf.spill %0 = %1%P0" : "=m" (*addr) : "f"(value)); /* Load a value from ADDR, which is in the current cpu implementation's fp spill format. As above, this must also be a macro. */ #define ldf_fill(result, addr) \ asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); /* Return the size of the C type associated with with TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ static size_t hfa_type_size (int type) { switch (type) { case FFI_IA64_TYPE_HFA_FLOAT: return sizeof(float); case FFI_IA64_TYPE_HFA_DOUBLE: return sizeof(double); case FFI_IA64_TYPE_HFA_LDOUBLE: return sizeof(__float80); default: abort (); } } /* Load from ADDR a value indicated by TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ static void hfa_type_load (fpreg *fpaddr, int type, void *addr) { switch (type) { case FFI_IA64_TYPE_HFA_FLOAT: stf_spill (fpaddr, *(float *) addr); return; case FFI_IA64_TYPE_HFA_DOUBLE: stf_spill (fpaddr, *(double *) addr); return; case FFI_IA64_TYPE_HFA_LDOUBLE: stf_spill (fpaddr, *(__float80 *) addr); return; default: abort (); } } /* Load VALUE into ADDR as indicated by TYPE. Which will be one of the FFI_IA64_TYPE_HFA_* values. */ static void hfa_type_store (int type, void *addr, fpreg *fpaddr) { switch (type) { case FFI_IA64_TYPE_HFA_FLOAT: { float result; ldf_fill (result, fpaddr); *(float *) addr = result; break; } case FFI_IA64_TYPE_HFA_DOUBLE: { double result; ldf_fill (result, fpaddr); *(double *) addr = result; break; } case FFI_IA64_TYPE_HFA_LDOUBLE: { __float80 result; ldf_fill (result, fpaddr); *(__float80 *) addr = result; break; } default: abort (); } } /* Is TYPE a struct containing floats, doubles, or extended doubles, all of the same fp type? If so, return the element type. Return FFI_TYPE_VOID if not. */ static int hfa_element_type (ffi_type *type, int nested) { int element = FFI_TYPE_VOID; switch (type->type) { case FFI_TYPE_FLOAT: /* We want to return VOID for raw floating-point types, but the synthetic HFA type if we're nested within an aggregate. */ if (nested) element = FFI_IA64_TYPE_HFA_FLOAT; break; case FFI_TYPE_DOUBLE: /* Similarly. */ if (nested) element = FFI_IA64_TYPE_HFA_DOUBLE; break; case FFI_TYPE_LONGDOUBLE: /* Similarly, except that that HFA is true for double extended, but not quad precision. Both have sizeof == 16, so tell the difference based on the precision. */ if (LDBL_MANT_DIG == 64 && nested) element = FFI_IA64_TYPE_HFA_LDOUBLE; break; case FFI_TYPE_STRUCT: { ffi_type **ptr = &type->elements[0]; for (ptr = &type->elements[0]; *ptr ; ptr++) { int sub_element = hfa_element_type (*ptr, 1); if (sub_element == FFI_TYPE_VOID) return FFI_TYPE_VOID; if (element == FFI_TYPE_VOID) element = sub_element; else if (element != sub_element) return FFI_TYPE_VOID; } } break; default: return FFI_TYPE_VOID; } return element; } /* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { int flags; /* Adjust cif->bytes to include space for the bits of the ia64_args frame that precedes the integer register portion. The estimate that the generic bits did for the argument space required is good enough for the integer component. */ cif->bytes += offsetof(struct ia64_args, gp_regs[0]); if (cif->bytes < sizeof(struct ia64_args)) cif->bytes = sizeof(struct ia64_args); /* Set the return type flag. */ flags = cif->rtype->type; switch (cif->rtype->type) { case FFI_TYPE_LONGDOUBLE: /* Leave FFI_TYPE_LONGDOUBLE as meaning double extended precision, and encode quad precision as a two-word integer structure. */ if (LDBL_MANT_DIG != 64) flags = FFI_IA64_TYPE_SMALL_STRUCT | (16 << 8); break; case FFI_TYPE_STRUCT: { size_t size = cif->rtype->size; int hfa_type = hfa_element_type (cif->rtype, 0); if (hfa_type != FFI_TYPE_VOID) { size_t nelts = size / hfa_type_size (hfa_type); if (nelts <= 8) flags = hfa_type | (size << 8); } else { if (size <= 32) flags = FFI_IA64_TYPE_SMALL_STRUCT | (size << 8); } } break; default: break; } cif->flags = flags; return FFI_OK; } extern int ffi_call_unix (struct ia64_args *, PTR64, void (*)(void), UINT64); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { struct ia64_args *stack; long i, avn, gpcount, fpcount; ffi_type **p_arg; FFI_ASSERT (cif->abi == FFI_UNIX); /* If we have no spot for a return value, make one. */ if (rvalue == NULL && cif->rtype->type != FFI_TYPE_VOID) rvalue = alloca (cif->rtype->size); /* Allocate the stack frame. */ stack = alloca (cif->bytes); gpcount = fpcount = 0; avn = cif->nargs; for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: stack->gp_regs[gpcount++] = *(SINT8 *)avalue[i]; break; case FFI_TYPE_UINT8: stack->gp_regs[gpcount++] = *(UINT8 *)avalue[i]; break; case FFI_TYPE_SINT16: stack->gp_regs[gpcount++] = *(SINT16 *)avalue[i]; break; case FFI_TYPE_UINT16: stack->gp_regs[gpcount++] = *(UINT16 *)avalue[i]; break; case FFI_TYPE_SINT32: stack->gp_regs[gpcount++] = *(SINT32 *)avalue[i]; break; case FFI_TYPE_UINT32: stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i]; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i]; break; case FFI_TYPE_POINTER: stack->gp_regs[gpcount++] = (UINT64)(PTR64) *(void **)avalue[i]; break; case FFI_TYPE_FLOAT: if (gpcount < 8 && fpcount < 8) stf_spill (&stack->fp_regs[fpcount++], *(float *)avalue[i]); stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i]; break; case FFI_TYPE_DOUBLE: if (gpcount < 8 && fpcount < 8) stf_spill (&stack->fp_regs[fpcount++], *(double *)avalue[i]); stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i]; break; case FFI_TYPE_LONGDOUBLE: if (gpcount & 1) gpcount++; if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8) stf_spill (&stack->fp_regs[fpcount++], *(__float80 *)avalue[i]); memcpy (&stack->gp_regs[gpcount], avalue[i], 16); gpcount += 2; break; case FFI_TYPE_STRUCT: { size_t size = (*p_arg)->size; size_t align = (*p_arg)->alignment; int hfa_type = hfa_element_type (*p_arg, 0); FFI_ASSERT (align <= 16); if (align == 16 && (gpcount & 1)) gpcount++; if (hfa_type != FFI_TYPE_VOID) { size_t hfa_size = hfa_type_size (hfa_type); size_t offset = 0; size_t gp_offset = gpcount * 8; while (fpcount < 8 && offset < size && gp_offset < 8 * 8) { hfa_type_load (&stack->fp_regs[fpcount], hfa_type, avalue[i] + offset); offset += hfa_size; gp_offset += hfa_size; fpcount += 1; } } memcpy (&stack->gp_regs[gpcount], avalue[i], size); gpcount += (size + 7) / 8; } break; default: abort (); } } ffi_call_unix (stack, rvalue, fn, cif->flags); } /* Closures represent a pair consisting of a function pointer, and some user data. A closure is invoked by reinterpreting the closure as a function pointer, and branching to it. Thus we can make an interpreted function callable as a C function: We turn the interpreter itself, together with a pointer specifying the interpreted procedure, into a closure. For IA64, function pointer are already pairs consisting of a code pointer, and a gp pointer. The latter is needed to access global variables. Here we set up such a pair as the first two words of the closure (in the "trampoline" area), but we replace the gp pointer with a pointer to the closure itself. We also add the real gp pointer to the closure. This allows the function entry code to both retrieve the user data, and to restire the correct gp pointer. */ extern void ffi_closure_unix (); ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { /* The layout of a function descriptor. A C function pointer really points to one of these. */ struct ia64_fd { UINT64 code_pointer; UINT64 gp; }; struct ffi_ia64_trampoline_struct { UINT64 code_pointer; /* Pointer to ffi_closure_unix. */ UINT64 fake_gp; /* Pointer to closure, installed as gp. */ UINT64 real_gp; /* Real gp value. */ }; struct ffi_ia64_trampoline_struct *tramp; struct ia64_fd *fd; FFI_ASSERT (cif->abi == FFI_UNIX); tramp = (struct ffi_ia64_trampoline_struct *)closure->tramp; fd = (struct ia64_fd *)(void *)ffi_closure_unix; tramp->code_pointer = fd->code_pointer; tramp->real_gp = fd->gp; tramp->fake_gp = (UINT64)(PTR64)codeloc; closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } UINT64 ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack, void *rvalue, void *r8) { ffi_cif *cif; void **avalue; ffi_type **p_arg; long i, avn, gpcount, fpcount; cif = closure->cif; avn = cif->nargs; avalue = alloca (avn * sizeof (void *)); /* If the structure return value is passed in memory get that location from r8 so as to pass the value directly back to the caller. */ if (cif->flags == FFI_TYPE_STRUCT) rvalue = r8; gpcount = fpcount = 0; for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 1); break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 2); break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 4); break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: avalue[i] = &stack->gp_regs[gpcount++]; break; case FFI_TYPE_POINTER: avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], sizeof(void*)); break; case FFI_TYPE_FLOAT: if (gpcount < 8 && fpcount < 8) { fpreg *addr = &stack->fp_regs[fpcount++]; float result; avalue[i] = addr; ldf_fill (result, addr); *(float *)addr = result; } else avalue[i] = endian_adjust(&stack->gp_regs[gpcount], 4); gpcount++; break; case FFI_TYPE_DOUBLE: if (gpcount < 8 && fpcount < 8) { fpreg *addr = &stack->fp_regs[fpcount++]; double result; avalue[i] = addr; ldf_fill (result, addr); *(double *)addr = result; } else avalue[i] = &stack->gp_regs[gpcount]; gpcount++; break; case FFI_TYPE_LONGDOUBLE: if (gpcount & 1) gpcount++; if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8) { fpreg *addr = &stack->fp_regs[fpcount++]; __float80 result; avalue[i] = addr; ldf_fill (result, addr); *(__float80 *)addr = result; } else avalue[i] = &stack->gp_regs[gpcount]; gpcount += 2; break; case FFI_TYPE_STRUCT: { size_t size = (*p_arg)->size; size_t align = (*p_arg)->alignment; int hfa_type = hfa_element_type (*p_arg, 0); FFI_ASSERT (align <= 16); if (align == 16 && (gpcount & 1)) gpcount++; if (hfa_type != FFI_TYPE_VOID) { size_t hfa_size = hfa_type_size (hfa_type); size_t offset = 0; size_t gp_offset = gpcount * 8; void *addr = alloca (size); avalue[i] = addr; while (fpcount < 8 && offset < size && gp_offset < 8 * 8) { hfa_type_store (hfa_type, addr + offset, &stack->fp_regs[fpcount]); offset += hfa_size; gp_offset += hfa_size; fpcount += 1; } if (offset < size) memcpy (addr + offset, (char *)stack->gp_regs + gp_offset, size - offset); } else avalue[i] = &stack->gp_regs[gpcount]; gpcount += (size + 7) / 8; } break; default: abort (); } } closure->fun (cif, rvalue, avalue, closure->user_data); return cif->flags; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/ia64/ffitarget.h0000644000175000017500000000361211545150464022514 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for IA-64. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long long ffi_arg; typedef signed long long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_UNIX, /* Linux and all Unix variants use the same conventions */ FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_UNIX } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 24 /* Really the following struct, which */ /* can be interpreted as a C function */ /* descriptor: */ #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/ia64/ia64_flags.h0000644000175000017500000000363511545150464022465 0ustar chr1schr1s/* ----------------------------------------------------------------------- ia64_flags.h - Copyright (c) 2000 Hewlett Packard Company IA64/unix Foreign Function Interface Original author: Hans Boehm, HP Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /* "Type" codes used between assembly and C. When used as a part of a cfi->flags value, the low byte will be these extra type codes, and bits 8-31 will be the actual size of the type. */ /* Small structures containing N words in integer registers. */ #define FFI_IA64_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 1) /* Homogeneous Floating Point Aggregates (HFAs) which are returned in FP registers. */ #define FFI_IA64_TYPE_HFA_FLOAT (FFI_TYPE_LAST + 2) #define FFI_IA64_TYPE_HFA_DOUBLE (FFI_TYPE_LAST + 3) #define FFI_IA64_TYPE_HFA_LDOUBLE (FFI_TYPE_LAST + 4) mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/ia64/unix.S0000644000175000017500000002660111545150464021502 0ustar chr1schr1s/* ----------------------------------------------------------------------- unix.S - Copyright (c) 1998, 2008 Red Hat, Inc. Copyright (c) 2000 Hewlett Packard Company IA64/unix Foreign Function Interface Primary author: Hans Boehm, HP Labs Loosely modeled on Cygnus code for other platforms. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #include "ia64_flags.h" .pred.safe_across_calls p1-p5,p16-p63 .text /* int ffi_call_unix (struct ia64_args *stack, PTR64 rvalue, void (*fn)(void), int flags); */ .align 16 .global ffi_call_unix .proc ffi_call_unix ffi_call_unix: .prologue /* Bit o trickiness. We actually share a stack frame with ffi_call. Rely on the fact that ffi_call uses a vframe and don't bother tracking one here at all. */ .fframe 0 .save ar.pfs, r36 // loc0 alloc loc0 = ar.pfs, 4, 3, 8, 0 .save rp, loc1 mov loc1 = b0 .body add r16 = 16, in0 mov loc2 = gp mov r8 = in1 ;; /* Load up all of the argument registers. */ ldf.fill f8 = [in0], 32 ldf.fill f9 = [r16], 32 ;; ldf.fill f10 = [in0], 32 ldf.fill f11 = [r16], 32 ;; ldf.fill f12 = [in0], 32 ldf.fill f13 = [r16], 32 ;; ldf.fill f14 = [in0], 32 ldf.fill f15 = [r16], 24 ;; ld8 out0 = [in0], 16 ld8 out1 = [r16], 16 ;; ld8 out2 = [in0], 16 ld8 out3 = [r16], 16 ;; ld8 out4 = [in0], 16 ld8 out5 = [r16], 16 ;; ld8 out6 = [in0] ld8 out7 = [r16] ;; /* Deallocate the register save area from the stack frame. */ mov sp = in0 /* Call the target function. */ ld8 r16 = [in2], 8 ;; ld8 gp = [in2] mov b6 = r16 br.call.sptk.many b0 = b6 ;; /* Dispatch to handle return value. */ mov gp = loc2 zxt1 r16 = in3 ;; mov ar.pfs = loc0 addl r18 = @ltoffx(.Lst_table), gp ;; ld8.mov r18 = [r18], .Lst_table mov b0 = loc1 ;; shladd r18 = r16, 3, r18 ;; ld8 r17 = [r18] shr in3 = in3, 8 ;; add r17 = r17, r18 ;; mov b6 = r17 br b6 ;; .Lst_void: br.ret.sptk.many b0 ;; .Lst_uint8: zxt1 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_sint8: sxt1 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_uint16: zxt2 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_sint16: sxt2 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_uint32: zxt4 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_sint32: sxt4 r8 = r8 ;; st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_int64: st8 [in1] = r8 br.ret.sptk.many b0 ;; .Lst_float: stfs [in1] = f8 br.ret.sptk.many b0 ;; .Lst_double: stfd [in1] = f8 br.ret.sptk.many b0 ;; .Lst_ldouble: stfe [in1] = f8 br.ret.sptk.many b0 ;; .Lst_small_struct: add sp = -16, sp cmp.lt p6, p0 = 8, in3 cmp.lt p7, p0 = 16, in3 cmp.lt p8, p0 = 24, in3 ;; add r16 = 8, sp add r17 = 16, sp add r18 = 24, sp ;; st8 [sp] = r8 (p6) st8 [r16] = r9 mov out0 = in1 (p7) st8 [r17] = r10 (p8) st8 [r18] = r11 mov out1 = sp mov out2 = in3 br.call.sptk.many b0 = memcpy# ;; mov ar.pfs = loc0 mov b0 = loc1 mov gp = loc2 br.ret.sptk.many b0 .Lst_hfa_float: add r16 = 4, in1 cmp.lt p6, p0 = 4, in3 ;; stfs [in1] = f8, 8 (p6) stfs [r16] = f9, 8 cmp.lt p7, p0 = 8, in3 cmp.lt p8, p0 = 12, in3 ;; (p7) stfs [in1] = f10, 8 (p8) stfs [r16] = f11, 8 cmp.lt p9, p0 = 16, in3 cmp.lt p10, p0 = 20, in3 ;; (p9) stfs [in1] = f12, 8 (p10) stfs [r16] = f13, 8 cmp.lt p6, p0 = 24, in3 cmp.lt p7, p0 = 28, in3 ;; (p6) stfs [in1] = f14 (p7) stfs [r16] = f15 br.ret.sptk.many b0 ;; .Lst_hfa_double: add r16 = 8, in1 cmp.lt p6, p0 = 8, in3 ;; stfd [in1] = f8, 16 (p6) stfd [r16] = f9, 16 cmp.lt p7, p0 = 16, in3 cmp.lt p8, p0 = 24, in3 ;; (p7) stfd [in1] = f10, 16 (p8) stfd [r16] = f11, 16 cmp.lt p9, p0 = 32, in3 cmp.lt p10, p0 = 40, in3 ;; (p9) stfd [in1] = f12, 16 (p10) stfd [r16] = f13, 16 cmp.lt p6, p0 = 48, in3 cmp.lt p7, p0 = 56, in3 ;; (p6) stfd [in1] = f14 (p7) stfd [r16] = f15 br.ret.sptk.many b0 ;; .Lst_hfa_ldouble: add r16 = 16, in1 cmp.lt p6, p0 = 16, in3 ;; stfe [in1] = f8, 32 (p6) stfe [r16] = f9, 32 cmp.lt p7, p0 = 32, in3 cmp.lt p8, p0 = 48, in3 ;; (p7) stfe [in1] = f10, 32 (p8) stfe [r16] = f11, 32 cmp.lt p9, p0 = 64, in3 cmp.lt p10, p0 = 80, in3 ;; (p9) stfe [in1] = f12, 32 (p10) stfe [r16] = f13, 32 cmp.lt p6, p0 = 96, in3 cmp.lt p7, p0 = 112, in3 ;; (p6) stfe [in1] = f14 (p7) stfe [r16] = f15 br.ret.sptk.many b0 ;; .endp ffi_call_unix .align 16 .global ffi_closure_unix .proc ffi_closure_unix #define FRAME_SIZE (8*16 + 8*8 + 8*16) ffi_closure_unix: .prologue .save ar.pfs, r40 // loc0 alloc loc0 = ar.pfs, 8, 4, 4, 0 .fframe FRAME_SIZE add r12 = -FRAME_SIZE, r12 .save rp, loc1 mov loc1 = b0 .save ar.unat, loc2 mov loc2 = ar.unat .body /* Retrieve closure pointer and real gp. */ #ifdef _ILP32 addp4 out0 = 0, gp addp4 gp = 16, gp #else mov out0 = gp add gp = 16, gp #endif ;; ld8 gp = [gp] /* Spill all of the possible argument registers. */ add r16 = 16 + 8*16, sp add r17 = 16 + 8*16 + 16, sp ;; stf.spill [r16] = f8, 32 stf.spill [r17] = f9, 32 mov loc3 = gp ;; stf.spill [r16] = f10, 32 stf.spill [r17] = f11, 32 ;; stf.spill [r16] = f12, 32 stf.spill [r17] = f13, 32 ;; stf.spill [r16] = f14, 32 stf.spill [r17] = f15, 24 ;; .mem.offset 0, 0 st8.spill [r16] = in0, 16 .mem.offset 8, 0 st8.spill [r17] = in1, 16 add out1 = 16 + 8*16, sp ;; .mem.offset 0, 0 st8.spill [r16] = in2, 16 .mem.offset 8, 0 st8.spill [r17] = in3, 16 add out2 = 16, sp ;; .mem.offset 0, 0 st8.spill [r16] = in4, 16 .mem.offset 8, 0 st8.spill [r17] = in5, 16 mov out3 = r8 ;; .mem.offset 0, 0 st8.spill [r16] = in6 .mem.offset 8, 0 st8.spill [r17] = in7 /* Invoke ffi_closure_unix_inner for the hard work. */ br.call.sptk.many b0 = ffi_closure_unix_inner ;; /* Dispatch to handle return value. */ mov gp = loc3 zxt1 r16 = r8 ;; addl r18 = @ltoffx(.Lld_table), gp mov ar.pfs = loc0 ;; ld8.mov r18 = [r18], .Lld_table mov b0 = loc1 ;; shladd r18 = r16, 3, r18 mov ar.unat = loc2 ;; ld8 r17 = [r18] shr r8 = r8, 8 ;; add r17 = r17, r18 add r16 = 16, sp ;; mov b6 = r17 br b6 ;; .label_state 1 .Lld_void: .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_int: .body .copy_state 1 ld8 r8 = [r16] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_float: .body .copy_state 1 ldfs f8 = [r16] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_double: .body .copy_state 1 ldfd f8 = [r16] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_ldouble: .body .copy_state 1 ldfe f8 = [r16] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_small_struct: .body .copy_state 1 add r17 = 8, r16 cmp.lt p6, p0 = 8, r8 cmp.lt p7, p0 = 16, r8 cmp.lt p8, p0 = 24, r8 ;; ld8 r8 = [r16], 16 (p6) ld8 r9 = [r17], 16 ;; (p7) ld8 r10 = [r16] (p8) ld8 r11 = [r17] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_hfa_float: .body .copy_state 1 add r17 = 4, r16 cmp.lt p6, p0 = 4, r8 ;; ldfs f8 = [r16], 8 (p6) ldfs f9 = [r17], 8 cmp.lt p7, p0 = 8, r8 cmp.lt p8, p0 = 12, r8 ;; (p7) ldfs f10 = [r16], 8 (p8) ldfs f11 = [r17], 8 cmp.lt p9, p0 = 16, r8 cmp.lt p10, p0 = 20, r8 ;; (p9) ldfs f12 = [r16], 8 (p10) ldfs f13 = [r17], 8 cmp.lt p6, p0 = 24, r8 cmp.lt p7, p0 = 28, r8 ;; (p6) ldfs f14 = [r16] (p7) ldfs f15 = [r17] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_hfa_double: .body .copy_state 1 add r17 = 8, r16 cmp.lt p6, p0 = 8, r8 ;; ldfd f8 = [r16], 16 (p6) ldfd f9 = [r17], 16 cmp.lt p7, p0 = 16, r8 cmp.lt p8, p0 = 24, r8 ;; (p7) ldfd f10 = [r16], 16 (p8) ldfd f11 = [r17], 16 cmp.lt p9, p0 = 32, r8 cmp.lt p10, p0 = 40, r8 ;; (p9) ldfd f12 = [r16], 16 (p10) ldfd f13 = [r17], 16 cmp.lt p6, p0 = 48, r8 cmp.lt p7, p0 = 56, r8 ;; (p6) ldfd f14 = [r16] (p7) ldfd f15 = [r17] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .Lld_hfa_ldouble: .body .copy_state 1 add r17 = 16, r16 cmp.lt p6, p0 = 16, r8 ;; ldfe f8 = [r16], 32 (p6) ldfe f9 = [r17], 32 cmp.lt p7, p0 = 32, r8 cmp.lt p8, p0 = 48, r8 ;; (p7) ldfe f10 = [r16], 32 (p8) ldfe f11 = [r17], 32 cmp.lt p9, p0 = 64, r8 cmp.lt p10, p0 = 80, r8 ;; (p9) ldfe f12 = [r16], 32 (p10) ldfe f13 = [r17], 32 cmp.lt p6, p0 = 96, r8 cmp.lt p7, p0 = 112, r8 ;; (p6) ldfe f14 = [r16] (p7) ldfe f15 = [r17] .restore sp add sp = FRAME_SIZE, sp br.ret.sptk.many b0 ;; .endp ffi_closure_unix .section .rodata .align 8 .Lst_table: data8 @pcrel(.Lst_void) // FFI_TYPE_VOID data8 @pcrel(.Lst_sint32) // FFI_TYPE_INT data8 @pcrel(.Lst_float) // FFI_TYPE_FLOAT data8 @pcrel(.Lst_double) // FFI_TYPE_DOUBLE data8 @pcrel(.Lst_ldouble) // FFI_TYPE_LONGDOUBLE data8 @pcrel(.Lst_uint8) // FFI_TYPE_UINT8 data8 @pcrel(.Lst_sint8) // FFI_TYPE_SINT8 data8 @pcrel(.Lst_uint16) // FFI_TYPE_UINT16 data8 @pcrel(.Lst_sint16) // FFI_TYPE_SINT16 data8 @pcrel(.Lst_uint32) // FFI_TYPE_UINT32 data8 @pcrel(.Lst_sint32) // FFI_TYPE_SINT32 data8 @pcrel(.Lst_int64) // FFI_TYPE_UINT64 data8 @pcrel(.Lst_int64) // FFI_TYPE_SINT64 data8 @pcrel(.Lst_void) // FFI_TYPE_STRUCT data8 @pcrel(.Lst_int64) // FFI_TYPE_POINTER data8 @pcrel(.Lst_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT data8 @pcrel(.Lst_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT data8 @pcrel(.Lst_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE data8 @pcrel(.Lst_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE .Lld_table: data8 @pcrel(.Lld_void) // FFI_TYPE_VOID data8 @pcrel(.Lld_int) // FFI_TYPE_INT data8 @pcrel(.Lld_float) // FFI_TYPE_FLOAT data8 @pcrel(.Lld_double) // FFI_TYPE_DOUBLE data8 @pcrel(.Lld_ldouble) // FFI_TYPE_LONGDOUBLE data8 @pcrel(.Lld_int) // FFI_TYPE_UINT8 data8 @pcrel(.Lld_int) // FFI_TYPE_SINT8 data8 @pcrel(.Lld_int) // FFI_TYPE_UINT16 data8 @pcrel(.Lld_int) // FFI_TYPE_SINT16 data8 @pcrel(.Lld_int) // FFI_TYPE_UINT32 data8 @pcrel(.Lld_int) // FFI_TYPE_SINT32 data8 @pcrel(.Lld_int) // FFI_TYPE_UINT64 data8 @pcrel(.Lld_int) // FFI_TYPE_SINT64 data8 @pcrel(.Lld_void) // FFI_TYPE_STRUCT data8 @pcrel(.Lld_int) // FFI_TYPE_POINTER data8 @pcrel(.Lld_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/m32r/ffi.c0000644000175000017500000001271511545150464021324 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2004 Renesas Technology Copyright (c) 2008 Red Hat, Inc. M32R Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments. */ void ffi_prep_args(char *stack, extended_cif *ecif) { unsigned int i; int tmp; unsigned int avn; void **p_argv; char *argp; ffi_type **p_arg; tmp = 0; argp = stack; if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 8) { *(void **) argp = ecif->rvalue; argp += 4; } avn = ecif->cif->nargs; p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0) && (avn != 0); i--, p_arg++) { size_t z; /* Align if necessary. */ if (((*p_arg)->alignment - 1) & (unsigned) argp) argp = (char *) ALIGN (argp, (*p_arg)->alignment); if (avn != 0) { avn--; z = (*p_arg)->size; if (z < sizeof (int)) { z = sizeof (int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; case FFI_TYPE_STRUCT: z = (*p_arg)->size; if ((*p_arg)->alignment != 1) memcpy (argp, *p_argv, z); else memcpy (argp + 4 - z, *p_argv, z); z = sizeof (int); break; default: FFI_ASSERT(0); } } else if (z == sizeof (int)) { *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); } else { if ((*p_arg)->type == FFI_TYPE_STRUCT) { if (z > 8) { *(unsigned int *) argp = (unsigned int)(void *)(* p_argv); z = sizeof(void *); } else { memcpy(argp, *p_argv, z); z = 8; } } else { /* Double or long long 64bit. */ memcpy (argp, *p_argv, z); } } p_argv++; argp += z; } } return; } /* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { /* Set the return type flag. */ switch (cif->rtype->type) { case FFI_TYPE_VOID: cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_STRUCT: if (cif->rtype->size <= 4) cif->flags = FFI_TYPE_INT; else if (cif->rtype->size <= 8) cif->flags = FFI_TYPE_DOUBLE; else cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_DOUBLE: cif->flags = FFI_TYPE_DOUBLE; break; case FFI_TYPE_FLOAT: default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return value address then we need to make one. */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca (cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); if (cif->rtype->type == FFI_TYPE_STRUCT) { int size = cif->rtype->size; int align = cif->rtype->alignment; if (size < 4) { if (align == 1) *(unsigned long *)(ecif.rvalue) <<= (4 - size) * 8; } else if (4 < size && size < 8) { if (align == 1) { memcpy (ecif.rvalue, ecif.rvalue + 8-size, size); } else if (align == 2) { if (size & 1) size += 1; if (size != 8) memcpy (ecif.rvalue, ecif.rvalue + 8-size, size); } } } break; default: FFI_ASSERT(0); break; } } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/m32r/ffitarget.h0000644000175000017500000000335211545150464022535 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 2004 Renesas Technology. Target configuration macros for M32R. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif #define FFI_CLOSURES 0 #define FFI_TRAMPOLINE_SIZE 24 #define FFI_NATIVE_RAW_API 0 #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/m32r/sysv.S0000644000175000017500000000575211545150464021547 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2004 Renesas Technology M32R Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef HAVE_MACHINE_ASM_H #include #else /* XXX these lose for some platforms, I'm sure. */ #define CNAME(x) x #define ENTRY(x) .globl CNAME(x)! .type CNAME(x),%function! CNAME(x): #endif .text /* R0: ffi_prep_args */ /* R1: &ecif */ /* R2: cif->bytes */ /* R3: fig->flags */ /* sp+0: ecif.rvalue */ /* sp+4: fn */ /* This assumes we are using gas. */ ENTRY(ffi_call_SYSV) /* Save registers. */ push fp push lr push r3 push r2 push r1 push r0 mv fp, sp /* Make room for all of the new args. */ sub sp, r2 /* Place all of the ffi_prep_args in position. */ mv lr, r0 mv r0, sp /* R1 already set. */ /* And call. */ jl lr /* Move first 4 parameters in registers... */ ld r0, @(0,sp) ld r1, @(4,sp) ld r2, @(8,sp) ld r3, @(12,sp) /* ...and adjust the stack. */ ld lr, @(8,fp) cmpi lr, #16 bc adjust_stack ldi lr, #16 adjust_stack: add sp, lr /* Call the function. */ ld lr, @(28,fp) jl lr /* Remove the space we pushed for the args. */ mv sp, fp /* Load R2 with the pointer to storage for the return value. */ ld r2, @(24,sp) /* Load R3 with the return type code. */ ld r3, @(12,sp) /* If the return value pointer is NULL, assume no return value. */ beqz r2, epilogue /* Return INT. */ ldi r4, #FFI_TYPE_INT bne r3, r4, return_double st r0, @r2 bra epilogue return_double: /* Return DOUBLE or LONGDOUBLE. */ ldi r4, #FFI_TYPE_DOUBLE bne r3, r4, epilogue st r0, @r2 st r1, @(4,r2) epilogue: pop r0 pop r1 pop r2 pop r3 pop lr pop fp jmp lr .ffi_call_SYSV_end: .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/m68k/ffi.c0000644000175000017500000001307311545150464021324 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c m68k Foreign Function Interface ----------------------------------------------------------------------- */ #include #include #include #include #include #include void ffi_call_SYSV (extended_cif *, unsigned, unsigned, void *, void (*fn) ()); void *ffi_prep_args (void *stack, extended_cif *ecif); void ffi_closure_SYSV (ffi_closure *); void ffi_closure_struct_SYSV (ffi_closure *); unsigned int ffi_closure_SYSV_inner (ffi_closure *closure, void *resp, void *args); /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments. */ void * ffi_prep_args (void *stack, extended_cif *ecif) { unsigned int i; void **p_argv; char *argp; ffi_type **p_arg; void *struct_value_ptr; argp = stack; if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && !ecif->cif->flags) struct_value_ptr = ecif->rvalue; else struct_value_ptr = NULL; p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i != 0; i--, p_arg++) { size_t z; z = (*p_arg)->size; if (z < sizeof (int)) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int) *(SINT8 *) *p_argv; break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int) *(UINT8 *) *p_argv; break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int) *(SINT16 *) *p_argv; break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int) *(UINT16 *) *p_argv; break; case FFI_TYPE_STRUCT: memcpy (argp + sizeof (int) - z, *p_argv, z); break; default: FFI_ASSERT (0); } z = sizeof (int); } else { memcpy (argp, *p_argv, z); /* Align if necessary. */ if ((sizeof(int) - 1) & z) z = ALIGN(z, sizeof(int)); } p_argv++; argp += z; } return struct_value_ptr; } #define CIF_FLAGS_INT 1 #define CIF_FLAGS_DINT 2 #define CIF_FLAGS_FLOAT 4 #define CIF_FLAGS_DOUBLE 8 #define CIF_FLAGS_LDOUBLE 16 #define CIF_FLAGS_POINTER 32 #define CIF_FLAGS_STRUCT1 64 #define CIF_FLAGS_STRUCT2 128 /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep (ffi_cif *cif) { /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_VOID: cif->flags = 0; break; case FFI_TYPE_STRUCT: switch (cif->rtype->size) { case 1: cif->flags = CIF_FLAGS_STRUCT1; break; case 2: cif->flags = CIF_FLAGS_STRUCT2; break; case 4: cif->flags = CIF_FLAGS_INT; break; case 8: cif->flags = CIF_FLAGS_DINT; break; default: cif->flags = 0; break; } break; case FFI_TYPE_FLOAT: cif->flags = CIF_FLAGS_FLOAT; break; case FFI_TYPE_DOUBLE: cif->flags = CIF_FLAGS_DOUBLE; break; case FFI_TYPE_LONGDOUBLE: cif->flags = CIF_FLAGS_LDOUBLE; break; case FFI_TYPE_POINTER: cif->flags = CIF_FLAGS_POINTER; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = CIF_FLAGS_DINT; break; default: cif->flags = CIF_FLAGS_INT; break; } return FFI_OK; } void ffi_call (ffi_cif *cif, void (*fn) (), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return value address then we need to make one. */ if (rvalue == NULL && cif->rtype->type == FFI_TYPE_STRUCT && cif->rtype->size > 8) ecif.rvalue = alloca (cif->rtype->size); else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV (&ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT (0); break; } } static void ffi_prep_incoming_args_SYSV (char *stack, void **avalue, ffi_cif *cif) { unsigned int i; void **p_argv; char *argp; ffi_type **p_arg; argp = stack; p_argv = avalue; for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { size_t z; z = (*p_arg)->size; if (z <= 4) { *p_argv = (void *) (argp + 4 - z); z = 4; } else { *p_argv = (void *) argp; /* Align if necessary */ if ((sizeof(int) - 1) & z) z = ALIGN(z, sizeof(int)); } p_argv++; argp += z; } } unsigned int ffi_closure_SYSV_inner (ffi_closure *closure, void *resp, void *args) { ffi_cif *cif; void **arg_area; cif = closure->cif; arg_area = (void**) alloca (cif->nargs * sizeof (void *)); ffi_prep_incoming_args_SYSV(args, arg_area, cif); (closure->fun) (cif, resp, arg_area, closure->user_data); return cif->flags; } ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { FFI_ASSERT (cif->abi == FFI_SYSV); *(unsigned short *)closure->tramp = 0x207c; *(void **)(closure->tramp + 2) = codeloc; *(unsigned short *)(closure->tramp + 6) = 0x4ef9; if (cif->rtype->type == FFI_TYPE_STRUCT && !cif->flags) *(void **)(closure->tramp + 8) = ffi_closure_struct_SYSV; else *(void **)(closure->tramp + 8) = ffi_closure_SYSV; syscall(SYS_cacheflush, codeloc, FLUSH_SCOPE_LINE, FLUSH_CACHE_BOTH, FFI_TRAMPOLINE_SIZE); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/m68k/ffitarget.h0000644000175000017500000000336511545150464022543 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for Motorola 68K. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 16 #define FFI_NATIVE_RAW_API 0 #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/m68k/sysv.S0000644000175000017500000001130011545150464021533 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 1998 Andreas Schwab Copyright (c) 2008 Red Hat, Inc. m68k Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef HAVE_AS_CFI_PSEUDO_OP #define CFI_STARTPROC() .cfi_startproc #define CFI_OFFSET(reg,off) .cfi_offset reg,off #define CFI_DEF_CFA(reg,off) .cfi_def_cfa reg,off #define CFI_ENDPROC() .cfi_endproc #else #define CFI_STARTPROC() #define CFI_OFFSET(reg,off) #define CFI_DEF_CFA(reg,off) #define CFI_ENDPROC() #endif .text .globl ffi_call_SYSV .type ffi_call_SYSV,@function .align 4 ffi_call_SYSV: CFI_STARTPROC() link %fp,#0 CFI_OFFSET(14,-8) CFI_DEF_CFA(14,8) move.l %d2,-(%sp) CFI_OFFSET(2,-12) | Make room for all of the new args. sub.l 12(%fp),%sp | Call ffi_prep_args move.l 8(%fp),-(%sp) pea 4(%sp) #if !defined __PIC__ jsr ffi_prep_args #else bsr.l ffi_prep_args@PLTPC #endif addq.l #8,%sp | Pass pointer to struct value, if any move.l %a0,%a1 | Call the function move.l 24(%fp),%a0 jsr (%a0) | Remove the space we pushed for the args add.l 12(%fp),%sp | Load the pointer to storage for the return value move.l 20(%fp),%a1 | Load the return type code move.l 16(%fp),%d2 | If the return value pointer is NULL, assume no return value. tst.l %a1 jbeq noretval btst #0,%d2 jbeq retlongint move.l %d0,(%a1) jbra epilogue retlongint: btst #1,%d2 jbeq retfloat move.l %d0,(%a1) move.l %d1,4(%a1) jbra epilogue retfloat: btst #2,%d2 jbeq retdouble fmove.s %fp0,(%a1) jbra epilogue retdouble: btst #3,%d2 jbeq retlongdouble fmove.d %fp0,(%a1) jbra epilogue retlongdouble: btst #4,%d2 jbeq retpointer fmove.x %fp0,(%a1) jbra epilogue retpointer: btst #5,%d2 jbeq retstruct1 move.l %a0,(%a1) jbra epilogue retstruct1: btst #6,%d2 jbeq retstruct2 move.b %d0,(%a1) jbra epilogue retstruct2: btst #7,%d2 jbeq noretval move.w %d0,(%a1) noretval: epilogue: move.l (%sp)+,%d2 unlk %fp rts CFI_ENDPROC() .size ffi_call_SYSV,.-ffi_call_SYSV .globl ffi_closure_SYSV .type ffi_closure_SYSV, @function .align 4 ffi_closure_SYSV: CFI_STARTPROC() link %fp,#-12 CFI_OFFSET(14,-8) CFI_DEF_CFA(14,8) move.l %sp,-12(%fp) pea 8(%fp) pea -12(%fp) move.l %a0,-(%sp) #if !defined __PIC__ jsr ffi_closure_SYSV_inner #else bsr.l ffi_closure_SYSV_inner@PLTPC #endif lsr.l #1,%d0 jne 1f jcc .Lcls_epilogue move.l -12(%fp),%d0 .Lcls_epilogue: unlk %fp rts 1: lea -12(%fp),%a0 lsr.l #2,%d0 jne 1f jcs .Lcls_ret_float move.l (%a0)+,%d0 move.l (%a0),%d1 jra .Lcls_epilogue .Lcls_ret_float: fmove.s (%a0),%fp0 jra .Lcls_epilogue 1: lsr.l #2,%d0 jne 1f jcs .Lcls_ret_ldouble fmove.d (%a0),%fp0 jra .Lcls_epilogue .Lcls_ret_ldouble: fmove.x (%a0),%fp0 jra .Lcls_epilogue 1: lsr.l #2,%d0 jne .Lcls_ret_struct2 jcs .Lcls_ret_struct1 move.l (%a0),%a0 move.l %a0,%d0 jra .Lcls_epilogue .Lcls_ret_struct1: move.b (%a0),%d0 jra .Lcls_epilogue .Lcls_ret_struct2: move.w (%a0),%d0 jra .Lcls_epilogue CFI_ENDPROC() .size ffi_closure_SYSV,.-ffi_closure_SYSV .globl ffi_closure_struct_SYSV .type ffi_closure_struct_SYSV, @function .align 4 ffi_closure_struct_SYSV: CFI_STARTPROC() link %fp,#0 CFI_OFFSET(14,-8) CFI_DEF_CFA(14,8) move.l %sp,-12(%fp) pea 8(%fp) move.l %a1,-(%sp) move.l %a0,-(%sp) #if !defined __PIC__ jsr ffi_closure_SYSV_inner #else bsr.l ffi_closure_SYSV_inner@PLTPC #endif unlk %fp rts CFI_ENDPROC() .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/mips/ffi.c0000644000175000017500000006304311545150464021511 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1996, 2007, 2008 Red Hat, Inc. Copyright (c) 2008 David Daney MIPS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #ifdef __GNUC__ # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) # define USE__BUILTIN___CLEAR_CACHE 1 # endif #endif #ifndef USE__BUILTIN___CLEAR_CACHE #include #endif #ifdef FFI_DEBUG # define FFI_MIPS_STOP_HERE() ffi_stop_here() #else # define FFI_MIPS_STOP_HERE() do {} while(0) #endif #ifdef FFI_MIPS_N32 #define FIX_ARGP \ FFI_ASSERT(argp <= &stack[bytes]); \ if (argp == &stack[bytes]) \ { \ argp = stack; \ FFI_MIPS_STOP_HERE(); \ } #else #define FIX_ARGP #endif /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ static void ffi_prep_args(char *stack, extended_cif *ecif, int bytes, int flags) { int i; void **p_argv; char *argp; ffi_type **p_arg; #ifdef FFI_MIPS_N32 /* If more than 8 double words are used, the remainder go on the stack. We reorder stuff on the stack here to support this easily. */ if (bytes > 8 * sizeof(ffi_arg)) argp = &stack[bytes - (8 * sizeof(ffi_arg))]; else argp = stack; #else argp = stack; #endif memset(stack, 0, bytes); #ifdef FFI_MIPS_N32 if ( ecif->cif->rstruct_flag != 0 ) #else if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) #endif { *(ffi_arg *) argp = (ffi_arg) ecif->rvalue; argp += sizeof(ffi_arg); FIX_ARGP; } p_argv = ecif->avalue; for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; i++, p_arg++) { size_t z; unsigned int a; /* Align if necessary. */ a = (*p_arg)->alignment; if (a < sizeof(ffi_arg)) a = sizeof(ffi_arg); if ((a - 1) & (unsigned long) argp) { argp = (char *) ALIGN(argp, a); FIX_ARGP; } z = (*p_arg)->size; if (z <= sizeof(ffi_arg)) { int type = (*p_arg)->type; z = sizeof(ffi_arg); /* The size of a pointer depends on the ABI */ if (type == FFI_TYPE_POINTER) type = (ecif->cif->abi == FFI_N64 || ecif->cif->abi == FFI_N64_SOFT_FLOAT) ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32; if (i < 8 && (ecif->cif->abi == FFI_N32_SOFT_FLOAT || ecif->cif->abi == FFI_N64_SOFT_FLOAT)) { switch (type) { case FFI_TYPE_FLOAT: type = FFI_TYPE_UINT32; break; case FFI_TYPE_DOUBLE: type = FFI_TYPE_UINT64; break; default: break; } } switch (type) { case FFI_TYPE_SINT8: *(ffi_arg *)argp = *(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(ffi_arg *)argp = *(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(ffi_arg *)argp = *(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(ffi_arg *)argp = *(UINT16 *)(* p_argv); break; case FFI_TYPE_SINT32: *(ffi_arg *)argp = *(SINT32 *)(* p_argv); break; case FFI_TYPE_UINT32: *(ffi_arg *)argp = *(UINT32 *)(* p_argv); break; /* This can only happen with 64bit slots. */ case FFI_TYPE_FLOAT: *(float *) argp = *(float *)(* p_argv); break; /* Handle structures. */ default: memcpy(argp, *p_argv, (*p_arg)->size); break; } } else { #ifdef FFI_MIPS_O32 memcpy(argp, *p_argv, z); #else { unsigned long end = (unsigned long) argp + z; unsigned long cap = (unsigned long) stack + bytes; /* Check if the data will fit within the register space. Handle it if it doesn't. */ if (end <= cap) memcpy(argp, *p_argv, z); else { unsigned long portion = cap - (unsigned long)argp; memcpy(argp, *p_argv, portion); argp = stack; z -= portion; memcpy(argp, (void*)((unsigned long)(*p_argv) + portion), z); } } #endif } p_argv++; argp += z; FIX_ARGP; } } #ifdef FFI_MIPS_N32 /* The n32 spec says that if "a chunk consists solely of a double float field (but not a double, which is part of a union), it is passed in a floating point register. Any other chunk is passed in an integer register". This code traverses structure definitions and generates the appropriate flags. */ static unsigned calc_n32_struct_flags(int soft_float, ffi_type *arg, unsigned *loc, unsigned *arg_reg) { unsigned flags = 0; unsigned index = 0; ffi_type *e; if (soft_float) return 0; while ((e = arg->elements[index])) { /* Align this object. */ *loc = ALIGN(*loc, e->alignment); if (e->type == FFI_TYPE_DOUBLE) { /* Already aligned to FFI_SIZEOF_ARG. */ *arg_reg = *loc / FFI_SIZEOF_ARG; if (*arg_reg > 7) break; flags += (FFI_TYPE_DOUBLE << (*arg_reg * FFI_FLAG_BITS)); *loc += e->size; } else *loc += e->size; index++; } /* Next Argument register at alignment of FFI_SIZEOF_ARG. */ *arg_reg = ALIGN(*loc, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; return flags; } static unsigned calc_n32_return_struct_flags(int soft_float, ffi_type *arg) { unsigned flags = 0; unsigned small = FFI_TYPE_SMALLSTRUCT; ffi_type *e; /* Returning structures under n32 is a tricky thing. A struct with only one or two floating point fields is returned in $f0 (and $f2 if necessary). Any other struct results at most 128 bits are returned in $2 (the first 64 bits) and $3 (remainder, if necessary). Larger structs are handled normally. */ if (arg->size > 16) return 0; if (arg->size > 8) small = FFI_TYPE_SMALLSTRUCT2; e = arg->elements[0]; if (e->type == FFI_TYPE_DOUBLE) flags = FFI_TYPE_DOUBLE; else if (e->type == FFI_TYPE_FLOAT) flags = FFI_TYPE_FLOAT; if (flags && (e = arg->elements[1])) { if (e->type == FFI_TYPE_DOUBLE) flags += FFI_TYPE_DOUBLE << FFI_FLAG_BITS; else if (e->type == FFI_TYPE_FLOAT) flags += FFI_TYPE_FLOAT << FFI_FLAG_BITS; else return small; if (flags && (arg->elements[2])) { /* There are three arguments and the first two are floats! This must be passed the old way. */ return small; } if (soft_float) flags += FFI_TYPE_STRUCT_SOFT; } else if (!flags) return small; return flags; } #endif /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { cif->flags = 0; #ifdef FFI_MIPS_O32 /* Set the flags necessary for O32 processing. FFI_O32_SOFT_FLOAT * does not have special handling for floating point args. */ if (cif->rtype->type != FFI_TYPE_STRUCT && cif->abi == FFI_O32) { if (cif->nargs > 0) { switch ((cif->arg_types)[0]->type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags += (cif->arg_types)[0]->type; break; default: break; } if (cif->nargs > 1) { /* Only handle the second argument if the first is a float or double. */ if (cif->flags) { switch ((cif->arg_types)[1]->type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags += (cif->arg_types)[1]->type << FFI_FLAG_BITS; break; default: break; } } } } } /* Set the return type flag */ if (cif->abi == FFI_O32_SOFT_FLOAT) { switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_STRUCT: cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2); break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_DOUBLE: cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); break; case FFI_TYPE_FLOAT: default: cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); break; } } else { /* FFI_O32 */ switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_STRUCT: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2); break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); break; default: cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); break; } } #endif #ifdef FFI_MIPS_N32 /* Set the flags necessary for N32 processing */ { int type; unsigned arg_reg = 0; unsigned loc = 0; unsigned count = (cif->nargs < 8) ? cif->nargs : 8; unsigned index = 0; unsigned struct_flags = 0; int soft_float = (cif->abi == FFI_N32_SOFT_FLOAT || cif->abi == FFI_N64_SOFT_FLOAT); if (cif->rtype->type == FFI_TYPE_STRUCT) { struct_flags = calc_n32_return_struct_flags(soft_float, cif->rtype); if (struct_flags == 0) { /* This means that the structure is being passed as a hidden argument */ arg_reg = 1; count = (cif->nargs < 7) ? cif->nargs : 7; cif->rstruct_flag = !0; } else cif->rstruct_flag = 0; } else cif->rstruct_flag = 0; while (count-- > 0 && arg_reg < 8) { type = (cif->arg_types)[index]->type; if (soft_float) { switch (type) { case FFI_TYPE_FLOAT: type = FFI_TYPE_UINT32; break; case FFI_TYPE_DOUBLE: type = FFI_TYPE_UINT64; break; default: break; } } switch (type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags += ((cif->arg_types)[index]->type << (arg_reg * FFI_FLAG_BITS)); arg_reg++; break; case FFI_TYPE_LONGDOUBLE: /* Align it. */ arg_reg = ALIGN(arg_reg, 2); /* Treat it as two adjacent doubles. */ if (soft_float) { arg_reg += 2; } else { cif->flags += (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS)); arg_reg++; cif->flags += (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS)); arg_reg++; } break; case FFI_TYPE_STRUCT: loc = arg_reg * FFI_SIZEOF_ARG; cif->flags += calc_n32_struct_flags(soft_float, (cif->arg_types)[index], &loc, &arg_reg); break; default: arg_reg++; break; } index++; } /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_STRUCT: { if (struct_flags == 0) { /* The structure is returned through a hidden first argument. Do nothing, 'cause FFI_TYPE_VOID is 0 */ } else { /* The structure is returned via some tricky mechanism */ cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); cif->flags += struct_flags << (4 + (FFI_FLAG_BITS * 8)); } break; } case FFI_TYPE_VOID: /* Do nothing, 'cause FFI_TYPE_VOID is 0 */ break; case FFI_TYPE_POINTER: if (cif->abi == FFI_N32_SOFT_FLOAT || cif->abi == FFI_N32) cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8); else cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); break; case FFI_TYPE_FLOAT: if (soft_float) { cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8); break; } /* else fall through */ case FFI_TYPE_DOUBLE: if (soft_float) cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); else cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 8); break; case FFI_TYPE_LONGDOUBLE: /* Long double is returned as if it were a struct containing two doubles. */ if (soft_float) { cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); cif->flags += FFI_TYPE_SMALLSTRUCT2 << (4 + (FFI_FLAG_BITS * 8)); } else { cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); cif->flags += (FFI_TYPE_DOUBLE + (FFI_TYPE_DOUBLE << FFI_FLAG_BITS)) << (4 + (FFI_FLAG_BITS * 8)); } break; default: cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); break; } } #endif return FFI_OK; } /* Low level routine for calling O32 functions */ extern int ffi_call_O32(void (*)(char *, extended_cif *, int, int), extended_cif *, unsigned, unsigned, unsigned *, void (*)(void)); /* Low level routine for calling N32 functions */ extern int ffi_call_N32(void (*)(char *, extended_cif *, int, int), extended_cif *, unsigned, unsigned, void *, void (*)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) ecif.rvalue = alloca(cif->rtype->size); else ecif.rvalue = rvalue; switch (cif->abi) { #ifdef FFI_MIPS_O32 case FFI_O32: case FFI_O32_SOFT_FLOAT: ffi_call_O32(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #endif #ifdef FFI_MIPS_N32 case FFI_N32: case FFI_N32_SOFT_FLOAT: case FFI_N64: case FFI_N64_SOFT_FLOAT: { int copy_rvalue = 0; int copy_offset = 0; char *rvalue_copy = ecif.rvalue; if (cif->rtype->type == FFI_TYPE_STRUCT && cif->rtype->size < 16) { /* For structures smaller than 16 bytes we clobber memory in 8 byte increments. Make a copy so we don't clobber the callers memory outside of the struct bounds. */ rvalue_copy = alloca(16); copy_rvalue = 1; } else if (cif->rtype->type == FFI_TYPE_FLOAT && (cif->abi == FFI_N64_SOFT_FLOAT || cif->abi == FFI_N32_SOFT_FLOAT)) { rvalue_copy = alloca (8); copy_rvalue = 1; #if defined(__MIPSEB__) || defined(_MIPSEB) copy_offset = 4; #endif } ffi_call_N32(ffi_prep_args, &ecif, cif->bytes, cif->flags, rvalue_copy, fn); if (copy_rvalue) memcpy(ecif.rvalue, rvalue_copy + copy_offset, cif->rtype->size); } break; #endif default: FFI_ASSERT(0); break; } } #if FFI_CLOSURES #if defined(FFI_MIPS_O32) extern void ffi_closure_O32(void); #else extern void ffi_closure_N32(void); #endif /* FFI_MIPS_O32 */ ffi_status ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { unsigned int *tramp = (unsigned int *) &closure->tramp[0]; void * fn; char *clear_location = (char *) codeloc; #if defined(FFI_MIPS_O32) FFI_ASSERT(cif->abi == FFI_O32 || cif->abi == FFI_O32_SOFT_FLOAT); fn = ffi_closure_O32; #else /* FFI_MIPS_N32 */ FFI_ASSERT(cif->abi == FFI_N32 || cif->abi == FFI_N64); fn = ffi_closure_N32; #endif /* FFI_MIPS_O32 */ #if defined(FFI_MIPS_O32) || (_MIPS_SIM ==_ABIN32) /* lui $25,high(fn) */ tramp[0] = 0x3c190000 | ((unsigned)fn >> 16); /* ori $25,low(fn) */ tramp[1] = 0x37390000 | ((unsigned)fn & 0xffff); /* lui $12,high(codeloc) */ tramp[2] = 0x3c0c0000 | ((unsigned)codeloc >> 16); /* jr $25 */ tramp[3] = 0x03200008; /* ori $12,low(codeloc) */ tramp[4] = 0x358c0000 | ((unsigned)codeloc & 0xffff); #else /* N64 has a somewhat larger trampoline. */ /* lui $25,high(fn) */ tramp[0] = 0x3c190000 | ((unsigned long)fn >> 48); /* lui $12,high(codeloc) */ tramp[1] = 0x3c0c0000 | ((unsigned long)codeloc >> 48); /* ori $25,mid-high(fn) */ tramp[2] = 0x37390000 | (((unsigned long)fn >> 32 ) & 0xffff); /* ori $12,mid-high(codeloc) */ tramp[3] = 0x358c0000 | (((unsigned long)codeloc >> 32) & 0xffff); /* dsll $25,$25,16 */ tramp[4] = 0x0019cc38; /* dsll $12,$12,16 */ tramp[5] = 0x000c6438; /* ori $25,mid-low(fn) */ tramp[6] = 0x37390000 | (((unsigned long)fn >> 16 ) & 0xffff); /* ori $12,mid-low(codeloc) */ tramp[7] = 0x358c0000 | (((unsigned long)codeloc >> 16) & 0xffff); /* dsll $25,$25,16 */ tramp[8] = 0x0019cc38; /* dsll $12,$12,16 */ tramp[9] = 0x000c6438; /* ori $25,low(fn) */ tramp[10] = 0x37390000 | ((unsigned long)fn & 0xffff); /* jr $25 */ tramp[11] = 0x03200008; /* ori $12,low(codeloc) */ tramp[12] = 0x358c0000 | ((unsigned long)codeloc & 0xffff); #endif closure->cif = cif; closure->fun = fun; closure->user_data = user_data; #ifdef USE__BUILTIN___CLEAR_CACHE __builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE); #else cacheflush (clear_location, FFI_TRAMPOLINE_SIZE, ICACHE); #endif return FFI_OK; } /* * Decodes the arguments to a function, which will be stored on the * stack. AR is the pointer to the beginning of the integer arguments * (and, depending upon the arguments, some floating-point arguments * as well). FPR is a pointer to the area where floating point * registers have been saved, if any. * * RVALUE is the location where the function return value will be * stored. CLOSURE is the prepared closure to invoke. * * This function should only be called from assembly, which is in * turn called from a trampoline. * * Returns the function return type. * * Based on the similar routine for sparc. */ int ffi_closure_mips_inner_O32 (ffi_closure *closure, void *rvalue, ffi_arg *ar, double *fpr) { ffi_cif *cif; void **avaluep; ffi_arg *avalue; ffi_type **arg_types; int i, avn, argn, seen_int; cif = closure->cif; avalue = alloca (cif->nargs * sizeof (ffi_arg)); avaluep = alloca (cif->nargs * sizeof (ffi_arg)); seen_int = (cif->abi == FFI_O32_SOFT_FLOAT); argn = 0; if ((cif->flags >> (FFI_FLAG_BITS * 2)) == FFI_TYPE_STRUCT) { rvalue = (void *)(UINT32)ar[0]; argn = 1; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; while (i < avn) { if (i < 2 && !seen_int && (arg_types[i]->type == FFI_TYPE_FLOAT || arg_types[i]->type == FFI_TYPE_DOUBLE || arg_types[i]->type == FFI_TYPE_LONGDOUBLE)) { #if defined(__MIPSEB__) || defined(_MIPSEB) if (arg_types[i]->type == FFI_TYPE_FLOAT) avaluep[i] = ((char *) &fpr[i]) + sizeof (float); else #endif avaluep[i] = (char *) &fpr[i]; } else { if (arg_types[i]->alignment == 8 && (argn & 0x1)) argn++; switch (arg_types[i]->type) { case FFI_TYPE_SINT8: avaluep[i] = &avalue[i]; *(SINT8 *) &avalue[i] = (SINT8) ar[argn]; break; case FFI_TYPE_UINT8: avaluep[i] = &avalue[i]; *(UINT8 *) &avalue[i] = (UINT8) ar[argn]; break; case FFI_TYPE_SINT16: avaluep[i] = &avalue[i]; *(SINT16 *) &avalue[i] = (SINT16) ar[argn]; break; case FFI_TYPE_UINT16: avaluep[i] = &avalue[i]; *(UINT16 *) &avalue[i] = (UINT16) ar[argn]; break; default: avaluep[i] = (char *) &ar[argn]; break; } seen_int = 1; } argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; i++; } /* Invoke the closure. */ (closure->fun) (cif, rvalue, avaluep, closure->user_data); if (cif->abi == FFI_O32_SOFT_FLOAT) { switch (cif->rtype->type) { case FFI_TYPE_FLOAT: return FFI_TYPE_INT; case FFI_TYPE_DOUBLE: return FFI_TYPE_UINT64; default: return cif->rtype->type; } } else { return cif->rtype->type; } } #if defined(FFI_MIPS_N32) static void copy_struct_N32(char *target, unsigned offset, ffi_abi abi, ffi_type *type, int argn, unsigned arg_offset, ffi_arg *ar, ffi_arg *fpr, int soft_float) { ffi_type **elt_typep = type->elements; while(*elt_typep) { ffi_type *elt_type = *elt_typep; unsigned o; char *tp; char *argp; char *fpp; o = ALIGN(offset, elt_type->alignment); arg_offset += o - offset; offset = o; argn += arg_offset / sizeof(ffi_arg); arg_offset = arg_offset % sizeof(ffi_arg); argp = (char *)(ar + argn); fpp = (char *)(argn >= 8 ? ar + argn : fpr + argn); tp = target + offset; if (elt_type->type == FFI_TYPE_DOUBLE && !soft_float) *(double *)tp = *(double *)fpp; else memcpy(tp, argp + arg_offset, elt_type->size); offset += elt_type->size; arg_offset += elt_type->size; elt_typep++; argn += arg_offset / sizeof(ffi_arg); arg_offset = arg_offset % sizeof(ffi_arg); } } /* * Decodes the arguments to a function, which will be stored on the * stack. AR is the pointer to the beginning of the integer * arguments. FPR is a pointer to the area where floating point * registers have been saved. * * RVALUE is the location where the function return value will be * stored. CLOSURE is the prepared closure to invoke. * * This function should only be called from assembly, which is in * turn called from a trampoline. * * Returns the function return flags. * */ int ffi_closure_mips_inner_N32 (ffi_closure *closure, void *rvalue, ffi_arg *ar, ffi_arg *fpr) { ffi_cif *cif; void **avaluep; ffi_arg *avalue; ffi_type **arg_types; int i, avn, argn; int soft_float; ffi_arg *argp; cif = closure->cif; soft_float = cif->abi == FFI_N64_SOFT_FLOAT || cif->abi == FFI_N32_SOFT_FLOAT; avalue = alloca (cif->nargs * sizeof (ffi_arg)); avaluep = alloca (cif->nargs * sizeof (ffi_arg)); argn = 0; if (cif->rstruct_flag) { #if _MIPS_SIM==_ABIN32 rvalue = (void *)(UINT32)ar[0]; #else /* N64 */ rvalue = (void *)ar[0]; #endif argn = 1; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; while (i < avn) { if (arg_types[i]->type == FFI_TYPE_FLOAT || arg_types[i]->type == FFI_TYPE_DOUBLE || arg_types[i]->type == FFI_TYPE_LONGDOUBLE) { argp = (argn >= 8 || soft_float) ? ar + argn : fpr + argn; if ((arg_types[i]->type == FFI_TYPE_LONGDOUBLE) && ((unsigned)argp & (arg_types[i]->alignment-1))) { argp=(ffi_arg*)ALIGN(argp,arg_types[i]->alignment); argn++; } #if defined(__MIPSEB__) || defined(_MIPSEB) if (arg_types[i]->type == FFI_TYPE_FLOAT && argn < 8) avaluep[i] = ((char *) argp) + sizeof (float); else #endif avaluep[i] = (char *) argp; } else { unsigned type = arg_types[i]->type; if (arg_types[i]->alignment > sizeof(ffi_arg)) argn = ALIGN(argn, arg_types[i]->alignment / sizeof(ffi_arg)); argp = ar + argn; /* The size of a pointer depends on the ABI */ if (type == FFI_TYPE_POINTER) type = (cif->abi == FFI_N64 || cif->abi == FFI_N64_SOFT_FLOAT) ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32; if (soft_float && type == FFI_TYPE_FLOAT) type = FFI_TYPE_UINT32; switch (type) { case FFI_TYPE_SINT8: avaluep[i] = &avalue[i]; *(SINT8 *) &avalue[i] = (SINT8) *argp; break; case FFI_TYPE_UINT8: avaluep[i] = &avalue[i]; *(UINT8 *) &avalue[i] = (UINT8) *argp; break; case FFI_TYPE_SINT16: avaluep[i] = &avalue[i]; *(SINT16 *) &avalue[i] = (SINT16) *argp; break; case FFI_TYPE_UINT16: avaluep[i] = &avalue[i]; *(UINT16 *) &avalue[i] = (UINT16) *argp; break; case FFI_TYPE_SINT32: avaluep[i] = &avalue[i]; *(SINT32 *) &avalue[i] = (SINT32) *argp; break; case FFI_TYPE_UINT32: avaluep[i] = &avalue[i]; *(UINT32 *) &avalue[i] = (UINT32) *argp; break; case FFI_TYPE_STRUCT: if (argn < 8) { /* Allocate space for the struct as at least part of it was passed in registers. */ avaluep[i] = alloca(arg_types[i]->size); copy_struct_N32(avaluep[i], 0, cif->abi, arg_types[i], argn, 0, ar, fpr, soft_float); break; } /* Else fall through. */ default: avaluep[i] = (char *) argp; break; } } argn += ALIGN(arg_types[i]->size, sizeof(ffi_arg)) / sizeof(ffi_arg); i++; } /* Invoke the closure. */ (closure->fun) (cif, rvalue, avaluep, closure->user_data); return cif->flags >> (FFI_FLAG_BITS * 8); } #endif /* FFI_MIPS_N32 */ #endif /* FFI_CLOSURES */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/mips/ffitarget.h0000644000175000017500000001404111545150464022717 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for MIPS. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #ifdef linux # include #else # include #endif # ifndef _ABIN32 # define _ABIN32 _MIPS_SIM_NABI32 # endif # ifndef _ABI64 # define _ABI64 _MIPS_SIM_ABI64 # endif # ifndef _ABIO32 # define _ABIO32 _MIPS_SIM_ABI32 # endif #if !defined(_MIPS_SIM) -- something is very wrong -- #else # if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64)) # define FFI_MIPS_N32 # else # if (_MIPS_SIM==_ABIO32 && defined(_ABIO32)) # define FFI_MIPS_O32 # else -- this is an unsupported platform -- # endif # endif #endif #ifdef FFI_MIPS_O32 /* O32 stack frames have 32bit integer args */ # define FFI_SIZEOF_ARG 4 #else /* N32 and N64 frames have 64bit integer args */ # define FFI_SIZEOF_ARG 8 # if _MIPS_SIM == _ABIN32 # define FFI_SIZEOF_JAVA_RAW 4 # endif #endif #define FFI_FLAG_BITS 2 /* SGI's strange assembler requires that we multiply by 4 rather than shift left by FFI_FLAG_BITS */ #define FFI_ARGS_D FFI_TYPE_DOUBLE #define FFI_ARGS_F FFI_TYPE_FLOAT #define FFI_ARGS_DD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_DOUBLE #define FFI_ARGS_FF FFI_TYPE_FLOAT * 4 + FFI_TYPE_FLOAT #define FFI_ARGS_FD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_FLOAT #define FFI_ARGS_DF FFI_TYPE_FLOAT * 4 + FFI_TYPE_DOUBLE /* Needed for N32 structure returns */ #define FFI_TYPE_SMALLSTRUCT FFI_TYPE_UINT8 #define FFI_TYPE_SMALLSTRUCT2 FFI_TYPE_SINT8 #if 0 /* The SGI assembler can't handle this.. */ #define FFI_TYPE_STRUCT_DD (( FFI_ARGS_DD ) << 4) + FFI_TYPE_STRUCT /* (and so on) */ #else /* ...so we calculate these by hand! */ #define FFI_TYPE_STRUCT_D 61 #define FFI_TYPE_STRUCT_F 45 #define FFI_TYPE_STRUCT_DD 253 #define FFI_TYPE_STRUCT_FF 173 #define FFI_TYPE_STRUCT_FD 237 #define FFI_TYPE_STRUCT_DF 189 #define FFI_TYPE_STRUCT_SMALL 93 #define FFI_TYPE_STRUCT_SMALL2 109 /* and for n32 soft float, add 16 * 2^4 */ #define FFI_TYPE_STRUCT_D_SOFT 317 #define FFI_TYPE_STRUCT_F_SOFT 301 #define FFI_TYPE_STRUCT_DD_SOFT 509 #define FFI_TYPE_STRUCT_FF_SOFT 429 #define FFI_TYPE_STRUCT_FD_SOFT 493 #define FFI_TYPE_STRUCT_DF_SOFT 445 #define FFI_TYPE_STRUCT_SOFT 16 #endif #ifdef LIBFFI_ASM #define v0 $2 #define v1 $3 #define a0 $4 #define a1 $5 #define a2 $6 #define a3 $7 #define a4 $8 #define a5 $9 #define a6 $10 #define a7 $11 #define t0 $8 #define t1 $9 #define t2 $10 #define t3 $11 #define t4 $12 #define t5 $13 #define t6 $14 #define t7 $15 #define t8 $24 #define t9 $25 #define ra $31 #ifdef FFI_MIPS_O32 # define REG_L lw # define REG_S sw # define SUBU subu # define ADDU addu # define SRL srl # define LI li #else /* !FFI_MIPS_O32 */ # define REG_L ld # define REG_S sd # define SUBU dsubu # define ADDU daddu # define SRL dsrl # define LI dli # if (_MIPS_SIM==_ABI64) # define LA dla # define EH_FRAME_ALIGN 3 # define FDE_ADDR_BYTES .8byte # else # define LA la # define EH_FRAME_ALIGN 2 # define FDE_ADDR_BYTES .4byte # endif /* _MIPS_SIM==_ABI64 */ #endif /* !FFI_MIPS_O32 */ #else /* !LIBFFI_ASM */ # ifdef __GNUC__ # ifdef FFI_MIPS_O32 /* O32 stack frames have 32bit integer args */ typedef unsigned int ffi_arg __attribute__((__mode__(__SI__))); typedef signed int ffi_sarg __attribute__((__mode__(__SI__))); #else /* N32 and N64 frames have 64bit integer args */ typedef unsigned int ffi_arg __attribute__((__mode__(__DI__))); typedef signed int ffi_sarg __attribute__((__mode__(__DI__))); # endif # else # ifdef FFI_MIPS_O32 /* O32 stack frames have 32bit integer args */ typedef __uint32_t ffi_arg; typedef __int32_t ffi_sarg; # else /* N32 and N64 frames have 64bit integer args */ typedef __uint64_t ffi_arg; typedef __int64_t ffi_sarg; # endif # endif /* __GNUC__ */ typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_O32, FFI_N32, FFI_N64, FFI_O32_SOFT_FLOAT, FFI_N32_SOFT_FLOAT, FFI_N64_SOFT_FLOAT, FFI_LAST_ABI, #ifdef FFI_MIPS_O32 #ifdef __mips_soft_float FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT #else FFI_DEFAULT_ABI = FFI_O32 #endif #else # if _MIPS_SIM==_ABI64 # ifdef __mips_soft_float FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT # else FFI_DEFAULT_ABI = FFI_N64 # endif # else # ifdef __mips_soft_float FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT # else FFI_DEFAULT_ABI = FFI_N32 # endif # endif #endif } ffi_abi; #define FFI_EXTRA_CIF_FIELDS unsigned rstruct_flag #endif /* !LIBFFI_ASM */ /* ---- Definitions for closures ----------------------------------------- */ #if defined(FFI_MIPS_O32) #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 20 #else /* N32/N64. */ # define FFI_CLOSURES 1 #if _MIPS_SIM==_ABI64 #define FFI_TRAMPOLINE_SIZE 52 #else #define FFI_TRAMPOLINE_SIZE 20 #endif #endif /* FFI_MIPS_O32 */ #define FFI_NATIVE_RAW_API 0 #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/mips/n32.S0000644000175000017500000003426511545150464021333 0ustar chr1schr1s/* ----------------------------------------------------------------------- n32.S - Copyright (c) 1996, 1998, 2005, 2007, 2009, 2010 Red Hat, Inc. MIPS Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include /* Only build this code if we are compiling for n32 */ #if defined(FFI_MIPS_N32) #define callback a0 #define bytes a2 #define flags a3 #define raddr a4 #define fn a5 #define SIZEOF_FRAME ( 8 * FFI_SIZEOF_ARG ) #ifdef __GNUC__ .abicalls #endif .text .align 2 .globl ffi_call_N32 .ent ffi_call_N32 ffi_call_N32: .LFB3: .frame $fp, SIZEOF_FRAME, ra .mask 0xc0000000,-FFI_SIZEOF_ARG .fmask 0x00000000,0 # Prologue SUBU $sp, SIZEOF_FRAME # Frame size .LCFI0: REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address .LCFI1: move $fp, $sp .LCFI3: move t9, callback # callback function pointer REG_S bytes, 2*FFI_SIZEOF_ARG($fp) # bytes REG_S flags, 3*FFI_SIZEOF_ARG($fp) # flags REG_S raddr, 4*FFI_SIZEOF_ARG($fp) # raddr REG_S fn, 5*FFI_SIZEOF_ARG($fp) # fn # Allocate at least 4 words in the argstack move v0, bytes bge bytes, 4 * FFI_SIZEOF_ARG, bigger LI v0, 4 * FFI_SIZEOF_ARG b sixteen bigger: ADDU t4, v0, 2 * FFI_SIZEOF_ARG -1 # make sure it is aligned and v0, t4, -2 * FFI_SIZEOF_ARG # to a proper boundry. sixteen: SUBU $sp, $sp, v0 # move the stack pointer to reflect the # arg space move a0, $sp # 4 * FFI_SIZEOF_ARG ADDU a3, $fp, 3 * FFI_SIZEOF_ARG # Call ffi_prep_args jal t9 # Copy the stack pointer to t9 move t9, $sp # Fix the stack if there are more than 8 64bit slots worth # of arguments. # Load the number of bytes REG_L t6, 2*FFI_SIZEOF_ARG($fp) # Is it bigger than 8 * FFI_SIZEOF_ARG? daddiu t8, t6, -(8 * FFI_SIZEOF_ARG) bltz t8, loadregs ADDU t9, t9, t8 loadregs: REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6. and t4, t6, ((1< #include /* Only build this code if we are compiling for o32 */ #if defined(FFI_MIPS_O32) #define callback a0 #define bytes a2 #define flags a3 #define SIZEOF_FRAME (4 * FFI_SIZEOF_ARG + 2 * FFI_SIZEOF_ARG) #define A3_OFF (SIZEOF_FRAME + 3 * FFI_SIZEOF_ARG) #define FP_OFF (SIZEOF_FRAME - 2 * FFI_SIZEOF_ARG) #define RA_OFF (SIZEOF_FRAME - 1 * FFI_SIZEOF_ARG) .abicalls .text .align 2 .globl ffi_call_O32 .ent ffi_call_O32 ffi_call_O32: $LFB0: # Prologue SUBU $sp, SIZEOF_FRAME # Frame size $LCFI0: REG_S $fp, FP_OFF($sp) # Save frame pointer $LCFI1: REG_S ra, RA_OFF($sp) # Save return address $LCFI2: move $fp, $sp $LCFI3: move t9, callback # callback function pointer REG_S flags, A3_OFF($fp) # flags # Allocate at least 4 words in the argstack LI v0, 4 * FFI_SIZEOF_ARG blt bytes, v0, sixteen ADDU v0, bytes, 7 # make sure it is aligned and v0, -8 # to an 8 byte boundry sixteen: SUBU $sp, v0 # move the stack pointer to reflect the # arg space ADDU a0, $sp, 4 * FFI_SIZEOF_ARG jalr t9 REG_L t0, A3_OFF($fp) # load the flags word SRL t2, t0, 4 # shift our arg info and t0, ((1<<4)-1) # mask out the return type ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args bnez t0, pass_d # make it quick for int REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs. REG_L a2, 2*FFI_SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_d: bne t0, FFI_ARGS_D, pass_f l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args REG_L a2, 2*FFI_SIZEOF_ARG($sp) # passing a double REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_f: bne t0, FFI_ARGS_F, pass_d_d l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args REG_L a1, 1*FFI_SIZEOF_ARG($sp) # passing a float REG_L a2, 2*FFI_SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_d_d: bne t0, FFI_ARGS_DD, pass_f_f l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing two doubles b call_it pass_f_f: bne t0, FFI_ARGS_FF, pass_d_f l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.s $f14, 1*FFI_SIZEOF_ARG($sp) # passing two floats REG_L a2, 2*FFI_SIZEOF_ARG($sp) REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_d_f: bne t0, FFI_ARGS_DF, pass_f_d l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.s $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float REG_L a3, 3*FFI_SIZEOF_ARG($sp) b call_it pass_f_d: # assume that the only other combination must be float then double # bne t0, FFI_ARGS_F_D, call_it l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float call_it: # Load the function pointer REG_L t9, SIZEOF_FRAME + 5*FFI_SIZEOF_ARG($fp) # If the return value pointer is NULL, assume no return value. REG_L t1, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) beqz t1, noretval bne t2, FFI_TYPE_INT, retlonglong jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) REG_S v0, 0(t0) b epilogue retlonglong: # Really any 64-bit int, signed or not. bne t2, FFI_TYPE_UINT64, retfloat jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) REG_S v1, 4(t0) REG_S v0, 0(t0) b epilogue retfloat: bne t2, FFI_TYPE_FLOAT, retdouble jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) s.s $f0, 0(t0) b epilogue retdouble: bne t2, FFI_TYPE_DOUBLE, noretval jalr t9 REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) s.d $f0, 0(t0) b epilogue noretval: jalr t9 # Epilogue epilogue: move $sp, $fp REG_L $fp, FP_OFF($sp) # Restore frame pointer REG_L ra, RA_OFF($sp) # Restore return address ADDU $sp, SIZEOF_FRAME # Fix stack pointer j ra $LFE0: .end ffi_call_O32 /* ffi_closure_O32. Expects address of the passed-in ffi_closure in t4 ($12). Stores any arguments passed in registers onto the stack, then calls ffi_closure_mips_inner_O32, which then decodes them. Stack layout: 3 - a3 save 2 - a2 save 1 - a1 save 0 - a0 save, original sp -1 - ra save -2 - fp save -3 - $16 (s0) save -4 - cprestore -5 - return value high (v1) -6 - return value low (v0) -7 - f14 (le high, be low) -8 - f14 (le low, be high) -9 - f12 (le high, be low) -10 - f12 (le low, be high) -11 - Called function a3 save -12 - Called function a2 save -13 - Called function a1 save -14 - Called function a0 save, our sp and fp point here */ #define SIZEOF_FRAME2 (14 * FFI_SIZEOF_ARG) #define A3_OFF2 (SIZEOF_FRAME2 + 3 * FFI_SIZEOF_ARG) #define A2_OFF2 (SIZEOF_FRAME2 + 2 * FFI_SIZEOF_ARG) #define A1_OFF2 (SIZEOF_FRAME2 + 1 * FFI_SIZEOF_ARG) #define A0_OFF2 (SIZEOF_FRAME2 + 0 * FFI_SIZEOF_ARG) #define RA_OFF2 (SIZEOF_FRAME2 - 1 * FFI_SIZEOF_ARG) #define FP_OFF2 (SIZEOF_FRAME2 - 2 * FFI_SIZEOF_ARG) #define S0_OFF2 (SIZEOF_FRAME2 - 3 * FFI_SIZEOF_ARG) #define GP_OFF2 (SIZEOF_FRAME2 - 4 * FFI_SIZEOF_ARG) #define V1_OFF2 (SIZEOF_FRAME2 - 5 * FFI_SIZEOF_ARG) #define V0_OFF2 (SIZEOF_FRAME2 - 6 * FFI_SIZEOF_ARG) #define FA_1_1_OFF2 (SIZEOF_FRAME2 - 7 * FFI_SIZEOF_ARG) #define FA_1_0_OFF2 (SIZEOF_FRAME2 - 8 * FFI_SIZEOF_ARG) #define FA_0_1_OFF2 (SIZEOF_FRAME2 - 9 * FFI_SIZEOF_ARG) #define FA_0_0_OFF2 (SIZEOF_FRAME2 - 10 * FFI_SIZEOF_ARG) .text .align 2 .globl ffi_closure_O32 .ent ffi_closure_O32 ffi_closure_O32: $LFB1: # Prologue .frame $fp, SIZEOF_FRAME2, ra .set noreorder .cpload t9 .set reorder SUBU $sp, SIZEOF_FRAME2 .cprestore GP_OFF2 $LCFI4: REG_S $16, S0_OFF2($sp) # Save s0 REG_S $fp, FP_OFF2($sp) # Save frame pointer REG_S ra, RA_OFF2($sp) # Save return address $LCFI6: move $fp, $sp $LCFI7: # Store all possible argument registers. If there are more than # four arguments, then they are stored above where we put a3. REG_S a0, A0_OFF2($fp) REG_S a1, A1_OFF2($fp) REG_S a2, A2_OFF2($fp) REG_S a3, A3_OFF2($fp) # Load ABI enum to s0 REG_L $16, 20($12) # cif pointer follows tramp. REG_L $16, 0($16) # abi is first member. li $13, 1 # FFI_O32 bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT # Store all possible float/double registers. s.d $f12, FA_0_0_OFF2($fp) s.d $f14, FA_1_0_OFF2($fp) 1: # Call ffi_closure_mips_inner_O32 to do the work. la t9, ffi_closure_mips_inner_O32 move a0, $12 # Pointer to the ffi_closure addu a1, $fp, V0_OFF2 addu a2, $fp, A0_OFF2 addu a3, $fp, FA_0_0_OFF2 jalr t9 # Load the return value into the appropriate register. move $8, $2 li $9, FFI_TYPE_VOID beq $8, $9, closure_done li $13, 1 # FFI_O32 bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT li $9, FFI_TYPE_FLOAT l.s $f0, V0_OFF2($fp) beq $8, $9, closure_done li $9, FFI_TYPE_DOUBLE l.d $f0, V0_OFF2($fp) beq $8, $9, closure_done 1: REG_L $3, V1_OFF2($fp) REG_L $2, V0_OFF2($fp) closure_done: # Epilogue move $sp, $fp REG_L $16, S0_OFF2($sp) # Restore s0 REG_L $fp, FP_OFF2($sp) # Restore frame pointer REG_L ra, RA_OFF2($sp) # Restore return address ADDU $sp, SIZEOF_FRAME2 j ra $LFE1: .end ffi_closure_O32 /* DWARF-2 unwind info. */ .section .eh_frame,"a",@progbits $Lframe0: .4byte $LECIE0-$LSCIE0 # Length of Common Information Entry $LSCIE0: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .uleb128 0x1 # CIE Code Alignment Factor .sleb128 4 # CIE Data Alignment Factor .byte 0x1f # CIE RA Column .uleb128 0x1 # Augmentation size .byte 0x00 # FDE Encoding (absptr) .byte 0xc # DW_CFA_def_cfa .uleb128 0x1d .uleb128 0x0 .align 2 $LECIE0: $LSFDE0: .4byte $LEFDE0-$LASFDE0 # FDE Length $LASFDE0: .4byte $LASFDE0-$Lframe0 # FDE CIE offset .4byte $LFB0 # FDE initial location .4byte $LFE0-$LFB0 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI0-$LFB0 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0x18 .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI2-$LCFI0 .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x1e # $fp .sleb128 -2 # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x1f # $ra .sleb128 -1 # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI3-$LCFI2 .byte 0xc # DW_CFA_def_cfa .uleb128 0x1e .uleb128 0x18 .align 2 $LEFDE0: $LSFDE1: .4byte $LEFDE1-$LASFDE1 # FDE Length $LASFDE1: .4byte $LASFDE1-$Lframe0 # FDE CIE offset .4byte $LFB1 # FDE initial location .4byte $LFE1-$LFB1 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI4-$LFB1 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0x38 .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI6-$LCFI4 .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x10 # $16 .sleb128 -3 # SIZEOF_FRAME2 - 3*FFI_SIZEOF_ARG($sp) .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x1e # $fp .sleb128 -2 # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x1f # $ra .sleb128 -1 # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) .byte 0x4 # DW_CFA_advance_loc4 .4byte $LCFI7-$LCFI6 .byte 0xc # DW_CFA_def_cfa .uleb128 0x1e .uleb128 0x38 .align 2 $LEFDE1: #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/moxie/eabi.S0000644000175000017500000000652611545150464022001 0ustar chr1schr1s/* ----------------------------------------------------------------------- eabi.S - Copyright (c) 2004 Anthony Green FR-V Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .globl ffi_prep_args_EABI .text .p2align 4 .globl ffi_call_EABI .type ffi_call_EABI, @function # gr8 : ffi_prep_args # gr9 : &ecif # gr10: cif->bytes # gr11: fig->flags # gr12: ecif.rvalue # gr13: fn ffi_call_EABI: addi sp, #-80, sp sti fp, @(sp, #24) addi sp, #24, fp movsg lr, gr5 /* Make room for the new arguments. */ /* subi sp, fp, gr10 */ /* Store return address and incoming args on stack. */ sti gr5, @(fp, #8) sti gr8, @(fp, #-4) sti gr9, @(fp, #-8) sti gr10, @(fp, #-12) sti gr11, @(fp, #-16) sti gr12, @(fp, #-20) sti gr13, @(fp, #-24) sub sp, gr10, sp /* Call ffi_prep_args. */ ldi @(fp, #-4), gr4 addi sp, #0, gr8 ldi @(fp, #-8), gr9 #ifdef __FRV_FDPIC__ ldd @(gr4, gr0), gr14 calll @(gr14, gr0) #else calll @(gr4, gr0) #endif /* ffi_prep_args returns the new stack pointer. */ mov gr8, gr4 ldi @(sp, #0), gr8 ldi @(sp, #4), gr9 ldi @(sp, #8), gr10 ldi @(sp, #12), gr11 ldi @(sp, #16), gr12 ldi @(sp, #20), gr13 /* Always copy the return value pointer into the hidden parameter register. This is only strictly necessary when we're returning an aggregate type, but it doesn't hurt to do this all the time, and it saves a branch. */ ldi @(fp, #-20), gr3 /* Use the ffi_prep_args return value for the new sp. */ mov gr4, sp /* Call the target function. */ ldi @(fp, -24), gr4 #ifdef __FRV_FDPIC__ ldd @(gr4, gr0), gr14 calll @(gr14, gr0) #else calll @(gr4, gr0) #endif /* Store the result. */ ldi @(fp, #-16), gr10 /* fig->flags */ ldi @(fp, #-20), gr4 /* ecif.rvalue */ /* Is the return value stored in two registers? */ cmpi gr10, #8, icc0 bne icc0, 0, .L2 /* Yes, save them. */ sti gr8, @(gr4, #0) sti gr9, @(gr4, #4) bra .L3 .L2: /* Is the return value a structure? */ cmpi gr10, #-1, icc0 beq icc0, 0, .L3 /* No, save a 4 byte return value. */ sti gr8, @(gr4, #0) .L3: /* Restore the stack, and return. */ ldi @(fp, 8), gr5 ld @(fp, gr0), fp addi sp,#80,sp jmpl @(gr5,gr0) .size ffi_call_EABI, .-ffi_call_EABI mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/moxie/ffi.c0000644000175000017500000001714011545150464021657 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (C) 2009 Anthony Green Moxie Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void *ffi_prep_args(char *stack, extended_cif *ecif) { register unsigned int i; register void **p_argv; register char *argp; register ffi_type **p_arg; register int count = 0; p_argv = ecif->avalue; argp = stack; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; (i != 0); i--, p_arg++) { size_t z; z = (*p_arg)->size; if ((*p_arg)->type == FFI_TYPE_STRUCT) { z = sizeof(void*); *(void **) argp = *p_argv; } /* if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (count > 24) { // This is going on the stack. Turn it into a double. *(double *) argp = (double) *(float*)(* p_argv); z = sizeof(double); } else *(void **) argp = *(void **)(* p_argv); } */ else if (z < sizeof(int)) { z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; default: FFI_ASSERT(0); } } else if (z == sizeof(int)) { *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); } else { memcpy(argp, *p_argv, z); } p_argv++; argp += z; count += z; } return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8))); } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { if (cif->rtype->type == FFI_TYPE_STRUCT) cif->flags = -1; else cif->flags = cif->rtype->size; cif->bytes = ALIGN (cif->bytes, 8); return FFI_OK; } extern void ffi_call_EABI(void *(*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_EABI: ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT(0); break; } } void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3, unsigned arg4, unsigned arg5, unsigned arg6) { /* This function is called by a trampoline. The trampoline stows a pointer to the ffi_closure object in gr7. We must save this pointer in a place that will persist while we do our work. */ register ffi_closure *creg __asm__ ("gr7"); ffi_closure *closure = creg; /* Arguments that don't fit in registers are found on the stack at a fixed offset above the current frame pointer. */ register char *frame_pointer __asm__ ("fp"); char *stack_args = frame_pointer + 16; /* Lay the register arguments down in a continuous chunk of memory. */ unsigned register_args[6] = { arg1, arg2, arg3, arg4, arg5, arg6 }; ffi_cif *cif = closure->cif; ffi_type **arg_types = cif->arg_types; void **avalue = alloca (cif->nargs * sizeof(void *)); char *ptr = (char *) register_args; int i; /* Find the address of each argument. */ for (i = 0; i < cif->nargs; i++) { switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = ptr + 3; break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = ptr + 2; break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_FLOAT: avalue[i] = ptr; break; case FFI_TYPE_STRUCT: avalue[i] = *(void**)ptr; break; default: /* This is an 8-byte value. */ avalue[i] = ptr; ptr += 4; break; } ptr += 4; /* If we've handled more arguments than fit in registers, start looking at the those passed on the stack. */ if (ptr == ((char *)register_args + (6*4))) ptr = stack_args; } /* Invoke the closure. */ if (cif->rtype->type == FFI_TYPE_STRUCT) { /* The caller allocates space for the return structure, and passes a pointer to this space in gr3. Use this value directly as the return value. */ register void *return_struct_ptr __asm__("gr3"); (closure->fun) (cif, return_struct_ptr, avalue, closure->user_data); } else { /* Allocate space for the return value and call the function. */ long long rvalue; (closure->fun) (cif, &rvalue, avalue, closure->user_data); /* Functions return 4-byte or smaller results in gr8. 8-byte values also use gr9. We fill the both, even for small return values, just to avoid a branch. */ asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); } } ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp = (unsigned int *) &closure->tramp[0]; unsigned long fn = (long) ffi_closure_eabi; unsigned long cls = (long) codeloc; int i; fn = (unsigned long) ffi_closure_eabi; tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Cache flushing. */ for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++) __asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i), "r" (codeloc)); return FFI_OK; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/moxie/ffitarget.h0000644000175000017500000000355411545150464023077 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 2009 Anthony Green Target configuration macros for Moxie Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_EABI, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_EABI } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 0 #define FFI_NATIVE_RAW_API 0 /* Trampolines are 5 4-byte instructions long. */ #define FFI_TRAMPOLINE_SIZE (5*4) #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/pa/ffi.c0000644000175000017500000004701211545150464021137 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - (c) 2003-2004 Randolph Chung (c) 2008 Red Hat, Inc. HPPA Foreign Function Interface HP-UX PA ABI support (c) 2006 Free Software Foundation, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include #define ROUND_UP(v, a) (((size_t)(v) + (a) - 1) & ~((a) - 1)) #define MIN_STACK_SIZE 64 #define FIRST_ARG_SLOT 9 #define DEBUG_LEVEL 0 #define fldw(addr, fpreg) \ __asm__ volatile ("fldw 0(%0), %%" #fpreg "L" : : "r"(addr) : #fpreg) #define fstw(fpreg, addr) \ __asm__ volatile ("fstw %%" #fpreg "L, 0(%0)" : : "r"(addr)) #define fldd(addr, fpreg) \ __asm__ volatile ("fldd 0(%0), %%" #fpreg : : "r"(addr) : #fpreg) #define fstd(fpreg, addr) \ __asm__ volatile ("fstd %%" #fpreg "L, 0(%0)" : : "r"(addr)) #define debug(lvl, x...) do { if (lvl <= DEBUG_LEVEL) { printf(x); } } while (0) static inline int ffi_struct_type(ffi_type *t) { size_t sz = t->size; /* Small structure results are passed in registers, larger ones are passed by pointer. Note that small structures of size 2, 4 and 8 differ from the corresponding integer types in that they have different alignment requirements. */ if (sz <= 1) return FFI_TYPE_UINT8; else if (sz == 2) return FFI_TYPE_SMALL_STRUCT2; else if (sz == 3) return FFI_TYPE_SMALL_STRUCT3; else if (sz == 4) return FFI_TYPE_SMALL_STRUCT4; else if (sz == 5) return FFI_TYPE_SMALL_STRUCT5; else if (sz == 6) return FFI_TYPE_SMALL_STRUCT6; else if (sz == 7) return FFI_TYPE_SMALL_STRUCT7; else if (sz <= 8) return FFI_TYPE_SMALL_STRUCT8; else return FFI_TYPE_STRUCT; /* else, we pass it by pointer. */ } /* PA has a downward growing stack, which looks like this: Offset [ Variable args ] SP = (4*(n+9)) arg word N ... SP-52 arg word 4 [ Fixed args ] SP-48 arg word 3 SP-44 arg word 2 SP-40 arg word 1 SP-36 arg word 0 [ Frame marker ] ... SP-20 RP SP-4 previous SP The first four argument words on the stack are reserved for use by the callee. Instead, the general and floating registers replace the first four argument slots. Non FP arguments are passed solely in the general registers. FP arguments are passed in both general and floating registers when using libffi. Non-FP 32-bit args are passed in gr26, gr25, gr24 and gr23. Non-FP 64-bit args are passed in register pairs, starting on an odd numbered register (i.e. r25+r26 and r23+r24). FP 32-bit arguments are passed in fr4L, fr5L, fr6L and fr7L. FP 64-bit arguments are passed in fr5 and fr7. The registers are allocated in the same manner as stack slots. This allows the callee to save its arguments on the stack if necessary: arg word 3 -> gr23 or fr7L arg word 2 -> gr24 or fr6L or fr7R arg word 1 -> gr25 or fr5L arg word 0 -> gr26 or fr4L or fr5R Note that fr4R and fr6R are never used for arguments (i.e., doubles are not passed in fr4 or fr6). The rest of the arguments are passed on the stack starting at SP-52, but 64-bit arguments need to be aligned to an 8-byte boundary This means we can have holes either in the register allocation, or in the stack. */ /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments The following code will put everything into the stack frame (which was allocated by the asm routine), and on return the asm routine will load the arguments that should be passed by register into the appropriate registers NOTE: We load floating point args in this function... that means we assume gcc will not mess with fp regs in here. */ void ffi_prep_args_pa32(UINT32 *stack, extended_cif *ecif, unsigned bytes) { register unsigned int i; register ffi_type **p_arg; register void **p_argv; unsigned int slot = FIRST_ARG_SLOT; char *dest_cpy; size_t len; debug(1, "%s: stack = %p, ecif = %p, bytes = %u\n", __FUNCTION__, stack, ecif, bytes); p_arg = ecif->cif->arg_types; p_argv = ecif->avalue; for (i = 0; i < ecif->cif->nargs; i++) { int type = (*p_arg)->type; switch (type) { case FFI_TYPE_SINT8: *(SINT32 *)(stack - slot) = *(SINT8 *)(*p_argv); break; case FFI_TYPE_UINT8: *(UINT32 *)(stack - slot) = *(UINT8 *)(*p_argv); break; case FFI_TYPE_SINT16: *(SINT32 *)(stack - slot) = *(SINT16 *)(*p_argv); break; case FFI_TYPE_UINT16: *(UINT32 *)(stack - slot) = *(UINT16 *)(*p_argv); break; case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: case FFI_TYPE_POINTER: debug(3, "Storing UINT32 %u in slot %u\n", *(UINT32 *)(*p_argv), slot); *(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv); break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: /* Align slot for 64-bit type. */ slot += (slot & 1) ? 1 : 2; *(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv); break; case FFI_TYPE_FLOAT: /* First 4 args go in fr4L - fr7L. */ debug(3, "Storing UINT32(float) in slot %u\n", slot); *(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv); switch (slot - FIRST_ARG_SLOT) { /* First 4 args go in fr4L - fr7L. */ case 0: fldw(stack - slot, fr4); break; case 1: fldw(stack - slot, fr5); break; case 2: fldw(stack - slot, fr6); break; case 3: fldw(stack - slot, fr7); break; } break; case FFI_TYPE_DOUBLE: /* Align slot for 64-bit type. */ slot += (slot & 1) ? 1 : 2; debug(3, "Storing UINT64(double) at slot %u\n", slot); *(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv); switch (slot - FIRST_ARG_SLOT) { /* First 2 args go in fr5, fr7. */ case 1: fldd(stack - slot, fr5); break; case 3: fldd(stack - slot, fr7); break; } break; #ifdef PA_HPUX case FFI_TYPE_LONGDOUBLE: /* Long doubles are passed in the same manner as structures larger than 8 bytes. */ *(UINT32 *)(stack - slot) = (UINT32)(*p_argv); break; #endif case FFI_TYPE_STRUCT: /* Structs smaller or equal than 4 bytes are passed in one register. Structs smaller or equal 8 bytes are passed in two registers. Larger structures are passed by pointer. */ len = (*p_arg)->size; if (len <= 4) { dest_cpy = (char *)(stack - slot) + 4 - len; memcpy(dest_cpy, (char *)*p_argv, len); } else if (len <= 8) { slot += (slot & 1) ? 1 : 2; dest_cpy = (char *)(stack - slot) + 8 - len; memcpy(dest_cpy, (char *)*p_argv, len); } else *(UINT32 *)(stack - slot) = (UINT32)(*p_argv); break; default: FFI_ASSERT(0); } slot++; p_arg++; p_argv++; } /* Make sure we didn't mess up and scribble on the stack. */ { unsigned int n; debug(5, "Stack setup:\n"); for (n = 0; n < (bytes + 3) / 4; n++) { if ((n%4) == 0) { debug(5, "\n%08x: ", (unsigned int)(stack - n)); } debug(5, "%08x ", *(stack - n)); } debug(5, "\n"); } FFI_ASSERT(slot * 4 <= bytes); return; } static void ffi_size_stack_pa32(ffi_cif *cif) { ffi_type **ptr; int i; int z = 0; /* # stack slots */ for (ptr = cif->arg_types, i = 0; i < cif->nargs; ptr++, i++) { int type = (*ptr)->type; switch (type) { case FFI_TYPE_DOUBLE: case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: z += 2 + (z & 1); /* must start on even regs, so we may waste one */ break; #ifdef PA_HPUX case FFI_TYPE_LONGDOUBLE: #endif case FFI_TYPE_STRUCT: z += 1; /* pass by ptr, callee will copy */ break; default: /* <= 32-bit values */ z++; } } /* We can fit up to 6 args in the default 64-byte stack frame, if we need more, we need more stack. */ if (z <= 6) cif->bytes = MIN_STACK_SIZE; /* min stack size */ else cif->bytes = 64 + ROUND_UP((z - 6) * sizeof(UINT32), MIN_STACK_SIZE); debug(3, "Calculated stack size is %u bytes\n", cif->bytes); } /* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: cif->flags = (unsigned) cif->rtype->type; break; #ifdef PA_HPUX case FFI_TYPE_LONGDOUBLE: /* Long doubles are treated like a structure. */ cif->flags = FFI_TYPE_STRUCT; break; #endif case FFI_TYPE_STRUCT: /* For the return type we have to check the size of the structures. If the size is smaller or equal 4 bytes, the result is given back in one register. If the size is smaller or equal 8 bytes than we return the result in two registers. But if the size is bigger than 8 bytes, we work with pointers. */ cif->flags = ffi_struct_type(cif->rtype); break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: cif->flags = FFI_TYPE_UINT64; break; default: cif->flags = FFI_TYPE_INT; break; } /* Lucky us, because of the unique PA ABI we get to do our own stack sizing. */ switch (cif->abi) { case FFI_PA32: ffi_size_stack_pa32(cif); break; default: FFI_ASSERT(0); break; } return FFI_OK; } extern void ffi_call_pa32(void (*)(UINT32 *, extended_cif *, unsigned), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return value address then we need to make one. */ if (rvalue == NULL #ifdef PA_HPUX && (cif->rtype->type == FFI_TYPE_STRUCT || cif->rtype->type == FFI_TYPE_LONGDOUBLE)) #else && cif->rtype->type == FFI_TYPE_STRUCT) #endif { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_PA32: debug(3, "Calling ffi_call_pa32: ecif=%p, bytes=%u, flags=%u, rvalue=%p, fn=%p\n", &ecif, cif->bytes, cif->flags, ecif.rvalue, (void *)fn); ffi_call_pa32(ffi_prep_args_pa32, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT(0); break; } } #if FFI_CLOSURES /* This is more-or-less an inverse of ffi_call -- we have arguments on the stack, and we need to fill them into a cif structure and invoke the user function. This really ought to be in asm to make sure the compiler doesn't do things we don't expect. */ ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack) { ffi_cif *cif; void **avalue; void *rvalue; UINT32 ret[2]; /* function can return up to 64-bits in registers */ ffi_type **p_arg; char *tmp; int i, avn; unsigned int slot = FIRST_ARG_SLOT; register UINT32 r28 asm("r28"); cif = closure->cif; /* If returning via structure, callee will write to our pointer. */ if (cif->flags == FFI_TYPE_STRUCT) rvalue = (void *)r28; else rvalue = &ret[0]; avalue = (void **)alloca(cif->nargs * FFI_SIZEOF_ARG); avn = cif->nargs; p_arg = cif->arg_types; for (i = 0; i < avn; i++) { int type = (*p_arg)->type; switch (type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_POINTER: avalue[i] = (char *)(stack - slot) + sizeof(UINT32) - (*p_arg)->size; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: slot += (slot & 1) ? 1 : 2; avalue[i] = (void *)(stack - slot); break; case FFI_TYPE_FLOAT: #ifdef PA_LINUX /* The closure call is indirect. In Linux, floating point arguments in indirect calls with a prototype are passed in the floating point registers instead of the general registers. So, we need to replace what was previously stored in the current slot with the value in the corresponding floating point register. */ switch (slot - FIRST_ARG_SLOT) { case 0: fstw(fr4, (void *)(stack - slot)); break; case 1: fstw(fr5, (void *)(stack - slot)); break; case 2: fstw(fr6, (void *)(stack - slot)); break; case 3: fstw(fr7, (void *)(stack - slot)); break; } #endif avalue[i] = (void *)(stack - slot); break; case FFI_TYPE_DOUBLE: slot += (slot & 1) ? 1 : 2; #ifdef PA_LINUX /* See previous comment for FFI_TYPE_FLOAT. */ switch (slot - FIRST_ARG_SLOT) { case 1: fstd(fr5, (void *)(stack - slot)); break; case 3: fstd(fr7, (void *)(stack - slot)); break; } #endif avalue[i] = (void *)(stack - slot); break; #ifdef PA_HPUX case FFI_TYPE_LONGDOUBLE: /* Long doubles are treated like a big structure. */ avalue[i] = (void *) *(stack - slot); break; #endif case FFI_TYPE_STRUCT: /* Structs smaller or equal than 4 bytes are passed in one register. Structs smaller or equal 8 bytes are passed in two registers. Larger structures are passed by pointer. */ if((*p_arg)->size <= 4) { avalue[i] = (void *)(stack - slot) + sizeof(UINT32) - (*p_arg)->size; } else if ((*p_arg)->size <= 8) { slot += (slot & 1) ? 1 : 2; avalue[i] = (void *)(stack - slot) + sizeof(UINT64) - (*p_arg)->size; } else avalue[i] = (void *) *(stack - slot); break; default: FFI_ASSERT(0); } slot++; p_arg++; } /* Invoke the closure. */ (closure->fun) (cif, rvalue, avalue, closure->user_data); debug(3, "after calling function, ret[0] = %08x, ret[1] = %08x\n", ret[0], ret[1]); /* Store the result using the lower 2 bytes of the flags. */ switch (cif->flags) { case FFI_TYPE_UINT8: *(stack - FIRST_ARG_SLOT) = (UINT8)(ret[0] >> 24); break; case FFI_TYPE_SINT8: *(stack - FIRST_ARG_SLOT) = (SINT8)(ret[0] >> 24); break; case FFI_TYPE_UINT16: *(stack - FIRST_ARG_SLOT) = (UINT16)(ret[0] >> 16); break; case FFI_TYPE_SINT16: *(stack - FIRST_ARG_SLOT) = (SINT16)(ret[0] >> 16); break; case FFI_TYPE_INT: case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: *(stack - FIRST_ARG_SLOT) = ret[0]; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: *(stack - FIRST_ARG_SLOT) = ret[0]; *(stack - FIRST_ARG_SLOT - 1) = ret[1]; break; case FFI_TYPE_DOUBLE: fldd(rvalue, fr4); break; case FFI_TYPE_FLOAT: fldw(rvalue, fr4); break; case FFI_TYPE_STRUCT: /* Don't need a return value, done by caller. */ break; case FFI_TYPE_SMALL_STRUCT2: case FFI_TYPE_SMALL_STRUCT3: case FFI_TYPE_SMALL_STRUCT4: tmp = (void*)(stack - FIRST_ARG_SLOT); tmp += 4 - cif->rtype->size; memcpy((void*)tmp, &ret[0], cif->rtype->size); break; case FFI_TYPE_SMALL_STRUCT5: case FFI_TYPE_SMALL_STRUCT6: case FFI_TYPE_SMALL_STRUCT7: case FFI_TYPE_SMALL_STRUCT8: { unsigned int ret2[2]; int off; /* Right justify ret[0] and ret[1] */ switch (cif->flags) { case FFI_TYPE_SMALL_STRUCT5: off = 3; break; case FFI_TYPE_SMALL_STRUCT6: off = 2; break; case FFI_TYPE_SMALL_STRUCT7: off = 1; break; default: off = 0; break; } memset (ret2, 0, sizeof (ret2)); memcpy ((char *)ret2 + off, ret, 8 - off); *(stack - FIRST_ARG_SLOT) = ret2[0]; *(stack - FIRST_ARG_SLOT - 1) = ret2[1]; } break; case FFI_TYPE_POINTER: case FFI_TYPE_VOID: break; default: debug(0, "assert with cif->flags: %d\n",cif->flags); FFI_ASSERT(0); break; } return FFI_OK; } /* Fill in a closure to refer to the specified fun and user_data. cif specifies the argument and result types for fun. The cif must already be prep'ed. */ extern void ffi_closure_pa32(void); ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { UINT32 *tramp = (UINT32 *)(closure->tramp); #ifdef PA_HPUX UINT32 *tmp; #endif FFI_ASSERT (cif->abi == FFI_PA32); /* Make a small trampoline that will branch to our handler function. Use PC-relative addressing. */ #ifdef PA_LINUX tramp[0] = 0xeaa00000; /* b,l .+8,%r21 ; %r21 <- pc+8 */ tramp[1] = 0xd6a01c1e; /* depi 0,31,2,%r21 ; mask priv bits */ tramp[2] = 0x4aa10028; /* ldw 20(%r21),%r1 ; load plabel */ tramp[3] = 0x36b53ff1; /* ldo -8(%r21),%r21 ; get closure addr */ tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22 ; address of handler */ tramp[5] = 0xeac0c000; /* bv%r0(%r22) ; branch to handler */ tramp[6] = 0x0c281093; /* ldw 4(%r1),%r19 ; GP of handler */ tramp[7] = ((UINT32)(ffi_closure_pa32) & ~2); /* Flush d/icache -- have to flush up 2 two lines because of alignment. */ __asm__ volatile( "fdc 0(%0)\n\t" "fdc %1(%0)\n\t" "fic 0(%%sr4, %0)\n\t" "fic %1(%%sr4, %0)\n\t" "sync\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n" : : "r"((unsigned long)tramp & ~31), "r"(32 /* stride */) : "memory"); #endif #ifdef PA_HPUX tramp[0] = 0xeaa00000; /* b,l .+8,%r21 ; %r21 <- pc+8 */ tramp[1] = 0xd6a01c1e; /* depi 0,31,2,%r21 ; mask priv bits */ tramp[2] = 0x4aa10038; /* ldw 28(%r21),%r1 ; load plabel */ tramp[3] = 0x36b53ff1; /* ldo -8(%r21),%r21 ; get closure addr */ tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22 ; address of handler */ tramp[5] = 0x02c010b4; /* ldsid (%r22),%r20 ; load space id */ tramp[6] = 0x00141820; /* mtsp %r20,%sr0 ; into %sr0 */ tramp[7] = 0xe2c00000; /* be 0(%sr0,%r22) ; branch to handler */ tramp[8] = 0x0c281093; /* ldw 4(%r1),%r19 ; GP of handler */ tramp[9] = ((UINT32)(ffi_closure_pa32) & ~2); /* Flush d/icache -- have to flush three lines because of alignment. */ __asm__ volatile( "copy %1,%0\n\t" "fdc,m %2(%0)\n\t" "fdc,m %2(%0)\n\t" "fdc,m %2(%0)\n\t" "ldsid (%1),%0\n\t" "mtsp %0,%%sr0\n\t" "copy %1,%0\n\t" "fic,m %2(%%sr0,%0)\n\t" "fic,m %2(%%sr0,%0)\n\t" "fic,m %2(%%sr0,%0)\n\t" "sync\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n\t" "nop\n" : "=&r" ((unsigned long)tmp) : "r" ((unsigned long)tramp & ~31), "r" (32/* stride */) : "memory"); #endif closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/pa/ffitarget.h0000644000175000017500000000451611545150464022355 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for hppa. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, #ifdef PA_LINUX FFI_PA32, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_PA32 #endif #ifdef PA_HPUX FFI_PA32, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_PA32 #endif #ifdef PA64_HPUX #error "PA64_HPUX FFI is not yet implemented" FFI_PA64, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_PA64 #endif } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 #ifdef PA_LINUX #define FFI_TRAMPOLINE_SIZE 32 #else #define FFI_TRAMPOLINE_SIZE 40 #endif #define FFI_TYPE_SMALL_STRUCT2 -1 #define FFI_TYPE_SMALL_STRUCT3 -2 #define FFI_TYPE_SMALL_STRUCT4 -3 #define FFI_TYPE_SMALL_STRUCT5 -4 #define FFI_TYPE_SMALL_STRUCT6 -5 #define FFI_TYPE_SMALL_STRUCT7 -6 #define FFI_TYPE_SMALL_STRUCT8 -7 #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/pa/hpux32.S0000644000175000017500000002201211545150464021475 0ustar chr1schr1s/* ----------------------------------------------------------------------- hpux32.S - Copyright (c) 2006 Free Software Foundation, Inc. (c) 2008 Red Hat, Inc. based on src/pa/linux.S HP-UX PA Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .LEVEL 1.1 .SPACE $PRIVATE$ .IMPORT $global$,DATA .IMPORT $$dyncall,MILLICODE .SUBSPA $DATA$ .align 4 /* void ffi_call_pa32(void (*)(char *, extended_cif *), extended_cif *ecif, unsigned bytes, unsigned flags, unsigned *rvalue, void (*fn)(void)); */ .export ffi_call_pa32,ENTRY,PRIV_LEV=3 .import ffi_prep_args_pa32,CODE .SPACE $TEXT$ .SUBSPA $CODE$ .align 4 L$FB1 ffi_call_pa32 .proc .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4 .entry stw %rp, -20(%sp) copy %r3, %r1 L$CFI11 copy %sp, %r3 L$CFI12 /* Setup the stack for calling prep_args... We want the stack to look like this: [ Previous stack ] <- %r3 [ 64-bytes register save area ] <- %r4 [ Stack space for actual call, passed as ] <- %arg0 [ arg0 to ffi_prep_args_pa32 ] [ Stack for calling prep_args ] <- %sp */ stwm %r1, 64(%sp) stw %r4, 12(%r3) L$CFI13 copy %sp, %r4 addl %arg2, %r4, %arg0 ; arg stack stw %arg3, -48(%r3) ; save flags we need it later /* Call prep_args: %arg0(stack) -- set up above %arg1(ecif) -- same as incoming param %arg2(bytes) -- same as incoming param */ bl ffi_prep_args_pa32,%r2 ldo 64(%arg0), %sp ldo -64(%sp), %sp /* now %sp should point where %arg0 was pointing. */ /* Load the arguments that should be passed in registers The fp args are loaded by the prep_args function. */ ldw -36(%sp), %arg0 ldw -40(%sp), %arg1 ldw -44(%sp), %arg2 ldw -48(%sp), %arg3 /* in case the function is going to return a structure we need to give it a place to put the result. */ ldw -52(%r3), %ret0 ; %ret0 <- rvalue ldw -56(%r3), %r22 ; %r22 <- function to call bl $$dyncall, %r31 ; Call the user function copy %r31, %rp /* Prepare to store the result; we need to recover flags and rvalue. */ ldw -48(%r3), %r21 ; r21 <- flags ldw -52(%r3), %r20 ; r20 <- rvalue /* Store the result according to the return type. The most likely types should come first. */ L$checkint comib,<>,n FFI_TYPE_INT, %r21, L$checkint8 b L$done stw %ret0, 0(%r20) L$checkint8 comib,<>,n FFI_TYPE_UINT8, %r21, L$checkint16 b L$done stb %ret0, 0(%r20) L$checkint16 comib,<>,n FFI_TYPE_UINT16, %r21, L$checkdbl b L$done sth %ret0, 0(%r20) L$checkdbl comib,<>,n FFI_TYPE_DOUBLE, %r21, L$checkfloat b L$done fstd %fr4,0(%r20) L$checkfloat comib,<>,n FFI_TYPE_FLOAT, %r21, L$checkll b L$done fstw %fr4L,0(%r20) L$checkll comib,<>,n FFI_TYPE_UINT64, %r21, L$checksmst2 stw %ret0, 0(%r20) b L$done stw %ret1, 4(%r20) L$checksmst2 comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, L$checksmst3 /* 2-byte structs are returned in ret0 as ????xxyy. */ extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret0, 0(%r20) L$checksmst3 comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, L$checksmst4 /* 3-byte structs are returned in ret0 as ??xxyyzz. */ extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret0, 0(%r20) L$checksmst4 comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, L$checksmst5 /* 4-byte structs are returned in ret0 as wwxxyyzz. */ extru %ret0, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret0, 0(%r20) L$checksmst5 comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, L$checksmst6 /* 5 byte values are returned right justified: ret0 ret1 5: ??????aa bbccddee */ stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret1, 0(%r20) L$checksmst6 comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, L$checksmst7 /* 6 byte values are returned right justified: ret0 ret1 6: ????aabb ccddeeff */ extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret1, 0(%r20) L$checksmst7 comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, L$checksmst8 /* 7 byte values are returned right justified: ret0 ret1 7: ??aabbcc ddeeffgg */ extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b L$done stb %ret1, 0(%r20) L$checksmst8 comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, L$done /* 8 byte values are returned right justified: ret0 ret1 8: aabbccdd eeffgghh */ extru %ret0, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) stb %ret1, 0(%r20) L$done /* all done, return */ copy %r4, %sp ; pop arg stack ldw 12(%r3), %r4 ldwm -64(%sp), %r3 ; .. and pop stack ldw -20(%sp), %rp bv %r0(%rp) nop .exit .procend L$FE1 /* void ffi_closure_pa32(void); Called with closure argument in %r21 */ .SPACE $TEXT$ .SUBSPA $CODE$ .export ffi_closure_pa32,ENTRY,PRIV_LEV=3,RTNVAL=GR .import ffi_closure_inner_pa32,CODE .align 4 L$FB2 ffi_closure_pa32 .proc .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3 .entry stw %rp, -20(%sp) copy %r3, %r1 L$CFI21 copy %sp, %r3 L$CFI22 stwm %r1, 64(%sp) /* Put arguments onto the stack and call ffi_closure_inner. */ stw %arg0, -36(%r3) stw %arg1, -40(%r3) stw %arg2, -44(%r3) stw %arg3, -48(%r3) copy %r21, %arg0 bl ffi_closure_inner_pa32, %r2 copy %r3, %arg1 ldwm -64(%sp), %r3 ldw -20(%sp), %rp ldw -36(%sp), %ret0 bv %r0(%rp) ldw -40(%sp), %ret1 .exit .procend L$FE2: .SPACE $PRIVATE$ .SUBSPA $DATA$ .align 4 .EXPORT _GLOBAL__F_ffi_call_pa32,DATA _GLOBAL__F_ffi_call_pa32 L$frame1: .word L$ECIE1-L$SCIE1 ;# Length of Common Information Entry L$SCIE1: .word 0x0 ;# CIE Identifier Tag .byte 0x1 ;# CIE Version .ascii "\0" ;# CIE Augmentation .uleb128 0x1 ;# CIE Code Alignment Factor .sleb128 4 ;# CIE Data Alignment Factor .byte 0x2 ;# CIE RA Column .byte 0xc ;# DW_CFA_def_cfa .uleb128 0x1e .uleb128 0x0 .align 4 L$ECIE1: L$SFDE1: .word L$EFDE1-L$ASFDE1 ;# FDE Length L$ASFDE1: .word L$ASFDE1-L$frame1 ;# FDE CIE offset .word L$FB1 ;# FDE initial location .word L$FE1-L$FB1 ;# FDE address range .byte 0x4 ;# DW_CFA_advance_loc4 .word L$CFI11-L$FB1 .byte 0x83 ;# DW_CFA_offset, column 0x3 .uleb128 0x0 .byte 0x11 ;# DW_CFA_offset_extended_sf; save r2 at [r30-20] .uleb128 0x2 .sleb128 -5 .byte 0x4 ;# DW_CFA_advance_loc4 .word L$CFI12-L$CFI11 .byte 0xd ;# DW_CFA_def_cfa_register = r3 .uleb128 0x3 .byte 0x4 ;# DW_CFA_advance_loc4 .word L$CFI13-L$CFI12 .byte 0x84 ;# DW_CFA_offset, column 0x4 .uleb128 0x3 .align 4 L$EFDE1: L$SFDE2: .word L$EFDE2-L$ASFDE2 ;# FDE Length L$ASFDE2: .word L$ASFDE2-L$frame1 ;# FDE CIE offset .word L$FB2 ;# FDE initial location .word L$FE2-L$FB2 ;# FDE address range .byte 0x4 ;# DW_CFA_advance_loc4 .word L$CFI21-L$FB2 .byte 0x83 ;# DW_CFA_offset, column 0x3 .uleb128 0x0 .byte 0x11 ;# DW_CFA_offset_extended_sf .uleb128 0x2 .sleb128 -5 .byte 0x4 ;# DW_CFA_advance_loc4 .word L$CFI22-L$CFI21 .byte 0xd ;# DW_CFA_def_cfa_register = r3 .uleb128 0x3 .align 4 L$EFDE2: mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/pa/linux.S0000644000175000017500000002174311545150464021515 0ustar chr1schr1s/* ----------------------------------------------------------------------- linux.S - (c) 2003-2004 Randolph Chung (c) 2008 Red Hat, Inc. HPPA Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .text .level 1.1 .align 4 /* void ffi_call_pa32(void (*)(char *, extended_cif *), extended_cif *ecif, unsigned bytes, unsigned flags, unsigned *rvalue, void (*fn)(void)); */ .export ffi_call_pa32,code .import ffi_prep_args_pa32,code .type ffi_call_pa32, @function .LFB1: ffi_call_pa32: .proc .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4 .entry stw %rp, -20(%sp) copy %r3, %r1 .LCFI11: copy %sp, %r3 .LCFI12: /* Setup the stack for calling prep_args... We want the stack to look like this: [ Previous stack ] <- %r3 [ 64-bytes register save area ] <- %r4 [ Stack space for actual call, passed as ] <- %arg0 [ arg0 to ffi_prep_args_pa32 ] [ Stack for calling prep_args ] <- %sp */ stwm %r1, 64(%sp) stw %r4, 12(%r3) .LCFI13: copy %sp, %r4 addl %arg2, %r4, %arg0 /* arg stack */ stw %arg3, -48(%r3) /* save flags; we need it later */ /* Call prep_args: %arg0(stack) -- set up above %arg1(ecif) -- same as incoming param %arg2(bytes) -- same as incoming param */ bl ffi_prep_args_pa32,%r2 ldo 64(%arg0), %sp ldo -64(%sp), %sp /* now %sp should point where %arg0 was pointing. */ /* Load the arguments that should be passed in registers The fp args were loaded by the prep_args function. */ ldw -36(%sp), %arg0 ldw -40(%sp), %arg1 ldw -44(%sp), %arg2 ldw -48(%sp), %arg3 /* in case the function is going to return a structure we need to give it a place to put the result. */ ldw -52(%r3), %ret0 /* %ret0 <- rvalue */ ldw -56(%r3), %r22 /* %r22 <- function to call */ bl $$dyncall, %r31 /* Call the user function */ copy %r31, %rp /* Prepare to store the result; we need to recover flags and rvalue. */ ldw -48(%r3), %r21 /* r21 <- flags */ ldw -52(%r3), %r20 /* r20 <- rvalue */ /* Store the result according to the return type. */ .Lcheckint: comib,<>,n FFI_TYPE_INT, %r21, .Lcheckint8 b .Ldone stw %ret0, 0(%r20) .Lcheckint8: comib,<>,n FFI_TYPE_UINT8, %r21, .Lcheckint16 b .Ldone stb %ret0, 0(%r20) .Lcheckint16: comib,<>,n FFI_TYPE_UINT16, %r21, .Lcheckdbl b .Ldone sth %ret0, 0(%r20) .Lcheckdbl: comib,<>,n FFI_TYPE_DOUBLE, %r21, .Lcheckfloat b .Ldone fstd %fr4,0(%r20) .Lcheckfloat: comib,<>,n FFI_TYPE_FLOAT, %r21, .Lcheckll b .Ldone fstw %fr4L,0(%r20) .Lcheckll: comib,<>,n FFI_TYPE_UINT64, %r21, .Lchecksmst2 stw %ret0, 0(%r20) b .Ldone stw %ret1, 4(%r20) .Lchecksmst2: comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, .Lchecksmst3 /* 2-byte structs are returned in ret0 as ????xxyy. */ extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret0, 0(%r20) .Lchecksmst3: comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, .Lchecksmst4 /* 3-byte structs are returned in ret0 as ??xxyyzz. */ extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret0, 0(%r20) .Lchecksmst4: comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, .Lchecksmst5 /* 4-byte structs are returned in ret0 as wwxxyyzz. */ extru %ret0, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret0, 0(%r20) .Lchecksmst5: comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, .Lchecksmst6 /* 5 byte values are returned right justified: ret0 ret1 5: ??????aa bbccddee */ stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret1, 0(%r20) .Lchecksmst6: comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, .Lchecksmst7 /* 6 byte values are returned right justified: ret0 ret1 6: ????aabb ccddeeff */ extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret1, 0(%r20) .Lchecksmst7: comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, .Lchecksmst8 /* 7 byte values are returned right justified: ret0 ret1 7: ??aabbcc ddeeffgg */ extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) b .Ldone stb %ret1, 0(%r20) .Lchecksmst8: comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, .Ldone /* 8 byte values are returned right justified: ret0 ret1 8: aabbccdd eeffgghh */ extru %ret0, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret0, 23, 8, %r22 stbs,ma %r22, 1(%r20) stbs,ma %ret0, 1(%r20) extru %ret1, 7, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 15, 8, %r22 stbs,ma %r22, 1(%r20) extru %ret1, 23, 8, %r22 stbs,ma %r22, 1(%r20) stb %ret1, 0(%r20) .Ldone: /* all done, return */ copy %r4, %sp /* pop arg stack */ ldw 12(%r3), %r4 ldwm -64(%sp), %r3 /* .. and pop stack */ ldw -20(%sp), %rp bv %r0(%rp) nop .exit .procend .LFE1: /* void ffi_closure_pa32(void); Called with closure argument in %r21 */ .export ffi_closure_pa32,code .import ffi_closure_inner_pa32,code .type ffi_closure_pa32, @function .LFB2: ffi_closure_pa32: .proc .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3 .entry stw %rp, -20(%sp) .LCFI20: copy %r3, %r1 .LCFI21: copy %sp, %r3 .LCFI22: stwm %r1, 64(%sp) /* Put arguments onto the stack and call ffi_closure_inner. */ stw %arg0, -36(%r3) stw %arg1, -40(%r3) stw %arg2, -44(%r3) stw %arg3, -48(%r3) copy %r21, %arg0 bl ffi_closure_inner_pa32, %r2 copy %r3, %arg1 ldwm -64(%sp), %r3 ldw -20(%sp), %rp ldw -36(%sp), %ret0 bv %r0(%r2) ldw -40(%sp), %ret1 .exit .procend .LFE2: .section ".eh_frame",EH_FRAME_FLAGS,@progbits .Lframe1: .word .LECIE1-.LSCIE1 ;# Length of Common Information Entry .LSCIE1: .word 0x0 ;# CIE Identifier Tag .byte 0x1 ;# CIE Version .ascii "\0" ;# CIE Augmentation .uleb128 0x1 ;# CIE Code Alignment Factor .sleb128 4 ;# CIE Data Alignment Factor .byte 0x2 ;# CIE RA Column .byte 0xc ;# DW_CFA_def_cfa .uleb128 0x1e .uleb128 0x0 .align 4 .LECIE1: .LSFDE1: .word .LEFDE1-.LASFDE1 ;# FDE Length .LASFDE1: .word .LASFDE1-.Lframe1 ;# FDE CIE offset .word .LFB1 ;# FDE initial location .word .LFE1-.LFB1 ;# FDE address range .byte 0x4 ;# DW_CFA_advance_loc4 .word .LCFI11-.LFB1 .byte 0x83 ;# DW_CFA_offset, column 0x3 .uleb128 0x0 .byte 0x11 ;# DW_CFA_offset_extended_sf; save r2 at [r30-20] .uleb128 0x2 .sleb128 -5 .byte 0x4 ;# DW_CFA_advance_loc4 .word .LCFI12-.LCFI11 .byte 0xd ;# DW_CFA_def_cfa_register = r3 .uleb128 0x3 .byte 0x4 ;# DW_CFA_advance_loc4 .word .LCFI13-.LCFI12 .byte 0x84 ;# DW_CFA_offset, column 0x4 .uleb128 0x3 .align 4 .LEFDE1: .LSFDE2: .word .LEFDE2-.LASFDE2 ;# FDE Length .LASFDE2: .word .LASFDE2-.Lframe1 ;# FDE CIE offset .word .LFB2 ;# FDE initial location .word .LFE2-.LFB2 ;# FDE address range .byte 0x4 ;# DW_CFA_advance_loc4 .word .LCFI21-.LFB2 .byte 0x83 ;# DW_CFA_offset, column 0x3 .uleb128 0x0 .byte 0x11 ;# DW_CFA_offset_extended_sf .uleb128 0x2 .sleb128 -5 .byte 0x4 ;# DW_CFA_advance_loc4 .word .LCFI22-.LCFI21 .byte 0xd ;# DW_CFA_def_cfa_register = r3 .uleb128 0x3 .align 4 .LEFDE2: mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/aix.S0000644000175000017500000001475311545150464022221 0ustar chr1schr1s/* ----------------------------------------------------------------------- aix.S - Copyright (c) 2002,2009 Free Software Foundation, Inc. based on darwin.S by John Hornkvist PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ .set r0,0 .set r1,1 .set r2,2 .set r3,3 .set r4,4 .set r5,5 .set r6,6 .set r7,7 .set r8,8 .set r9,9 .set r10,10 .set r11,11 .set r12,12 .set r13,13 .set r14,14 .set r15,15 .set r16,16 .set r17,17 .set r18,18 .set r19,19 .set r20,20 .set r21,21 .set r22,22 .set r23,23 .set r24,24 .set r25,25 .set r26,26 .set r27,27 .set r28,28 .set r29,29 .set r30,30 .set r31,31 .set f0,0 .set f1,1 .set f2,2 .set f3,3 .set f4,4 .set f5,5 .set f6,6 .set f7,7 .set f8,8 .set f9,9 .set f10,10 .set f11,11 .set f12,12 .set f13,13 .set f14,14 .set f15,15 .set f16,16 .set f17,17 .set f18,18 .set f19,19 .set f20,20 .set f21,21 #define LIBFFI_ASM #include #include #define JUMPTARGET(name) name #define L(x) x .file "aix.S" .toc /* void ffi_call_AIX(extended_cif *ecif, unsigned long bytes, * unsigned int flags, unsigned int *rvalue, * void (*fn)(), * void (*prep_args)(extended_cif*, unsigned *const)); * r3=ecif, r4=bytes, r5=flags, r6=rvalue, r7=fn, r8=prep_args */ .csect .text[PR] .align 2 .globl ffi_call_AIX .globl .ffi_call_AIX .csect ffi_call_AIX[DS] ffi_call_AIX: #ifdef __64BIT__ .llong .ffi_call_AIX, TOC[tc0], 0 .csect .text[PR] .ffi_call_AIX: /* Save registers we use. */ mflr r0 std r28,-32(r1) std r29,-24(r1) std r30,-16(r1) std r31, -8(r1) std r0, 16(r1) mr r28, r1 /* our AP. */ stdux r1, r1, r4 /* Save arguments over call... */ mr r31, r5 /* flags, */ mr r30, r6 /* rvalue, */ mr r29, r7 /* function address. */ std r2, 40(r1) /* Call ffi_prep_args. */ mr r4, r1 bl .ffi_prep_args /* Now do the call. */ ld r0, 0(r29) ld r2, 8(r29) ld r11, 16(r29) /* Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40, r31 mtctr r0 /* Load all those argument registers. */ // We have set up a nice stack frame, just load it into registers. ld r3, 40+(1*8)(r1) ld r4, 40+(2*8)(r1) ld r5, 40+(3*8)(r1) ld r6, 40+(4*8)(r1) nop ld r7, 40+(5*8)(r1) ld r8, 40+(6*8)(r1) ld r9, 40+(7*8)(r1) ld r10,40+(8*8)(r1) L1: /* Load all the FP registers. */ bf 6,L2 // 2f + 0x18 lfd f1,-32-(13*8)(r28) lfd f2,-32-(12*8)(r28) lfd f3,-32-(11*8)(r28) lfd f4,-32-(10*8)(r28) nop lfd f5,-32-(9*8)(r28) lfd f6,-32-(8*8)(r28) lfd f7,-32-(7*8)(r28) lfd f8,-32-(6*8)(r28) nop lfd f9,-32-(5*8)(r28) lfd f10,-32-(4*8)(r28) lfd f11,-32-(3*8)(r28) lfd f12,-32-(2*8)(r28) nop lfd f13,-32-(1*8)(r28) L2: /* Make the call. */ bctrl ld r2, 40(r1) /* Now, deal with the return value. */ mtcrf 0x01, r31 bt 30, L(done_return_value) bt 29, L(fp_return_value) std r3, 0(r30) /* Fall through... */ L(done_return_value): /* Restore the registers we used and return. */ mr r1, r28 ld r0, 16(r28) ld r28, -32(r1) mtlr r0 ld r29, -24(r1) ld r30, -16(r1) ld r31, -8(r1) blr L(fp_return_value): bf 28, L(float_return_value) stfd f1, 0(r30) bf 31, L(done_return_value) stfd f2, 8(r30) b L(done_return_value) L(float_return_value): stfs f1, 0(r30) b L(done_return_value) #else /* ! __64BIT__ */ .long .ffi_call_AIX, TOC[tc0], 0 .csect .text[PR] .ffi_call_AIX: /* Save registers we use. */ mflr r0 stw r28,-16(r1) stw r29,-12(r1) stw r30, -8(r1) stw r31, -4(r1) stw r0, 8(r1) mr r28, r1 /* out AP. */ stwux r1, r1, r4 /* Save arguments over call... */ mr r31, r5 /* flags, */ mr r30, r6 /* rvalue, */ mr r29, r7 /* function address, */ stw r2, 20(r1) /* Call ffi_prep_args. */ mr r4, r1 bl .ffi_prep_args /* Now do the call. */ lwz r0, 0(r29) lwz r2, 4(r29) lwz r11, 8(r29) /* Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40, r31 mtctr r0 /* Load all those argument registers. */ // We have set up a nice stack frame, just load it into registers. lwz r3, 20+(1*4)(r1) lwz r4, 20+(2*4)(r1) lwz r5, 20+(3*4)(r1) lwz r6, 20+(4*4)(r1) nop lwz r7, 20+(5*4)(r1) lwz r8, 20+(6*4)(r1) lwz r9, 20+(7*4)(r1) lwz r10,20+(8*4)(r1) L1: /* Load all the FP registers. */ bf 6,L2 // 2f + 0x18 lfd f1,-16-(13*8)(r28) lfd f2,-16-(12*8)(r28) lfd f3,-16-(11*8)(r28) lfd f4,-16-(10*8)(r28) nop lfd f5,-16-(9*8)(r28) lfd f6,-16-(8*8)(r28) lfd f7,-16-(7*8)(r28) lfd f8,-16-(6*8)(r28) nop lfd f9,-16-(5*8)(r28) lfd f10,-16-(4*8)(r28) lfd f11,-16-(3*8)(r28) lfd f12,-16-(2*8)(r28) nop lfd f13,-16-(1*8)(r28) L2: /* Make the call. */ bctrl lwz r2, 20(r1) /* Now, deal with the return value. */ mtcrf 0x01, r31 bt 30, L(done_return_value) bt 29, L(fp_return_value) stw r3, 0(r30) bf 28, L(done_return_value) stw r4, 4(r30) /* Fall through... */ L(done_return_value): /* Restore the registers we used and return. */ mr r1, r28 lwz r0, 8(r28) lwz r28,-16(r1) mtlr r0 lwz r29,-12(r1) lwz r30, -8(r1) lwz r31, -4(r1) blr L(fp_return_value): bf 28, L(float_return_value) stfd f1, 0(r30) b L(done_return_value) L(float_return_value): stfs f1, 0(r30) b L(done_return_value) #endif .long 0 .byte 0,0,0,1,128,4,0,0 //END(ffi_call_AIX) .csect .text[PR] .align 2 .globl ffi_call_DARWIN .globl .ffi_call_DARWIN .csect ffi_call_DARWIN[DS] ffi_call_DARWIN: #ifdef __64BIT__ .llong .ffi_call_DARWIN, TOC[tc0], 0 #else .long .ffi_call_DARWIN, TOC[tc0], 0 #endif .csect .text[PR] .ffi_call_DARWIN: blr .long 0 .byte 0,0,0,0,0,0,0,0 //END(ffi_call_DARWIN) mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/aix_closure.S0000644000175000017500000002143111545150464023744 0ustar chr1schr1s/* ----------------------------------------------------------------------- aix_closure.S - Copyright (c) 2002, 2003, 2009 Free Software Foundation, Inc. based on darwin_closure.S PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ .set r0,0 .set r1,1 .set r2,2 .set r3,3 .set r4,4 .set r5,5 .set r6,6 .set r7,7 .set r8,8 .set r9,9 .set r10,10 .set r11,11 .set r12,12 .set r13,13 .set r14,14 .set r15,15 .set r16,16 .set r17,17 .set r18,18 .set r19,19 .set r20,20 .set r21,21 .set r22,22 .set r23,23 .set r24,24 .set r25,25 .set r26,26 .set r27,27 .set r28,28 .set r29,29 .set r30,30 .set r31,31 .set f0,0 .set f1,1 .set f2,2 .set f3,3 .set f4,4 .set f5,5 .set f6,6 .set f7,7 .set f8,8 .set f9,9 .set f10,10 .set f11,11 .set f12,12 .set f13,13 .set f14,14 .set f15,15 .set f16,16 .set f17,17 .set f18,18 .set f19,19 .set f20,20 .set f21,21 #define LIBFFI_ASM #define JUMPTARGET(name) name #define L(x) x .file "aix_closure.S" .toc LC..60: .tc L..60[TC],L..60 .csect .text[PR] .align 2 .csect .text[PR] .align 2 .globl ffi_closure_ASM .globl .ffi_closure_ASM .csect ffi_closure_ASM[DS] ffi_closure_ASM: #ifdef __64BIT__ .llong .ffi_closure_ASM, TOC[tc0], 0 .csect .text[PR] .ffi_closure_ASM: /* we want to build up an area for the parameters passed */ /* in registers (both floating point and integer) */ /* we store gpr 3 to gpr 10 (aligned to 4) in the parents outgoing area */ std r3, 48+(0*8)(r1) std r4, 48+(1*8)(r1) std r5, 48+(2*8)(r1) std r6, 48+(3*8)(r1) mflr r0 std r7, 48+(4*8)(r1) std r8, 48+(5*8)(r1) std r9, 48+(6*8)(r1) std r10, 48+(7*8)(r1) std r0, 16(r1) /* save the return address */ /* 48 Bytes (Linkage Area) */ /* 64 Bytes (params) */ /* 16 Bytes (result) */ /* 104 Bytes (13*8 from FPR) */ /* 8 Bytes (alignment) */ /* 240 Bytes */ stdu r1, -240(r1) /* skip over caller save area keep stack aligned to 16 */ /* next save fpr 1 to fpr 13 (aligned to 8) */ stfd f1, 128+(0*8)(r1) stfd f2, 128+(1*8)(r1) stfd f3, 128+(2*8)(r1) stfd f4, 128+(3*8)(r1) stfd f5, 128+(4*8)(r1) stfd f6, 128+(5*8)(r1) stfd f7, 128+(6*8)(r1) stfd f8, 128+(7*8)(r1) stfd f9, 128+(8*8)(r1) stfd f10, 128+(9*8)(r1) stfd f11, 128+(10*8)(r1) stfd f12, 128+(11*8)(r1) stfd f13, 128+(12*8)(r1) /* set up registers for the routine that actually does the work */ /* get the context pointer from the trampoline */ mr r3, r11 /* now load up the pointer to the result storage */ addi r4, r1, 112 /* now load up the pointer to the saved gpr registers */ addi r5, r1, 288 /* now load up the pointer to the saved fpr registers */ addi r6, r1, 128 /* make the call */ bl .ffi_closure_helper_DARWIN nop /* now r3 contains the return type */ /* so use it to look up in a table */ /* so we know how to deal with each type */ /* look up the proper starting point in table */ /* by using return type as offset */ ld r4, LC..60(2) /* get address of jump table */ sldi r3, r3, 4 /* now multiply return type by 16 */ ld r0, 240+16(r1) /* load return address */ add r3, r3, r4 /* add contents of table to table address */ mtctr r3 bctr /* jump to it */ /* Each fragment must be exactly 16 bytes long (4 instructions). Align to 16 byte boundary for cache and dispatch efficiency. */ .align 4 L..60: /* case FFI_TYPE_VOID */ mtlr r0 addi r1, r1, 240 blr nop /* case FFI_TYPE_INT */ lwa r3, 112+4(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_FLOAT */ lfs f1, 112+0(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_DOUBLE */ lfd f1, 112+0(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_LONGDOUBLE */ lfd f1, 112+0(r1) mtlr r0 lfd f2, 112+8(r1) b L..finish /* case FFI_TYPE_UINT8 */ lbz r3, 112+7(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_SINT8 */ lbz r3, 112+7(r1) mtlr r0 extsb r3, r3 b L..finish /* case FFI_TYPE_UINT16 */ lhz r3, 112+6(r1) mtlr r0 L..finish: addi r1, r1, 240 blr /* case FFI_TYPE_SINT16 */ lha r3, 112+6(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_UINT32 */ lwz r3, 112+4(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_SINT32 */ lwa r3, 112+4(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_UINT64 */ ld r3, 112+0(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_SINT64 */ ld r3, 112+0(r1) mtlr r0 addi r1, r1, 240 blr /* case FFI_TYPE_STRUCT */ mtlr r0 addi r1, r1, 240 blr nop /* case FFI_TYPE_POINTER */ ld r3, 112+0(r1) mtlr r0 addi r1, r1, 240 blr #else /* ! __64BIT__ */ .long .ffi_closure_ASM, TOC[tc0], 0 .csect .text[PR] .ffi_closure_ASM: /* we want to build up an area for the parameters passed */ /* in registers (both floating point and integer) */ /* we store gpr 3 to gpr 10 (aligned to 4) in the parents outgoing area */ stw r3, 24+(0*4)(r1) stw r4, 24+(1*4)(r1) stw r5, 24+(2*4)(r1) stw r6, 24+(3*4)(r1) mflr r0 stw r7, 24+(4*4)(r1) stw r8, 24+(5*4)(r1) stw r9, 24+(6*4)(r1) stw r10, 24+(7*4)(r1) stw r0, 8(r1) /* 24 Bytes (Linkage Area) */ /* 32 Bytes (params) */ /* 16 Bytes (result) */ /* 104 Bytes (13*8 from FPR) */ /* 176 Bytes */ stwu r1, -176(r1) /* skip over caller save area keep stack aligned to 16 */ /* next save fpr 1 to fpr 13 (aligned to 8) */ stfd f1, 72+(0*8)(r1) stfd f2, 72+(1*8)(r1) stfd f3, 72+(2*8)(r1) stfd f4, 72+(3*8)(r1) stfd f5, 72+(4*8)(r1) stfd f6, 72+(5*8)(r1) stfd f7, 72+(6*8)(r1) stfd f8, 72+(7*8)(r1) stfd f9, 72+(8*8)(r1) stfd f10, 72+(9*8)(r1) stfd f11, 72+(10*8)(r1) stfd f12, 72+(11*8)(r1) stfd f13, 72+(12*8)(r1) /* set up registers for the routine that actually does the work */ /* get the context pointer from the trampoline */ mr r3, r11 /* now load up the pointer to the result storage */ addi r4, r1, 56 /* now load up the pointer to the saved gpr registers */ addi r5, r1, 200 /* now load up the pointer to the saved fpr registers */ addi r6, r1, 72 /* make the call */ bl .ffi_closure_helper_DARWIN nop /* now r3 contains the return type */ /* so use it to look up in a table */ /* so we know how to deal with each type */ /* look up the proper starting point in table */ /* by using return type as offset */ lwz r4, LC..60(2) /* get address of jump table */ slwi r3, r3, 4 /* now multiply return type by 4 */ lwz r0, 176+8(r1) /* load return address */ add r3, r3, r4 /* add contents of table to table address */ mtctr r3 bctr /* jump to it */ /* Each fragment must be exactly 16 bytes long (4 instructions). Align to 16 byte boundary for cache and dispatch efficiency. */ .align 4 L..60: /* case FFI_TYPE_VOID */ mtlr r0 addi r1, r1, 176 blr nop /* case FFI_TYPE_INT */ lwz r3, 56+0(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_FLOAT */ lfs f1, 56+0(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_DOUBLE */ lfd f1, 56+0(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_LONGDOUBLE */ lfd f1, 56+0(r1) mtlr r0 lfd f2, 56+8(r1) b L..finish /* case FFI_TYPE_UINT8 */ lbz r3, 56+3(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_SINT8 */ lbz r3, 56+3(r1) mtlr r0 extsb r3, r3 b L..finish /* case FFI_TYPE_UINT16 */ lhz r3, 56+2(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_SINT16 */ lha r3, 56+2(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_UINT32 */ lwz r3, 56+0(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_SINT32 */ lwz r3, 56+0(r1) mtlr r0 addi r1, r1, 176 blr /* case FFI_TYPE_UINT64 */ lwz r3, 56+0(r1) mtlr r0 lwz r4, 56+4(r1) b L..finish /* case FFI_TYPE_SINT64 */ lwz r3, 56+0(r1) mtlr r0 lwz r4, 56+4(r1) b L..finish /* case FFI_TYPE_STRUCT */ mtlr r0 addi r1, r1, 176 blr nop /* case FFI_TYPE_POINTER */ lwz r3, 56+0(r1) mtlr r0 L..finish: addi r1, r1, 176 blr #endif /* END(ffi_closure_ASM) */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/asm.h0000644000175000017500000001032611545150464022235 0ustar chr1schr1s/* ----------------------------------------------------------------------- asm.h - Copyright (c) 1998 Geoffrey Keating PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define ASM_GLOBAL_DIRECTIVE .globl #define C_SYMBOL_NAME(name) name /* Macro for a label. */ #ifdef __STDC__ #define C_LABEL(name) name##: #else #define C_LABEL(name) name/**/: #endif /* This seems to always be the case on PPC. */ #define ALIGNARG(log2) log2 /* For ELF we need the `.type' directive to make shared libs work right. */ #define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg; #define ASM_SIZE_DIRECTIVE(name) .size name,.-name /* If compiled for profiling, call `_mcount' at the start of each function. */ #ifdef PROF /* The mcount code relies on a the return address being on the stack to locate our caller and so it can restore it; so store one just for its benefit. */ #ifdef PIC #define CALL_MCOUNT \ .pushsection; \ .section ".data"; \ .align ALIGNARG(2); \ 0:.long 0; \ .previous; \ mflr %r0; \ stw %r0,4(%r1); \ bl _GLOBAL_OFFSET_TABLE_@local-4; \ mflr %r11; \ lwz %r0,0b@got(%r11); \ bl JUMPTARGET(_mcount); #else /* PIC */ #define CALL_MCOUNT \ .section ".data"; \ .align ALIGNARG(2); \ 0:.long 0; \ .previous; \ mflr %r0; \ lis %r11,0b@ha; \ stw %r0,4(%r1); \ addi %r0,%r11,0b@l; \ bl JUMPTARGET(_mcount); #endif /* PIC */ #else /* PROF */ #define CALL_MCOUNT /* Do nothing. */ #endif /* PROF */ #define ENTRY(name) \ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ .align ALIGNARG(2); \ C_LABEL(name) \ CALL_MCOUNT #define EALIGN_W_0 /* No words to insert. */ #define EALIGN_W_1 nop #define EALIGN_W_2 nop;nop #define EALIGN_W_3 nop;nop;nop #define EALIGN_W_4 EALIGN_W_3;nop #define EALIGN_W_5 EALIGN_W_4;nop #define EALIGN_W_6 EALIGN_W_5;nop #define EALIGN_W_7 EALIGN_W_6;nop /* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes past a 2^align boundary. */ #ifdef PROF #define EALIGN(name, alignt, words) \ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ .align ALIGNARG(2); \ C_LABEL(name) \ CALL_MCOUNT \ b 0f; \ .align ALIGNARG(alignt); \ EALIGN_W_##words; \ 0: #else /* PROF */ #define EALIGN(name, alignt, words) \ ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ .align ALIGNARG(alignt); \ EALIGN_W_##words; \ C_LABEL(name) #endif #define END(name) \ ASM_SIZE_DIRECTIVE(name) #ifdef PIC #define JUMPTARGET(name) name##@plt #else #define JUMPTARGET(name) name #endif /* Local labels stripped out by the linker. */ #define L(x) .L##x mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/darwin.S0000644000175000017500000001373011545150464022716 0ustar chr1schr1s/* ----------------------------------------------------------------------- darwin.S - Copyright (c) 2000 John Hornkvist Copyright (c) 2004 Free Software Foundation, Inc. PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #if defined(__ppc64__) #define MODE_CHOICE(x, y) y #else #define MODE_CHOICE(x, y) x #endif #define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ #define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ #define LIBFFI_ASM #include #include #define JUMPTARGET(name) name #define L(x) x .text .align 2 .globl _ffi_prep_args .text .align 2 .globl _ffi_call_DARWIN .text .align 2 _ffi_call_DARWIN: LFB0: mr r12,r8 /* We only need r12 until the call, so it doesn't have to be saved. */ LFB1: /* Save the old stack pointer as AP. */ mr r8,r1 LCFI0: /* Allocate the stack space we need. */ stwux r1,r1,r4 /* Save registers we use. */ mflr r9 stw r28,-16(r8) stw r29,-12(r8) stw r30,-8(r8) stw r31,-4(r8) stw r9,8(r8) stw r2,20(r1) LCFI1: /* Save arguments over call. */ mr r31,r5 /* flags, */ mr r30,r6 /* rvalue, */ mr r29,r7 /* function address, */ mr r28,r8 /* our AP. */ LCFI2: /* Call ffi_prep_args. */ mr r4,r1 li r9,0 mtctr r12 /* r12 holds address of _ffi_prep_args. */ bctrl lwz r2,20(r1) /* Now do the call. Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40,r31 /* Get the address to call into CTR. */ mtctr r29 /* Load all those argument registers. We have set up a nice stack frame, just load it into registers. */ lwz r3,20+(1*4)(r1) lwz r4,20+(2*4)(r1) lwz r5,20+(3*4)(r1) lwz r6,20+(4*4)(r1) nop lwz r7,20+(5*4)(r1) lwz r8,20+(6*4)(r1) lwz r9,20+(7*4)(r1) lwz r10,20+(8*4)(r1) L1: /* Load all the FP registers. */ bf 6,L2 /* No floats to load. */ lfd f1,-16-(13*8)(r28) lfd f2,-16-(12*8)(r28) lfd f3,-16-(11*8)(r28) lfd f4,-16-(10*8)(r28) nop lfd f5,-16-(9*8)(r28) lfd f6,-16-(8*8)(r28) lfd f7,-16-(7*8)(r28) lfd f8,-16-(6*8)(r28) nop lfd f9,-16-(5*8)(r28) lfd f10,-16-(4*8)(r28) lfd f11,-16-(3*8)(r28) lfd f12,-16-(2*8)(r28) nop lfd f13,-16-(1*8)(r28) L2: mr r12,r29 /* Put the target address in r12 as specified. */ mtctr r12 nop nop /* Make the call. */ bctrl /* Now, deal with the return value. */ mtcrf 0x01,r31 bt 30,L(done_return_value) bt 29,L(fp_return_value) stw r3,0(r30) bf 28,L(done_return_value) stw r4,4(r30) /* Fall through. */ L(done_return_value): /* Restore the registers we used and return. */ lwz r9,8(r28) lwz r31,-4(r28) mtlr r9 lwz r30,-8(r28) lwz r29,-12(r28) lwz r28,-16(r28) lwz r1,0(r1) blr L(fp_return_value): /* Do we have long double to store? */ bf 31,L(fd_return_value) stfd f1,0(r30) stfd f2,8(r30) b L(done_return_value) L(fd_return_value): /* Do we have double to store? */ bf 28,L(float_return_value) stfd f1,0(r30) b L(done_return_value) L(float_return_value): /* We only have a float to store. */ stfs f1,0(r30) b L(done_return_value) LFE1: /* END(_ffi_call_DARWIN) */ /* Provide a null definition of _ffi_call_AIX. */ .text .align 2 .globl _ffi_call_AIX .text .align 2 _ffi_call_AIX: blr /* END(_ffi_call_AIX) */ .data .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms EH_frame1: .set L$set$0,LECIE1-LSCIE1 .long L$set$0 ; Length of Common Information Entry LSCIE1: .long 0x0 ; CIE Identifier Tag .byte 0x1 ; CIE Version .ascii "zR\0" ; CIE Augmentation .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor .byte 0x41 ; CIE RA Column .byte 0x1 ; uleb128 0x1; Augmentation size .byte 0x90 ; FDE Encoding (indirect pcrel) .byte 0xc ; DW_CFA_def_cfa .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 .align LOG2_GPR_BYTES LECIE1: .globl _ffi_call_DARWIN.eh _ffi_call_DARWIN.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 .long L$set$1 ; FDE Length LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset .g_long LLFB0$non_lazy_ptr-. ; FDE initial location .set L$set$3,LFE1-LFB0 .g_long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$4,LCFI0-LFB1 .long L$set$4 .byte 0xd ; DW_CFA_def_cfa_register .byte 0x08 ; uleb128 0x08 .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$5,LCFI1-LCFI0 .long L$set$5 .byte 0x11 ; DW_CFA_offset_extended_sf .byte 0x41 ; uleb128 0x41 .byte 0x7e ; sleb128 -2 .byte 0x9f ; DW_CFA_offset, column 0x1f .byte 0x1 ; uleb128 0x1 .byte 0x9e ; DW_CFA_offset, column 0x1e .byte 0x2 ; uleb128 0x2 .byte 0x9d ; DW_CFA_offset, column 0x1d .byte 0x3 ; uleb128 0x3 .byte 0x9c ; DW_CFA_offset, column 0x1c .byte 0x4 ; uleb128 0x4 .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$6,LCFI2-LCFI1 .long L$set$6 .byte 0xd ; DW_CFA_def_cfa_register .byte 0x1c ; uleb128 0x1c .align LOG2_GPR_BYTES LEFDE1: .data .align LOG2_GPR_BYTES LLFB0$non_lazy_ptr: .g_long LFB0 mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/darwin_closure.S0000644000175000017500000001611311545150464024450 0ustar chr1schr1s/* ----------------------------------------------------------------------- darwin_closure.S - Copyright (c) 2002, 2003, 2004, Free Software Foundation, Inc. based on ppc_closure.S PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #define L(x) x #if defined(__ppc64__) #define MODE_CHOICE(x, y) y #else #define MODE_CHOICE(x, y) x #endif #define lgu MODE_CHOICE(lwzu, ldu) #define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ #define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ .file "darwin_closure.S" .text .align LOG2_GPR_BYTES .globl _ffi_closure_ASM .text .align LOG2_GPR_BYTES _ffi_closure_ASM: LFB1: mflr r0 /* extract return address */ stw r0,8(r1) /* save the return address */ LCFI0: /* 24 Bytes (Linkage Area) 32 Bytes (outgoing parameter area, always reserved) 104 Bytes (13*8 from FPR) 16 Bytes (result) 176 Bytes */ stwu r1,-176(r1) /* skip over caller save area keep stack aligned to 16. */ LCFI1: /* We want to build up an area for the parameters passed in registers. (both floating point and integer) */ /* We store gpr 3 to gpr 10 (aligned to 4) in the parents outgoing area. */ stw r3,200(r1) stw r4,204(r1) stw r5,208(r1) stw r6,212(r1) stw r7,216(r1) stw r8,220(r1) stw r9,224(r1) stw r10,228(r1) /* We save fpr 1 to fpr 13. (aligned to 8) */ stfd f1,56(r1) stfd f2,64(r1) stfd f3,72(r1) stfd f4,80(r1) stfd f5,88(r1) stfd f6,96(r1) stfd f7,104(r1) stfd f8,112(r1) stfd f9,120(r1) stfd f10,128(r1) stfd f11,136(r1) stfd f12,144(r1) stfd f13,152(r1) /* Set up registers for the routine that actually does the work get the context pointer from the trampoline. */ mr r3,r11 /* Now load up the pointer to the result storage. */ addi r4,r1,160 /* Now load up the pointer to the saved gpr registers. */ addi r5,r1,200 /* Now load up the pointer to the saved fpr registers. */ addi r6,r1,56 /* Make the call. */ bl Lffi_closure_helper_DARWIN$stub /* Now r3 contains the return type so use it to look up in a table so we know how to deal with each type. */ /* Look up the proper starting point in table by using return type as offset. */ addi r5,r1,160 /* Get pointer to results area. */ bl Lget_ret_type0_addr /* Get pointer to Lret_type0 into LR. */ mflr r4 /* Move to r4. */ slwi r3,r3,4 /* Now multiply return type by 16. */ add r3,r3,r4 /* Add contents of table to table address. */ mtctr r3 bctr /* Jump to it. */ LFE1: /* Each of the ret_typeX code fragments has to be exactly 16 bytes long (4 instructions). For cache effectiveness we align to a 16 byte boundary first. */ .align 4 nop nop nop Lget_ret_type0_addr: blrl /* case FFI_TYPE_VOID */ Lret_type0: b Lfinish nop nop nop /* case FFI_TYPE_INT */ Lret_type1: lwz r3,0(r5) b Lfinish nop nop /* case FFI_TYPE_FLOAT */ Lret_type2: lfs f1,0(r5) b Lfinish nop nop /* case FFI_TYPE_DOUBLE */ Lret_type3: lfd f1,0(r5) b Lfinish nop nop /* case FFI_TYPE_LONGDOUBLE */ Lret_type4: lfd f1,0(r5) lfd f2,8(r5) b Lfinish nop /* case FFI_TYPE_UINT8 */ Lret_type5: lbz r3,3(r5) b Lfinish nop nop /* case FFI_TYPE_SINT8 */ Lret_type6: lbz r3,3(r5) extsb r3,r3 b Lfinish nop /* case FFI_TYPE_UINT16 */ Lret_type7: lhz r3,2(r5) b Lfinish nop nop /* case FFI_TYPE_SINT16 */ Lret_type8: lha r3,2(r5) b Lfinish nop nop /* case FFI_TYPE_UINT32 */ Lret_type9: lwz r3,0(r5) b Lfinish nop nop /* case FFI_TYPE_SINT32 */ Lret_type10: lwz r3,0(r5) b Lfinish nop nop /* case FFI_TYPE_UINT64 */ Lret_type11: lwz r3,0(r5) lwz r4,4(r5) b Lfinish nop /* case FFI_TYPE_SINT64 */ Lret_type12: lwz r3,0(r5) lwz r4,4(r5) b Lfinish nop /* case FFI_TYPE_STRUCT */ Lret_type13: b Lfinish nop nop nop /* case FFI_TYPE_POINTER */ Lret_type14: lwz r3,0(r5) b Lfinish nop nop /* case done */ Lfinish: addi r1,r1,176 /* Restore stack pointer. */ lwz r0,8(r1) /* Get return address. */ mtlr r0 /* Reset link register. */ blr /* END(ffi_closure_ASM) */ .data .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support EH_frame1: .set L$set$0,LECIE1-LSCIE1 .long L$set$0 ; Length of Common Information Entry LSCIE1: .long 0x0 ; CIE Identifier Tag .byte 0x1 ; CIE Version .ascii "zR\0" ; CIE Augmentation .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor .byte 0x7c ; sleb128 -4; CIE Data Alignment Factor .byte 0x41 ; CIE RA Column .byte 0x1 ; uleb128 0x1; Augmentation size .byte 0x90 ; FDE Encoding (indirect pcrel) .byte 0xc ; DW_CFA_def_cfa .byte 0x1 ; uleb128 0x1 .byte 0x0 ; uleb128 0x0 .align LOG2_GPR_BYTES LECIE1: .globl _ffi_closure_ASM.eh _ffi_closure_ASM.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 .long L$set$1 ; FDE Length LASFDE1: .long LASFDE1-EH_frame1 ; FDE CIE offset .g_long LLFB1$non_lazy_ptr-. ; FDE initial location .set L$set$3,LFE1-LFB1 .g_long L$set$3 ; FDE address range .byte 0x0 ; uleb128 0x0; Augmentation size .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$3,LCFI1-LCFI0 .long L$set$3 .byte 0xe ; DW_CFA_def_cfa_offset .byte 176,1 ; uleb128 176 .byte 0x4 ; DW_CFA_advance_loc4 .set L$set$4,LCFI0-LFB1 .long L$set$4 .byte 0x11 ; DW_CFA_offset_extended_sf .byte 0x41 ; uleb128 0x41 .byte 0x7e ; sleb128 -2 .align LOG2_GPR_BYTES LEFDE1: .data .align LOG2_GPR_BYTES LDFCM0: .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 .align LOG2_GPR_BYTES Lffi_closure_helper_DARWIN$stub: #if 1 .indirect_symbol _ffi_closure_helper_DARWIN mflr r0 bcl 20,31,LO$ffi_closure_helper_DARWIN LO$ffi_closure_helper_DARWIN: mflr r11 addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN) mtlr r0 lgu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr - LO$ffi_closure_helper_DARWIN)(r11) mtctr r12 bctr .lazy_symbol_pointer L_ffi_closure_helper_DARWIN$lazy_ptr: .indirect_symbol _ffi_closure_helper_DARWIN .g_long dyld_stub_binding_helper #endif .data .align LOG2_GPR_BYTES LLFB1$non_lazy_ptr: .g_long LFB1 mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/ffi.c0000644000175000017500000011422011545150464022212 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1998 Geoffrey Keating Copyright (C) 2007, 2008 Free Software Foundation, Inc Copyright (C) 2008 Red Hat, Inc PowerPC Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include extern void ffi_closure_SYSV (void); extern void FFI_HIDDEN ffi_closure_LINUX64 (void); enum { /* The assembly depends on these exact flags. */ FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */ FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ FLAG_RETURNS_FP = 1 << (31-29), FLAG_RETURNS_64BITS = 1 << (31-28), FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */ FLAG_SYSV_SMST_R4 = 1 << (31-26), /* use r4 for FFI_SYSV 8 byte structs. */ FLAG_SYSV_SMST_R3 = 1 << (31-25), /* use r3 for FFI_SYSV 4 byte structs. */ /* Bits (31-24) through (31-19) store shift value for SMST */ FLAG_ARG_NEEDS_COPY = 1 << (31- 7), FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), FLAG_RETVAL_REFERENCE = 1 << (31- 4) }; /* About the SYSV ABI. */ unsigned int NUM_GPR_ARG_REGISTERS = 8; #ifndef __NO_FPRS__ unsigned int NUM_FPR_ARG_REGISTERS = 8; #else unsigned int NUM_FPR_ARG_REGISTERS = 0; #endif enum { ASM_NEEDS_REGISTERS = 4 }; /* ffi_prep_args_SYSV is called by the assembly routine once stack space has been allocated for the function's arguments. The stack layout we want looks like this: | Return address from ffi_call_SYSV 4bytes | higher addresses |--------------------------------------------| | Previous backchain pointer 4 | stack pointer here |--------------------------------------------|<+ <<< on entry to | Saved r28-r31 4*4 | | ffi_call_SYSV |--------------------------------------------| | | GPR registers r3-r10 8*4 | | ffi_call_SYSV |--------------------------------------------| | | FPR registers f1-f8 (optional) 8*8 | | |--------------------------------------------| | stack | | Space for copied structures | | grows | |--------------------------------------------| | down V | Parameters that didn't fit in registers | | |--------------------------------------------| | lower addresses | Space for callee's LR 4 | | |--------------------------------------------| | stack pointer here | Current backchain pointer 4 |-/ during |--------------------------------------------| <<< ffi_call_SYSV */ void ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack) { const unsigned bytes = ecif->cif->bytes; const unsigned flags = ecif->cif->flags; typedef union { char *c; unsigned *u; long long *ll; float *f; double *d; } valp; /* 'stacktop' points at the previous backchain pointer. */ valp stacktop; /* 'gpr_base' points at the space for gpr3, and grows upwards as we use GPR registers. */ valp gpr_base; int intarg_count; /* 'fpr_base' points at the space for fpr1, and grows upwards as we use FPR registers. */ valp fpr_base; int fparg_count; /* 'copy_space' grows down as we put structures in it. It should stay 16-byte aligned. */ valp copy_space; /* 'next_arg' grows up as we put parameters in it. */ valp next_arg; int i, ii MAYBE_UNUSED; ffi_type **ptr; double double_tmp; union { void **v; char **c; signed char **sc; unsigned char **uc; signed short **ss; unsigned short **us; unsigned int **ui; long long **ll; float **f; double **d; } p_argv; size_t struct_copy_size; unsigned gprvalue; if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) NUM_FPR_ARG_REGISTERS = 0; stacktop.c = (char *) stack + bytes; gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS; intarg_count = 0; fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS; fparg_count = 0; copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c); next_arg.u = stack + 2; /* Check that everything starts aligned properly. */ FFI_ASSERT (((unsigned) (char *) stack & 0xF) == 0); FFI_ASSERT (((unsigned) copy_space.c & 0xF) == 0); FFI_ASSERT (((unsigned) stacktop.c & 0xF) == 0); FFI_ASSERT ((bytes & 0xF) == 0); FFI_ASSERT (copy_space.c >= next_arg.c); /* Deal with return values that are actually pass-by-reference. */ if (flags & FLAG_RETVAL_REFERENCE) { *gpr_base.u++ = (unsigned long) (char *) ecif->rvalue; intarg_count++; } /* Now for the arguments. */ p_argv.v = ecif->avalue; for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv.v++) { switch ((*ptr)->type) { case FFI_TYPE_FLOAT: /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_float_prep; double_tmp = **p_argv.f; if (fparg_count >= NUM_FPR_ARG_REGISTERS) { *next_arg.f = (float) double_tmp; next_arg.u += 1; intarg_count++; } else *fpr_base.d++ = double_tmp; fparg_count++; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); break; case FFI_TYPE_DOUBLE: /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_double_prep; double_tmp = **p_argv.d; if (fparg_count >= NUM_FPR_ARG_REGISTERS) { if (intarg_count >= NUM_GPR_ARG_REGISTERS && intarg_count % 2 != 0) { intarg_count++; next_arg.u++; } *next_arg.d = double_tmp; next_arg.u += 2; } else *fpr_base.d++ = double_tmp; fparg_count++; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if ((ecif->cif->abi != FFI_LINUX) && (ecif->cif->abi != FFI_LINUX_SOFT_FLOAT)) goto do_struct; /* The soft float ABI for long doubles works like this, a long double is passed in four consecutive gprs if available. A maximum of 2 long doubles can be passed in gprs. If we do not have 4 gprs left, the long double is passed on the stack, 4-byte aligned. */ if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) { unsigned int int_tmp = (*p_argv.ui)[0]; if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) { if (intarg_count < NUM_GPR_ARG_REGISTERS) intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; *next_arg.u = int_tmp; next_arg.u++; for (ii = 1; ii < 4; ii++) { int_tmp = (*p_argv.ui)[ii]; *next_arg.u = int_tmp; next_arg.u++; } } else { *gpr_base.u++ = int_tmp; for (ii = 1; ii < 4; ii++) { int_tmp = (*p_argv.ui)[ii]; *gpr_base.u++ = int_tmp; } } intarg_count +=4; } else { double_tmp = (*p_argv.d)[0]; if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1) { if (intarg_count >= NUM_GPR_ARG_REGISTERS && intarg_count % 2 != 0) { intarg_count++; next_arg.u++; } *next_arg.d = double_tmp; next_arg.u += 2; double_tmp = (*p_argv.d)[1]; *next_arg.d = double_tmp; next_arg.u += 2; } else { *fpr_base.d++ = double_tmp; double_tmp = (*p_argv.d)[1]; *fpr_base.d++ = double_tmp; } fparg_count += 2; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); } break; #endif case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: soft_double_prep: if (intarg_count == NUM_GPR_ARG_REGISTERS-1) intarg_count++; if (intarg_count >= NUM_GPR_ARG_REGISTERS) { if (intarg_count % 2 != 0) { intarg_count++; next_arg.u++; } *next_arg.ll = **p_argv.ll; next_arg.u += 2; } else { /* whoops: abi states only certain register pairs * can be used for passing long long int * specifically (r3,r4), (r5,r6), (r7,r8), * (r9,r10) and if next arg is long long but * not correct starting register of pair then skip * until the proper starting register */ if (intarg_count % 2 != 0) { intarg_count ++; gpr_base.u++; } *gpr_base.ll++ = **p_argv.ll; } intarg_count += 2; break; case FFI_TYPE_STRUCT: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE do_struct: #endif struct_copy_size = ((*ptr)->size + 15) & ~0xF; copy_space.c -= struct_copy_size; memcpy (copy_space.c, *p_argv.c, (*ptr)->size); gprvalue = (unsigned long) copy_space.c; FFI_ASSERT (copy_space.c > next_arg.c); FFI_ASSERT (flags & FLAG_ARG_NEEDS_COPY); goto putgpr; case FFI_TYPE_UINT8: gprvalue = **p_argv.uc; goto putgpr; case FFI_TYPE_SINT8: gprvalue = **p_argv.sc; goto putgpr; case FFI_TYPE_UINT16: gprvalue = **p_argv.us; goto putgpr; case FFI_TYPE_SINT16: gprvalue = **p_argv.ss; goto putgpr; case FFI_TYPE_INT: case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: case FFI_TYPE_POINTER: soft_float_prep: gprvalue = **p_argv.ui; putgpr: if (intarg_count >= NUM_GPR_ARG_REGISTERS) *next_arg.u++ = gprvalue; else *gpr_base.u++ = gprvalue; intarg_count++; break; } } /* Check that we didn't overrun the stack... */ FFI_ASSERT (copy_space.c >= next_arg.c); FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS); FFI_ASSERT (fpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); } /* About the LINUX64 ABI. */ enum { NUM_GPR_ARG_REGISTERS64 = 8, NUM_FPR_ARG_REGISTERS64 = 13 }; enum { ASM_NEEDS_REGISTERS64 = 4 }; /* ffi_prep_args64 is called by the assembly routine once stack space has been allocated for the function's arguments. The stack layout we want looks like this: | Ret addr from ffi_call_LINUX64 8bytes | higher addresses |--------------------------------------------| | CR save area 8bytes | |--------------------------------------------| | Previous backchain pointer 8 | stack pointer here |--------------------------------------------|<+ <<< on entry to | Saved r28-r31 4*8 | | ffi_call_LINUX64 |--------------------------------------------| | | GPR registers r3-r10 8*8 | | |--------------------------------------------| | | FPR registers f1-f13 (optional) 13*8 | | |--------------------------------------------| | | Parameter save area | | |--------------------------------------------| | | TOC save area 8 | | |--------------------------------------------| | stack | | Linker doubleword 8 | | grows | |--------------------------------------------| | down V | Compiler doubleword 8 | | |--------------------------------------------| | lower addresses | Space for callee's LR 8 | | |--------------------------------------------| | | CR save area 8 | | |--------------------------------------------| | stack pointer here | Current backchain pointer 8 |-/ during |--------------------------------------------| <<< ffi_call_LINUX64 */ void FFI_HIDDEN ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack) { const unsigned long bytes = ecif->cif->bytes; const unsigned long flags = ecif->cif->flags; typedef union { char *c; unsigned long *ul; float *f; double *d; } valp; /* 'stacktop' points at the previous backchain pointer. */ valp stacktop; /* 'next_arg' points at the space for gpr3, and grows upwards as we use GPR registers, then continues at rest. */ valp gpr_base; valp gpr_end; valp rest; valp next_arg; /* 'fpr_base' points at the space for fpr3, and grows upwards as we use FPR registers. */ valp fpr_base; int fparg_count; int i, words; ffi_type **ptr; double double_tmp; union { void **v; char **c; signed char **sc; unsigned char **uc; signed short **ss; unsigned short **us; signed int **si; unsigned int **ui; unsigned long **ul; float **f; double **d; } p_argv; unsigned long gprvalue; stacktop.c = (char *) stack + bytes; gpr_base.ul = stacktop.ul - ASM_NEEDS_REGISTERS64 - NUM_GPR_ARG_REGISTERS64; gpr_end.ul = gpr_base.ul + NUM_GPR_ARG_REGISTERS64; rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64; fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64; fparg_count = 0; next_arg.ul = gpr_base.ul; /* Check that everything starts aligned properly. */ FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); FFI_ASSERT ((bytes & 0xF) == 0); /* Deal with return values that are actually pass-by-reference. */ if (flags & FLAG_RETVAL_REFERENCE) *next_arg.ul++ = (unsigned long) (char *) ecif->rvalue; /* Now for the arguments. */ p_argv.v = ecif->avalue; for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv.v++) { switch ((*ptr)->type) { case FFI_TYPE_FLOAT: double_tmp = **p_argv.f; *next_arg.f = (float) double_tmp; if (++next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; if (fparg_count < NUM_FPR_ARG_REGISTERS64) *fpr_base.d++ = double_tmp; fparg_count++; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); break; case FFI_TYPE_DOUBLE: double_tmp = **p_argv.d; *next_arg.d = double_tmp; if (++next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; if (fparg_count < NUM_FPR_ARG_REGISTERS64) *fpr_base.d++ = double_tmp; fparg_count++; FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: double_tmp = (*p_argv.d)[0]; *next_arg.d = double_tmp; if (++next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; if (fparg_count < NUM_FPR_ARG_REGISTERS64) *fpr_base.d++ = double_tmp; fparg_count++; double_tmp = (*p_argv.d)[1]; *next_arg.d = double_tmp; if (++next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; if (fparg_count < NUM_FPR_ARG_REGISTERS64) *fpr_base.d++ = double_tmp; fparg_count++; FFI_ASSERT (__LDBL_MANT_DIG__ == 106); FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); break; #endif case FFI_TYPE_STRUCT: words = ((*ptr)->size + 7) / 8; if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul) { size_t first = gpr_end.c - next_arg.c; memcpy (next_arg.c, *p_argv.c, first); memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first); next_arg.c = rest.c + words * 8 - first; } else { char *where = next_arg.c; /* Structures with size less than eight bytes are passed left-padded. */ if ((*ptr)->size < 8) where += 8 - (*ptr)->size; memcpy (where, *p_argv.c, (*ptr)->size); next_arg.ul += words; if (next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; } break; case FFI_TYPE_UINT8: gprvalue = **p_argv.uc; goto putgpr; case FFI_TYPE_SINT8: gprvalue = **p_argv.sc; goto putgpr; case FFI_TYPE_UINT16: gprvalue = **p_argv.us; goto putgpr; case FFI_TYPE_SINT16: gprvalue = **p_argv.ss; goto putgpr; case FFI_TYPE_UINT32: gprvalue = **p_argv.ui; goto putgpr; case FFI_TYPE_INT: case FFI_TYPE_SINT32: gprvalue = **p_argv.si; goto putgpr; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_POINTER: gprvalue = **p_argv.ul; putgpr: *next_arg.ul++ = gprvalue; if (next_arg.ul == gpr_end.ul) next_arg.ul = rest.ul; break; } } FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || (next_arg.ul >= gpr_base.ul && next_arg.ul <= gpr_base.ul + 4)); } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep (ffi_cif *cif) { /* All this is for the SYSV and LINUX64 ABI. */ int i; ffi_type **ptr; unsigned bytes; int fparg_count = 0, intarg_count = 0; unsigned flags = 0; unsigned struct_copy_size = 0; unsigned type = cif->rtype->type; unsigned size = cif->rtype->size; if (cif->abi == FFI_LINUX_SOFT_FLOAT) NUM_FPR_ARG_REGISTERS = 0; if (cif->abi != FFI_LINUX64) { /* All the machine-independent calculation of cif->bytes will be wrong. Redo the calculation for SYSV. */ /* Space for the frame pointer, callee's LR, and the asm's temp regs. */ bytes = (2 + ASM_NEEDS_REGISTERS) * sizeof (int); /* Space for the GPR registers. */ bytes += NUM_GPR_ARG_REGISTERS * sizeof (int); } else { /* 64-bit ABI. */ /* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp regs. */ bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long); /* Space for the mandatory parm save area and general registers. */ bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long); } /* Return value handling. The rules for SYSV are as follows: - 32-bit (or less) integer values are returned in gpr3; - Structures of size <= 4 bytes also returned in gpr3; - 64-bit integer values and structures between 5 and 8 bytes are returned in gpr3 and gpr4; - Single/double FP values are returned in fpr1; - Larger structures are allocated space and a pointer is passed as the first argument. - long doubles (if not equivalent to double) are returned in fpr1,fpr2 for Linux and as for large structs for SysV. For LINUX64: - integer values in gpr3; - Structures/Unions by reference; - Single/double FP values in fpr1, long double in fpr1,fpr2. - soft-float float/doubles are treated as UINT32/UINT64 respectivley. - soft-float long doubles are returned in gpr3-gpr6. */ switch (type) { #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64 && cif->abi != FFI_LINUX_SOFT_FLOAT) goto byref; flags |= FLAG_RETURNS_128BITS; /* Fall through. */ #endif case FFI_TYPE_DOUBLE: flags |= FLAG_RETURNS_64BITS; /* Fall through. */ case FFI_TYPE_FLOAT: /* With FFI_LINUX_SOFT_FLOAT no fp registers are used. */ if (cif->abi != FFI_LINUX_SOFT_FLOAT) flags |= FLAG_RETURNS_FP; break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: flags |= FLAG_RETURNS_64BITS; break; case FFI_TYPE_STRUCT: if (cif->abi == FFI_SYSV) { /* The final SYSV ABI says that structures smaller or equal 8 bytes are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them in memory. */ /* Treat structs with size <= 8 bytes. */ if (size <= 8) { flags |= FLAG_RETURNS_SMST; /* These structs are returned in r3. We pack the type and the precalculated shift value (needed in the sysv.S) into flags. The same applies for the structs returned in r3/r4. */ if (size <= 4) { flags |= FLAG_SYSV_SMST_R3; flags |= 8 * (4 - size) << 8; break; } /* These structs are returned in r3 and r4. See above. */ if (size <= 8) { flags |= FLAG_SYSV_SMST_R3 | FLAG_SYSV_SMST_R4; flags |= 8 * (8 - size) << 8; break; } } } #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE byref: #endif intarg_count++; flags |= FLAG_RETVAL_REFERENCE; /* Fall through. */ case FFI_TYPE_VOID: flags |= FLAG_RETURNS_NOTHING; break; default: /* Returns 32-bit integer, or similar. Nothing to do here. */ break; } if (cif->abi != FFI_LINUX64) /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest goes on the stack. Structures and long doubles (if not equivalent to double) are passed as a pointer to a copy of the structure. Stuff on the stack needs to keep proper alignment. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { switch ((*ptr)->type) { case FFI_TYPE_FLOAT: /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ if (cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_float_cif; fparg_count++; /* floating singles are not 8-aligned on stack */ break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) goto do_struct; if (cif->abi == FFI_LINUX_SOFT_FLOAT) { if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 || intarg_count < NUM_GPR_ARG_REGISTERS) /* A long double in FFI_LINUX_SOFT_FLOAT can use only a set of four consecutive gprs. If we have not enough, we have to adjust the intarg_count value. */ intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; intarg_count += 4; break; } else fparg_count++; /* Fall thru */ #endif case FFI_TYPE_DOUBLE: /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ if (cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_double_cif; fparg_count++; /* If this FP arg is going on the stack, it must be 8-byte-aligned. */ if (fparg_count > NUM_FPR_ARG_REGISTERS && intarg_count >= NUM_GPR_ARG_REGISTERS && intarg_count % 2 != 0) intarg_count++; break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: soft_double_cif: /* 'long long' arguments are passed as two words, but either both words must fit in registers or both go on the stack. If they go on the stack, they must be 8-byte-aligned. Also, only certain register pairs can be used for passing long long int -- specifically (r3,r4), (r5,r6), (r7,r8), (r9,r10). */ if (intarg_count == NUM_GPR_ARG_REGISTERS-1 || intarg_count % 2 != 0) intarg_count++; intarg_count += 2; break; case FFI_TYPE_STRUCT: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE do_struct: #endif /* We must allocate space for a copy of these to enforce pass-by-value. Pad the space up to a multiple of 16 bytes (the maximum alignment required for anything under the SYSV ABI). */ struct_copy_size += ((*ptr)->size + 15) & ~0xF; /* Fall through (allocate space for the pointer). */ default: soft_float_cif: /* Everything else is passed as a 4-byte word in a GPR, either the object itself or a pointer to it. */ intarg_count++; break; } } else for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { switch ((*ptr)->type) { #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if (cif->abi == FFI_LINUX_SOFT_FLOAT) intarg_count += 4; else { fparg_count += 2; intarg_count += 2; } break; #endif case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: fparg_count++; intarg_count++; break; case FFI_TYPE_STRUCT: intarg_count += ((*ptr)->size + 7) / 8; break; default: /* Everything else is passed as a 8-byte word in a GPR, either the object itself or a pointer to it. */ intarg_count++; break; } } if (fparg_count != 0) flags |= FLAG_FP_ARGUMENTS; if (intarg_count > 4) flags |= FLAG_4_GPR_ARGUMENTS; if (struct_copy_size != 0) flags |= FLAG_ARG_NEEDS_COPY; if (cif->abi != FFI_LINUX64) { /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS * sizeof (double); /* Stack space. */ if (intarg_count > NUM_GPR_ARG_REGISTERS) bytes += (intarg_count - NUM_GPR_ARG_REGISTERS) * sizeof (int); if (fparg_count > NUM_FPR_ARG_REGISTERS) bytes += (fparg_count - NUM_FPR_ARG_REGISTERS) * sizeof (double); } else { /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double); /* Stack space. */ if (intarg_count > NUM_GPR_ARG_REGISTERS64) bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long); } /* The stack space allocated needs to be a multiple of 16 bytes. */ bytes = (bytes + 15) & ~0xF; /* Add in the space for the copied structures. */ bytes += struct_copy_size; cif->flags = flags; cif->bytes = bytes; return FFI_OK; } extern void ffi_call_SYSV(extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); extern void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, unsigned long, unsigned long, unsigned long *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { #ifndef POWERPC64 case FFI_SYSV: case FFI_GCC_SYSV: case FFI_LINUX: case FFI_LINUX_SOFT_FLOAT: ffi_call_SYSV (&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn); break; #else case FFI_LINUX64: ffi_call_LINUX64 (&ecif, -(long) cif->bytes, cif->flags, ecif.rvalue, fn); break; #endif default: FFI_ASSERT (0); break; } } #ifndef POWERPC64 #define MIN_CACHE_LINE_SIZE 8 static void flush_icache (char *wraddr, char *xaddr, int size) { int i; for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" : : "r" (xaddr + i), "r" (wraddr + i) : "memory"); __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;" : : "r"(xaddr + size - 1), "r"(wraddr + size - 1) : "memory"); } #endif ffi_status ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, void (*fun) (ffi_cif *, void *, void **, void *), void *user_data, void *codeloc) { #ifdef POWERPC64 void **tramp = (void **) &closure->tramp[0]; FFI_ASSERT (cif->abi == FFI_LINUX64); /* Copy function address and TOC from ffi_closure_LINUX64. */ memcpy (tramp, (char *) ffi_closure_LINUX64, 16); tramp[2] = codeloc; #else unsigned int *tramp; FFI_ASSERT (cif->abi == FFI_GCC_SYSV || cif->abi == FFI_SYSV); tramp = (unsigned int *) &closure->tramp[0]; tramp[0] = 0x7c0802a6; /* mflr r0 */ tramp[1] = 0x4800000d; /* bl 10 */ tramp[4] = 0x7d6802a6; /* mflr r11 */ tramp[5] = 0x7c0803a6; /* mtlr r0 */ tramp[6] = 0x800b0000; /* lwz r0,0(r11) */ tramp[7] = 0x816b0004; /* lwz r11,4(r11) */ tramp[8] = 0x7c0903a6; /* mtctr r0 */ tramp[9] = 0x4e800420; /* bctr */ *(void **) &tramp[2] = (void *) ffi_closure_SYSV; /* function */ *(void **) &tramp[3] = codeloc; /* context */ /* Flush the icache. */ flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE); #endif closure->cif = cif; closure->fun = fun; closure->user_data = user_data; return FFI_OK; } typedef union { float f; double d; } ffi_dblfl; int ffi_closure_helper_SYSV (ffi_closure *, void *, unsigned long *, ffi_dblfl *, unsigned long *); /* Basically the trampoline invokes ffi_closure_SYSV, and on * entry, r11 holds the address of the closure. * After storing the registers that could possibly contain * parameters to be passed into the stack frame and setting * up space for a return value, ffi_closure_SYSV invokes the * following helper function to do most of the work */ int ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, unsigned long *pgr, ffi_dblfl *pfr, unsigned long *pst) { /* rvalue is the pointer to space for return value in closure assembly */ /* pgr is the pointer to where r3-r10 are stored in ffi_closure_SYSV */ /* pfr is the pointer to where f1-f8 are stored in ffi_closure_SYSV */ /* pst is the pointer to outgoing parameter stack in original caller */ void ** avalue; ffi_type ** arg_types; long i, avn; long nf; /* number of floating registers already used */ long ng; /* number of general registers already used */ ffi_cif * cif; double temp; unsigned size; cif = closure->cif; avalue = alloca (cif->nargs * sizeof (void *)); size = cif->rtype->size; nf = 0; ng = 0; /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. For FFI_SYSV the result is passed in r3/r4 if the struct size is less or equal 8 bytes. */ if ((cif->rtype->type == FFI_TYPE_STRUCT && !((cif->abi == FFI_SYSV) && (size <= 8))) #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE || (cif->rtype->type == FFI_TYPE_LONGDOUBLE && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) #endif ) { rvalue = (void *) *pgr; ng++; pgr++; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) { switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: /* there are 8 gpr registers used to pass values */ if (ng < 8) { avalue[i] = (char *) pgr + 3; ng++; pgr++; } else { avalue[i] = (char *) pst + 3; pst++; } break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: /* there are 8 gpr registers used to pass values */ if (ng < 8) { avalue[i] = (char *) pgr + 2; ng++; pgr++; } else { avalue[i] = (char *) pst + 2; pst++; } break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_POINTER: soft_float_closure: /* there are 8 gpr registers used to pass values */ if (ng < 8) { avalue[i] = pgr; ng++; pgr++; } else { avalue[i] = pst; pst++; } break; case FFI_TYPE_STRUCT: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE do_struct: #endif /* Structs are passed by reference. The address will appear in a gpr if it is one of the first 8 arguments. */ if (ng < 8) { avalue[i] = (void *) *pgr; ng++; pgr++; } else { avalue[i] = (void *) *pst; pst++; } break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: soft_double_closure: /* passing long long ints are complex, they must * be passed in suitable register pairs such as * (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10) * and if the entire pair aren't available then the outgoing * parameter stack is used for both but an alignment of 8 * must will be kept. So we must either look in pgr * or pst to find the correct address for this type * of parameter. */ if (ng < 7) { if (ng & 0x01) { /* skip r4, r6, r8 as starting points */ ng++; pgr++; } avalue[i] = pgr; ng += 2; pgr += 2; } else { if (((long) pst) & 4) pst++; avalue[i] = pst; pst += 2; ng = 8; } break; case FFI_TYPE_FLOAT: /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ if (cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_float_closure; /* unfortunately float values are stored as doubles * in the ffi_closure_SYSV code (since we don't check * the type in that routine). */ /* there are 8 64bit floating point registers */ if (nf < 8) { temp = pfr->d; pfr->f = (float) temp; avalue[i] = pfr; nf++; pfr++; } else { /* FIXME? here we are really changing the values * stored in the original calling routines outgoing * parameter stack. This is probably a really * naughty thing to do but... */ avalue[i] = pst; pst += 1; } break; case FFI_TYPE_DOUBLE: /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ if (cif->abi == FFI_LINUX_SOFT_FLOAT) goto soft_double_closure; /* On the outgoing stack all values are aligned to 8 */ /* there are 8 64bit floating point registers */ if (nf < 8) { avalue[i] = pfr; nf++; pfr++; } else { if (((long) pst) & 4) pst++; avalue[i] = pst; pst += 2; } break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) goto do_struct; if (cif->abi == FFI_LINUX_SOFT_FLOAT) { /* Test if for the whole long double, 4 gprs are available. otherwise the stuff ends up on the stack. */ if (ng < 5) { avalue[i] = pgr; pgr += 4; ng += 4; } else { avalue[i] = pst; pst += 4; ng = 8; } break; } if (nf < 7) { avalue[i] = pfr; pfr += 2; nf += 2; } else { if (((long) pst) & 4) pst++; avalue[i] = pst; pst += 4; nf = 8; } break; #endif default: FFI_ASSERT (0); } i++; } (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_SYSV how to perform return type promotions. Because the FFI_SYSV ABI returns the structures <= 8 bytes in r3/r4 we have to tell ffi_closure_SYSV how to treat them. We combine the base type FFI_SYSV_TYPE_SMALL_STRUCT - 1 with the size of the struct. So a one byte struct gets the return type 16. Return type 1 to 15 are already used and we never have a struct with size zero. That is the reason for the subtraction of 1. See the comment in ffitarget.h about ordering. */ if (cif->abi == FFI_SYSV && cif->rtype->type == FFI_TYPE_STRUCT && size <= 8) return (FFI_SYSV_TYPE_SMALL_STRUCT - 1) + size; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE else if (cif->rtype->type == FFI_TYPE_LONGDOUBLE && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) return FFI_TYPE_STRUCT; #endif /* With FFI_LINUX_SOFT_FLOAT floats and doubles are handled like UINT32 respectivley UINT64. */ if (cif->abi == FFI_LINUX_SOFT_FLOAT) { switch (cif->rtype->type) { case FFI_TYPE_FLOAT: return FFI_TYPE_UINT32; break; case FFI_TYPE_DOUBLE: return FFI_TYPE_UINT64; break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: return FFI_TYPE_UINT128; break; #endif default: return cif->rtype->type; } } else { return cif->rtype->type; } } int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *, void *, unsigned long *, ffi_dblfl *); int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue, unsigned long *pst, ffi_dblfl *pfr) { /* rvalue is the pointer to space for return value in closure assembly */ /* pst is the pointer to parameter save area (r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */ /* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */ void **avalue; ffi_type **arg_types; long i, avn; ffi_cif *cif; ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64; cif = closure->cif; avalue = alloca (cif->nargs * sizeof (void *)); /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. */ if (cif->rtype->type == FFI_TYPE_STRUCT) { rvalue = (void *) *pst; pst++; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) { switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = (char *) pst + 7; pst++; break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = (char *) pst + 6; pst++; break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: avalue[i] = (char *) pst + 4; pst++; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: case FFI_TYPE_POINTER: avalue[i] = pst; pst++; break; case FFI_TYPE_STRUCT: /* Structures with size less than eight bytes are passed left-padded. */ if (arg_types[i]->size < 8) avalue[i] = (char *) pst + 8 - arg_types[i]->size; else avalue[i] = pst; pst += (arg_types[i]->size + 7) / 8; break; case FFI_TYPE_FLOAT: /* unfortunately float values are stored as doubles * in the ffi_closure_LINUX64 code (since we don't check * the type in that routine). */ /* there are 13 64bit floating point registers */ if (pfr < end_pfr) { double temp = pfr->d; pfr->f = (float) temp; avalue[i] = pfr; pfr++; } else avalue[i] = pst; pst++; break; case FFI_TYPE_DOUBLE: /* On the outgoing stack all values are aligned to 8 */ /* there are 13 64bit floating point registers */ if (pfr < end_pfr) { avalue[i] = pfr; pfr++; } else avalue[i] = pst; pst++; break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: if (pfr + 1 < end_pfr) { avalue[i] = pfr; pfr += 2; } else { if (pfr < end_pfr) { /* Passed partly in f13 and partly on the stack. Move it all to the stack. */ *pst = *(unsigned long *) pfr; pfr++; } avalue[i] = pst; } pst += 2; break; #endif default: FFI_ASSERT (0); } i++; } (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_LINUX64 how to perform return type promotions. */ return cif->rtype->type; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/ffi_darwin.c0000644000175000017500000006274111545150464023570 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi_darwin.c Copyright (C) 1998 Geoffrey Keating Copyright (C) 2001 John Hornkvist Copyright (C) 2002, 2006, 2007, 2009 Free Software Foundation, Inc. FFI support for Darwin and AIX. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include extern void ffi_closure_ASM (void); enum { /* The assembly depends on these exact flags. */ FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ FLAG_RETURNS_FP = 1 << (31-29), FLAG_RETURNS_64BITS = 1 << (31-28), FLAG_RETURNS_128BITS = 1 << (31-31), FLAG_ARG_NEEDS_COPY = 1 << (31- 7), FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), FLAG_RETVAL_REFERENCE = 1 << (31- 4) }; /* About the DARWIN ABI. */ enum { NUM_GPR_ARG_REGISTERS = 8, NUM_FPR_ARG_REGISTERS = 13 }; enum { ASM_NEEDS_REGISTERS = 4 }; /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments. The stack layout we want looks like this: | Return address from ffi_call_DARWIN | higher addresses |--------------------------------------------| | Previous backchain pointer 4 | stack pointer here |--------------------------------------------|<+ <<< on entry to | Saved r28-r31 4*4 | | ffi_call_DARWIN |--------------------------------------------| | | Parameters (at least 8*4=32) | | |--------------------------------------------| | | Space for GPR2 4 | | |--------------------------------------------| | stack | | Reserved 2*4 | | grows | |--------------------------------------------| | down V | Space for callee's LR 4 | | |--------------------------------------------| | lower addresses | Saved CR 4 | | |--------------------------------------------| | stack pointer here | Current backchain pointer 4 |-/ during |--------------------------------------------| <<< ffi_call_DARWIN */ void ffi_prep_args (extended_cif *ecif, unsigned long *const stack) { const unsigned bytes = ecif->cif->bytes; const unsigned flags = ecif->cif->flags; const unsigned nargs = ecif->cif->nargs; const ffi_abi abi = ecif->cif->abi; /* 'stacktop' points at the previous backchain pointer. */ unsigned long *const stacktop = stack + (bytes / sizeof(unsigned long)); /* 'fpr_base' points at the space for fpr1, and grows upwards as we use FPR registers. */ double *fpr_base = (double *) (stacktop - ASM_NEEDS_REGISTERS) - NUM_FPR_ARG_REGISTERS; int fparg_count = 0; /* 'next_arg' grows up as we put parameters in it. */ unsigned long *next_arg = stack + 6; /* 6 reserved positions. */ int i; double double_tmp; void **p_argv = ecif->avalue; unsigned long gprvalue; ffi_type** ptr = ecif->cif->arg_types; char *dest_cpy; unsigned size_al = 0; /* Check that everything starts aligned properly. */ FFI_ASSERT(((unsigned) (char *) stack & 0xF) == 0); FFI_ASSERT(((unsigned) (char *) stacktop & 0xF) == 0); FFI_ASSERT((bytes & 0xF) == 0); /* Deal with return values that are actually pass-by-reference. Rule: Return values are referenced by r3, so r4 is the first parameter. */ if (flags & FLAG_RETVAL_REFERENCE) *next_arg++ = (unsigned long) (char *) ecif->rvalue; /* Now for the arguments. */ for (i = nargs; i > 0; i--, ptr++, p_argv++) { switch ((*ptr)->type) { /* If a floating-point parameter appears before all of the general- purpose registers are filled, the corresponding GPRs that match the size of the floating-point parameter are skipped. */ case FFI_TYPE_FLOAT: double_tmp = *(float *) *p_argv; if (fparg_count >= NUM_FPR_ARG_REGISTERS) *(double *)next_arg = double_tmp; else *fpr_base++ = double_tmp; next_arg++; fparg_count++; FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; case FFI_TYPE_DOUBLE: double_tmp = *(double *) *p_argv; if (fparg_count >= NUM_FPR_ARG_REGISTERS) *(double *)next_arg = double_tmp; else *fpr_base++ = double_tmp; #ifdef POWERPC64 next_arg++; #else next_arg += 2; #endif fparg_count++; FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #ifdef POWERPC64 if (fparg_count < NUM_FPR_ARG_REGISTERS) *(long double *) fpr_base++ = *(long double *) *p_argv; else *(long double *) next_arg = *(long double *) *p_argv; next_arg += 2; fparg_count += 2; #else double_tmp = ((double *) *p_argv)[0]; if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; else *(double *) next_arg = double_tmp; next_arg += 2; fparg_count++; double_tmp = ((double *) *p_argv)[1]; if (fparg_count < NUM_FPR_ARG_REGISTERS) *fpr_base++ = double_tmp; else *(double *) next_arg = double_tmp; next_arg += 2; fparg_count++; #endif FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); break; #endif case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef POWERPC64 gprvalue = *(long long *) *p_argv; goto putgpr; #else *(long long *) next_arg = *(long long *) *p_argv; next_arg += 2; #endif break; case FFI_TYPE_POINTER: gprvalue = *(unsigned long *) *p_argv; goto putgpr; case FFI_TYPE_UINT8: gprvalue = *(unsigned char *) *p_argv; goto putgpr; case FFI_TYPE_SINT8: gprvalue = *(signed char *) *p_argv; goto putgpr; case FFI_TYPE_UINT16: gprvalue = *(unsigned short *) *p_argv; goto putgpr; case FFI_TYPE_SINT16: gprvalue = *(signed short *) *p_argv; goto putgpr; case FFI_TYPE_STRUCT: #ifdef POWERPC64 dest_cpy = (char *) next_arg; size_al = (*ptr)->size; if ((*ptr)->elements[0]->type == 3) size_al = ALIGN((*ptr)->size, 8); if (size_al < 3 && abi == FFI_DARWIN) dest_cpy += 4 - size_al; memcpy ((char *) dest_cpy, (char *) *p_argv, size_al); next_arg += (size_al + 7) / 8; #else dest_cpy = (char *) next_arg; /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, SI 4 bytes) are aligned as if they were those modes. Structures with 3 byte in size are padded upwards. */ size_al = (*ptr)->size; /* If the first member of the struct is a double, then align the struct to double-word. */ if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN((*ptr)->size, 8); if (size_al < 3 && abi == FFI_DARWIN) dest_cpy += 4 - size_al; memcpy((char *) dest_cpy, (char *) *p_argv, size_al); next_arg += (size_al + 3) / 4; #endif break; case FFI_TYPE_INT: case FFI_TYPE_SINT32: gprvalue = *(signed int *) *p_argv; goto putgpr; case FFI_TYPE_UINT32: gprvalue = *(unsigned int *) *p_argv; putgpr: *next_arg++ = gprvalue; break; default: break; } } /* Check that we didn't overrun the stack... */ //FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); //FFI_ASSERT((unsigned *)fpr_base // <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); //FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); } /* Adjust the size of S to be correct for Darwin. On Darwin, the first field of a structure has natural alignment. */ static void darwin_adjust_aggregate_sizes (ffi_type *s) { int i; if (s->type != FFI_TYPE_STRUCT) return; s->size = 0; for (i = 0; s->elements[i] != NULL; i++) { ffi_type *p; int align; p = s->elements[i]; darwin_adjust_aggregate_sizes (p); if (i == 0 && (p->type == FFI_TYPE_UINT64 || p->type == FFI_TYPE_SINT64 || p->type == FFI_TYPE_DOUBLE || p->alignment == 8)) align = 8; else if (p->alignment == 16 || p->alignment < 4) align = p->alignment; else align = 4; s->size = ALIGN(s->size, align) + p->size; } s->size = ALIGN(s->size, s->alignment); if (s->elements[0]->type == FFI_TYPE_UINT64 || s->elements[0]->type == FFI_TYPE_SINT64 || s->elements[0]->type == FFI_TYPE_DOUBLE || s->elements[0]->alignment == 8) s->alignment = s->alignment > 8 ? s->alignment : 8; /* Do not add additional tail padding. */ } /* Adjust the size of S to be correct for AIX. Word-align double unless it is the first member of a structure. */ static void aix_adjust_aggregate_sizes (ffi_type *s) { int i; if (s->type != FFI_TYPE_STRUCT) return; s->size = 0; for (i = 0; s->elements[i] != NULL; i++) { ffi_type *p; int align; p = s->elements[i]; aix_adjust_aggregate_sizes (p); align = p->alignment; if (i != 0 && p->type == FFI_TYPE_DOUBLE) align = 4; s->size = ALIGN(s->size, align) + p->size; } s->size = ALIGN(s->size, s->alignment); if (s->elements[0]->type == FFI_TYPE_UINT64 || s->elements[0]->type == FFI_TYPE_SINT64 || s->elements[0]->type == FFI_TYPE_DOUBLE || s->elements[0]->alignment == 8) s->alignment = s->alignment > 8 ? s->alignment : 8; /* Do not add additional tail padding. */ } /* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep (ffi_cif *cif) { /* All this is for the DARWIN ABI. */ unsigned i; ffi_type **ptr; unsigned bytes; int fparg_count = 0, intarg_count = 0; unsigned flags = 0; unsigned size_al = 0; /* All the machine-independent calculation of cif->bytes will be wrong. All the calculation of structure sizes will also be wrong. Redo the calculation for DARWIN. */ if (cif->abi == FFI_DARWIN) { darwin_adjust_aggregate_sizes (cif->rtype); for (i = 0; i < cif->nargs; i++) darwin_adjust_aggregate_sizes (cif->arg_types[i]); } if (cif->abi == FFI_AIX) { aix_adjust_aggregate_sizes (cif->rtype); for (i = 0; i < cif->nargs; i++) aix_adjust_aggregate_sizes (cif->arg_types[i]); } /* Space for the frame pointer, callee's LR, CR, etc, and for the asm's temp regs. */ bytes = (6 + ASM_NEEDS_REGISTERS) * sizeof(long); /* Return value handling. The rules are as follows: - 32-bit (or less) integer values are returned in gpr3; - Structures of size <= 4 bytes also returned in gpr3; - 64-bit integer values and structures between 5 and 8 bytes are returned in gpr3 and gpr4; - Single/double FP values are returned in fpr1; - Long double FP (if not equivalent to double) values are returned in fpr1 and fpr2; - Larger structures values are allocated space and a pointer is passed as the first argument. */ switch (cif->rtype->type) { #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: flags |= FLAG_RETURNS_128BITS; flags |= FLAG_RETURNS_FP; break; #endif case FFI_TYPE_DOUBLE: flags |= FLAG_RETURNS_64BITS; /* Fall through. */ case FFI_TYPE_FLOAT: flags |= FLAG_RETURNS_FP; break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef POWERPC64 case FFI_TYPE_POINTER: #endif flags |= FLAG_RETURNS_64BITS; break; case FFI_TYPE_STRUCT: flags |= FLAG_RETVAL_REFERENCE; flags |= FLAG_RETURNS_NOTHING; intarg_count++; break; case FFI_TYPE_VOID: flags |= FLAG_RETURNS_NOTHING; break; default: /* Returns 32-bit integer, or similar. Nothing to do here. */ break; } /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest goes on the stack. Structures are passed as a pointer to a copy of the structure. Stuff on the stack needs to keep proper alignment. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { switch ((*ptr)->type) { case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: fparg_count++; /* If this FP arg is going on the stack, it must be 8-byte-aligned. */ if (fparg_count > NUM_FPR_ARG_REGISTERS && intarg_count%2 != 0) intarg_count++; break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: fparg_count += 2; /* If this FP arg is going on the stack, it must be 8-byte-aligned. */ if (fparg_count > NUM_FPR_ARG_REGISTERS && intarg_count%2 != 0) intarg_count++; intarg_count +=2; break; #endif case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: /* 'long long' arguments are passed as two words, but either both words must fit in registers or both go on the stack. If they go on the stack, they must be 8-byte-aligned. */ if (intarg_count == NUM_GPR_ARG_REGISTERS-1 || (intarg_count >= NUM_GPR_ARG_REGISTERS && intarg_count%2 != 0)) intarg_count++; intarg_count += 2; break; case FFI_TYPE_STRUCT: size_al = (*ptr)->size; /* If the first member of the struct is a double, then align the struct to double-word. */ if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN((*ptr)->size, 8); #ifdef POWERPC64 intarg_count += (size_al + 7) / 8; #else intarg_count += (size_al + 3) / 4; #endif break; default: /* Everything else is passed as a 4-byte word in a GPR, either the object itself or a pointer to it. */ intarg_count++; break; } } if (fparg_count != 0) flags |= FLAG_FP_ARGUMENTS; /* Space for the FPR registers, if needed. */ if (fparg_count != 0) bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); /* Stack space. */ #ifdef POWERPC64 if ((intarg_count + fparg_count) > NUM_GPR_ARG_REGISTERS) bytes += (intarg_count + fparg_count) * sizeof(long); #else if ((intarg_count + 2 * fparg_count) > NUM_GPR_ARG_REGISTERS) bytes += (intarg_count + 2 * fparg_count) * sizeof(long); #endif else bytes += NUM_GPR_ARG_REGISTERS * sizeof(long); /* The stack space allocated needs to be a multiple of 16 bytes. */ bytes = (bytes + 15) & ~0xF; cif->flags = flags; cif->bytes = bytes; return FFI_OK; } extern void ffi_call_AIX(extended_cif *, long, unsigned, unsigned *, void (*fn)(void), void (*fn2)(void)); extern void ffi_call_DARWIN(extended_cif *, long, unsigned, unsigned *, void (*fn)(void), void (*fn2)(void)); void ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return value address then we need to make one. */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca (cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_AIX: ffi_call_AIX(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, FFI_FN(ffi_prep_args)); break; case FFI_DARWIN: ffi_call_DARWIN(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, FFI_FN(ffi_prep_args)); break; default: FFI_ASSERT(0); break; } } static void flush_icache(char *); static void flush_range(char *, int); /* The layout of a function descriptor. A C function pointer really points to one of these. */ typedef struct aix_fd_struct { void *code_pointer; void *toc; } aix_fd; /* here I'd like to add the stack frame layout we use in darwin_closure.S and aix_clsoure.S SP previous -> +---------------------------------------+ <--- child frame | back chain to caller 4 | +---------------------------------------+ 4 | saved CR 4 | +---------------------------------------+ 8 | saved LR 4 | +---------------------------------------+ 12 | reserved for compilers 4 | +---------------------------------------+ 16 | reserved for binders 4 | +---------------------------------------+ 20 | saved TOC pointer 4 | +---------------------------------------+ 24 | always reserved 8*4=32 (previous GPRs)| | according to the linkage convention | | from AIX | +---------------------------------------+ 56 | our FPR area 13*8=104 | | f1 | | . | | f13 | +---------------------------------------+ 160 | result area 8 | +---------------------------------------+ 168 | alignement to the next multiple of 16 | SP current --> +---------------------------------------+ 176 <- parent frame | back chain to caller 4 | +---------------------------------------+ 180 | saved CR 4 | +---------------------------------------+ 184 | saved LR 4 | +---------------------------------------+ 188 | reserved for compilers 4 | +---------------------------------------+ 192 | reserved for binders 4 | +---------------------------------------+ 196 | saved TOC pointer 4 | +---------------------------------------+ 200 | always reserved 8*4=32 we store our | | GPRs here | | r3 | | . | | r10 | +---------------------------------------+ 232 | overflow part | +---------------------------------------+ xxx | ???? | +---------------------------------------+ xxx */ ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp; struct ffi_aix_trampoline_struct *tramp_aix; aix_fd *fd; switch (cif->abi) { case FFI_DARWIN: FFI_ASSERT (cif->abi == FFI_DARWIN); tramp = (unsigned int *) &closure->tramp[0]; tramp[0] = 0x7c0802a6; /* mflr r0 */ tramp[1] = 0x429f000d; /* bcl- 20,4*cr7+so,0x10 */ tramp[4] = 0x7d6802a6; /* mflr r11 */ tramp[5] = 0x818b0000; /* lwz r12,0(r11) function address */ tramp[6] = 0x7c0803a6; /* mtlr r0 */ tramp[7] = 0x7d8903a6; /* mtctr r12 */ tramp[8] = 0x816b0004; /* lwz r11,4(r11) static chain */ tramp[9] = 0x4e800420; /* bctr */ tramp[2] = (unsigned long) ffi_closure_ASM; /* function */ tramp[3] = (unsigned long) codeloc; /* context */ closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Flush the icache. Only necessary on Darwin. */ flush_range(codeloc, FFI_TRAMPOLINE_SIZE); break; case FFI_AIX: tramp_aix = (struct ffi_aix_trampoline_struct *) (closure->tramp); fd = (aix_fd *)(void *)ffi_closure_ASM; FFI_ASSERT (cif->abi == FFI_AIX); tramp_aix->code_pointer = fd->code_pointer; tramp_aix->toc = fd->toc; tramp_aix->static_chain = codeloc; closure->cif = cif; closure->fun = fun; closure->user_data = user_data; default: FFI_ASSERT(0); break; } return FFI_OK; } static void flush_icache(char *addr) { #ifndef _AIX __asm__ volatile ( "dcbf 0,%0\n" "\tsync\n" "\ticbi 0,%0\n" "\tsync\n" "\tisync" : : "r"(addr) : "memory"); #endif } static void flush_range(char * addr1, int size) { #define MIN_LINE_SIZE 32 int i; for (i = 0; i < size; i += MIN_LINE_SIZE) flush_icache(addr1+i); flush_icache(addr1+size-1); } typedef union { float f; double d; } ffi_dblfl; int ffi_closure_helper_DARWIN (ffi_closure *, void *, unsigned long *, ffi_dblfl *); /* Basically the trampoline invokes ffi_closure_ASM, and on entry, r11 holds the address of the closure. After storing the registers that could possibly contain parameters to be passed into the stack frame and setting up space for a return value, ffi_closure_ASM invokes the following helper function to do most of the work. */ int ffi_closure_helper_DARWIN (ffi_closure *closure, void *rvalue, unsigned long *pgr, ffi_dblfl *pfr) { /* rvalue is the pointer to space for return value in closure assembly pgr is the pointer to where r3-r10 are stored in ffi_closure_ASM pfr is the pointer to where f1-f13 are stored in ffi_closure_ASM. */ typedef double ldbits[2]; union ldu { ldbits lb; long double ld; }; void ** avalue; ffi_type ** arg_types; long i, avn; ffi_cif * cif; ffi_dblfl * end_pfr = pfr + NUM_FPR_ARG_REGISTERS; unsigned size_al; cif = closure->cif; avalue = alloca (cif->nargs * sizeof(void *)); /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. */ if (cif->rtype->type == FFI_TYPE_STRUCT) { rvalue = (void *) *pgr; pgr++; } i = 0; avn = cif->nargs; arg_types = cif->arg_types; /* Grab the addresses of the arguments from the stack frame. */ while (i < avn) { switch (arg_types[i]->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: #ifdef POWERPC64 avalue[i] = (char *) pgr + 7; #else avalue[i] = (char *) pgr + 3; #endif pgr++; break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: #ifdef POWERPC64 avalue[i] = (char *) pgr + 6; #else avalue[i] = (char *) pgr + 2; #endif pgr++; break; case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: #ifdef POWERPC64 avalue[i] = (char *) pgr + 4; #else case FFI_TYPE_POINTER: avalue[i] = pgr; #endif pgr++; break; case FFI_TYPE_STRUCT: #ifdef POWERPC64 size_al = arg_types[i]->size; if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN (arg_types[i]->size, 8); if (size_al < 3 && cif->abi == FFI_DARWIN) avalue[i] = (char *) pgr + 8 - size_al; else avalue[i] = pgr; pgr += (size_al + 7) / 8; #else /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, SI 4 bytes) are aligned as if they were those modes. */ size_al = arg_types[i]->size; /* If the first member of the struct is a double, then align the struct to double-word. */ if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) size_al = ALIGN(arg_types[i]->size, 8); if (size_al < 3 && cif->abi == FFI_DARWIN) avalue[i] = (char*) pgr + 4 - size_al; else avalue[i] = pgr; pgr += (size_al + 3) / 4; #endif break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: #ifdef POWERPC64 case FFI_TYPE_POINTER: avalue[i] = pgr; pgr++; break; #else /* Long long ints are passed in two gpr's. */ avalue[i] = pgr; pgr += 2; break; #endif case FFI_TYPE_FLOAT: /* A float value consumes a GPR. There are 13 64bit floating point registers. */ if (pfr < end_pfr) { double temp = pfr->d; pfr->f = (float) temp; avalue[i] = pfr; pfr++; } else { avalue[i] = pgr; } pgr++; break; case FFI_TYPE_DOUBLE: /* A double value consumes two GPRs. There are 13 64bit floating point registers. */ if (pfr < end_pfr) { avalue[i] = pfr; pfr++; } else { avalue[i] = pgr; } #ifdef POWERPC64 pgr++; #else pgr += 2; #endif break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #ifdef POWERPC64 if (pfr + 1 < end_pfr) { avalue[i] = pfr; pfr += 2; } else { if (pfr < end_pfr) { *pgr = *(unsigned long *) pfr; pfr++; } avalue[i] = pgr; } pgr += 2; #else /* POWERPC64 */ /* A long double value consumes four GPRs and two FPRs. There are 13 64bit floating point registers. */ if (pfr + 1 < end_pfr) { avalue[i] = pfr; pfr += 2; } /* Here we have the situation where one part of the long double is stored in fpr13 and the other part is already on the stack. We use a union to pass the long double to avalue[i]. */ else if (pfr + 1 == end_pfr) { union ldu temp_ld; memcpy (&temp_ld.lb[0], pfr, sizeof(ldbits)); memcpy (&temp_ld.lb[1], pgr + 2, sizeof(ldbits)); avalue[i] = &temp_ld.ld; pfr++; } else { avalue[i] = pgr; } pgr += 4; #endif /* POWERPC64 */ break; #endif default: FFI_ASSERT(0); } i++; } (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_ASM to perform return type promotions. */ return cif->rtype->type; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/ffitarget.h0000644000175000017500000000727411545150464023440 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Copyright (C) 2007, 2008 Free Software Foundation, Inc Target configuration macros for PowerPC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ #if defined (POWERPC) && defined (__powerpc64__) /* linux64 */ #ifndef POWERPC64 #define POWERPC64 #endif #elif defined (POWERPC_DARWIN) && defined (__ppc64__) /* Darwin */ #ifndef POWERPC64 #define POWERPC64 #endif #elif defined (POWERPC_AIX) && defined (__64BIT__) /* AIX64 */ #ifndef POWERPC64 #define POWERPC64 #endif #endif #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, #ifdef POWERPC FFI_SYSV, FFI_GCC_SYSV, FFI_LINUX64, FFI_LINUX, FFI_LINUX_SOFT_FLOAT, # ifdef POWERPC64 FFI_DEFAULT_ABI = FFI_LINUX64, # else # if (!defined(__NO_FPRS__) && (__LDBL_MANT_DIG__ == 106)) FFI_DEFAULT_ABI = FFI_LINUX, # else # ifdef __NO_FPRS__ FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT, # else FFI_DEFAULT_ABI = FFI_GCC_SYSV, # endif # endif # endif #endif #ifdef POWERPC_AIX FFI_AIX, FFI_DARWIN, FFI_DEFAULT_ABI = FFI_AIX, #endif #ifdef POWERPC_DARWIN FFI_AIX, FFI_DARWIN, FFI_DEFAULT_ABI = FFI_DARWIN, #endif #ifdef POWERPC_FREEBSD FFI_SYSV, FFI_GCC_SYSV, FFI_LINUX64, FFI_LINUX, FFI_LINUX_SOFT_FLOAT, FFI_DEFAULT_ABI = FFI_SYSV, #endif FFI_LAST_ABI } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 /* For additional types like the below, take care about the order in ppc_closures.S. They must follow after the FFI_TYPE_LAST. */ /* Needed for soft-float long-double-128 support. */ #define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1) /* Needed for FFI_SYSV small structure returns. We use two flag bits, (FLAG_SYSV_SMST_R3, FLAG_SYSV_SMST_R4) which are defined in ffi.c, to determine the exact return type and its size. */ #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2) #if defined(POWERPC64) || defined(POWERPC_AIX) #define FFI_TRAMPOLINE_SIZE 24 #else /* POWERPC || POWERPC_AIX */ #define FFI_TRAMPOLINE_SIZE 40 #endif #ifndef LIBFFI_ASM #if defined(POWERPC_DARWIN) || defined(POWERPC_AIX) struct ffi_aix_trampoline_struct { void * code_pointer; /* Pointer to ffi_closure_ASM */ void * toc; /* TOC */ void * static_chain; /* Pointer to closure */ }; #endif #endif #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/linux64.S0000644000175000017500000001156511545150464022747 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.h - Copyright (c) 2003 Jakub Jelinek Copyright (c) 2008 Red Hat, Inc. PowerPC64 Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef __powerpc64__ .hidden ffi_call_LINUX64, .ffi_call_LINUX64 .globl ffi_call_LINUX64, .ffi_call_LINUX64 .section ".opd","aw" .align 3 ffi_call_LINUX64: .quad .ffi_call_LINUX64,.TOC.@tocbase,0 .size ffi_call_LINUX64,24 .type .ffi_call_LINUX64,@function .text .ffi_call_LINUX64: .LFB1: mflr %r0 std %r28, -32(%r1) std %r29, -24(%r1) std %r30, -16(%r1) std %r31, -8(%r1) std %r0, 16(%r1) mr %r28, %r1 /* our AP. */ .LCFI0: stdux %r1, %r1, %r4 mr %r31, %r5 /* flags, */ mr %r30, %r6 /* rvalue, */ mr %r29, %r7 /* function address. */ std %r2, 40(%r1) /* Call ffi_prep_args64. */ mr %r4, %r1 bl .ffi_prep_args64 ld %r0, 0(%r29) ld %r2, 8(%r29) ld %r11, 16(%r29) /* Now do the call. */ /* Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40, %r31 /* Get the address to call into CTR. */ mtctr %r0 /* Load all those argument registers. */ ld %r3, -32-(8*8)(%r28) ld %r4, -32-(7*8)(%r28) ld %r5, -32-(6*8)(%r28) ld %r6, -32-(5*8)(%r28) bf- 5, 1f ld %r7, -32-(4*8)(%r28) ld %r8, -32-(3*8)(%r28) ld %r9, -32-(2*8)(%r28) ld %r10, -32-(1*8)(%r28) 1: /* Load all the FP registers. */ bf- 6, 2f lfd %f1, -32-(21*8)(%r28) lfd %f2, -32-(20*8)(%r28) lfd %f3, -32-(19*8)(%r28) lfd %f4, -32-(18*8)(%r28) lfd %f5, -32-(17*8)(%r28) lfd %f6, -32-(16*8)(%r28) lfd %f7, -32-(15*8)(%r28) lfd %f8, -32-(14*8)(%r28) lfd %f9, -32-(13*8)(%r28) lfd %f10, -32-(12*8)(%r28) lfd %f11, -32-(11*8)(%r28) lfd %f12, -32-(10*8)(%r28) lfd %f13, -32-(9*8)(%r28) 2: /* Make the call. */ bctrl /* This must follow the call immediately, the unwinder uses this to find out if r2 has been saved or not. */ ld %r2, 40(%r1) /* Now, deal with the return value. */ mtcrf 0x01, %r31 bt- 30, .Ldone_return_value bt- 29, .Lfp_return_value std %r3, 0(%r30) /* Fall through... */ .Ldone_return_value: /* Restore the registers we used and return. */ mr %r1, %r28 ld %r0, 16(%r28) ld %r28, -32(%r1) mtlr %r0 ld %r29, -24(%r1) ld %r30, -16(%r1) ld %r31, -8(%r1) blr .Lfp_return_value: bf 28, .Lfloat_return_value stfd %f1, 0(%r30) mtcrf 0x02, %r31 /* cr6 */ bf 27, .Ldone_return_value stfd %f2, 8(%r30) b .Ldone_return_value .Lfloat_return_value: stfs %f1, 0(%r30) b .Ldone_return_value .LFE1: .long 0 .byte 0,12,0,1,128,4,0,0 .size .ffi_call_LINUX64,.-.ffi_call_LINUX64 .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry .LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .uleb128 0x1 # CIE Code Alignment Factor .sleb128 -8 # CIE Data Alignment Factor .byte 0x41 # CIE RA Column .uleb128 0x1 # Augmentation size .byte 0x14 # FDE Encoding (pcrel udata8) .byte 0xc # DW_CFA_def_cfa .uleb128 0x1 .uleb128 0x0 .align 3 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 # FDE Length .LASFDE1: .4byte .LASFDE1-.Lframe1 # FDE CIE offset .8byte .LFB1-. # FDE initial location .8byte .LFE1-.LFB1 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x2 # DW_CFA_advance_loc1 .byte .LCFI0-.LFB1 .byte 0xd # DW_CFA_def_cfa_register .uleb128 0x1c .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x41 .sleb128 -2 .byte 0x9f # DW_CFA_offset, column 0x1f .uleb128 0x1 .byte 0x9e # DW_CFA_offset, column 0x1e .uleb128 0x2 .byte 0x9d # DW_CFA_offset, column 0x1d .uleb128 0x3 .byte 0x9c # DW_CFA_offset, column 0x1c .uleb128 0x4 .align 3 .LEFDE1: #endif #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/linux64_closure.S0000644000175000017500000001340311545150464024474 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.h - Copyright (c) 2003 Jakub Jelinek Copyright (c) 2008 Red Hat, Inc. PowerPC64 Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include .file "linux64_closure.S" #ifdef __powerpc64__ FFI_HIDDEN (ffi_closure_LINUX64) FFI_HIDDEN (.ffi_closure_LINUX64) .globl ffi_closure_LINUX64, .ffi_closure_LINUX64 .section ".opd","aw" .align 3 ffi_closure_LINUX64: .quad .ffi_closure_LINUX64,.TOC.@tocbase,0 .size ffi_closure_LINUX64,24 .type .ffi_closure_LINUX64,@function .text .ffi_closure_LINUX64: .LFB1: # save general regs into parm save area std %r3, 48(%r1) std %r4, 56(%r1) std %r5, 64(%r1) std %r6, 72(%r1) mflr %r0 std %r7, 80(%r1) std %r8, 88(%r1) std %r9, 96(%r1) std %r10, 104(%r1) std %r0, 16(%r1) # mandatory 48 bytes special reg save area + 64 bytes parm save area # + 16 bytes retval area + 13*8 bytes fpr save area + round to 16 stdu %r1, -240(%r1) .LCFI0: # next save fpr 1 to fpr 13 stfd %f1, 128+(0*8)(%r1) stfd %f2, 128+(1*8)(%r1) stfd %f3, 128+(2*8)(%r1) stfd %f4, 128+(3*8)(%r1) stfd %f5, 128+(4*8)(%r1) stfd %f6, 128+(5*8)(%r1) stfd %f7, 128+(6*8)(%r1) stfd %f8, 128+(7*8)(%r1) stfd %f9, 128+(8*8)(%r1) stfd %f10, 128+(9*8)(%r1) stfd %f11, 128+(10*8)(%r1) stfd %f12, 128+(11*8)(%r1) stfd %f13, 128+(12*8)(%r1) # set up registers for the routine that actually does the work # get the context pointer from the trampoline mr %r3, %r11 # now load up the pointer to the result storage addi %r4, %r1, 112 # now load up the pointer to the parameter save area # in the previous frame addi %r5, %r1, 240 + 48 # now load up the pointer to the saved fpr registers */ addi %r6, %r1, 128 # make the call bl .ffi_closure_helper_LINUX64 .Lret: # now r3 contains the return type # so use it to look up in a table # so we know how to deal with each type # look up the proper starting point in table # by using return type as offset mflr %r4 # move address of .Lret to r4 sldi %r3, %r3, 4 # now multiply return type by 16 addi %r4, %r4, .Lret_type0 - .Lret ld %r0, 240+16(%r1) add %r3, %r3, %r4 # add contents of table to table address mtctr %r3 bctr # jump to it # Each of the ret_typeX code fragments has to be exactly 16 bytes long # (4 instructions). For cache effectiveness we align to a 16 byte boundary # first. .align 4 .Lret_type0: # case FFI_TYPE_VOID mtlr %r0 addi %r1, %r1, 240 blr nop # case FFI_TYPE_INT lwa %r3, 112+4(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_FLOAT lfs %f1, 112+0(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_DOUBLE lfd %f1, 112+0(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_LONGDOUBLE lfd %f1, 112+0(%r1) mtlr %r0 lfd %f2, 112+8(%r1) b .Lfinish # case FFI_TYPE_UINT8 lbz %r3, 112+7(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_SINT8 lbz %r3, 112+7(%r1) extsb %r3,%r3 mtlr %r0 b .Lfinish # case FFI_TYPE_UINT16 lhz %r3, 112+6(%r1) mtlr %r0 .Lfinish: addi %r1, %r1, 240 blr # case FFI_TYPE_SINT16 lha %r3, 112+6(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_UINT32 lwz %r3, 112+4(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_SINT32 lwa %r3, 112+4(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_UINT64 ld %r3, 112+0(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_SINT64 ld %r3, 112+0(%r1) mtlr %r0 addi %r1, %r1, 240 blr # case FFI_TYPE_STRUCT mtlr %r0 addi %r1, %r1, 240 blr nop # case FFI_TYPE_POINTER ld %r3, 112+0(%r1) mtlr %r0 addi %r1, %r1, 240 blr # esac .LFE1: .long 0 .byte 0,12,0,1,128,0,0,0 .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64 .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry .LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .uleb128 0x1 # CIE Code Alignment Factor .sleb128 -8 # CIE Data Alignment Factor .byte 0x41 # CIE RA Column .uleb128 0x1 # Augmentation size .byte 0x14 # FDE Encoding (pcrel udata8) .byte 0xc # DW_CFA_def_cfa .uleb128 0x1 .uleb128 0x0 .align 3 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 # FDE Length .LASFDE1: .4byte .LASFDE1-.Lframe1 # FDE CIE offset .8byte .LFB1-. # FDE initial location .8byte .LFE1-.LFB1 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x2 # DW_CFA_advance_loc1 .byte .LCFI0-.LFB1 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 240 .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x41 .sleb128 -2 .align 3 .LEFDE1: #endif #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/ppc_closure.S0000644000175000017500000001573211545150464023754 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.h - Copyright (c) 2003 Jakub Jelinek Copyright (c) 2008 Red Hat, Inc. PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #include .file "ppc_closure.S" #ifndef __powerpc64__ ENTRY(ffi_closure_SYSV) .LFB1: stwu %r1,-144(%r1) .LCFI0: mflr %r0 .LCFI1: stw %r0,148(%r1) # we want to build up an areas for the parameters passed # in registers (both floating point and integer) # so first save gpr 3 to gpr 10 (aligned to 4) stw %r3, 16(%r1) stw %r4, 20(%r1) stw %r5, 24(%r1) stw %r6, 28(%r1) stw %r7, 32(%r1) stw %r8, 36(%r1) stw %r9, 40(%r1) stw %r10,44(%r1) #ifndef __NO_FPRS__ # next save fpr 1 to fpr 8 (aligned to 8) stfd %f1, 48(%r1) stfd %f2, 56(%r1) stfd %f3, 64(%r1) stfd %f4, 72(%r1) stfd %f5, 80(%r1) stfd %f6, 88(%r1) stfd %f7, 96(%r1) stfd %f8, 104(%r1) #endif # set up registers for the routine that actually does the work # get the context pointer from the trampoline mr %r3,%r11 # now load up the pointer to the result storage addi %r4,%r1,112 # now load up the pointer to the saved gpr registers addi %r5,%r1,16 # now load up the pointer to the saved fpr registers */ addi %r6,%r1,48 # now load up the pointer to the outgoing parameter # stack in the previous frame # i.e. the previous frame pointer + 8 addi %r7,%r1,152 # make the call bl ffi_closure_helper_SYSV@local .Lret: # now r3 contains the return type # so use it to look up in a table # so we know how to deal with each type # look up the proper starting point in table # by using return type as offset mflr %r4 # move address of .Lret to r4 slwi %r3,%r3,4 # now multiply return type by 16 addi %r4, %r4, .Lret_type0 - .Lret lwz %r0,148(%r1) add %r3,%r3,%r4 # add contents of table to table address mtctr %r3 bctr # jump to it .LFE1: # Each of the ret_typeX code fragments has to be exactly 16 bytes long # (4 instructions). For cache effectiveness we align to a 16 byte boundary # first. .align 4 # case FFI_TYPE_VOID .Lret_type0: mtlr %r0 addi %r1,%r1,144 blr nop # case FFI_TYPE_INT lwz %r3,112+0(%r1) mtlr %r0 .Lfinish: addi %r1,%r1,144 blr # case FFI_TYPE_FLOAT lfs %f1,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_DOUBLE lfd %f1,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_LONGDOUBLE lfd %f1,112+0(%r1) lfd %f2,112+8(%r1) mtlr %r0 b .Lfinish # case FFI_TYPE_UINT8 lbz %r3,112+3(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_SINT8 lbz %r3,112+3(%r1) extsb %r3,%r3 mtlr %r0 b .Lfinish # case FFI_TYPE_UINT16 lhz %r3,112+2(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_SINT16 lha %r3,112+2(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_UINT32 lwz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_SINT32 lwz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_UINT64 lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) mtlr %r0 b .Lfinish # case FFI_TYPE_SINT64 lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) mtlr %r0 b .Lfinish # case FFI_TYPE_STRUCT mtlr %r0 addi %r1,%r1,144 blr nop # case FFI_TYPE_POINTER lwz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_TYPE_UINT128 lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) lwz %r5,112+8(%r1) bl .Luint128 # The return types below are only used when the ABI type is FFI_SYSV. # case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct. lbz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_SYSV_TYPE_SMALL_STRUCT + 2. Two byte struct. lhz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_SYSV_TYPE_SMALL_STRUCT + 3. Three byte struct. lwz %r3,112+0(%r1) srwi %r3,%r3,8 mtlr %r0 b .Lfinish # case FFI_SYSV_TYPE_SMALL_STRUCT + 4. Four byte struct. lwz %r3,112+0(%r1) mtlr %r0 addi %r1,%r1,144 blr # case FFI_SYSV_TYPE_SMALL_STRUCT + 5. Five byte struct. lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) li %r5,24 b .Lstruct567 # case FFI_SYSV_TYPE_SMALL_STRUCT + 6. Six byte struct. lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) li %r5,16 b .Lstruct567 # case FFI_SYSV_TYPE_SMALL_STRUCT + 7. Seven byte struct. lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) li %r5,8 b .Lstruct567 # case FFI_SYSV_TYPE_SMALL_STRUCT + 8. Eight byte struct. lwz %r3,112+0(%r1) lwz %r4,112+4(%r1) mtlr %r0 b .Lfinish .Lstruct567: subfic %r6,%r5,32 srw %r4,%r4,%r5 slw %r6,%r3,%r6 srw %r3,%r3,%r5 or %r4,%r6,%r4 mtlr %r0 addi %r1,%r1,144 blr .Luint128: lwz %r6,112+12(%r1) mtlr %r0 addi %r1,%r1,144 blr END(ffi_closure_SYSV) .section ".eh_frame",EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry .LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version #if defined _RELOCATABLE || defined __PIC__ .ascii "zR\0" # CIE Augmentation #else .ascii "\0" # CIE Augmentation #endif .uleb128 0x1 # CIE Code Alignment Factor .sleb128 -4 # CIE Data Alignment Factor .byte 0x41 # CIE RA Column #if defined _RELOCATABLE || defined __PIC__ .uleb128 0x1 # Augmentation size .byte 0x1b # FDE Encoding (pcrel sdata4) #endif .byte 0xc # DW_CFA_def_cfa .uleb128 0x1 .uleb128 0x0 .align 2 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 # FDE Length .LASFDE1: .4byte .LASFDE1-.Lframe1 # FDE CIE offset #if defined _RELOCATABLE || defined __PIC__ .4byte .LFB1-. # FDE initial location #else .4byte .LFB1 # FDE initial location #endif .4byte .LFE1-.LFB1 # FDE address range #if defined _RELOCATABLE || defined __PIC__ .uleb128 0x0 # Augmentation size #endif .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI0-.LFB1 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 144 .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI1-.LCFI0 .byte 0x11 # DW_CFA_offset_extended_sf .uleb128 0x41 .sleb128 -1 .align 2 .LEFDE1: #endif #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/powerpc/sysv.S0000644000175000017500000001465411545150464022444 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 1998 Geoffrey Keating Copyright (C) 2007 Free Software Foundation, Inc PowerPC Assembly glue. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #include #ifndef __powerpc64__ .globl ffi_prep_args_SYSV ENTRY(ffi_call_SYSV) .LFB1: /* Save the old stack pointer as AP. */ mr %r8,%r1 .LCFI0: /* Allocate the stack space we need. */ stwux %r1,%r1,%r4 /* Save registers we use. */ mflr %r9 stw %r28,-16(%r8) .LCFI1: stw %r29,-12(%r8) .LCFI2: stw %r30, -8(%r8) .LCFI3: stw %r31, -4(%r8) .LCFI4: stw %r9, 4(%r8) .LCFI5: /* Save arguments over call... */ mr %r31,%r5 /* flags, */ mr %r30,%r6 /* rvalue, */ mr %r29,%r7 /* function address, */ mr %r28,%r8 /* our AP. */ .LCFI6: /* Call ffi_prep_args_SYSV. */ mr %r4,%r1 bl ffi_prep_args_SYSV@local /* Now do the call. */ /* Set up cr1 with bits 4-7 of the flags. */ mtcrf 0x40,%r31 /* Get the address to call into CTR. */ mtctr %r29 /* Load all those argument registers. */ lwz %r3,-16-(8*4)(%r28) lwz %r4,-16-(7*4)(%r28) lwz %r5,-16-(6*4)(%r28) lwz %r6,-16-(5*4)(%r28) bf- 5,1f nop lwz %r7,-16-(4*4)(%r28) lwz %r8,-16-(3*4)(%r28) lwz %r9,-16-(2*4)(%r28) lwz %r10,-16-(1*4)(%r28) nop 1: /* Load all the FP registers. */ bf- 6,2f lfd %f1,-16-(8*4)-(8*8)(%r28) lfd %f2,-16-(8*4)-(7*8)(%r28) lfd %f3,-16-(8*4)-(6*8)(%r28) lfd %f4,-16-(8*4)-(5*8)(%r28) nop lfd %f5,-16-(8*4)-(4*8)(%r28) lfd %f6,-16-(8*4)-(3*8)(%r28) lfd %f7,-16-(8*4)-(2*8)(%r28) lfd %f8,-16-(8*4)-(1*8)(%r28) 2: /* Make the call. */ bctrl /* Now, deal with the return value. */ mtcrf 0x01,%r31 /* cr7 */ bt- 31,L(small_struct_return_value) bt- 30,L(done_return_value) bt- 29,L(fp_return_value) stw %r3,0(%r30) bf+ 28,L(done_return_value) stw %r4,4(%r30) mtcrf 0x02,%r31 /* cr6 */ bf 27,L(done_return_value) stw %r5,8(%r30) stw %r6,12(%r30) /* Fall through... */ L(done_return_value): /* Restore the registers we used and return. */ lwz %r9, 4(%r28) lwz %r31, -4(%r28) mtlr %r9 lwz %r30, -8(%r28) lwz %r29,-12(%r28) lwz %r28,-16(%r28) lwz %r1,0(%r1) blr L(fp_return_value): bf 28,L(float_return_value) stfd %f1,0(%r30) mtcrf 0x02,%r31 /* cr6 */ bf 27,L(done_return_value) stfd %f2,8(%r30) b L(done_return_value) L(float_return_value): stfs %f1,0(%r30) b L(done_return_value) L(small_struct_return_value): extrwi %r6,%r31,2,19 /* number of bytes padding = shift/8 */ mtcrf 0x02,%r31 /* copy flags to cr[24:27] (cr6) */ extrwi %r5,%r31,5,19 /* r5 <- number of bits of padding */ subfic %r6,%r6,4 /* r6 <- number of useful bytes in r3 */ bf- 25,L(done_return_value) /* struct in r3 ? if not, done. */ /* smst_one_register: */ slw %r3,%r3,%r5 /* Left-justify value in r3 */ mtxer %r6 /* move byte count to XER ... */ stswx %r3,0,%r30 /* ... and store that many bytes */ bf+ 26,L(done_return_value) /* struct in r3:r4 ? */ add %r6,%r6,%r30 /* adjust pointer */ stswi %r4,%r6,4 /* store last four bytes */ b L(done_return_value) .LFE1: END(ffi_call_SYSV) .section ".eh_frame",EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .4byte 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #if defined _RELOCATABLE || defined __PIC__ .ascii "zR\0" /* CIE Augmentation */ #else .ascii "\0" /* CIE Augmentation */ #endif .uleb128 0x1 /* CIE Code Alignment Factor */ .sleb128 -4 /* CIE Data Alignment Factor */ .byte 0x41 /* CIE RA Column */ #if defined _RELOCATABLE || defined __PIC__ .uleb128 0x1 /* Augmentation size */ .byte 0x1b /* FDE Encoding (pcrel sdata4) */ #endif .byte 0xc /* DW_CFA_def_cfa */ .uleb128 0x1 .uleb128 0x0 .align 2 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .4byte .LASFDE1-.Lframe1 /* FDE CIE offset */ #if defined _RELOCATABLE || defined __PIC__ .4byte .LFB1-. /* FDE initial location */ #else .4byte .LFB1 /* FDE initial location */ #endif .4byte .LFE1-.LFB1 /* FDE address range */ #if defined _RELOCATABLE || defined __PIC__ .uleb128 0x0 /* Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI0-.LFB1 .byte 0xd /* DW_CFA_def_cfa_register */ .uleb128 0x08 .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI5-.LCFI0 .byte 0x11 /* DW_CFA_offset_extended_sf */ .uleb128 0x41 .sleb128 -1 .byte 0x9f /* DW_CFA_offset, column 0x1f */ .uleb128 0x1 .byte 0x9e /* DW_CFA_offset, column 0x1e */ .uleb128 0x2 .byte 0x9d /* DW_CFA_offset, column 0x1d */ .uleb128 0x3 .byte 0x9c /* DW_CFA_offset, column 0x1c */ .uleb128 0x4 .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI6-.LCFI5 .byte 0xd /* DW_CFA_def_cfa_register */ .uleb128 0x1c .align 2 .LEFDE1: #endif #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/s390/ffi.c0000644000175000017500000005456111545150464021244 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2000, 2007 Software AG Copyright (c) 2008 Red Hat, Inc S390 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /*====================================================================*/ /* Includes */ /* -------- */ /*====================================================================*/ #include #include #include #include /*====================== End of Includes =============================*/ /*====================================================================*/ /* Defines */ /* ------- */ /*====================================================================*/ /* Maximum number of GPRs available for argument passing. */ #define MAX_GPRARGS 5 /* Maximum number of FPRs available for argument passing. */ #ifdef __s390x__ #define MAX_FPRARGS 4 #else #define MAX_FPRARGS 2 #endif /* Round to multiple of 16. */ #define ROUND_SIZE(size) (((size) + 15) & ~15) /* If these values change, sysv.S must be adapted! */ #define FFI390_RET_VOID 0 #define FFI390_RET_STRUCT 1 #define FFI390_RET_FLOAT 2 #define FFI390_RET_DOUBLE 3 #define FFI390_RET_INT32 4 #define FFI390_RET_INT64 5 /*===================== End of Defines ===============================*/ /*====================================================================*/ /* Prototypes */ /* ---------- */ /*====================================================================*/ static void ffi_prep_args (unsigned char *, extended_cif *); void #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) __attribute__ ((visibility ("hidden"))) #endif ffi_closure_helper_SYSV (ffi_closure *, unsigned long *, unsigned long long *, unsigned long *); /*====================== End of Prototypes ===========================*/ /*====================================================================*/ /* Externals */ /* --------- */ /*====================================================================*/ extern void ffi_call_SYSV(unsigned, extended_cif *, void (*)(unsigned char *, extended_cif *), unsigned, void *, void (*fn)(void)); extern void ffi_closure_SYSV(void); /*====================== End of Externals ============================*/ /*====================================================================*/ /* */ /* Name - ffi_check_struct_type. */ /* */ /* Function - Determine if a structure can be passed within a */ /* general purpose or floating point register. */ /* */ /*====================================================================*/ static int ffi_check_struct_type (ffi_type *arg) { size_t size = arg->size; /* If the struct has just one element, look at that element to find out whether to consider the struct as floating point. */ while (arg->type == FFI_TYPE_STRUCT && arg->elements[0] && !arg->elements[1]) arg = arg->elements[0]; /* Structs of size 1, 2, 4, and 8 are passed in registers, just like the corresponding int/float types. */ switch (size) { case 1: return FFI_TYPE_UINT8; case 2: return FFI_TYPE_UINT16; case 4: if (arg->type == FFI_TYPE_FLOAT) return FFI_TYPE_FLOAT; else return FFI_TYPE_UINT32; case 8: if (arg->type == FFI_TYPE_DOUBLE) return FFI_TYPE_DOUBLE; else return FFI_TYPE_UINT64; default: break; } /* Other structs are passed via a pointer to the data. */ return FFI_TYPE_POINTER; } /*======================== End of Routine ============================*/ /*====================================================================*/ /* */ /* Name - ffi_prep_args. */ /* */ /* Function - Prepare parameters for call to function. */ /* */ /* ffi_prep_args is called by the assembly routine once stack space */ /* has been allocated for the function's arguments. */ /* */ /*====================================================================*/ static void ffi_prep_args (unsigned char *stack, extended_cif *ecif) { /* The stack space will be filled with those areas: FPR argument register save area (highest addresses) GPR argument register save area temporary struct copies overflow argument area (lowest addresses) We set up the following pointers: p_fpr: bottom of the FPR area (growing upwards) p_gpr: bottom of the GPR area (growing upwards) p_ov: bottom of the overflow area (growing upwards) p_struct: top of the struct copy area (growing downwards) All areas are kept aligned to twice the word size. */ int gpr_off = ecif->cif->bytes; int fpr_off = gpr_off + ROUND_SIZE (MAX_GPRARGS * sizeof (long)); unsigned long long *p_fpr = (unsigned long long *)(stack + fpr_off); unsigned long *p_gpr = (unsigned long *)(stack + gpr_off); unsigned char *p_struct = (unsigned char *)p_gpr; unsigned long *p_ov = (unsigned long *)stack; int n_fpr = 0; int n_gpr = 0; int n_ov = 0; ffi_type **ptr; void **p_argv = ecif->avalue; int i; /* If we returning a structure then we set the first parameter register to the address of where we are returning this structure. */ if (ecif->cif->flags == FFI390_RET_STRUCT) p_gpr[n_gpr++] = (unsigned long) ecif->rvalue; /* Now for the arguments. */ for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv++) { void *arg = *p_argv; int type = (*ptr)->type; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE /* 16-byte long double is passed like a struct. */ if (type == FFI_TYPE_LONGDOUBLE) type = FFI_TYPE_STRUCT; #endif /* Check how a structure type is passed. */ if (type == FFI_TYPE_STRUCT) { type = ffi_check_struct_type (*ptr); /* If we pass the struct via pointer, copy the data. */ if (type == FFI_TYPE_POINTER) { p_struct -= ROUND_SIZE ((*ptr)->size); memcpy (p_struct, (char *)arg, (*ptr)->size); arg = &p_struct; } } /* Now handle all primitive int/pointer/float data types. */ switch (type) { case FFI_TYPE_DOUBLE: if (n_fpr < MAX_FPRARGS) p_fpr[n_fpr++] = *(unsigned long long *) arg; else #ifdef __s390x__ p_ov[n_ov++] = *(unsigned long *) arg; #else p_ov[n_ov++] = ((unsigned long *) arg)[0], p_ov[n_ov++] = ((unsigned long *) arg)[1]; #endif break; case FFI_TYPE_FLOAT: if (n_fpr < MAX_FPRARGS) p_fpr[n_fpr++] = (long long) *(unsigned int *) arg << 32; else p_ov[n_ov++] = *(unsigned int *) arg; break; case FFI_TYPE_POINTER: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = (unsigned long)*(unsigned char **) arg; else p_ov[n_ov++] = (unsigned long)*(unsigned char **) arg; break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef __s390x__ if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(unsigned long *) arg; else p_ov[n_ov++] = *(unsigned long *) arg; #else if (n_gpr == MAX_GPRARGS-1) n_gpr = MAX_GPRARGS; if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = ((unsigned long *) arg)[0], p_gpr[n_gpr++] = ((unsigned long *) arg)[1]; else p_ov[n_ov++] = ((unsigned long *) arg)[0], p_ov[n_ov++] = ((unsigned long *) arg)[1]; #endif break; case FFI_TYPE_UINT32: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(unsigned int *) arg; else p_ov[n_ov++] = *(unsigned int *) arg; break; case FFI_TYPE_INT: case FFI_TYPE_SINT32: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(signed int *) arg; else p_ov[n_ov++] = *(signed int *) arg; break; case FFI_TYPE_UINT16: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(unsigned short *) arg; else p_ov[n_ov++] = *(unsigned short *) arg; break; case FFI_TYPE_SINT16: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(signed short *) arg; else p_ov[n_ov++] = *(signed short *) arg; break; case FFI_TYPE_UINT8: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(unsigned char *) arg; else p_ov[n_ov++] = *(unsigned char *) arg; break; case FFI_TYPE_SINT8: if (n_gpr < MAX_GPRARGS) p_gpr[n_gpr++] = *(signed char *) arg; else p_ov[n_ov++] = *(signed char *) arg; break; default: FFI_ASSERT (0); break; } } } /*======================== End of Routine ============================*/ /*====================================================================*/ /* */ /* Name - ffi_prep_cif_machdep. */ /* */ /* Function - Perform machine dependent CIF processing. */ /* */ /*====================================================================*/ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { size_t struct_size = 0; int n_gpr = 0; int n_fpr = 0; int n_ov = 0; ffi_type **ptr; int i; /* Determine return value handling. */ switch (cif->rtype->type) { /* Void is easy. */ case FFI_TYPE_VOID: cif->flags = FFI390_RET_VOID; break; /* Structures are returned via a hidden pointer. */ case FFI_TYPE_STRUCT: cif->flags = FFI390_RET_STRUCT; n_gpr++; /* We need one GPR to pass the pointer. */ break; /* Floating point values are returned in fpr 0. */ case FFI_TYPE_FLOAT: cif->flags = FFI390_RET_FLOAT; break; case FFI_TYPE_DOUBLE: cif->flags = FFI390_RET_DOUBLE; break; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: cif->flags = FFI390_RET_STRUCT; n_gpr++; break; #endif /* Integer values are returned in gpr 2 (and gpr 3 for 64-bit values on 31-bit machines). */ case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: cif->flags = FFI390_RET_INT64; break; case FFI_TYPE_POINTER: case FFI_TYPE_INT: case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: /* These are to be extended to word size. */ #ifdef __s390x__ cif->flags = FFI390_RET_INT64; #else cif->flags = FFI390_RET_INT32; #endif break; default: FFI_ASSERT (0); break; } /* Now for the arguments. */ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { int type = (*ptr)->type; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE /* 16-byte long double is passed like a struct. */ if (type == FFI_TYPE_LONGDOUBLE) type = FFI_TYPE_STRUCT; #endif /* Check how a structure type is passed. */ if (type == FFI_TYPE_STRUCT) { type = ffi_check_struct_type (*ptr); /* If we pass the struct via pointer, we must reserve space to copy its data for proper call-by-value semantics. */ if (type == FFI_TYPE_POINTER) struct_size += ROUND_SIZE ((*ptr)->size); } /* Now handle all primitive int/float data types. */ switch (type) { /* The first MAX_FPRARGS floating point arguments go in FPRs, the rest overflow to the stack. */ case FFI_TYPE_DOUBLE: if (n_fpr < MAX_FPRARGS) n_fpr++; else n_ov += sizeof (double) / sizeof (long); break; case FFI_TYPE_FLOAT: if (n_fpr < MAX_FPRARGS) n_fpr++; else n_ov++; break; /* On 31-bit machines, 64-bit integers are passed in GPR pairs, if one is still available, or else on the stack. If only one register is free, skip the register (it won't be used for any subsequent argument either). */ #ifndef __s390x__ case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: if (n_gpr == MAX_GPRARGS-1) n_gpr = MAX_GPRARGS; if (n_gpr < MAX_GPRARGS) n_gpr += 2; else n_ov += 2; break; #endif /* Everything else is passed in GPRs (until MAX_GPRARGS have been used) or overflows to the stack. */ default: if (n_gpr < MAX_GPRARGS) n_gpr++; else n_ov++; break; } } /* Total stack space as required for overflow arguments and temporary structure copies. */ cif->bytes = ROUND_SIZE (n_ov * sizeof (long)) + struct_size; return FFI_OK; } /*======================== End of Routine ============================*/ /*====================================================================*/ /* */ /* Name - ffi_call. */ /* */ /* Function - Call the FFI routine. */ /* */ /*====================================================================*/ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { int ret_type = cif->flags; extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; ecif.rvalue = rvalue; /* If we don't have a return value, we need to fake one. */ if (rvalue == NULL) { if (ret_type == FFI390_RET_STRUCT) ecif.rvalue = alloca (cif->rtype->size); else ret_type = FFI390_RET_VOID; } switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV (cif->bytes, &ecif, ffi_prep_args, ret_type, ecif.rvalue, fn); break; default: FFI_ASSERT (0); break; } } /*======================== End of Routine ============================*/ /*====================================================================*/ /* */ /* Name - ffi_closure_helper_SYSV. */ /* */ /* Function - Call a FFI closure target function. */ /* */ /*====================================================================*/ void ffi_closure_helper_SYSV (ffi_closure *closure, unsigned long *p_gpr, unsigned long long *p_fpr, unsigned long *p_ov) { unsigned long long ret_buffer; void *rvalue = &ret_buffer; void **avalue; void **p_arg; int n_gpr = 0; int n_fpr = 0; int n_ov = 0; ffi_type **ptr; int i; /* Allocate buffer for argument list pointers. */ p_arg = avalue = alloca (closure->cif->nargs * sizeof (void *)); /* If we returning a structure, pass the structure address directly to the target function. Otherwise, have the target function store the return value to the GPR save area. */ if (closure->cif->flags == FFI390_RET_STRUCT) rvalue = (void *) p_gpr[n_gpr++]; /* Now for the arguments. */ for (ptr = closure->cif->arg_types, i = closure->cif->nargs; i > 0; i--, p_arg++, ptr++) { int deref_struct_pointer = 0; int type = (*ptr)->type; #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE /* 16-byte long double is passed like a struct. */ if (type == FFI_TYPE_LONGDOUBLE) type = FFI_TYPE_STRUCT; #endif /* Check how a structure type is passed. */ if (type == FFI_TYPE_STRUCT) { type = ffi_check_struct_type (*ptr); /* If we pass the struct via pointer, remember to retrieve the pointer later. */ if (type == FFI_TYPE_POINTER) deref_struct_pointer = 1; } /* Pointers are passed like UINTs of the same size. */ if (type == FFI_TYPE_POINTER) #ifdef __s390x__ type = FFI_TYPE_UINT64; #else type = FFI_TYPE_UINT32; #endif /* Now handle all primitive int/float data types. */ switch (type) { case FFI_TYPE_DOUBLE: if (n_fpr < MAX_FPRARGS) *p_arg = &p_fpr[n_fpr++]; else *p_arg = &p_ov[n_ov], n_ov += sizeof (double) / sizeof (long); break; case FFI_TYPE_FLOAT: if (n_fpr < MAX_FPRARGS) *p_arg = &p_fpr[n_fpr++]; else *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; break; case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef __s390x__ if (n_gpr < MAX_GPRARGS) *p_arg = &p_gpr[n_gpr++]; else *p_arg = &p_ov[n_ov++]; #else if (n_gpr == MAX_GPRARGS-1) n_gpr = MAX_GPRARGS; if (n_gpr < MAX_GPRARGS) *p_arg = &p_gpr[n_gpr], n_gpr += 2; else *p_arg = &p_ov[n_ov], n_ov += 2; #endif break; case FFI_TYPE_INT: case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: if (n_gpr < MAX_GPRARGS) *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 4; else *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; break; case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: if (n_gpr < MAX_GPRARGS) *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 2; else *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 2; break; case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: if (n_gpr < MAX_GPRARGS) *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 1; else *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 1; break; default: FFI_ASSERT (0); break; } /* If this is a struct passed via pointer, we need to actually retrieve that pointer. */ if (deref_struct_pointer) *p_arg = *(void **)*p_arg; } /* Call the target function. */ (closure->fun) (closure->cif, rvalue, avalue, closure->user_data); /* Convert the return value. */ switch (closure->cif->rtype->type) { /* Void is easy, and so is struct. */ case FFI_TYPE_VOID: case FFI_TYPE_STRUCT: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #endif break; /* Floating point values are returned in fpr 0. */ case FFI_TYPE_FLOAT: p_fpr[0] = (long long) *(unsigned int *) rvalue << 32; break; case FFI_TYPE_DOUBLE: p_fpr[0] = *(unsigned long long *) rvalue; break; /* Integer values are returned in gpr 2 (and gpr 3 for 64-bit values on 31-bit machines). */ case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: #ifdef __s390x__ p_gpr[0] = *(unsigned long *) rvalue; #else p_gpr[0] = ((unsigned long *) rvalue)[0], p_gpr[1] = ((unsigned long *) rvalue)[1]; #endif break; case FFI_TYPE_POINTER: case FFI_TYPE_UINT32: case FFI_TYPE_UINT16: case FFI_TYPE_UINT8: p_gpr[0] = *(unsigned long *) rvalue; break; case FFI_TYPE_INT: case FFI_TYPE_SINT32: case FFI_TYPE_SINT16: case FFI_TYPE_SINT8: p_gpr[0] = *(signed long *) rvalue; break; default: FFI_ASSERT (0); break; } } /*======================== End of Routine ============================*/ /*====================================================================*/ /* */ /* Name - ffi_prep_closure_loc. */ /* */ /* Function - Prepare a FFI closure. */ /* */ /*====================================================================*/ ffi_status ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, void (*fun) (ffi_cif *, void *, void **, void *), void *user_data, void *codeloc) { FFI_ASSERT (cif->abi == FFI_SYSV); #ifndef __s390x__ *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ *(short *)&closure->tramp [2] = 0x9801; /* lm %r0,%r1,6(%r1) */ *(short *)&closure->tramp [4] = 0x1006; *(short *)&closure->tramp [6] = 0x07f1; /* br %r1 */ *(long *)&closure->tramp [8] = (long)codeloc; *(long *)&closure->tramp[12] = (long)&ffi_closure_SYSV; #else *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ *(short *)&closure->tramp [2] = 0xeb01; /* lmg %r0,%r1,14(%r1) */ *(short *)&closure->tramp [4] = 0x100e; *(short *)&closure->tramp [6] = 0x0004; *(short *)&closure->tramp [8] = 0x07f1; /* br %r1 */ *(long *)&closure->tramp[16] = (long)codeloc; *(long *)&closure->tramp[24] = (long)&ffi_closure_SYSV; #endif closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } /*======================== End of Routine ============================*/ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/s390/ffitarget.h0000644000175000017500000000367111545150464022454 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for S390. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H #if defined (__s390x__) #ifndef S390X #define S390X #endif #endif /* ---- System specific configurations ----------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #ifdef S390X #define FFI_TRAMPOLINE_SIZE 32 #else #define FFI_TRAMPOLINE_SIZE 16 #endif #define FFI_NATIVE_RAW_API 0 #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/s390/sysv.S0000644000175000017500000002504111545150464021453 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2000 Software AG Copyright (c) 2008 Red Hat, Inc. S390 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifndef __s390x__ .text # r2: cif->bytes # r3: &ecif # r4: ffi_prep_args # r5: ret_type # r6: ecif.rvalue # ov: fn # This assumes we are using gas. .globl ffi_call_SYSV .type ffi_call_SYSV,%function ffi_call_SYSV: .LFB1: stm %r6,%r15,24(%r15) # Save registers .LCFI0: basr %r13,0 # Set up base register .Lbase: lr %r11,%r15 # Set up frame pointer .LCFI1: sr %r15,%r2 ahi %r15,-96-48 # Allocate stack lr %r8,%r6 # Save ecif.rvalue sr %r9,%r9 ic %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address l %r7,96(%r11) # Load function address st %r11,0(%r15) # Set up back chain ahi %r11,-48 # Register save area .LCFI2: la %r2,96(%r15) # Save area # r3 already holds &ecif basr %r14,%r4 # Call ffi_prep_args lm %r2,%r6,0(%r11) # Load arguments ld %f0,32(%r11) ld %f2,40(%r11) la %r14,0(%r13,%r9) # Set return address br %r7 # ... and call function .LretNone: # Return void l %r4,48+56(%r11) lm %r6,%r15,48+24(%r11) br %r4 .LretFloat: l %r4,48+56(%r11) ste %f0,0(%r8) # Return float lm %r6,%r15,48+24(%r11) br %r4 .LretDouble: l %r4,48+56(%r11) std %f0,0(%r8) # Return double lm %r6,%r15,48+24(%r11) br %r4 .LretInt32: l %r4,48+56(%r11) st %r2,0(%r8) # Return int lm %r6,%r15,48+24(%r11) br %r4 .LretInt64: l %r4,48+56(%r11) stm %r2,%r3,0(%r8) # Return long long lm %r6,%r15,48+24(%r11) br %r4 .Ltable: .byte .LretNone-.Lbase # FFI390_RET_VOID .byte .LretNone-.Lbase # FFI390_RET_STRUCT .byte .LretFloat-.Lbase # FFI390_RET_FLOAT .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE .byte .LretInt32-.Lbase # FFI390_RET_INT32 .byte .LretInt64-.Lbase # FFI390_RET_INT64 .LFE1: .ffi_call_SYSV_end: .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV .globl ffi_closure_SYSV .type ffi_closure_SYSV,%function ffi_closure_SYSV: .LFB2: stm %r12,%r15,48(%r15) # Save registers .LCFI10: basr %r13,0 # Set up base register .Lcbase: stm %r2,%r6,8(%r15) # Save arguments std %f0,64(%r15) std %f2,72(%r15) lr %r1,%r15 # Set up stack frame ahi %r15,-96 .LCFI11: l %r12,.Lchelper-.Lcbase(%r13) # Get helper function lr %r2,%r0 # Closure la %r3,8(%r1) # GPRs la %r4,64(%r1) # FPRs la %r5,96(%r1) # Overflow st %r1,0(%r15) # Set up back chain bas %r14,0(%r12,%r13) # Call helper l %r4,96+56(%r15) ld %f0,96+64(%r15) # Load return registers lm %r2,%r3,96+8(%r15) lm %r12,%r15,96+48(%r15) br %r4 .align 4 .Lchelper: .long ffi_closure_helper_SYSV-.Lcbase .LFE2: .ffi_closure_SYSV_end: .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry .LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .uleb128 0x1 # CIE Code Alignment Factor .sleb128 -4 # CIE Data Alignment Factor .byte 0xe # CIE RA Column .uleb128 0x1 # Augmentation size .byte 0x1b # FDE Encoding (pcrel sdata4) .byte 0xc # DW_CFA_def_cfa .uleb128 0xf .uleb128 0x60 .align 4 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 # FDE Length .LASFDE1: .4byte .LASFDE1-.Lframe1 # FDE CIE offset .4byte .LFB1-. # FDE initial location .4byte .LFE1-.LFB1 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI0-.LFB1 .byte 0x8f # DW_CFA_offset, column 0xf .uleb128 0x9 .byte 0x8e # DW_CFA_offset, column 0xe .uleb128 0xa .byte 0x8d # DW_CFA_offset, column 0xd .uleb128 0xb .byte 0x8c # DW_CFA_offset, column 0xc .uleb128 0xc .byte 0x8b # DW_CFA_offset, column 0xb .uleb128 0xd .byte 0x8a # DW_CFA_offset, column 0xa .uleb128 0xe .byte 0x89 # DW_CFA_offset, column 0x9 .uleb128 0xf .byte 0x88 # DW_CFA_offset, column 0x8 .uleb128 0x10 .byte 0x87 # DW_CFA_offset, column 0x7 .uleb128 0x11 .byte 0x86 # DW_CFA_offset, column 0x6 .uleb128 0x12 .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI1-.LCFI0 .byte 0xd # DW_CFA_def_cfa_register .uleb128 0xb .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI2-.LCFI1 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0x90 .align 4 .LEFDE1: .LSFDE2: .4byte .LEFDE2-.LASFDE2 # FDE Length .LASFDE2: .4byte .LASFDE2-.Lframe1 # FDE CIE offset .4byte .LFB2-. # FDE initial location .4byte .LFE2-.LFB2 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI10-.LFB2 .byte 0x8f # DW_CFA_offset, column 0xf .uleb128 0x9 .byte 0x8e # DW_CFA_offset, column 0xe .uleb128 0xa .byte 0x8d # DW_CFA_offset, column 0xd .uleb128 0xb .byte 0x8c # DW_CFA_offset, column 0xc .uleb128 0xc .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI11-.LCFI10 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0xc0 .align 4 .LEFDE2: #else .text # r2: cif->bytes # r3: &ecif # r4: ffi_prep_args # r5: ret_type # r6: ecif.rvalue # ov: fn # This assumes we are using gas. .globl ffi_call_SYSV .type ffi_call_SYSV,%function ffi_call_SYSV: .LFB1: stmg %r6,%r15,48(%r15) # Save registers .LCFI0: larl %r13,.Lbase # Set up base register lgr %r11,%r15 # Set up frame pointer .LCFI1: sgr %r15,%r2 aghi %r15,-160-80 # Allocate stack lgr %r8,%r6 # Save ecif.rvalue llgc %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address lg %r7,160(%r11) # Load function address stg %r11,0(%r15) # Set up back chain aghi %r11,-80 # Register save area .LCFI2: la %r2,160(%r15) # Save area # r3 already holds &ecif basr %r14,%r4 # Call ffi_prep_args lmg %r2,%r6,0(%r11) # Load arguments ld %f0,48(%r11) ld %f2,56(%r11) ld %f4,64(%r11) ld %f6,72(%r11) la %r14,0(%r13,%r9) # Set return address br %r7 # ... and call function .Lbase: .LretNone: # Return void lg %r4,80+112(%r11) lmg %r6,%r15,80+48(%r11) br %r4 .LretFloat: lg %r4,80+112(%r11) ste %f0,0(%r8) # Return float lmg %r6,%r15,80+48(%r11) br %r4 .LretDouble: lg %r4,80+112(%r11) std %f0,0(%r8) # Return double lmg %r6,%r15,80+48(%r11) br %r4 .LretInt32: lg %r4,80+112(%r11) st %r2,0(%r8) # Return int lmg %r6,%r15,80+48(%r11) br %r4 .LretInt64: lg %r4,80+112(%r11) stg %r2,0(%r8) # Return long lmg %r6,%r15,80+48(%r11) br %r4 .Ltable: .byte .LretNone-.Lbase # FFI390_RET_VOID .byte .LretNone-.Lbase # FFI390_RET_STRUCT .byte .LretFloat-.Lbase # FFI390_RET_FLOAT .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE .byte .LretInt32-.Lbase # FFI390_RET_INT32 .byte .LretInt64-.Lbase # FFI390_RET_INT64 .LFE1: .ffi_call_SYSV_end: .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV .globl ffi_closure_SYSV .type ffi_closure_SYSV,%function ffi_closure_SYSV: .LFB2: stmg %r14,%r15,112(%r15) # Save registers .LCFI10: stmg %r2,%r6,16(%r15) # Save arguments std %f0,128(%r15) std %f2,136(%r15) std %f4,144(%r15) std %f6,152(%r15) lgr %r1,%r15 # Set up stack frame aghi %r15,-160 .LCFI11: lgr %r2,%r0 # Closure la %r3,16(%r1) # GPRs la %r4,128(%r1) # FPRs la %r5,160(%r1) # Overflow stg %r1,0(%r15) # Set up back chain brasl %r14,ffi_closure_helper_SYSV # Call helper lg %r14,160+112(%r15) ld %f0,160+128(%r15) # Load return registers lg %r2,160+16(%r15) la %r15,160(%r15) br %r14 .LFE2: .ffi_closure_SYSV_end: .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry .LSCIE1: .4byte 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .uleb128 0x1 # CIE Code Alignment Factor .sleb128 -8 # CIE Data Alignment Factor .byte 0xe # CIE RA Column .uleb128 0x1 # Augmentation size .byte 0x1b # FDE Encoding (pcrel sdata4) .byte 0xc # DW_CFA_def_cfa .uleb128 0xf .uleb128 0xa0 .align 8 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 # FDE Length .LASFDE1: .4byte .LASFDE1-.Lframe1 # FDE CIE offset .4byte .LFB1-. # FDE initial location .4byte .LFE1-.LFB1 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI0-.LFB1 .byte 0x8f # DW_CFA_offset, column 0xf .uleb128 0x5 .byte 0x8e # DW_CFA_offset, column 0xe .uleb128 0x6 .byte 0x8d # DW_CFA_offset, column 0xd .uleb128 0x7 .byte 0x8c # DW_CFA_offset, column 0xc .uleb128 0x8 .byte 0x8b # DW_CFA_offset, column 0xb .uleb128 0x9 .byte 0x8a # DW_CFA_offset, column 0xa .uleb128 0xa .byte 0x89 # DW_CFA_offset, column 0x9 .uleb128 0xb .byte 0x88 # DW_CFA_offset, column 0x8 .uleb128 0xc .byte 0x87 # DW_CFA_offset, column 0x7 .uleb128 0xd .byte 0x86 # DW_CFA_offset, column 0x6 .uleb128 0xe .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI1-.LCFI0 .byte 0xd # DW_CFA_def_cfa_register .uleb128 0xb .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI2-.LCFI1 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0xf0 .align 8 .LEFDE1: .LSFDE2: .4byte .LEFDE2-.LASFDE2 # FDE Length .LASFDE2: .4byte .LASFDE2-.Lframe1 # FDE CIE offset .4byte .LFB2-. # FDE initial location .4byte .LFE2-.LFB2 # FDE address range .uleb128 0x0 # Augmentation size .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI10-.LFB2 .byte 0x8f # DW_CFA_offset, column 0xf .uleb128 0x5 .byte 0x8e # DW_CFA_offset, column 0xe .uleb128 0x6 .byte 0x4 # DW_CFA_advance_loc4 .4byte .LCFI11-.LCFI10 .byte 0xe # DW_CFA_def_cfa_offset .uleb128 0x140 .align 8 .LEFDE2: #endif #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/sh/ffi.c0000644000175000017500000003562511545150464021160 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Kaz Kojima Copyright (c) 2008 Red Hat, Inc. SuperH Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #define NGREGARG 4 #if defined(__SH4__) #define NFREGARG 8 #endif #if defined(__HITACHI__) #define STRUCT_VALUE_ADDRESS_WITH_ARG 1 #else #define STRUCT_VALUE_ADDRESS_WITH_ARG 0 #endif /* If the structure has essentialy an unique element, return its type. */ static int simple_type (ffi_type *arg) { if (arg->type != FFI_TYPE_STRUCT) return arg->type; else if (arg->elements[1]) return FFI_TYPE_STRUCT; return simple_type (arg->elements[0]); } static int return_type (ffi_type *arg) { unsigned short type; if (arg->type != FFI_TYPE_STRUCT) return arg->type; type = simple_type (arg->elements[0]); if (! arg->elements[1]) { switch (type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: return FFI_TYPE_INT; default: return type; } } /* gcc uses r0/r1 pair for some kind of structures. */ if (arg->size <= 2 * sizeof (int)) { int i = 0; ffi_type *e; while ((e = arg->elements[i++])) { type = simple_type (e); switch (type) { case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_INT: case FFI_TYPE_FLOAT: return FFI_TYPE_UINT64; default: break; } } } return FFI_TYPE_STRUCT; } /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void ffi_prep_args(char *stack, extended_cif *ecif) { register unsigned int i; register int tmp; register unsigned int avn; register void **p_argv; register char *argp; register ffi_type **p_arg; int greg, ireg; #if defined(__SH4__) int freg = 0; #endif tmp = 0; argp = stack; if (return_type (ecif->cif->rtype) == FFI_TYPE_STRUCT) { *(void **) argp = ecif->rvalue; argp += 4; ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0; } else ireg = 0; /* Set arguments for registers. */ greg = ireg; avn = ecif->cif->nargs; p_argv = ecif->avalue; for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) { size_t z; z = (*p_arg)->size; if (z < sizeof(int)) { if (greg++ >= NGREGARG) continue; z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; case FFI_TYPE_STRUCT: *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); break; default: FFI_ASSERT(0); } argp += z; } else if (z == sizeof(int)) { #if defined(__SH4__) if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (freg++ >= NFREGARG) continue; } else #endif { if (greg++ >= NGREGARG) continue; } *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); argp += z; } #if defined(__SH4__) else if ((*p_arg)->type == FFI_TYPE_DOUBLE) { if (freg + 1 >= NFREGARG) continue; freg = (freg + 1) & ~1; freg += 2; memcpy (argp, *p_argv, z); argp += z; } #endif else { int n = (z + sizeof (int) - 1) / sizeof (int); #if defined(__SH4__) if (greg + n - 1 >= NGREGARG) continue; #else if (greg >= NGREGARG) continue; #endif greg += n; memcpy (argp, *p_argv, z); argp += n * sizeof (int); } } /* Set arguments on stack. */ greg = ireg; #if defined(__SH4__) freg = 0; #endif p_argv = ecif->avalue; for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) { size_t z; z = (*p_arg)->size; if (z < sizeof(int)) { if (greg++ < NGREGARG) continue; z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); break; case FFI_TYPE_STRUCT: *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); break; default: FFI_ASSERT(0); } argp += z; } else if (z == sizeof(int)) { #if defined(__SH4__) if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (freg++ < NFREGARG) continue; } else #endif { if (greg++ < NGREGARG) continue; } *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); argp += z; } #if defined(__SH4__) else if ((*p_arg)->type == FFI_TYPE_DOUBLE) { if (freg + 1 < NFREGARG) { freg = (freg + 1) & ~1; freg += 2; continue; } memcpy (argp, *p_argv, z); argp += z; } #endif else { int n = (z + sizeof (int) - 1) / sizeof (int); if (greg + n - 1 < NGREGARG) { greg += n; continue; } #if (! defined(__SH4__)) else if (greg < NGREGARG) { greg = NGREGARG; continue; } #endif memcpy (argp, *p_argv, z); argp += n * sizeof (int); } } return; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { int i, j; int size, type; int n, m; int greg; #if defined(__SH4__) int freg = 0; #endif cif->flags = 0; greg = ((return_type (cif->rtype) == FFI_TYPE_STRUCT) && STRUCT_VALUE_ADDRESS_WITH_ARG) ? 1 : 0; #if defined(__SH4__) for (i = j = 0; i < cif->nargs && j < 12; i++) { type = (cif->arg_types)[i]->type; switch (type) { case FFI_TYPE_FLOAT: if (freg >= NFREGARG) continue; freg++; cif->flags += ((cif->arg_types)[i]->type) << (2 * j); j++; break; case FFI_TYPE_DOUBLE: if ((freg + 1) >= NFREGARG) continue; freg = (freg + 1) & ~1; freg += 2; cif->flags += ((cif->arg_types)[i]->type) << (2 * j); j++; break; default: size = (cif->arg_types)[i]->size; n = (size + sizeof (int) - 1) / sizeof (int); if (greg + n - 1 >= NGREGARG) continue; greg += n; for (m = 0; m < n; m++) cif->flags += FFI_TYPE_INT << (2 * j++); break; } } #else for (i = j = 0; i < cif->nargs && j < 4; i++) { size = (cif->arg_types)[i]->size; n = (size + sizeof (int) - 1) / sizeof (int); if (greg >= NGREGARG) continue; else if (greg + n - 1 >= NGREGARG) n = NGREGARG - greg; greg += n; for (m = 0; m < n; m++) cif->flags += FFI_TYPE_INT << (2 * j++); } #endif /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_STRUCT: cif->flags += (unsigned) (return_type (cif->rtype)) << 24; break; case FFI_TYPE_VOID: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags += (unsigned) cif->rtype->type << 24; break; default: cif->flags += FFI_TYPE_INT << 24; break; } return FFI_OK; } extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; UINT64 trvalue; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if (cif->rtype->type == FFI_TYPE_STRUCT && return_type (cif->rtype) != FFI_TYPE_STRUCT) ecif.rvalue = &trvalue; else if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; default: FFI_ASSERT(0); break; } if (rvalue && cif->rtype->type == FFI_TYPE_STRUCT && return_type (cif->rtype) != FFI_TYPE_STRUCT) memcpy (rvalue, &trvalue, cif->rtype->size); } extern void ffi_closure_SYSV (void); #if defined(__SH4__) extern void __ic_invalidate (void *line); #endif ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp; unsigned int insn; FFI_ASSERT (cif->abi == FFI_GCC_SYSV); tramp = (unsigned int *) &closure->tramp[0]; /* Set T bit if the function returns a struct pointed with R2. */ insn = (return_type (cif->rtype) == FFI_TYPE_STRUCT ? 0x0018 /* sett */ : 0x0008 /* clrt */); #ifdef __LITTLE_ENDIAN__ tramp[0] = 0xd301d102; tramp[1] = 0x0000412b | (insn << 16); #else tramp[0] = 0xd102d301; tramp[1] = 0x412b0000 | insn; #endif *(void **) &tramp[2] = (void *)codeloc; /* ctx */ *(void **) &tramp[3] = (void *)ffi_closure_SYSV; /* funaddr */ closure->cif = cif; closure->fun = fun; closure->user_data = user_data; #if defined(__SH4__) /* Flush the icache. */ __ic_invalidate(codeloc); #endif return FFI_OK; } /* Basically the trampoline invokes ffi_closure_SYSV, and on * entry, r3 holds the address of the closure. * After storing the registers that could possibly contain * parameters to be passed into the stack frame and setting * up space for a return value, ffi_closure_SYSV invokes the * following helper function to do most of the work. */ #ifdef __LITTLE_ENDIAN__ #define OFS_INT8 0 #define OFS_INT16 0 #else #define OFS_INT8 3 #define OFS_INT16 2 #endif int ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, unsigned long *pgr, unsigned long *pfr, unsigned long *pst) { void **avalue; ffi_type **p_arg; int i, avn; int ireg, greg = 0; #if defined(__SH4__) int freg = 0; #endif ffi_cif *cif; cif = closure->cif; avalue = alloca(cif->nargs * sizeof(void *)); /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. */ if (cif->rtype->type == FFI_TYPE_STRUCT && STRUCT_VALUE_ADDRESS_WITH_ARG) { rvalue = (void *) *pgr++; ireg = 1; } else ireg = 0; cif = closure->cif; greg = ireg; avn = cif->nargs; /* Grab the addresses of the arguments from the stack frame. */ for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) { size_t z; z = (*p_arg)->size; if (z < sizeof(int)) { if (greg++ >= NGREGARG) continue; z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = (((char *)pgr) + OFS_INT8); break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = (((char *)pgr) + OFS_INT16); break; case FFI_TYPE_STRUCT: avalue[i] = pgr; break; default: FFI_ASSERT(0); } pgr++; } else if (z == sizeof(int)) { #if defined(__SH4__) if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (freg++ >= NFREGARG) continue; avalue[i] = pfr; pfr++; } else #endif { if (greg++ >= NGREGARG) continue; avalue[i] = pgr; pgr++; } } #if defined(__SH4__) else if ((*p_arg)->type == FFI_TYPE_DOUBLE) { if (freg + 1 >= NFREGARG) continue; if (freg & 1) pfr++; freg = (freg + 1) & ~1; freg += 2; avalue[i] = pfr; pfr += 2; } #endif else { int n = (z + sizeof (int) - 1) / sizeof (int); #if defined(__SH4__) if (greg + n - 1 >= NGREGARG) continue; #else if (greg >= NGREGARG) continue; #endif greg += n; avalue[i] = pgr; pgr += n; } } greg = ireg; #if defined(__SH4__) freg = 0; #endif for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) { size_t z; z = (*p_arg)->size; if (z < sizeof(int)) { if (greg++ < NGREGARG) continue; z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: avalue[i] = (((char *)pst) + OFS_INT8); break; case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: avalue[i] = (((char *)pst) + OFS_INT16); break; case FFI_TYPE_STRUCT: avalue[i] = pst; break; default: FFI_ASSERT(0); } pst++; } else if (z == sizeof(int)) { #if defined(__SH4__) if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (freg++ < NFREGARG) continue; } else #endif { if (greg++ < NGREGARG) continue; } avalue[i] = pst; pst++; } #if defined(__SH4__) else if ((*p_arg)->type == FFI_TYPE_DOUBLE) { if (freg + 1 < NFREGARG) { freg = (freg + 1) & ~1; freg += 2; continue; } avalue[i] = pst; pst += 2; } #endif else { int n = (z + sizeof (int) - 1) / sizeof (int); if (greg + n - 1 < NGREGARG) { greg += n; continue; } #if (! defined(__SH4__)) else if (greg < NGREGARG) { greg += n; pst += greg - NGREGARG; continue; } #endif avalue[i] = pst; pst += n; } } (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_SYSV how to perform return type promotions. */ return return_type (cif->rtype); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/sh/ffitarget.h0000644000175000017500000000335711545150464022371 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SuperH. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #endif #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 16 #define FFI_NATIVE_RAW_API 0 #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/sh/sysv.S0000644000175000017500000003453711545150464021401 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2002, 2003, 2004, 2006, 2008 Kaz Kojima SuperH Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef HAVE_MACHINE_ASM_H #include #else /* XXX these lose for some platforms, I'm sure. */ #define CNAME(x) x #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): #endif #if defined(__HITACHI__) #define STRUCT_VALUE_ADDRESS_WITH_ARG 1 #else #define STRUCT_VALUE_ADDRESS_WITH_ARG 0 #endif .text # r4: ffi_prep_args # r5: &ecif # r6: bytes # r7: flags # sp+0: rvalue # sp+4: fn # This assumes we are using gas. ENTRY(ffi_call_SYSV) # Save registers .LFB1: mov.l r8,@-r15 .LCFI0: mov.l r9,@-r15 .LCFI1: mov.l r10,@-r15 .LCFI2: mov.l r12,@-r15 .LCFI3: mov.l r14,@-r15 .LCFI4: sts.l pr,@-r15 .LCFI5: mov r15,r14 .LCFI6: #if defined(__SH4__) mov r6,r8 mov r7,r9 sub r6,r15 add #-16,r15 mov #~7,r0 and r0,r15 mov r4,r0 jsr @r0 mov r15,r4 mov r9,r1 shlr8 r9 shlr8 r9 shlr8 r9 mov #FFI_TYPE_STRUCT,r2 cmp/eq r2,r9 bf 1f #if STRUCT_VALUE_ADDRESS_WITH_ARG mov.l @r15+,r4 bra 2f mov #5,r2 #else mov.l @r15+,r10 #endif 1: mov #4,r2 2: mov #4,r3 L_pass: cmp/pl r8 bf L_call_it mov r1,r0 and #3,r0 L_pass_d: cmp/eq #FFI_TYPE_DOUBLE,r0 bf L_pass_f mov r3,r0 and #1,r0 tst r0,r0 bt 1f add #1,r3 1: mov #12,r0 cmp/hs r0,r3 bt/s 3f shlr2 r1 bsr L_pop_d nop 3: add #2,r3 bra L_pass add #-8,r8 L_pop_d: mov r3,r0 add r0,r0 add r3,r0 add #-12,r0 braf r0 nop #ifdef __LITTLE_ENDIAN__ fmov.s @r15+,fr5 rts fmov.s @r15+,fr4 fmov.s @r15+,fr7 rts fmov.s @r15+,fr6 fmov.s @r15+,fr9 rts fmov.s @r15+,fr8 fmov.s @r15+,fr11 rts fmov.s @r15+,fr10 #else fmov.s @r15+,fr4 rts fmov.s @r15+,fr5 fmov.s @r15+,fr6 rts fmov.s @r15+,fr7 fmov.s @r15+,fr8 rts fmov.s @r15+,fr9 fmov.s @r15+,fr10 rts fmov.s @r15+,fr11 #endif L_pass_f: cmp/eq #FFI_TYPE_FLOAT,r0 bf L_pass_i mov #12,r0 cmp/hs r0,r3 bt/s 2f shlr2 r1 bsr L_pop_f nop 2: add #1,r3 bra L_pass add #-4,r8 L_pop_f: mov r3,r0 shll2 r0 add #-16,r0 braf r0 nop #ifdef __LITTLE_ENDIAN__ rts fmov.s @r15+,fr5 rts fmov.s @r15+,fr4 rts fmov.s @r15+,fr7 rts fmov.s @r15+,fr6 rts fmov.s @r15+,fr9 rts fmov.s @r15+,fr8 rts fmov.s @r15+,fr11 rts fmov.s @r15+,fr10 #else rts fmov.s @r15+,fr4 rts fmov.s @r15+,fr5 rts fmov.s @r15+,fr6 rts fmov.s @r15+,fr7 rts fmov.s @r15+,fr8 rts fmov.s @r15+,fr9 rts fmov.s @r15+,fr10 rts fmov.s @r15+,fr11 #endif L_pass_i: cmp/eq #FFI_TYPE_INT,r0 bf L_call_it mov #8,r0 cmp/hs r0,r2 bt/s 2f shlr2 r1 bsr L_pop_i nop 2: add #1,r2 bra L_pass add #-4,r8 L_pop_i: mov r2,r0 shll2 r0 add #-16,r0 braf r0 nop rts mov.l @r15+,r4 rts mov.l @r15+,r5 rts mov.l @r15+,r6 rts mov.l @r15+,r7 L_call_it: # call function #if (! STRUCT_VALUE_ADDRESS_WITH_ARG) mov r10, r2 #endif mov.l @(28,r14),r1 jsr @r1 nop L_ret_d: mov #FFI_TYPE_DOUBLE,r2 cmp/eq r2,r9 bf L_ret_ll mov.l @(24,r14),r1 #ifdef __LITTLE_ENDIAN__ fmov.s fr1,@r1 add #4,r1 bra L_epilogue fmov.s fr0,@r1 #else fmov.s fr0,@r1 add #4,r1 bra L_epilogue fmov.s fr1,@r1 #endif L_ret_ll: mov #FFI_TYPE_SINT64,r2 cmp/eq r2,r9 bt/s 1f mov #FFI_TYPE_UINT64,r2 cmp/eq r2,r9 bf L_ret_f 1: mov.l @(24,r14),r2 mov.l r0,@r2 bra L_epilogue mov.l r1,@(4,r2) L_ret_f: mov #FFI_TYPE_FLOAT,r2 cmp/eq r2,r9 bf L_ret_i mov.l @(24,r14),r1 bra L_epilogue fmov.s fr0,@r1 L_ret_i: mov #FFI_TYPE_INT,r2 cmp/eq r2,r9 bf L_epilogue mov.l @(24,r14),r1 bra L_epilogue mov.l r0,@r1 L_epilogue: # Remove the space we pushed for the args mov r14,r15 lds.l @r15+,pr mov.l @r15+,r14 mov.l @r15+,r12 mov.l @r15+,r10 mov.l @r15+,r9 rts mov.l @r15+,r8 #else mov r6,r8 mov r7,r9 sub r6,r15 add #-16,r15 mov #~7,r0 and r0,r15 mov r4,r0 jsr @r0 mov r15,r4 mov r9,r3 shlr8 r9 shlr8 r9 shlr8 r9 mov #FFI_TYPE_STRUCT,r2 cmp/eq r2,r9 bf 1f #if STRUCT_VALUE_ADDRESS_WITH_ARG mov.l @r15+,r4 bra 2f mov #5,r2 #else mov.l @r15+,r10 #endif 1: mov #4,r2 2: L_pass: cmp/pl r8 bf L_call_it mov r3,r0 and #3,r0 L_pass_d: cmp/eq #FFI_TYPE_DOUBLE,r0 bf L_pass_i mov r15,r0 and #7,r0 tst r0,r0 bt 1f add #4,r15 1: mov #8,r0 cmp/hs r0,r2 bt/s 2f shlr2 r3 bsr L_pop_d nop 2: add #2,r2 bra L_pass add #-8,r8 L_pop_d: mov r2,r0 add r0,r0 add r2,r0 add #-12,r0 add r0,r0 braf r0 nop mov.l @r15+,r4 rts mov.l @r15+,r5 mov.l @r15+,r5 rts mov.l @r15+,r6 mov.l @r15+,r6 rts mov.l @r15+,r7 rts mov.l @r15+,r7 L_pass_i: cmp/eq #FFI_TYPE_INT,r0 bf L_call_it mov #8,r0 cmp/hs r0,r2 bt/s 2f shlr2 r3 bsr L_pop_i nop 2: add #1,r2 bra L_pass add #-4,r8 L_pop_i: mov r2,r0 shll2 r0 add #-16,r0 braf r0 nop rts mov.l @r15+,r4 rts mov.l @r15+,r5 rts mov.l @r15+,r6 rts mov.l @r15+,r7 L_call_it: # call function #if (! STRUCT_VALUE_ADDRESS_WITH_ARG) mov r10, r2 #endif mov.l @(28,r14),r1 jsr @r1 nop L_ret_d: mov #FFI_TYPE_DOUBLE,r2 cmp/eq r2,r9 bf L_ret_ll mov.l @(24,r14),r2 mov.l r0,@r2 bra L_epilogue mov.l r1,@(4,r2) L_ret_ll: mov #FFI_TYPE_SINT64,r2 cmp/eq r2,r9 bt/s 1f mov #FFI_TYPE_UINT64,r2 cmp/eq r2,r9 bf L_ret_i 1: mov.l @(24,r14),r2 mov.l r0,@r2 bra L_epilogue mov.l r1,@(4,r2) L_ret_i: mov #FFI_TYPE_FLOAT,r2 cmp/eq r2,r9 bt 1f mov #FFI_TYPE_INT,r2 cmp/eq r2,r9 bf L_epilogue 1: mov.l @(24,r14),r1 bra L_epilogue mov.l r0,@r1 L_epilogue: # Remove the space we pushed for the args mov r14,r15 lds.l @r15+,pr mov.l @r15+,r14 mov.l @r15+,r12 mov.l @r15+,r10 mov.l @r15+,r9 rts mov.l @r15+,r8 #endif .LFE1: .ffi_call_SYSV_end: .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) .globl ffi_closure_helper_SYSV ENTRY(ffi_closure_SYSV) .LFB2: mov.l r7,@-r15 .LCFI7: mov.l r6,@-r15 .LCFI8: mov.l r5,@-r15 .LCFI9: mov.l r4,@-r15 .LCFIA: mov.l r14,@-r15 .LCFIB: sts.l pr,@-r15 /* Stack layout: xx bytes (on stack parameters) 16 bytes (register parameters) 4 bytes (saved frame pointer) 4 bytes (saved return address) 32 bytes (floating register parameters, SH-4 only) 8 bytes (result) 4 bytes (pad) 4 bytes (5th arg) <- new stack pointer */ .LCFIC: #if defined(__SH4__) add #-48,r15 #else add #-16,r15 #endif .LCFID: mov r15,r14 .LCFIE: #if defined(__SH4__) mov r14,r1 add #48,r1 #ifdef __LITTLE_ENDIAN__ fmov.s fr10,@-r1 fmov.s fr11,@-r1 fmov.s fr8,@-r1 fmov.s fr9,@-r1 fmov.s fr6,@-r1 fmov.s fr7,@-r1 fmov.s fr4,@-r1 fmov.s fr5,@-r1 #else fmov.s fr11,@-r1 fmov.s fr10,@-r1 fmov.s fr9,@-r1 fmov.s fr8,@-r1 fmov.s fr7,@-r1 fmov.s fr6,@-r1 fmov.s fr5,@-r1 fmov.s fr4,@-r1 #endif mov r1,r7 mov r14,r6 add #56,r6 #else mov r14,r6 add #24,r6 #endif bt/s 10f mov r2, r5 mov r14,r1 add #8,r1 mov r1,r5 10: mov r14,r1 #if defined(__SH4__) add #72,r1 #else add #40,r1 #endif mov.l r1,@r14 #ifdef PIC mov.l L_got,r1 mova L_got,r0 add r0,r1 mov.l L_helper,r0 add r1,r0 #else mov.l L_helper,r0 #endif jsr @r0 mov r3,r4 shll r0 mov r0,r1 mova L_table,r0 add r1,r0 mov.w @r0,r0 mov r14,r2 braf r0 add #8,r2 0: .align 2 #ifdef PIC L_got: .long _GLOBAL_OFFSET_TABLE_ L_helper: .long ffi_closure_helper_SYSV@GOTOFF #else L_helper: .long ffi_closure_helper_SYSV #endif L_table: .short L_case_v - 0b /* FFI_TYPE_VOID */ .short L_case_i - 0b /* FFI_TYPE_INT */ #if defined(__SH4__) .short L_case_f - 0b /* FFI_TYPE_FLOAT */ .short L_case_d - 0b /* FFI_TYPE_DOUBLE */ .short L_case_d - 0b /* FFI_TYPE_LONGDOUBLE */ #else .short L_case_i - 0b /* FFI_TYPE_FLOAT */ .short L_case_ll - 0b /* FFI_TYPE_DOUBLE */ .short L_case_ll - 0b /* FFI_TYPE_LONGDOUBLE */ #endif .short L_case_uq - 0b /* FFI_TYPE_UINT8 */ .short L_case_q - 0b /* FFI_TYPE_SINT8 */ .short L_case_uh - 0b /* FFI_TYPE_UINT16 */ .short L_case_h - 0b /* FFI_TYPE_SINT16 */ .short L_case_i - 0b /* FFI_TYPE_UINT32 */ .short L_case_i - 0b /* FFI_TYPE_SINT32 */ .short L_case_ll - 0b /* FFI_TYPE_UINT64 */ .short L_case_ll - 0b /* FFI_TYPE_SINT64 */ .short L_case_v - 0b /* FFI_TYPE_STRUCT */ .short L_case_i - 0b /* FFI_TYPE_POINTER */ #if defined(__SH4__) L_case_d: #ifdef __LITTLE_ENDIAN__ fmov.s @r2+,fr1 bra L_case_v fmov.s @r2,fr0 #else fmov.s @r2+,fr0 bra L_case_v fmov.s @r2,fr1 #endif L_case_f: bra L_case_v fmov.s @r2,fr0 #endif L_case_ll: mov.l @r2+,r0 bra L_case_v mov.l @r2,r1 L_case_i: bra L_case_v mov.l @r2,r0 L_case_q: #ifdef __LITTLE_ENDIAN__ #else add #3,r2 #endif bra L_case_v mov.b @r2,r0 L_case_uq: #ifdef __LITTLE_ENDIAN__ #else add #3,r2 #endif mov.b @r2,r0 bra L_case_v extu.b r0,r0 L_case_h: #ifdef __LITTLE_ENDIAN__ #else add #2,r2 #endif bra L_case_v mov.w @r2,r0 L_case_uh: #ifdef __LITTLE_ENDIAN__ #else add #2,r2 #endif mov.w @r2,r0 extu.w r0,r0 /* fall through */ L_case_v: #if defined(__SH4__) add #48,r15 #else add #16,r15 #endif lds.l @r15+,pr mov.l @r15+,r14 rts add #16,r15 .LFE2: .ffi_closure_SYSV_end: .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif .section ".eh_frame","aw",@progbits __FRAME_BEGIN__: .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .4byte 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #ifdef PIC .ascii "zR\0" /* CIE Augmentation */ #else .byte 0x0 /* CIE Augmentation */ #endif .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */ .byte 0x7c /* sleb128 -4; CIE Data Alignment Factor */ .byte 0x11 /* CIE RA Column */ #ifdef PIC .uleb128 0x1 /* Augmentation size */ .byte 0x10 /* FDE Encoding (pcrel) */ #endif .byte 0xc /* DW_CFA_def_cfa */ .byte 0xf /* uleb128 0xf */ .byte 0x0 /* uleb128 0x0 */ .align 2 .LECIE1: .LSFDE1: .4byte .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .4byte .LASFDE1-__FRAME_BEGIN__ /* FDE CIE offset */ #ifdef PIC .4byte .LFB1-. /* FDE initial location */ #else .4byte .LFB1 /* FDE initial location */ #endif .4byte .LFE1-.LFB1 /* FDE address range */ #ifdef PIC .uleb128 0x0 /* Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI0-.LFB1 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x4 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI1-.LCFI0 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI2-.LCFI1 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0xc /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI3-.LCFI2 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x10 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI4-.LCFI3 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x14 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI5-.LCFI4 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x18 /* uleb128 0x4 */ .byte 0x91 /* DW_CFA_offset, column 0x11 */ .byte 0x6 /* uleb128 0x6 */ .byte 0x8e /* DW_CFA_offset, column 0xe */ .byte 0x5 /* uleb128 0x5 */ .byte 0x8c /* DW_CFA_offset, column 0xc */ .byte 0x4 /* uleb128 0x4 */ .byte 0x8a /* DW_CFA_offset, column 0xa */ .byte 0x3 /* uleb128 0x3 */ .byte 0x89 /* DW_CFA_offset, column 0x9 */ .byte 0x2 /* uleb128 0x2 */ .byte 0x88 /* DW_CFA_offset, column 0x8 */ .byte 0x1 /* uleb128 0x1 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI6-.LCFI5 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0xe /* uleb128 0xe */ .align 2 .LEFDE1: .LSFDE3: .4byte .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .4byte .LASFDE3-__FRAME_BEGIN__ /* FDE CIE offset */ #ifdef PIC .4byte .LFB2-. /* FDE initial location */ #else .4byte .LFB2 /* FDE initial location */ #endif .4byte .LFE2-.LFB2 /* FDE address range */ #ifdef PIC .uleb128 0x0 /* Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI7-.LFB2 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x4 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI8-.LCFI7 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFI9-.LCFI8 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0xc /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFIA-.LCFI9 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x10 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFIB-.LCFIA .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x14 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFIC-.LCFIB .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x18 /* uleb128 0x4 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFID-.LCFIC .byte 0xe /* DW_CFA_def_cfa_offset */ #if defined(__SH4__) .byte 24+48 /* uleb128 24+48 */ #else .byte 24+16 /* uleb128 24+16 */ #endif .byte 0x91 /* DW_CFA_offset, column 0x11 */ .byte 0x6 /* uleb128 0x6 */ .byte 0x8e /* DW_CFA_offset, column 0xe */ .byte 0x5 /* uleb128 0x5 */ .byte 0x84 /* DW_CFA_offset, column 0x4 */ .byte 0x4 /* uleb128 0x4 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x3 /* uleb128 0x3 */ .byte 0x86 /* DW_CFA_offset, column 0x6 */ .byte 0x2 /* uleb128 0x2 */ .byte 0x87 /* DW_CFA_offset, column 0x7 */ .byte 0x1 /* uleb128 0x1 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte .LCFIE-.LCFID .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0xe /* uleb128 0xe */ .align 2 .LEFDE3: mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/sh64/ffi.c0000644000175000017500000002602711545150464021326 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 2003, 2004, 2006, 2007 Kaz Kojima Copyright (c) 2008 Anthony Green SuperH SHmedia Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #define NGREGARG 8 #define NFREGARG 12 static int return_type (ffi_type *arg) { if (arg->type != FFI_TYPE_STRUCT) return arg->type; /* gcc uses r2 if the result can be packed in on register. */ if (arg->size <= sizeof (UINT8)) return FFI_TYPE_UINT8; else if (arg->size <= sizeof (UINT16)) return FFI_TYPE_UINT16; else if (arg->size <= sizeof (UINT32)) return FFI_TYPE_UINT32; else if (arg->size <= sizeof (UINT64)) return FFI_TYPE_UINT64; return FFI_TYPE_STRUCT; } /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void ffi_prep_args(char *stack, extended_cif *ecif) { register unsigned int i; register unsigned int avn; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; if (return_type (ecif->cif->rtype) == FFI_TYPE_STRUCT) { *(void **) argp = ecif->rvalue; argp += sizeof (UINT64); } avn = ecif->cif->nargs; p_argv = ecif->avalue; for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) { size_t z; int align; z = (*p_arg)->size; align = (*p_arg)->alignment; if (z < sizeof (UINT32)) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(SINT64 *) argp = (SINT64) *(SINT8 *)(*p_argv); break; case FFI_TYPE_UINT8: *(UINT64 *) argp = (UINT64) *(UINT8 *)(*p_argv); break; case FFI_TYPE_SINT16: *(SINT64 *) argp = (SINT64) *(SINT16 *)(*p_argv); break; case FFI_TYPE_UINT16: *(UINT64 *) argp = (UINT64) *(UINT16 *)(*p_argv); break; case FFI_TYPE_STRUCT: memcpy (argp, *p_argv, z); break; default: FFI_ASSERT(0); } argp += sizeof (UINT64); } else if (z == sizeof (UINT32) && align == sizeof (UINT32)) { switch ((*p_arg)->type) { case FFI_TYPE_INT: case FFI_TYPE_SINT32: *(SINT64 *) argp = (SINT64) *(SINT32 *) (*p_argv); break; case FFI_TYPE_FLOAT: case FFI_TYPE_POINTER: case FFI_TYPE_UINT32: case FFI_TYPE_STRUCT: *(UINT64 *) argp = (UINT64) *(UINT32 *) (*p_argv); break; default: FFI_ASSERT(0); break; } argp += sizeof (UINT64); } else if (z == sizeof (UINT64) && align == sizeof (UINT64) && ((int) *p_argv & (sizeof (UINT64) - 1)) == 0) { *(UINT64 *) argp = *(UINT64 *) (*p_argv); argp += sizeof (UINT64); } else { int n = (z + sizeof (UINT64) - 1) / sizeof (UINT64); memcpy (argp, *p_argv, z); argp += n * sizeof (UINT64); } } return; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { int i, j; int size, type; int n, m; int greg; int freg; int fpair = -1; greg = (return_type (cif->rtype) == FFI_TYPE_STRUCT ? 1 : 0); freg = 0; cif->flags2 = 0; for (i = j = 0; i < cif->nargs; i++) { type = (cif->arg_types)[i]->type; switch (type) { case FFI_TYPE_FLOAT: greg++; cif->bytes += sizeof (UINT64) - sizeof (float); if (freg >= NFREGARG - 1) continue; if (fpair < 0) { fpair = freg; freg += 2; } else fpair = -1; cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++); break; case FFI_TYPE_DOUBLE: if (greg++ >= NGREGARG && (freg + 1) >= NFREGARG) continue; if ((freg + 1) < NFREGARG) { freg += 2; cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++); } else cif->flags2 += FFI_TYPE_INT << (2 * j++); break; default: size = (cif->arg_types)[i]->size; if (size < sizeof (UINT64)) cif->bytes += sizeof (UINT64) - size; n = (size + sizeof (UINT64) - 1) / sizeof (UINT64); if (greg >= NGREGARG) continue; else if (greg + n - 1 >= NGREGARG) greg = NGREGARG; else greg += n; for (m = 0; m < n; m++) cif->flags2 += FFI_TYPE_INT << (2 * j++); break; } } /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_STRUCT: cif->flags = return_type (cif->rtype); break; case FFI_TYPE_VOID: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: cif->flags = cif->rtype->type; break; default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } /*@-declundef@*/ /*@-exportheader@*/ extern void ffi_call_SYSV(void (*)(char *, extended_cif *), /*@out@*/ extended_cif *, unsigned, unsigned, long long, /*@out@*/ unsigned *, void (*fn)(void)); /*@=declundef@*/ /*@=exportheader@*/ void ffi_call(/*@dependent@*/ ffi_cif *cif, void (*fn)(void), /*@out@*/ void *rvalue, /*@dependent@*/ void **avalue) { extended_cif ecif; UINT64 trvalue; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if (cif->rtype->type == FFI_TYPE_STRUCT && return_type (cif->rtype) != FFI_TYPE_STRUCT) ecif.rvalue = &trvalue; else if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, cif->flags2, ecif.rvalue, fn); break; default: FFI_ASSERT(0); break; } if (rvalue && cif->rtype->type == FFI_TYPE_STRUCT && return_type (cif->rtype) != FFI_TYPE_STRUCT) memcpy (rvalue, &trvalue, cif->rtype->size); } extern void ffi_closure_SYSV (void); extern void __ic_invalidate (void *line); ffi_status ffi_prep_closure_loc (ffi_closure *closure, ffi_cif *cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp; FFI_ASSERT (cif->abi == FFI_GCC_SYSV); tramp = (unsigned int *) &closure->tramp[0]; /* Since ffi_closure is an aligned object, the ffi trampoline is called as an SHcompact code. Sigh. SHcompact part: mova @(1,pc),r0; add #1,r0; jmp @r0; nop; SHmedia part: movi fnaddr >> 16,r1; shori fnaddr,r1; ptabs/l r1,tr0 movi cxt >> 16,r1; shori cxt,r1; blink tr0,r63 */ #ifdef __LITTLE_ENDIAN__ tramp[0] = 0x7001c701; tramp[1] = 0x0009402b; #else tramp[0] = 0xc7017001; tramp[1] = 0x402b0009; #endif tramp[2] = 0xcc000010 | (((UINT32) ffi_closure_SYSV) >> 16) << 10; tramp[3] = 0xc8000010 | (((UINT32) ffi_closure_SYSV) & 0xffff) << 10; tramp[4] = 0x6bf10600; tramp[5] = 0xcc000010 | (((UINT32) codeloc) >> 16) << 10; tramp[6] = 0xc8000010 | (((UINT32) codeloc) & 0xffff) << 10; tramp[7] = 0x4401fff0; closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Flush the icache. */ asm volatile ("ocbwb %0,0; synco; icbi %1,0; synci" : : "r" (tramp), "r"(codeloc)); return FFI_OK; } /* Basically the trampoline invokes ffi_closure_SYSV, and on * entry, r3 holds the address of the closure. * After storing the registers that could possibly contain * parameters to be passed into the stack frame and setting * up space for a return value, ffi_closure_SYSV invokes the * following helper function to do most of the work. */ int ffi_closure_helper_SYSV (ffi_closure *closure, UINT64 *rvalue, UINT64 *pgr, UINT64 *pfr, UINT64 *pst) { void **avalue; ffi_type **p_arg; int i, avn; int greg, freg; ffi_cif *cif; int fpair = -1; cif = closure->cif; avalue = alloca (cif->nargs * sizeof (void *)); /* Copy the caller's structure return value address so that the closure returns the data directly to the caller. */ if (return_type (cif->rtype) == FFI_TYPE_STRUCT) { rvalue = (UINT64 *) *pgr; greg = 1; } else greg = 0; freg = 0; cif = closure->cif; avn = cif->nargs; /* Grab the addresses of the arguments from the stack frame. */ for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) { size_t z; void *p; z = (*p_arg)->size; if (z < sizeof (UINT32)) { p = pgr + greg++; switch ((*p_arg)->type) { case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: case FFI_TYPE_STRUCT: #ifdef __LITTLE_ENDIAN__ avalue[i] = p; #else avalue[i] = ((char *) p) + sizeof (UINT32) - z; #endif break; default: FFI_ASSERT(0); } } else if (z == sizeof (UINT32)) { if ((*p_arg)->type == FFI_TYPE_FLOAT) { if (freg < NFREGARG - 1) { if (fpair >= 0) { avalue[i] = (UINT32 *) pfr + fpair; fpair = -1; } else { #ifdef __LITTLE_ENDIAN__ fpair = freg; avalue[i] = (UINT32 *) pfr + (1 ^ freg); #else fpair = 1 ^ freg; avalue[i] = (UINT32 *) pfr + freg; #endif freg += 2; } } else #ifdef __LITTLE_ENDIAN__ avalue[i] = pgr + greg; #else avalue[i] = (UINT32 *) (pgr + greg) + 1; #endif } else #ifdef __LITTLE_ENDIAN__ avalue[i] = pgr + greg; #else avalue[i] = (UINT32 *) (pgr + greg) + 1; #endif greg++; } else if ((*p_arg)->type == FFI_TYPE_DOUBLE) { if (freg + 1 >= NFREGARG) avalue[i] = pgr + greg; else { avalue[i] = pfr + (freg >> 1); freg += 2; } greg++; } else { int n = (z + sizeof (UINT64) - 1) / sizeof (UINT64); avalue[i] = pgr + greg; greg += n; } } (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_SYSV how to perform return type promotions. */ return return_type (cif->rtype); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/sh64/ffitarget.h0000644000175000017500000000356711545150464022546 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SuperH - SHmedia. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_SYSV, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_SYSV } ffi_abi; #define FFI_EXTRA_CIF_FIELDS long long flags2 #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TRAMPOLINE_SIZE 32 #define FFI_NATIVE_RAW_API 0 #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/sh64/sysv.S0000644000175000017500000002665511545150464021555 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 2003, 2004, 2006, 2008 Kaz Kojima SuperH SHmedia Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef HAVE_MACHINE_ASM_H #include #else /* XXX these lose for some platforms, I'm sure. */ #define CNAME(x) x #define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): #endif #ifdef __LITTLE_ENDIAN__ #define OFS_FLT 0 #else #define OFS_FLT 4 #endif .section .text..SHmedia32,"ax" # r2: ffi_prep_args # r3: &ecif # r4: bytes # r5: flags # r6: flags2 # r7: rvalue # r8: fn # This assumes we are using gas. .align 5 ENTRY(ffi_call_SYSV) # Save registers .LFB1: addi.l r15, -48, r15 .LCFI0: st.q r15, 40, r32 st.q r15, 32, r31 st.q r15, 24, r30 st.q r15, 16, r29 st.q r15, 8, r28 st.l r15, 4, r18 st.l r15, 0, r14 .LCFI1: add.l r15, r63, r14 .LCFI2: # add r4, r63, r28 add r5, r63, r29 add r6, r63, r30 add r7, r63, r31 add r8, r63, r32 addi r4, (64 + 7), r4 andi r4, ~7, r4 sub.l r15, r4, r15 ptabs/l r2, tr0 add r15, r63, r2 blink tr0, r18 addi r15, 64, r22 movi 0, r0 movi 0, r1 movi -1, r23 pt/l 1f, tr1 bnei/l r29, FFI_TYPE_STRUCT, tr1 ld.l r15, 0, r19 addi r15, 8, r15 addi r0, 1, r0 1: .L_pass: andi r30, 3, r20 shlri r30, 2, r30 pt/l .L_call_it, tr0 pt/l .L_pass_i, tr1 pt/l .L_pass_f, tr2 beqi/l r20, FFI_TYPE_VOID, tr0 beqi/l r20, FFI_TYPE_INT, tr1 beqi/l r20, FFI_TYPE_FLOAT, tr2 .L_pass_d: addi r0, 1, r0 pt/l 3f, tr0 movi 12, r20 bge/l r1, r20, tr0 pt/l .L_pop_d, tr1 pt/l 2f, tr0 blink tr1, r63 2: addi.l r15, 8, r15 3: pt/l .L_pass, tr0 addi r1, 2, r1 blink tr0, r63 .L_pop_d: pt/l .L_pop_d_tbl, tr1 gettr tr1, r20 shlli r1, 2, r21 add r20, r21, r20 ptabs/l r20, tr1 blink tr1, r63 .L_pop_d_tbl: fld.d r15, 0, dr0 blink tr0, r63 fld.d r15, 0, dr2 blink tr0, r63 fld.d r15, 0, dr4 blink tr0, r63 fld.d r15, 0, dr6 blink tr0, r63 fld.d r15, 0, dr8 blink tr0, r63 fld.d r15, 0, dr10 blink tr0, r63 .L_pass_f: addi r0, 1, r0 pt/l 3f, tr0 movi 12, r20 bge/l r1, r20, tr0 pt/l .L_pop_f, tr1 pt/l 2f, tr0 blink tr1, r63 2: addi.l r15, 8, r15 3: pt/l .L_pass, tr0 blink tr0, r63 .L_pop_f: pt/l .L_pop_f_tbl, tr1 pt/l 5f, tr2 gettr tr1, r20 bge/l r23, r63, tr2 add r1, r63, r23 shlli r1, 3, r21 addi r1, 2, r1 add r20, r21, r20 ptabs/l r20, tr1 blink tr1, r63 5: addi r23, 1, r21 movi -1, r23 shlli r21, 3, r21 add r20, r21, r20 ptabs/l r20, tr1 blink tr1, r63 .L_pop_f_tbl: fld.s r15, OFS_FLT, fr0 blink tr0, r63 fld.s r15, OFS_FLT, fr1 blink tr0, r63 fld.s r15, OFS_FLT, fr2 blink tr0, r63 fld.s r15, OFS_FLT, fr3 blink tr0, r63 fld.s r15, OFS_FLT, fr4 blink tr0, r63 fld.s r15, OFS_FLT, fr5 blink tr0, r63 fld.s r15, OFS_FLT, fr6 blink tr0, r63 fld.s r15, OFS_FLT, fr7 blink tr0, r63 fld.s r15, OFS_FLT, fr8 blink tr0, r63 fld.s r15, OFS_FLT, fr9 blink tr0, r63 fld.s r15, OFS_FLT, fr10 blink tr0, r63 fld.s r15, OFS_FLT, fr11 blink tr0, r63 .L_pass_i: pt/l 3f, tr0 movi 8, r20 bge/l r0, r20, tr0 pt/l .L_pop_i, tr1 pt/l 2f, tr0 blink tr1, r63 2: addi.l r15, 8, r15 3: pt/l .L_pass, tr0 addi r0, 1, r0 blink tr0, r63 .L_pop_i: pt/l .L_pop_i_tbl, tr1 gettr tr1, r20 shlli r0, 3, r21 add r20, r21, r20 ptabs/l r20, tr1 blink tr1, r63 .L_pop_i_tbl: ld.q r15, 0, r2 blink tr0, r63 ld.q r15, 0, r3 blink tr0, r63 ld.q r15, 0, r4 blink tr0, r63 ld.q r15, 0, r5 blink tr0, r63 ld.q r15, 0, r6 blink tr0, r63 ld.q r15, 0, r7 blink tr0, r63 ld.q r15, 0, r8 blink tr0, r63 ld.q r15, 0, r9 blink tr0, r63 .L_call_it: # call function pt/l 1f, tr1 bnei/l r29, FFI_TYPE_STRUCT, tr1 add r19, r63, r2 1: add r22, r63, r15 ptabs/l r32, tr0 blink tr0, r18 pt/l .L_ret_i, tr0 pt/l .L_ret_ll, tr1 pt/l .L_ret_d, tr2 pt/l .L_ret_f, tr3 pt/l .L_epilogue, tr4 beqi/l r29, FFI_TYPE_INT, tr0 beqi/l r29, FFI_TYPE_UINT32, tr0 beqi/l r29, FFI_TYPE_SINT64, tr1 beqi/l r29, FFI_TYPE_UINT64, tr1 beqi/l r29, FFI_TYPE_DOUBLE, tr2 beqi/l r29, FFI_TYPE_FLOAT, tr3 pt/l .L_ret_q, tr0 pt/l .L_ret_h, tr1 beqi/l r29, FFI_TYPE_UINT8, tr0 beqi/l r29, FFI_TYPE_UINT16, tr1 blink tr4, r63 .L_ret_d: fst.d r31, 0, dr0 blink tr4, r63 .L_ret_ll: st.q r31, 0, r2 blink tr4, r63 .L_ret_f: fst.s r31, OFS_FLT, fr0 blink tr4, r63 .L_ret_q: st.b r31, 0, r2 blink tr4, r63 .L_ret_h: st.w r31, 0, r2 blink tr4, r63 .L_ret_i: st.l r31, 0, r2 # Fall .L_epilogue: # Remove the space we pushed for the args add r14, r63, r15 ld.l r15, 0, r14 ld.l r15, 4, r18 ld.q r15, 8, r28 ld.q r15, 16, r29 ld.q r15, 24, r30 ld.q r15, 32, r31 ld.q r15, 40, r32 addi.l r15, 48, r15 ptabs r18, tr0 blink tr0, r63 .LFE1: .ffi_call_SYSV_end: .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) .align 5 ENTRY(ffi_closure_SYSV) .LFB2: addi.l r15, -136, r15 .LCFI3: st.l r15, 12, r18 st.l r15, 8, r14 st.l r15, 4, r12 .LCFI4: add r15, r63, r14 .LCFI5: /* Stack layout: ... 64 bytes (register parameters) 48 bytes (floating register parameters) 8 bytes (result) 4 bytes (r18) 4 bytes (r14) 4 bytes (r12) 4 bytes (for align) <- new stack pointer */ fst.d r14, 24, dr0 fst.d r14, 32, dr2 fst.d r14, 40, dr4 fst.d r14, 48, dr6 fst.d r14, 56, dr8 fst.d r14, 64, dr10 st.q r14, 72, r2 st.q r14, 80, r3 st.q r14, 88, r4 st.q r14, 96, r5 st.q r14, 104, r6 st.q r14, 112, r7 st.q r14, 120, r8 st.q r14, 128, r9 add r1, r63, r2 addi r14, 16, r3 addi r14, 72, r4 addi r14, 24, r5 addi r14, 136, r6 #ifdef PIC movi (((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) >> 16) & 65535), r12 shori ((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) & 65535), r12 .LPCS0: ptrel/u r12, tr0 movi ((ffi_closure_helper_SYSV@GOTPLT) & 65535), r1 gettr tr0, r12 ldx.l r1, r12, r1 ptabs r1, tr0 #else pt/l ffi_closure_helper_SYSV, tr0 #endif blink tr0, r18 shlli r2, 1, r1 movi (((datalabel .L_table) >> 16) & 65535), r2 shori ((datalabel .L_table) & 65535), r2 ldx.w r2, r1, r1 add r1, r2, r1 pt/l .L_case_v, tr1 ptabs r1, tr0 blink tr0, r63 .align 2 .L_table: .word .L_case_v - datalabel .L_table /* FFI_TYPE_VOID */ .word .L_case_i - datalabel .L_table /* FFI_TYPE_INT */ .word .L_case_f - datalabel .L_table /* FFI_TYPE_FLOAT */ .word .L_case_d - datalabel .L_table /* FFI_TYPE_DOUBLE */ .word .L_case_d - datalabel .L_table /* FFI_TYPE_LONGDOUBLE */ .word .L_case_uq - datalabel .L_table /* FFI_TYPE_UINT8 */ .word .L_case_q - datalabel .L_table /* FFI_TYPE_SINT8 */ .word .L_case_uh - datalabel .L_table /* FFI_TYPE_UINT16 */ .word .L_case_h - datalabel .L_table /* FFI_TYPE_SINT16 */ .word .L_case_i - datalabel .L_table /* FFI_TYPE_UINT32 */ .word .L_case_i - datalabel .L_table /* FFI_TYPE_SINT32 */ .word .L_case_ll - datalabel .L_table /* FFI_TYPE_UINT64 */ .word .L_case_ll - datalabel .L_table /* FFI_TYPE_SINT64 */ .word .L_case_v - datalabel .L_table /* FFI_TYPE_STRUCT */ .word .L_case_i - datalabel .L_table /* FFI_TYPE_POINTER */ .align 2 .L_case_d: fld.d r14, 16, dr0 blink tr1, r63 .L_case_f: fld.s r14, 16, fr0 blink tr1, r63 .L_case_ll: ld.q r14, 16, r2 blink tr1, r63 .L_case_i: ld.l r14, 16, r2 blink tr1, r63 .L_case_q: ld.b r14, 16, r2 blink tr1, r63 .L_case_uq: ld.ub r14, 16, r2 blink tr1, r63 .L_case_h: ld.w r14, 16, r2 blink tr1, r63 .L_case_uh: ld.uw r14, 16, r2 blink tr1, r63 .L_case_v: add.l r14, r63, r15 ld.l r15, 4, r12 ld.l r15, 8, r14 ld.l r15, 12, r18 addi.l r15, 136, r15 ptabs r18, tr0 blink tr0, r63 .LFE2: .ffi_closure_SYSV_end: .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif .section ".eh_frame","aw",@progbits __FRAME_BEGIN__: .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .4byte 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #ifdef PIC .ascii "zR\0" /* CIE Augmentation */ #else .byte 0x0 /* CIE Augmentation */ #endif .uleb128 0x1 /* CIE Code Alignment Factor */ .sleb128 -4 /* CIE Data Alignment Factor */ .byte 0x12 /* CIE RA Column */ #ifdef PIC .uleb128 0x1 /* Augmentation size */ .byte 0x10 /* FDE Encoding (pcrel) */ #endif .byte 0xc /* DW_CFA_def_cfa */ .uleb128 0xf .uleb128 0x0 .align 2 .LECIE1: .LSFDE1: .4byte datalabel .LEFDE1-datalabel .LASFDE1 /* FDE Length */ .LASFDE1: .4byte datalabel .LASFDE1-datalabel __FRAME_BEGIN__ #ifdef PIC .4byte .LFB1-. /* FDE initial location */ #else .4byte .LFB1 /* FDE initial location */ #endif .4byte datalabel .LFE1-datalabel .LFB1 /* FDE address range */ #ifdef PIC .uleb128 0x0 /* Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI0-datalabel .LFB1 .byte 0xe /* DW_CFA_def_cfa_offset */ .uleb128 0x30 .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI1-datalabel .LCFI0 .byte 0x8e /* DW_CFA_offset, column 0xe */ .uleb128 0xc .byte 0x92 /* DW_CFA_offset, column 0x12 */ .uleb128 0xb .byte 0x9c /* DW_CFA_offset, column 0x1c */ .uleb128 0xa .byte 0x9d /* DW_CFA_offset, column 0x1d */ .uleb128 0x8 .byte 0x9e /* DW_CFA_offset, column 0x1e */ .uleb128 0x6 .byte 0x9f /* DW_CFA_offset, column 0x1f */ .uleb128 0x4 .byte 0xa0 /* DW_CFA_offset, column 0x20 */ .uleb128 0x2 .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI2-datalabel .LCFI1 .byte 0xd /* DW_CFA_def_cfa_register */ .uleb128 0xe .align 2 .LEFDE1: .LSFDE3: .4byte datalabel .LEFDE3-datalabel .LASFDE3 /* FDE Length */ .LASFDE3: .4byte datalabel .LASFDE3-datalabel __FRAME_BEGIN__ #ifdef PIC .4byte .LFB2-. /* FDE initial location */ #else .4byte .LFB2 /* FDE initial location */ #endif .4byte datalabel .LFE2-datalabel .LFB2 /* FDE address range */ #ifdef PIC .uleb128 0x0 /* Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI3-datalabel .LFB2 .byte 0xe /* DW_CFA_def_cfa_offset */ .uleb128 0x88 .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI4-datalabel .LCFI3 .byte 0x8c /* DW_CFA_offset, column 0xc */ .uleb128 0x21 .byte 0x8e /* DW_CFA_offset, column 0xe */ .uleb128 0x20 .byte 0x92 /* DW_CFA_offset, column 0x12 */ .uleb128 0x1f .byte 0x4 /* DW_CFA_advance_loc4 */ .4byte datalabel .LCFI5-datalabel .LCFI4 .byte 0xd /* DW_CFA_def_cfa_register */ .uleb128 0xe .align 2 .LEFDE3: mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/sparc/ffi.c0000644000175000017500000003656111545150464021656 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1996, 2003, 2004, 2007, 2008 Red Hat, Inc. SPARC Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void ffi_prep_args_v8(char *stack, extended_cif *ecif) { int i; void **p_argv; char *argp; ffi_type **p_arg; /* Skip 16 words for the window save area */ argp = stack + 16*sizeof(int); /* This should only really be done when we are returning a structure, however, it's faster just to do it all the time... if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) */ *(int *) argp = (long)ecif->rvalue; /* And 1 word for the structure return value. */ argp += sizeof(int); #ifdef USING_PURIFY /* Purify will probably complain in our assembly routine, unless we zero out this memory. */ ((int*)argp)[0] = 0; ((int*)argp)[1] = 0; ((int*)argp)[2] = 0; ((int*)argp)[3] = 0; ((int*)argp)[4] = 0; ((int*)argp)[5] = 0; #endif p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i; i--, p_arg++) { size_t z; if ((*p_arg)->type == FFI_TYPE_STRUCT #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE || (*p_arg)->type == FFI_TYPE_LONGDOUBLE #endif ) { *(unsigned int *) argp = (unsigned long)(* p_argv); z = sizeof(int); } else { z = (*p_arg)->size; if (z < sizeof(int)) { z = sizeof(int); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed int *) argp = *(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned int *) argp = *(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed int *) argp = *(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned int *) argp = *(UINT16 *)(* p_argv); break; default: FFI_ASSERT(0); } } else { memcpy(argp, *p_argv, z); } } p_argv++; argp += z; } return; } int ffi_prep_args_v9(char *stack, extended_cif *ecif) { int i, ret = 0; int tmp; void **p_argv; char *argp; ffi_type **p_arg; tmp = 0; /* Skip 16 words for the window save area */ argp = stack + 16*sizeof(long long); #ifdef USING_PURIFY /* Purify will probably complain in our assembly routine, unless we zero out this memory. */ ((long long*)argp)[0] = 0; ((long long*)argp)[1] = 0; ((long long*)argp)[2] = 0; ((long long*)argp)[3] = 0; ((long long*)argp)[4] = 0; ((long long*)argp)[5] = 0; #endif p_argv = ecif->avalue; if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 32) { *(unsigned long long *) argp = (unsigned long)ecif->rvalue; argp += sizeof(long long); tmp = 1; } for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; i++, p_arg++) { size_t z; z = (*p_arg)->size; switch ((*p_arg)->type) { case FFI_TYPE_STRUCT: if (z > 16) { /* For structures larger than 16 bytes we pass reference. */ *(unsigned long long *) argp = (unsigned long)* p_argv; argp += sizeof(long long); tmp++; p_argv++; continue; } /* FALLTHROUGH */ case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #endif ret = 1; /* We should promote into FP regs as well as integer. */ break; } if (z < sizeof(long long)) { switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(signed long long *) argp = *(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(unsigned long long *) argp = *(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(signed long long *) argp = *(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(unsigned long long *) argp = *(UINT16 *)(* p_argv); break; case FFI_TYPE_SINT32: *(signed long long *) argp = *(SINT32 *)(* p_argv); break; case FFI_TYPE_UINT32: *(unsigned long long *) argp = *(UINT32 *)(* p_argv); break; case FFI_TYPE_FLOAT: *(float *) (argp + 4) = *(FLOAT32 *)(* p_argv); /* Right justify */ break; case FFI_TYPE_STRUCT: memcpy(argp, *p_argv, z); break; default: FFI_ASSERT(0); } z = sizeof(long long); tmp++; } else if (z == sizeof(long long)) { memcpy(argp, *p_argv, z); z = sizeof(long long); tmp++; } else { if ((tmp & 1) && (*p_arg)->alignment > 8) { tmp++; argp += sizeof(long long); } memcpy(argp, *p_argv, z); z = 2 * sizeof(long long); tmp += 2; } p_argv++; argp += z; } return ret; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { int wordsize; if (cif->abi != FFI_V9) { wordsize = 4; /* If we are returning a struct, this will already have been added. Otherwise we need to add it because it's always got to be there! */ if (cif->rtype->type != FFI_TYPE_STRUCT) cif->bytes += wordsize; /* sparc call frames require that space is allocated for 6 args, even if they aren't used. Make that space if necessary. */ if (cif->bytes < 4*6+4) cif->bytes = 4*6+4; } else { wordsize = 8; /* sparc call frames require that space is allocated for 6 args, even if they aren't used. Make that space if necessary. */ if (cif->bytes < 8*6) cif->bytes = 8*6; } /* Adjust cif->bytes. to include 16 words for the window save area, and maybe the struct/union return pointer area, */ cif->bytes += 16 * wordsize; /* The stack must be 2 word aligned, so round bytes up appropriately. */ cif->bytes = ALIGN(cif->bytes, 2 * wordsize); /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #endif cif->flags = cif->rtype->type; break; case FFI_TYPE_STRUCT: if (cif->abi == FFI_V9 && cif->rtype->size > 32) cif->flags = FFI_TYPE_VOID; else cif->flags = FFI_TYPE_STRUCT; break; case FFI_TYPE_SINT8: case FFI_TYPE_UINT8: case FFI_TYPE_SINT16: case FFI_TYPE_UINT16: if (cif->abi == FFI_V9) cif->flags = FFI_TYPE_INT; else cif->flags = cif->rtype->type; break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: if (cif->abi == FFI_V9) cif->flags = FFI_TYPE_INT; else cif->flags = FFI_TYPE_SINT64; break; default: cif->flags = FFI_TYPE_INT; break; } return FFI_OK; } int ffi_v9_layout_struct(ffi_type *arg, int off, char *ret, char *intg, char *flt) { ffi_type **ptr = &arg->elements[0]; while (*ptr != NULL) { if (off & ((*ptr)->alignment - 1)) off = ALIGN(off, (*ptr)->alignment); switch ((*ptr)->type) { case FFI_TYPE_STRUCT: off = ffi_v9_layout_struct(*ptr, off, ret, intg, flt); off = ALIGN(off, FFI_SIZEOF_ARG); break; case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE case FFI_TYPE_LONGDOUBLE: #endif memmove(ret + off, flt + off, (*ptr)->size); off += (*ptr)->size; break; default: memmove(ret + off, intg + off, (*ptr)->size); off += (*ptr)->size; break; } ptr++; } return off; } #ifdef SPARC64 extern int ffi_call_v9(void *, extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #else extern int ffi_call_v8(void *, extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #endif void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; void *rval = rvalue; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ ecif.rvalue = rvalue; if (cif->rtype->type == FFI_TYPE_STRUCT) { if (cif->rtype->size <= 32) rval = alloca(64); else { rval = NULL; if (rvalue == NULL) ecif.rvalue = alloca(cif->rtype->size); } } switch (cif->abi) { case FFI_V8: #ifdef SPARC64 /* We don't yet support calling 32bit code from 64bit */ FFI_ASSERT(0); #else ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, cif->flags, rvalue, fn); #endif break; case FFI_V9: #ifdef SPARC64 ffi_call_v9(ffi_prep_args_v9, &ecif, cif->bytes, cif->flags, rval, fn); if (rvalue && rval && cif->rtype->type == FFI_TYPE_STRUCT) ffi_v9_layout_struct(cif->rtype, 0, (char *)rvalue, (char *)rval, ((char *)rval)+32); #else /* And vice versa */ FFI_ASSERT(0); #endif break; default: FFI_ASSERT(0); break; } } #ifdef SPARC64 extern void ffi_closure_v9(void); #else extern void ffi_closure_v8(void); #endif ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { unsigned int *tramp = (unsigned int *) &closure->tramp[0]; unsigned long fn; #ifdef SPARC64 /* Trampoline address is equal to the closure address. We take advantage of that to reduce the trampoline size by 8 bytes. */ FFI_ASSERT (cif->abi == FFI_V9); fn = (unsigned long) ffi_closure_v9; tramp[0] = 0x83414000; /* rd %pc, %g1 */ tramp[1] = 0xca586010; /* ldx [%g1+16], %g5 */ tramp[2] = 0x81c14000; /* jmp %g5 */ tramp[3] = 0x01000000; /* nop */ *((unsigned long *) &tramp[4]) = fn; #else unsigned long ctx = (unsigned long) codeloc; FFI_ASSERT (cif->abi == FFI_V8); fn = (unsigned long) ffi_closure_v8; tramp[0] = 0x03000000 | fn >> 10; /* sethi %hi(fn), %g1 */ tramp[1] = 0x05000000 | ctx >> 10; /* sethi %hi(ctx), %g2 */ tramp[2] = 0x81c06000 | (fn & 0x3ff); /* jmp %g1+%lo(fn) */ tramp[3] = 0x8410a000 | (ctx & 0x3ff);/* or %g2, %lo(ctx) */ #endif closure->cif = cif; closure->fun = fun; closure->user_data = user_data; /* Flush the Icache. FIXME: alignment isn't certain, assume 8 bytes */ #ifdef SPARC64 asm volatile ("flush %0" : : "r" (closure) : "memory"); asm volatile ("flush %0" : : "r" (((char *) closure) + 8) : "memory"); #else asm volatile ("iflush %0" : : "r" (closure) : "memory"); asm volatile ("iflush %0" : : "r" (((char *) closure) + 8) : "memory"); #endif return FFI_OK; } int ffi_closure_sparc_inner_v8(ffi_closure *closure, void *rvalue, unsigned long *gpr, unsigned long *scratch) { ffi_cif *cif; ffi_type **arg_types; void **avalue; int i, argn; cif = closure->cif; arg_types = cif->arg_types; avalue = alloca(cif->nargs * sizeof(void *)); /* Copy the caller's structure return address so that the closure returns the data directly to the caller. */ if (cif->flags == FFI_TYPE_STRUCT #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE || cif->flags == FFI_TYPE_LONGDOUBLE #endif ) rvalue = (void *) gpr[0]; /* Always skip the structure return address. */ argn = 1; /* Grab the addresses of the arguments from the stack frame. */ for (i = 0; i < cif->nargs; i++) { if (arg_types[i]->type == FFI_TYPE_STRUCT #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE || arg_types[i]->type == FFI_TYPE_LONGDOUBLE #endif ) { /* Straight copy of invisible reference. */ avalue[i] = (void *)gpr[argn++]; } else if ((arg_types[i]->type == FFI_TYPE_DOUBLE || arg_types[i]->type == FFI_TYPE_SINT64 || arg_types[i]->type == FFI_TYPE_UINT64) /* gpr is 8-byte aligned. */ && (argn % 2) != 0) { /* Align on a 8-byte boundary. */ scratch[0] = gpr[argn]; scratch[1] = gpr[argn+1]; avalue[i] = scratch; scratch -= 2; argn += 2; } else { /* Always right-justify. */ argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size; } } /* Invoke the closure. */ (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_sparc how to perform return type promotions. */ return cif->rtype->type; } int ffi_closure_sparc_inner_v9(ffi_closure *closure, void *rvalue, unsigned long *gpr, double *fpr) { ffi_cif *cif; ffi_type **arg_types; void **avalue; int i, argn, fp_slot_max; cif = closure->cif; arg_types = cif->arg_types; avalue = alloca(cif->nargs * sizeof(void *)); /* Copy the caller's structure return address so that the closure returns the data directly to the caller. */ if (cif->flags == FFI_TYPE_VOID && cif->rtype->type == FFI_TYPE_STRUCT) { rvalue = (void *) gpr[0]; /* Skip the structure return address. */ argn = 1; } else argn = 0; fp_slot_max = 16 - argn; /* Grab the addresses of the arguments from the stack frame. */ for (i = 0; i < cif->nargs; i++) { if (arg_types[i]->type == FFI_TYPE_STRUCT) { if (arg_types[i]->size > 16) { /* Straight copy of invisible reference. */ avalue[i] = (void *)gpr[argn++]; } else { /* Left-justify. */ ffi_v9_layout_struct(arg_types[i], 0, (char *) &gpr[argn], (char *) &gpr[argn], (char *) &fpr[argn]); avalue[i] = &gpr[argn]; argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; } } else { /* Right-justify. */ argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; /* Align on a 16-byte boundary. */ #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE if (arg_types[i]->type == FFI_TYPE_LONGDOUBLE && (argn % 2) != 0) argn++; #endif if (i < fp_slot_max && (arg_types[i]->type == FFI_TYPE_FLOAT || arg_types[i]->type == FFI_TYPE_DOUBLE #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE || arg_types[i]->type == FFI_TYPE_LONGDOUBLE #endif )) avalue[i] = ((char *) &fpr[argn]) - arg_types[i]->size; else avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size; } } /* Invoke the closure. */ (closure->fun) (cif, rvalue, avalue, closure->user_data); /* Tell ffi_closure_sparc how to perform return type promotions. */ return cif->rtype->type; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/sparc/ffitarget.h0000644000175000017500000000404111545150464023056 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for SPARC. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ #if defined(__arch64__) || defined(__sparcv9) #ifndef SPARC64 #define SPARC64 #endif #endif #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; typedef enum ffi_abi { FFI_FIRST_ABI = 0, FFI_V8, FFI_V8PLUS, FFI_V9, FFI_LAST_ABI, #ifdef SPARC64 FFI_DEFAULT_ABI = FFI_V9 #else FFI_DEFAULT_ABI = FFI_V8 #endif } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_NATIVE_RAW_API 0 #ifdef SPARC64 #define FFI_TRAMPOLINE_SIZE 24 #else #define FFI_TRAMPOLINE_SIZE 16 #endif #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/sparc/v8.S0000644000175000017500000001540511545150464021421 0ustar chr1schr1s/* ----------------------------------------------------------------------- v8.S - Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. SPARC Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #define STACKFRAME 96 /* Minimum stack framesize for SPARC */ #define ARGS (64+4) /* Offset of register area in frame */ .text .align 8 .globl ffi_call_v8 .globl _ffi_call_v8 ffi_call_v8: _ffi_call_v8: .LLFB1: save %sp, -STACKFRAME, %sp .LLCFI0: sub %sp, %i2, %sp ! alloca() space in stack for frame to set up add %sp, STACKFRAME, %l0 ! %l0 has start of ! frame to set up mov %l0, %o0 ! call routine to set up frame call %i0 mov %i1, %o1 ! (delay) ld [%l0+ARGS], %o0 ! call foreign function ld [%l0+ARGS+4], %o1 ld [%l0+ARGS+8], %o2 ld [%l0+ARGS+12], %o3 ld [%l0+ARGS+16], %o4 ld [%l0+ARGS+20], %o5 call %i5 mov %l0, %sp ! (delay) switch to frame nop ! STRUCT returning functions skip 12 instead of 8 bytes ! If the return value pointer is NULL, assume no return value. tst %i4 bz done nop cmp %i3, FFI_TYPE_INT be,a done st %o0, [%i4] ! (delay) cmp %i3, FFI_TYPE_FLOAT be,a done st %f0, [%i4+0] ! (delay) cmp %i3, FFI_TYPE_DOUBLE be,a double st %f0, [%i4+0] ! (delay) cmp %i3, FFI_TYPE_SINT8 be,a sint8 sll %o0, 24, %o0 ! (delay) cmp %i3, FFI_TYPE_UINT8 be,a uint8 sll %o0, 24, %o0 ! (delay) cmp %i3, FFI_TYPE_SINT16 be,a sint16 sll %o0, 16, %o0 ! (delay) cmp %i3, FFI_TYPE_UINT16 be,a uint16 sll %o0, 16, %o0 ! (delay) cmp %i3, FFI_TYPE_SINT64 be,a longlong st %o0, [%i4+0] ! (delay) done: ret restore double: st %f1, [%i4+4] ret restore sint8: sra %o0, 24, %o0 st %o0, [%i4+0] ret restore uint8: srl %o0, 24, %o0 st %o0, [%i4+0] ret restore sint16: sra %o0, 16, %o0 st %o0, [%i4+0] ret restore uint16: srl %o0, 16, %o0 st %o0, [%i4+0] ret restore longlong: st %o1, [%i4+4] ret restore .LLFE1: .ffi_call_v8_end: .size ffi_call_v8,.ffi_call_v8_end-ffi_call_v8 #undef STACKFRAME #define STACKFRAME 104 /* 16*4 register window + 1*4 struct return + 6*4 args backing store + 3*4 locals */ /* ffi_closure_v8(...) Receives the closure argument in %g2. */ .text .align 8 .globl ffi_closure_v8 ffi_closure_v8: #ifdef HAVE_AS_REGISTER_PSEUDO_OP .register %g2, #scratch #endif .LLFB2: ! Reserve frame space for all arguments in case ! we need to align them on a 8-byte boundary. ld [%g2+FFI_TRAMPOLINE_SIZE], %g1 ld [%g1+4], %g1 sll %g1, 3, %g1 add %g1, STACKFRAME, %g1 ! %g1 == STACKFRAME + 8*nargs neg %g1 save %sp, %g1, %sp .LLCFI1: ! Store all of the potential argument registers in va_list format. st %i0, [%fp+68+0] st %i1, [%fp+68+4] st %i2, [%fp+68+8] st %i3, [%fp+68+12] st %i4, [%fp+68+16] st %i5, [%fp+68+20] ! Call ffi_closure_sparc_inner to do the bulk of the work. mov %g2, %o0 add %fp, -8, %o1 add %fp, 64, %o2 call ffi_closure_sparc_inner_v8 add %fp, -16, %o3 ! Load up the return value in the proper type. ! See ffi_prep_cif_machdep for the list of cases. cmp %o0, FFI_TYPE_VOID be done1 cmp %o0, FFI_TYPE_INT be done1 ld [%fp-8], %i0 cmp %o0, FFI_TYPE_FLOAT be,a done1 ld [%fp-8], %f0 cmp %o0, FFI_TYPE_DOUBLE be,a done1 ldd [%fp-8], %f0 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE cmp %o0, FFI_TYPE_LONGDOUBLE be done2 #endif cmp %o0, FFI_TYPE_STRUCT be done2 cmp %o0, FFI_TYPE_SINT64 be,a done1 ldd [%fp-8], %i0 ld [%fp-8], %i0 done1: jmp %i7+8 restore done2: ! Skip 'unimp'. jmp %i7+12 restore .LLFE2: .ffi_closure_v8_end: .size ffi_closure_v8,.ffi_closure_v8_end-ffi_closure_v8 #ifdef SPARC64 #define WS 8 #define nword xword #define uanword uaxword #else #define WS 4 #define nword long #define uanword uaword #endif #ifdef HAVE_RO_EH_FRAME .section ".eh_frame",#alloc #else .section ".eh_frame",#alloc,#write #endif .LLframe1: .uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry .LLSCIE1: .uaword 0x0 ! CIE Identifier Tag .byte 0x1 ! CIE Version .ascii "zR\0" ! CIE Augmentation .byte 0x1 ! uleb128 0x1; CIE Code Alignment Factor .byte 0x80-WS ! sleb128 -WS; CIE Data Alignment Factor .byte 0xf ! CIE RA Column .byte 0x1 ! uleb128 0x1; Augmentation size #ifdef HAVE_AS_SPARC_UA_PCREL .byte 0x1b ! FDE Encoding (pcrel sdata4) #else .byte 0x50 ! FDE Encoding (aligned absolute) #endif .byte 0xc ! DW_CFA_def_cfa .byte 0xe ! uleb128 0xe .byte 0x0 ! uleb128 0x0 .align WS .LLECIE1: .LLSFDE1: .uaword .LLEFDE1-.LLASFDE1 ! FDE Length .LLASFDE1: .uaword .LLASFDE1-.LLframe1 ! FDE CIE offset #ifdef HAVE_AS_SPARC_UA_PCREL .uaword %r_disp32(.LLFB1) .uaword .LLFE1-.LLFB1 ! FDE address range #else .align WS .nword .LLFB1 .uanword .LLFE1-.LLFB1 ! FDE address range #endif .byte 0x0 ! uleb128 0x0; Augmentation size .byte 0x4 ! DW_CFA_advance_loc4 .uaword .LLCFI0-.LLFB1 .byte 0xd ! DW_CFA_def_cfa_register .byte 0x1e ! uleb128 0x1e .byte 0x2d ! DW_CFA_GNU_window_save .byte 0x9 ! DW_CFA_register .byte 0xf ! uleb128 0xf .byte 0x1f ! uleb128 0x1f .align WS .LLEFDE1: .LLSFDE2: .uaword .LLEFDE2-.LLASFDE2 ! FDE Length .LLASFDE2: .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset #ifdef HAVE_AS_SPARC_UA_PCREL .uaword %r_disp32(.LLFB2) .uaword .LLFE2-.LLFB2 ! FDE address range #else .align WS .nword .LLFB2 .uanword .LLFE2-.LLFB2 ! FDE address range #endif .byte 0x0 ! uleb128 0x0; Augmentation size .byte 0x4 ! DW_CFA_advance_loc4 .uaword .LLCFI1-.LLFB2 .byte 0xd ! DW_CFA_def_cfa_register .byte 0x1e ! uleb128 0x1e .byte 0x2d ! DW_CFA_GNU_window_save .byte 0x9 ! DW_CFA_register .byte 0xf ! uleb128 0xf .byte 0x1f ! uleb128 0x1f .align WS .LLEFDE2: #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/sparc/v9.S0000644000175000017500000001635711545150464021431 0ustar chr1schr1s/* ----------------------------------------------------------------------- v9.S - Copyright (c) 2000, 2003, 2004, 2008 Red Hat, Inc. SPARC 64-bit Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef SPARC64 /* Only compile this in for 64bit builds, because otherwise the object file will have inproper architecture due to used instructions. */ #define STACKFRAME 128 /* Minimum stack framesize for SPARC */ #define STACK_BIAS 2047 #define ARGS (128) /* Offset of register area in frame */ .text .align 8 .globl ffi_call_v9 .globl _ffi_call_v9 ffi_call_v9: _ffi_call_v9: .LLFB1: save %sp, -STACKFRAME, %sp .LLCFI0: sub %sp, %i2, %sp ! alloca() space in stack for frame to set up add %sp, STACKFRAME+STACK_BIAS, %l0 ! %l0 has start of ! frame to set up mov %l0, %o0 ! call routine to set up frame call %i0 mov %i1, %o1 ! (delay) brz,pt %o0, 1f ldx [%l0+ARGS], %o0 ! call foreign function ldd [%l0+ARGS], %f0 ldd [%l0+ARGS+8], %f2 ldd [%l0+ARGS+16], %f4 ldd [%l0+ARGS+24], %f6 ldd [%l0+ARGS+32], %f8 ldd [%l0+ARGS+40], %f10 ldd [%l0+ARGS+48], %f12 ldd [%l0+ARGS+56], %f14 ldd [%l0+ARGS+64], %f16 ldd [%l0+ARGS+72], %f18 ldd [%l0+ARGS+80], %f20 ldd [%l0+ARGS+88], %f22 ldd [%l0+ARGS+96], %f24 ldd [%l0+ARGS+104], %f26 ldd [%l0+ARGS+112], %f28 ldd [%l0+ARGS+120], %f30 1: ldx [%l0+ARGS+8], %o1 ldx [%l0+ARGS+16], %o2 ldx [%l0+ARGS+24], %o3 ldx [%l0+ARGS+32], %o4 ldx [%l0+ARGS+40], %o5 call %i5 sub %l0, STACK_BIAS, %sp ! (delay) switch to frame ! If the return value pointer is NULL, assume no return value. brz,pn %i4, done nop cmp %i3, FFI_TYPE_INT be,a,pt %icc, done stx %o0, [%i4+0] ! (delay) cmp %i3, FFI_TYPE_FLOAT be,a,pn %icc, done st %f0, [%i4+0] ! (delay) cmp %i3, FFI_TYPE_DOUBLE be,a,pn %icc, done std %f0, [%i4+0] ! (delay) cmp %i3, FFI_TYPE_STRUCT be,pn %icc, dostruct cmp %i3, FFI_TYPE_LONGDOUBLE bne,pt %icc, done nop std %f0, [%i4+0] std %f2, [%i4+8] done: ret restore dostruct: /* This will not work correctly for unions. */ stx %o0, [%i4+0] stx %o1, [%i4+8] stx %o2, [%i4+16] stx %o3, [%i4+24] std %f0, [%i4+32] std %f2, [%i4+40] std %f4, [%i4+48] std %f6, [%i4+56] ret restore .LLFE1: .ffi_call_v9_end: .size ffi_call_v9,.ffi_call_v9_end-ffi_call_v9 #undef STACKFRAME #define STACKFRAME 336 /* 16*8 register window + 6*8 args backing store + 20*8 locals */ #define FP %fp+STACK_BIAS /* ffi_closure_v9(...) Receives the closure argument in %g1. */ .text .align 8 .globl ffi_closure_v9 ffi_closure_v9: .LLFB2: save %sp, -STACKFRAME, %sp .LLCFI1: ! Store all of the potential argument registers in va_list format. stx %i0, [FP+128+0] stx %i1, [FP+128+8] stx %i2, [FP+128+16] stx %i3, [FP+128+24] stx %i4, [FP+128+32] stx %i5, [FP+128+40] ! Store possible floating point argument registers too. std %f0, [FP-128] std %f2, [FP-120] std %f4, [FP-112] std %f6, [FP-104] std %f8, [FP-96] std %f10, [FP-88] std %f12, [FP-80] std %f14, [FP-72] std %f16, [FP-64] std %f18, [FP-56] std %f20, [FP-48] std %f22, [FP-40] std %f24, [FP-32] std %f26, [FP-24] std %f28, [FP-16] std %f30, [FP-8] ! Call ffi_closure_sparc_inner to do the bulk of the work. mov %g1, %o0 add %fp, STACK_BIAS-160, %o1 add %fp, STACK_BIAS+128, %o2 call ffi_closure_sparc_inner_v9 add %fp, STACK_BIAS-128, %o3 ! Load up the return value in the proper type. ! See ffi_prep_cif_machdep for the list of cases. cmp %o0, FFI_TYPE_VOID be,pn %icc, done1 cmp %o0, FFI_TYPE_INT be,pn %icc, integer cmp %o0, FFI_TYPE_FLOAT be,a,pn %icc, done1 ld [FP-160], %f0 cmp %o0, FFI_TYPE_DOUBLE be,a,pn %icc, done1 ldd [FP-160], %f0 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE cmp %o0, FFI_TYPE_LONGDOUBLE be,a,pn %icc, longdouble1 ldd [FP-160], %f0 #endif ! FFI_TYPE_STRUCT ldx [FP-152], %i1 ldx [FP-144], %i2 ldx [FP-136], %i3 ldd [FP-160], %f0 ldd [FP-152], %f2 ldd [FP-144], %f4 ldd [FP-136], %f6 integer: ldx [FP-160], %i0 done1: ret restore #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE longdouble1: ldd [FP-152], %f2 ret restore #endif .LLFE2: .ffi_closure_v9_end: .size ffi_closure_v9,.ffi_closure_v9_end-ffi_closure_v9 #ifdef HAVE_RO_EH_FRAME .section ".eh_frame",#alloc #else .section ".eh_frame",#alloc,#write #endif .LLframe1: .uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry .LLSCIE1: .uaword 0x0 ! CIE Identifier Tag .byte 0x1 ! CIE Version .ascii "zR\0" ! CIE Augmentation .byte 0x1 ! uleb128 0x1; CIE Code Alignment Factor .byte 0x78 ! sleb128 -8; CIE Data Alignment Factor .byte 0xf ! CIE RA Column .byte 0x1 ! uleb128 0x1; Augmentation size #ifdef HAVE_AS_SPARC_UA_PCREL .byte 0x1b ! FDE Encoding (pcrel sdata4) #else .byte 0x50 ! FDE Encoding (aligned absolute) #endif .byte 0xc ! DW_CFA_def_cfa .byte 0xe ! uleb128 0xe .byte 0xff,0xf ! uleb128 0x7ff .align 8 .LLECIE1: .LLSFDE1: .uaword .LLEFDE1-.LLASFDE1 ! FDE Length .LLASFDE1: .uaword .LLASFDE1-.LLframe1 ! FDE CIE offset #ifdef HAVE_AS_SPARC_UA_PCREL .uaword %r_disp32(.LLFB1) .uaword .LLFE1-.LLFB1 ! FDE address range #else .align 8 .xword .LLFB1 .uaxword .LLFE1-.LLFB1 ! FDE address range #endif .byte 0x0 ! uleb128 0x0; Augmentation size .byte 0x4 ! DW_CFA_advance_loc4 .uaword .LLCFI0-.LLFB1 .byte 0xd ! DW_CFA_def_cfa_register .byte 0x1e ! uleb128 0x1e .byte 0x2d ! DW_CFA_GNU_window_save .byte 0x9 ! DW_CFA_register .byte 0xf ! uleb128 0xf .byte 0x1f ! uleb128 0x1f .align 8 .LLEFDE1: .LLSFDE2: .uaword .LLEFDE2-.LLASFDE2 ! FDE Length .LLASFDE2: .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset #ifdef HAVE_AS_SPARC_UA_PCREL .uaword %r_disp32(.LLFB2) .uaword .LLFE2-.LLFB2 ! FDE address range #else .align 8 .xword .LLFB2 .uaxword .LLFE2-.LLFB2 ! FDE address range #endif .byte 0x0 ! uleb128 0x0; Augmentation size .byte 0x4 ! DW_CFA_advance_loc4 .uaword .LLCFI1-.LLFB2 .byte 0xd ! DW_CFA_def_cfa_register .byte 0x1e ! uleb128 0x1e .byte 0x2d ! DW_CFA_GNU_window_save .byte 0x9 ! DW_CFA_register .byte 0xf ! uleb128 0xf .byte 0x1f ! uleb128 0x1f .align 8 .LLEFDE2: #endif #ifdef __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/x86/darwin.S0000644000175000017500000002314311545150464021663 0ustar chr1schr1s/* ----------------------------------------------------------------------- darwin.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc. Copyright (C) 2008 Free Software Foundation, Inc. X86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef __x86_64__ #define LIBFFI_ASM #include #include .text .globl _ffi_prep_args .align 4 .globl _ffi_call_SYSV _ffi_call_SYSV: .LFB1: pushl %ebp .LCFI0: movl %esp,%ebp .LCFI1: subl $8,%esp /* Make room for all of the new args. */ movl 16(%ebp),%ecx subl %ecx,%esp movl %esp,%eax /* Place all of the ffi_prep_args in position */ subl $8,%esp pushl 12(%ebp) pushl %eax call *8(%ebp) /* Return stack to previous state and call the function */ addl $16,%esp call *28(%ebp) /* Load %ecx with the return type code */ movl 20(%ebp),%ecx /* Protect %esi. We're going to pop it in the epilogue. */ pushl %esi /* If the return value pointer is NULL, assume no return value. */ cmpl $0,24(%ebp) jne 0f /* Even if there is no space for the return value, we are obliged to handle floating-point values. */ cmpl $FFI_TYPE_FLOAT,%ecx jne noretval fstp %st(0) jmp epilogue 0: .align 4 call 1f .Lstore_table: .long noretval-.Lstore_table /* FFI_TYPE_VOID */ .long retint-.Lstore_table /* FFI_TYPE_INT */ .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ .long retint-.Lstore_table /* FFI_TYPE_POINTER */ .long retstruct1b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_1B */ .long retstruct2b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_2B */ 1: pop %esi add (%esi, %ecx, 4), %esi jmp *%esi /* Sign/zero extend as appropriate. */ retsint8: movsbl %al, %eax jmp retint retsint16: movswl %ax, %eax jmp retint retuint8: movzbl %al, %eax jmp retint retuint16: movzwl %ax, %eax jmp retint retfloat: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstps (%ecx) jmp epilogue retdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpl (%ecx) jmp epilogue retlongdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpt (%ecx) jmp epilogue retint64: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp epilogue retstruct1b: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movb %al,0(%ecx) jmp epilogue retstruct2b: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movw %ax,0(%ecx) jmp epilogue retint: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) retstruct: /* Nothing to do! */ noretval: epilogue: popl %esi movl %ebp,%esp popl %ebp ret .LFE1: .ffi_call_SYSV_end: .align 4 FFI_HIDDEN (ffi_closure_SYSV) .globl _ffi_closure_SYSV _ffi_closure_SYSV: .LFB2: pushl %ebp .LCFI2: movl %esp, %ebp .LCFI3: subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ movl %ebx, 8(%esp) .LCFI7: call L_ffi_closure_SYSV_inner$stub movl 8(%esp), %ebx movl -12(%ebp), %ecx cmpl $FFI_TYPE_INT, %eax je .Lcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lcls_retllong cmpl $FFI_TYPE_SMALL_STRUCT_1B, %eax je .Lcls_retstruct1b cmpl $FFI_TYPE_SMALL_STRUCT_2B, %eax je .Lcls_retstruct2b cmpl $FFI_TYPE_STRUCT, %eax je .Lcls_retstruct .Lcls_epilogue: movl %ebp, %esp popl %ebp ret .Lcls_retint: movl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retfloat: flds (%ecx) jmp .Lcls_epilogue .Lcls_retdouble: fldl (%ecx) jmp .Lcls_epilogue .Lcls_retldouble: fldt (%ecx) jmp .Lcls_epilogue .Lcls_retllong: movl (%ecx), %eax movl 4(%ecx), %edx jmp .Lcls_epilogue .Lcls_retstruct1b: movsbl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct2b: movswl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct: lea -8(%ebp),%esp movl %ebp, %esp popl %ebp ret $4 .LFE2: #if !FFI_NO_RAW_API #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 .align 4 FFI_HIDDEN (ffi_closure_raw_SYSV) .globl _ffi_closure_raw_SYSV _ffi_closure_raw_SYSV: .LFB3: pushl %ebp .LCFI4: movl %esp, %ebp .LCFI5: pushl %esi .LCFI6: subl $36, %esp movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl %edx, 12(%esp) /* user_data */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ movl %edx, 8(%esp) /* raw_args */ leal -24(%ebp), %edx movl %edx, 4(%esp) /* &res */ movl %esi, (%esp) /* cif */ call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ cmpl $FFI_TYPE_INT, %eax je .Lrcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lrcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lrcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lrcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lrcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lrcls_retllong .Lrcls_epilogue: addl $36, %esp popl %esi popl %ebp ret .Lrcls_retint: movl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retfloat: flds -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retdouble: fldl -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retldouble: fldt -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retllong: movl -24(%ebp), %eax movl -20(%ebp), %edx jmp .Lrcls_epilogue .LFE3: #endif .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 L_ffi_closure_SYSV_inner$stub: .indirect_symbol _ffi_closure_SYSV_inner hlt ; hlt ; hlt ; hlt ; hlt .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support EH_frame1: .set L$set$0,LECIE1-LSCIE1 .long L$set$0 LSCIE1: .long 0x0 .byte 0x1 .ascii "zR\0" .byte 0x1 .byte 0x7c .byte 0x8 .byte 0x1 .byte 0x10 .byte 0xc .byte 0x5 .byte 0x4 .byte 0x88 .byte 0x1 .align 2 LECIE1: .globl _ffi_call_SYSV.eh _ffi_call_SYSV.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 .long L$set$1 LASFDE1: .long LASFDE1-EH_frame1 .long .LFB1-. .set L$set$2,.LFE1-.LFB1 .long L$set$2 .byte 0x0 .byte 0x4 .set L$set$3,.LCFI0-.LFB1 .long L$set$3 .byte 0xe .byte 0x8 .byte 0x84 .byte 0x2 .byte 0x4 .set L$set$4,.LCFI1-.LCFI0 .long L$set$4 .byte 0xd .byte 0x4 .align 2 LEFDE1: .globl _ffi_closure_SYSV.eh _ffi_closure_SYSV.eh: LSFDE2: .set L$set$5,LEFDE2-LASFDE2 .long L$set$5 LASFDE2: .long LASFDE2-EH_frame1 .long .LFB2-. .set L$set$6,.LFE2-.LFB2 .long L$set$6 .byte 0x0 .byte 0x4 .set L$set$7,.LCFI2-.LFB2 .long L$set$7 .byte 0xe .byte 0x8 .byte 0x84 .byte 0x2 .byte 0x4 .set L$set$8,.LCFI3-.LCFI2 .long L$set$8 .byte 0xd .byte 0x4 .align 2 LEFDE2: #if !FFI_NO_RAW_API .globl _ffi_closure_raw_SYSV.eh _ffi_closure_raw_SYSV.eh: LSFDE3: .set L$set$10,LEFDE3-LASFDE3 .long L$set$10 LASFDE3: .long LASFDE3-EH_frame1 .long .LFB3-. .set L$set$11,.LFE3-.LFB3 .long L$set$11 .byte 0x0 .byte 0x4 .set L$set$12,.LCFI4-.LFB3 .long L$set$12 .byte 0xe .byte 0x8 .byte 0x84 .byte 0x2 .byte 0x4 .set L$set$13,.LCFI5-.LCFI4 .long L$set$13 .byte 0xd .byte 0x4 .byte 0x4 .set L$set$14,.LCFI6-.LCFI5 .long L$set$14 .byte 0x85 .byte 0x3 .align 2 LEFDE3: #endif #endif /* ifndef __x86_64__ */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/x86/darwin64.S0000644000175000017500000002614311545150464022040 0ustar chr1schr1s/* ----------------------------------------------------------------------- darwin64.S - Copyright (c) 2006 Free Software Foundation, Inc. Copyright (c) 2008 Red Hat, Inc. derived from unix64.S x86-64 Foreign Function Interface for Darwin. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifdef __x86_64__ #define LIBFFI_ASM #include #include .file "darwin64.S" .text /* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, void *raddr, void (*fnaddr)(void)); Bit o trickiness here -- ARGS+BYTES is the base of the stack frame for this function. This has been allocated by ffi_call. We also deallocate some of the stack that has been alloca'd. */ .align 3 .globl _ffi_call_unix64 _ffi_call_unix64: LUW0: movq (%rsp), %r10 /* Load return address. */ leaq (%rdi, %rsi), %rax /* Find local stack base. */ movq %rdx, (%rax) /* Save flags. */ movq %rcx, 8(%rax) /* Save raddr. */ movq %rbp, 16(%rax) /* Save old frame pointer. */ movq %r10, 24(%rax) /* Relocate return address. */ movq %rax, %rbp /* Finalize local stack frame. */ LUW1: movq %rdi, %r10 /* Save a copy of the register area. */ movq %r8, %r11 /* Save a copy of the target fn. */ movl %r9d, %eax /* Set number of SSE registers. */ /* Load up all argument registers. */ movq (%r10), %rdi movq 8(%r10), %rsi movq 16(%r10), %rdx movq 24(%r10), %rcx movq 32(%r10), %r8 movq 40(%r10), %r9 testl %eax, %eax jnz Lload_sse Lret_from_load_sse: /* Deallocate the reg arg area. */ leaq 176(%r10), %rsp /* Call the user function. */ call *%r11 /* Deallocate stack arg area; local stack frame in redzone. */ leaq 24(%rbp), %rsp movq 0(%rbp), %rcx /* Reload flags. */ movq 8(%rbp), %rdi /* Reload raddr. */ movq 16(%rbp), %rbp /* Reload old frame pointer. */ LUW2: /* The first byte of the flags contains the FFI_TYPE. */ movzbl %cl, %r10d leaq Lstore_table(%rip), %r11 movslq (%r11, %r10, 4), %r10 addq %r11, %r10 jmp *%r10 Lstore_table: .long Lst_void-Lstore_table /* FFI_TYPE_VOID */ .long Lst_sint32-Lstore_table /* FFI_TYPE_INT */ .long Lst_float-Lstore_table /* FFI_TYPE_FLOAT */ .long Lst_double-Lstore_table /* FFI_TYPE_DOUBLE */ .long Lst_ldouble-Lstore_table /* FFI_TYPE_LONGDOUBLE */ .long Lst_uint8-Lstore_table /* FFI_TYPE_UINT8 */ .long Lst_sint8-Lstore_table /* FFI_TYPE_SINT8 */ .long Lst_uint16-Lstore_table /* FFI_TYPE_UINT16 */ .long Lst_sint16-Lstore_table /* FFI_TYPE_SINT16 */ .long Lst_uint32-Lstore_table /* FFI_TYPE_UINT32 */ .long Lst_sint32-Lstore_table /* FFI_TYPE_SINT32 */ .long Lst_int64-Lstore_table /* FFI_TYPE_UINT64 */ .long Lst_int64-Lstore_table /* FFI_TYPE_SINT64 */ .long Lst_struct-Lstore_table /* FFI_TYPE_STRUCT */ .long Lst_int64-Lstore_table /* FFI_TYPE_POINTER */ .text .align 3 Lst_void: ret .align 3 Lst_uint8: movzbq %al, %rax movq %rax, (%rdi) ret .align 3 Lst_sint8: movsbq %al, %rax movq %rax, (%rdi) ret .align 3 Lst_uint16: movzwq %ax, %rax movq %rax, (%rdi) .align 3 Lst_sint16: movswq %ax, %rax movq %rax, (%rdi) ret .align 3 Lst_uint32: movl %eax, %eax movq %rax, (%rdi) .align 3 Lst_sint32: cltq movq %rax, (%rdi) ret .align 3 Lst_int64: movq %rax, (%rdi) ret .align 3 Lst_float: movss %xmm0, (%rdi) ret .align 3 Lst_double: movsd %xmm0, (%rdi) ret Lst_ldouble: fstpt (%rdi) ret .align 3 Lst_struct: leaq -20(%rsp), %rsi /* Scratch area in redzone. */ /* We have to locate the values now, and since we don't want to write too much data into the user's return value, we spill the value to a 16 byte scratch area first. Bits 8, 9, and 10 control where the values are located. Only one of the three bits will be set; see ffi_prep_cif_machdep for the pattern. */ movd %xmm0, %r10 movd %xmm1, %r11 testl $0x100, %ecx cmovnz %rax, %rdx cmovnz %r10, %rax testl $0x200, %ecx cmovnz %r10, %rdx testl $0x400, %ecx cmovnz %r10, %rax cmovnz %r11, %rdx movq %rax, (%rsi) movq %rdx, 8(%rsi) /* Bits 12-31 contain the true size of the structure. Copy from the scratch area to the true destination. */ shrl $12, %ecx rep movsb ret /* Many times we can avoid loading any SSE registers at all. It's not worth an indirect jump to load the exact set of SSE registers needed; zero or all is a good compromise. */ .align 3 LUW3: Lload_sse: movdqa 48(%r10), %xmm0 movdqa 64(%r10), %xmm1 movdqa 80(%r10), %xmm2 movdqa 96(%r10), %xmm3 movdqa 112(%r10), %xmm4 movdqa 128(%r10), %xmm5 movdqa 144(%r10), %xmm6 movdqa 160(%r10), %xmm7 jmp Lret_from_load_sse LUW4: .align 3 .globl _ffi_closure_unix64 _ffi_closure_unix64: LUW5: /* The carry flag is set by the trampoline iff SSE registers are used. Don't clobber it before the branch instruction. */ leaq -200(%rsp), %rsp LUW6: movq %rdi, (%rsp) movq %rsi, 8(%rsp) movq %rdx, 16(%rsp) movq %rcx, 24(%rsp) movq %r8, 32(%rsp) movq %r9, 40(%rsp) jc Lsave_sse Lret_from_save_sse: movq %r10, %rdi leaq 176(%rsp), %rsi movq %rsp, %rdx leaq 208(%rsp), %rcx call _ffi_closure_unix64_inner /* Deallocate stack frame early; return value is now in redzone. */ addq $200, %rsp LUW7: /* The first byte of the return value contains the FFI_TYPE. */ movzbl %al, %r10d leaq Lload_table(%rip), %r11 movslq (%r11, %r10, 4), %r10 addq %r11, %r10 jmp *%r10 Lload_table: .long Lld_void-Lload_table /* FFI_TYPE_VOID */ .long Lld_int32-Lload_table /* FFI_TYPE_INT */ .long Lld_float-Lload_table /* FFI_TYPE_FLOAT */ .long Lld_double-Lload_table /* FFI_TYPE_DOUBLE */ .long Lld_ldouble-Lload_table /* FFI_TYPE_LONGDOUBLE */ .long Lld_int8-Lload_table /* FFI_TYPE_UINT8 */ .long Lld_int8-Lload_table /* FFI_TYPE_SINT8 */ .long Lld_int16-Lload_table /* FFI_TYPE_UINT16 */ .long Lld_int16-Lload_table /* FFI_TYPE_SINT16 */ .long Lld_int32-Lload_table /* FFI_TYPE_UINT32 */ .long Lld_int32-Lload_table /* FFI_TYPE_SINT32 */ .long Lld_int64-Lload_table /* FFI_TYPE_UINT64 */ .long Lld_int64-Lload_table /* FFI_TYPE_SINT64 */ .long Lld_struct-Lload_table /* FFI_TYPE_STRUCT */ .long Lld_int64-Lload_table /* FFI_TYPE_POINTER */ .text .align 3 Lld_void: ret .align 3 Lld_int8: movzbl -24(%rsp), %eax ret .align 3 Lld_int16: movzwl -24(%rsp), %eax ret .align 3 Lld_int32: movl -24(%rsp), %eax ret .align 3 Lld_int64: movq -24(%rsp), %rax ret .align 3 Lld_float: movss -24(%rsp), %xmm0 ret .align 3 Lld_double: movsd -24(%rsp), %xmm0 ret .align 3 Lld_ldouble: fldt -24(%rsp) ret .align 3 Lld_struct: /* There are four possibilities here, %rax/%rdx, %xmm0/%rax, %rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading both rdx and xmm1 with the second word. For the remaining, bit 8 set means xmm0 gets the second word, and bit 9 means that rax gets the second word. */ movq -24(%rsp), %rcx movq -16(%rsp), %rdx movq -16(%rsp), %xmm1 testl $0x100, %eax cmovnz %rdx, %rcx movd %rcx, %xmm0 testl $0x200, %eax movq -24(%rsp), %rax cmovnz %rdx, %rax ret /* See the comment above Lload_sse; the same logic applies here. */ .align 3 LUW8: Lsave_sse: movdqa %xmm0, 48(%rsp) movdqa %xmm1, 64(%rsp) movdqa %xmm2, 80(%rsp) movdqa %xmm3, 96(%rsp) movdqa %xmm4, 112(%rsp) movdqa %xmm5, 128(%rsp) movdqa %xmm6, 144(%rsp) movdqa %xmm7, 160(%rsp) jmp Lret_from_save_sse LUW9: .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support EH_frame1: .set L$set$0,LECIE1-LSCIE1 /* CIE Length */ .long L$set$0 LSCIE1: .long 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ .ascii "zR\0" /* CIE Augmentation */ .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */ .byte 0x78 /* sleb128 -8; CIE Data Alignment Factor */ .byte 0x10 /* CIE RA Column */ .byte 0x1 /* uleb128 0x1; Augmentation size */ .byte 0x10 /* FDE Encoding (pcrel sdata4) */ .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ .byte 0x7 /* uleb128 0x7 */ .byte 0x8 /* uleb128 0x8 */ .byte 0x90 /* DW_CFA_offset, column 0x10 */ .byte 0x1 .align 3 LECIE1: .globl _ffi_call_unix64.eh _ffi_call_unix64.eh: LSFDE1: .set L$set$1,LEFDE1-LASFDE1 /* FDE Length */ .long L$set$1 LASFDE1: .long LASFDE1-EH_frame1 /* FDE CIE offset */ .quad LUW0-. /* FDE initial location */ .set L$set$2,LUW4-LUW0 /* FDE address range */ .quad L$set$2 .byte 0x0 /* Augmentation size */ .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$3,LUW1-LUW0 .long L$set$3 /* New stack frame based off rbp. This is a itty bit of unwind trickery in that the CFA *has* changed. There is no easy way to describe it correctly on entry to the function. Fortunately, it doesn't matter too much since at all points we can correctly unwind back to ffi_call. Note that the location to which we moved the return address is (the new) CFA-8, so from the perspective of the unwind info, it hasn't moved. */ .byte 0xc /* DW_CFA_def_cfa, %rbp offset 32 */ .byte 0x6 .byte 0x20 .byte 0x80+6 /* DW_CFA_offset, %rbp offset 2*-8 */ .byte 0x2 .byte 0xa /* DW_CFA_remember_state */ .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$4,LUW2-LUW1 .long L$set$4 .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ .byte 0x7 .byte 0x8 .byte 0xc0+6 /* DW_CFA_restore, %rbp */ .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$5,LUW3-LUW2 .long L$set$5 .byte 0xb /* DW_CFA_restore_state */ .align 3 LEFDE1: .globl _ffi_closure_unix64.eh _ffi_closure_unix64.eh: LSFDE3: .set L$set$6,LEFDE3-LASFDE3 /* FDE Length */ .long L$set$6 LASFDE3: .long LASFDE3-EH_frame1 /* FDE CIE offset */ .quad LUW5-. /* FDE initial location */ .set L$set$7,LUW9-LUW5 /* FDE address range */ .quad L$set$7 .byte 0x0 /* Augmentation size */ .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$8,LUW6-LUW5 .long L$set$8 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 208,1 /* uleb128 208 */ .byte 0xa /* DW_CFA_remember_state */ .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$9,LUW7-LUW6 .long L$set$9 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 .byte 0x4 /* DW_CFA_advance_loc4 */ .set L$set$10,LUW8-LUW7 .long L$set$10 .byte 0xb /* DW_CFA_restore_state */ .align 3 LEFDE3: .subsections_via_symbols #endif /* __x86_64__ */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/x86/ffi.c0000644000175000017500000004334311545150464021167 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc. Copyright (c) 2002 Ranjit Mathew Copyright (c) 2002 Bo Thorsen Copyright (c) 2002 Roger Sayle Copyright (C) 2008 Free Software Foundation, Inc. x86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #if !defined(__x86_64__) || defined(_WIN64) #ifdef _WIN64 #include #endif #include #include #include /* ffi_prep_args is called by the assembly routine once stack space has been allocated for the function's arguments */ void ffi_prep_args(char *stack, extended_cif *ecif) { register unsigned int i; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; if (ecif->cif->flags == FFI_TYPE_STRUCT #ifdef X86_WIN64 && (ecif->cif->rtype->size != 1 && ecif->cif->rtype->size != 2 && ecif->cif->rtype->size != 4 && ecif->cif->rtype->size != 8) #endif ) { *(void **) argp = ecif->rvalue; argp += sizeof(void*); } p_argv = ecif->avalue; for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i != 0; i--, p_arg++) { size_t z; /* Align if necessary */ if ((sizeof(void*) - 1) & (size_t) argp) argp = (char *) ALIGN(argp, sizeof(void*)); z = (*p_arg)->size; #ifdef X86_WIN64 if (z > sizeof(ffi_arg) || ((*p_arg)->type == FFI_TYPE_STRUCT && (z != 1 && z != 2 && z != 4 && z != 8)) #if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE || ((*p_arg)->type == FFI_TYPE_LONGDOUBLE) #endif ) { z = sizeof(ffi_arg); *(void **)argp = *p_argv; } else if ((*p_arg)->type == FFI_TYPE_FLOAT) { memcpy(argp, *p_argv, z); } else #endif if (z < sizeof(ffi_arg)) { z = sizeof(ffi_arg); switch ((*p_arg)->type) { case FFI_TYPE_SINT8: *(ffi_sarg *) argp = (ffi_sarg)*(SINT8 *)(* p_argv); break; case FFI_TYPE_UINT8: *(ffi_arg *) argp = (ffi_arg)*(UINT8 *)(* p_argv); break; case FFI_TYPE_SINT16: *(ffi_sarg *) argp = (ffi_sarg)*(SINT16 *)(* p_argv); break; case FFI_TYPE_UINT16: *(ffi_arg *) argp = (ffi_arg)*(UINT16 *)(* p_argv); break; case FFI_TYPE_SINT32: *(ffi_sarg *) argp = (ffi_sarg)*(SINT32 *)(* p_argv); break; case FFI_TYPE_UINT32: *(ffi_arg *) argp = (ffi_arg)*(UINT32 *)(* p_argv); break; case FFI_TYPE_STRUCT: *(ffi_arg *) argp = *(ffi_arg *)(* p_argv); break; default: FFI_ASSERT(0); } } else { memcpy(argp, *p_argv, z); } p_argv++; #ifdef X86_WIN64 argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); #else argp += z; #endif } return; } /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) { unsigned int i; ffi_type **ptr; /* Set the return type flag */ switch (cif->rtype->type) { case FFI_TYPE_VOID: case FFI_TYPE_UINT8: case FFI_TYPE_UINT16: case FFI_TYPE_SINT8: case FFI_TYPE_SINT16: #ifdef X86_WIN64 case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: #endif case FFI_TYPE_SINT64: case FFI_TYPE_FLOAT: case FFI_TYPE_DOUBLE: #ifndef X86_WIN64 #if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE case FFI_TYPE_LONGDOUBLE: #endif #endif cif->flags = (unsigned) cif->rtype->type; break; case FFI_TYPE_UINT64: #ifdef X86_WIN64 case FFI_TYPE_POINTER: #endif cif->flags = FFI_TYPE_SINT64; break; case FFI_TYPE_STRUCT: #ifndef X86 if (cif->rtype->size == 1) { cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */ } else if (cif->rtype->size == 2) { cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */ } else if (cif->rtype->size == 4) { #ifdef X86_WIN64 cif->flags = FFI_TYPE_SMALL_STRUCT_4B; #else cif->flags = FFI_TYPE_INT; /* same as int type */ #endif } else if (cif->rtype->size == 8) { cif->flags = FFI_TYPE_SINT64; /* same as int64 type */ } else #endif { cif->flags = FFI_TYPE_STRUCT; /* allocate space for return value pointer */ cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG); } break; default: #ifdef X86_WIN64 cif->flags = FFI_TYPE_SINT64; break; case FFI_TYPE_INT: cif->flags = FFI_TYPE_SINT32; #else cif->flags = FFI_TYPE_INT; #endif break; } for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { if (((*ptr)->alignment - 1) & cif->bytes) cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment); cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG); } #ifdef X86_WIN64 /* ensure space for storing four registers */ cif->bytes += 4 * sizeof(ffi_arg); #endif #ifdef X86_DARWIN cif->bytes = (cif->bytes + 15) & ~0xF; #endif return FFI_OK; } #ifdef X86_WIN64 extern int ffi_call_win64(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #elif defined(X86_WIN32) extern void ffi_call_win32(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #else extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, unsigned, unsigned, unsigned *, void (*fn)(void)); #endif void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { extended_cif ecif; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ #ifdef X86_WIN64 if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT && cif->rtype->size != 1 && cif->rtype->size != 2 && cif->rtype->size != 4 && cif->rtype->size != 8) { ecif.rvalue = alloca((cif->rtype->size + 0xF) & ~0xF); } #else if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT) { ecif.rvalue = alloca(cif->rtype->size); } #endif else ecif.rvalue = rvalue; switch (cif->abi) { #ifdef X86_WIN64 case FFI_WIN64: ffi_call_win64(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #elif defined(X86_WIN32) case FFI_SYSV: case FFI_STDCALL: ffi_call_win32(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #else case FFI_SYSV: ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #endif default: FFI_ASSERT(0); break; } } /** private members **/ /* The following __attribute__((regparm(1))) decorations will have no effect on MSVC - standard cdecl convention applies. */ static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, void** args, ffi_cif* cif); void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) __attribute__ ((regparm(1))); unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *) __attribute__ ((regparm(1))); void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) __attribute__ ((regparm(1))); #ifdef X86_WIN32 void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) __attribute__ ((regparm(1))); #endif #ifdef X86_WIN64 void FFI_HIDDEN ffi_closure_win64 (ffi_closure *); #endif /* This function is jumped to by the trampoline */ #ifdef X86_WIN64 void * FFI_HIDDEN ffi_closure_win64_inner (ffi_closure *closure, void *args) { ffi_cif *cif; void **arg_area; void *result; void *resp = &result; cif = closure->cif; arg_area = (void**) alloca (cif->nargs * sizeof (void*)); /* this call will initialize ARG_AREA, such that each * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will change RESP to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(args, &resp, arg_area, cif); (closure->fun) (cif, resp, arg_area, closure->user_data); /* The result is returned in rax. This does the right thing for result types except for floats; we have to 'mov xmm0, rax' in the caller to correct this. TODO: structure sizes of 3 5 6 7 are returned by reference, too!!! */ return cif->rtype->size > sizeof(void *) ? resp : *(void **)resp; } #else unsigned int FFI_HIDDEN __attribute__ ((regparm(1))) ffi_closure_SYSV_inner (ffi_closure *closure, void **respp, void *args) { /* our various things... */ ffi_cif *cif; void **arg_area; cif = closure->cif; arg_area = (void**) alloca (cif->nargs * sizeof (void*)); /* this call will initialize ARG_AREA, such that each * element in that array points to the corresponding * value on the stack; and if the function returns * a structure, it will change RESP to point to the * structure return address. */ ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); (closure->fun) (cif, *respp, arg_area, closure->user_data); return cif->flags; } #endif /* !X86_WIN64 */ static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, ffi_cif *cif) { register unsigned int i; register void **p_argv; register char *argp; register ffi_type **p_arg; argp = stack; #ifdef X86_WIN64 if (cif->rtype->size > sizeof(ffi_arg) || (cif->flags == FFI_TYPE_STRUCT && (cif->rtype->size != 1 && cif->rtype->size != 2 && cif->rtype->size != 4 && cif->rtype->size != 8))) { *rvalue = *(void **) argp; argp += sizeof(void *); } #else if ( cif->flags == FFI_TYPE_STRUCT ) { *rvalue = *(void **) argp; argp += sizeof(void *); } #endif p_argv = avalue; for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) { size_t z; /* Align if necessary */ if ((sizeof(void*) - 1) & (size_t) argp) { argp = (char *) ALIGN(argp, sizeof(void*)); } #ifdef X86_WIN64 if ((*p_arg)->size > sizeof(ffi_arg) || ((*p_arg)->type == FFI_TYPE_STRUCT && ((*p_arg)->size != 1 && (*p_arg)->size != 2 && (*p_arg)->size != 4 && (*p_arg)->size != 8))) { z = sizeof(void *); *p_argv = *(void **)argp; } else #endif { z = (*p_arg)->size; /* because we're little endian, this is what it turns into. */ *p_argv = (void*) argp; } p_argv++; #ifdef X86_WIN64 argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); #else argp += z; #endif } return; } #define FFI_INIT_TRAMPOLINE_WIN64(TRAMP,FUN,CTX,MASK) \ { unsigned char *__tramp = (unsigned char*)(TRAMP); \ void* __fun = (void*)(FUN); \ void* __ctx = (void*)(CTX); \ *(unsigned char*) &__tramp[0] = 0x41; \ *(unsigned char*) &__tramp[1] = 0xbb; \ *(unsigned int*) &__tramp[2] = MASK; /* mov $mask, %r11 */ \ *(unsigned char*) &__tramp[6] = 0x48; \ *(unsigned char*) &__tramp[7] = 0xb8; \ *(void**) &__tramp[8] = __ctx; /* mov __ctx, %rax */ \ *(unsigned char *) &__tramp[16] = 0x49; \ *(unsigned char *) &__tramp[17] = 0xba; \ *(void**) &__tramp[18] = __fun; /* mov __fun, %r10 */ \ *(unsigned char *) &__tramp[26] = 0x41; \ *(unsigned char *) &__tramp[27] = 0xff; \ *(unsigned char *) &__tramp[28] = 0xe2; /* jmp %r10 */ \ } /* How to make a trampoline. Derived from gcc/config/i386/i386.c. */ #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ { unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ unsigned int __ctx = (unsigned int)(CTX); \ unsigned int __dis = __fun - (__ctx + 10); \ *(unsigned char*) &__tramp[0] = 0xb8; \ *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ *(unsigned char *) &__tramp[5] = 0xe9; \ *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ } #define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \ { unsigned char *__tramp = (unsigned char*)(TRAMP); \ unsigned int __fun = (unsigned int)(FUN); \ unsigned int __ctx = (unsigned int)(CTX); \ unsigned int __dis = __fun - (__ctx + 10); \ unsigned short __size = (unsigned short)(SIZE); \ *(unsigned char*) &__tramp[0] = 0xb8; \ *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ *(unsigned char *) &__tramp[5] = 0xe8; \ *(unsigned int*) &__tramp[6] = __dis; /* call __fun */ \ *(unsigned char *) &__tramp[10] = 0xc2; \ *(unsigned short*) &__tramp[11] = __size; /* ret __size */ \ } /* the cif must already be prep'ed */ ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void *codeloc) { #ifdef X86_WIN64 #define ISFLOAT(IDX) (cif->arg_types[IDX]->type == FFI_TYPE_FLOAT || cif->arg_types[IDX]->type == FFI_TYPE_DOUBLE) #define FLAG(IDX) (cif->nargs>(IDX)&&ISFLOAT(IDX)?(1<<(IDX)):0) if (cif->abi == FFI_WIN64) { int mask = FLAG(0)|FLAG(1)|FLAG(2)|FLAG(3); FFI_INIT_TRAMPOLINE_WIN64 (&closure->tramp[0], &ffi_closure_win64, codeloc, mask); /* make sure we can execute here */ } #else if (cif->abi == FFI_SYSV) { FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_SYSV, (void*)codeloc); } #ifdef X86_WIN32 else if (cif->abi == FFI_STDCALL) { FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0], &ffi_closure_STDCALL, (void*)codeloc, cif->bytes); } #endif /* X86_WIN32 */ #endif /* !X86_WIN64 */ else { return FFI_BAD_ABI; } closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } /* ------- Native raw API support -------------------------------- */ #if !FFI_NO_RAW_API ffi_status ffi_prep_raw_closure_loc (ffi_raw_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data, void *codeloc) { int i; if (cif->abi != FFI_SYSV) { return FFI_BAD_ABI; } /* we currently don't support certain kinds of arguments for raw closures. This should be implemented by a separate assembly language routine, since it would require argument processing, something we don't do now for performance. */ for (i = cif->nargs-1; i >= 0; i--) { FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT); FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); } FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, codeloc); closure->cif = cif; closure->user_data = user_data; closure->fun = fun; return FFI_OK; } static void ffi_prep_args_raw(char *stack, extended_cif *ecif) { memcpy (stack, ecif->avalue, ecif->cif->bytes); } /* we borrow this routine from libffi (it must be changed, though, to * actually call the function passed in the first argument. as of * libffi-1.20, this is not the case.) */ void ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue) { extended_cif ecif; void **avalue = (void **)fake_avalue; ecif.cif = cif; ecif.avalue = avalue; /* If the return value is a struct and we don't have a return */ /* value address then we need to make one */ if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) { ecif.rvalue = alloca(cif->rtype->size); } else ecif.rvalue = rvalue; switch (cif->abi) { #ifdef X86_WIN32 case FFI_SYSV: case FFI_STDCALL: ffi_call_win32(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #else case FFI_SYSV: ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, ecif.rvalue, fn); break; #endif default: FFI_ASSERT(0); break; } } #endif #endif /* !__x86_64__ || X86_WIN64 */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/x86/ffi64.c0000644000175000017500000004171411545150464021341 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi64.c - Copyright (c) 2002, 2007 Bo Thorsen Copyright (c) 2008 Red Hat, Inc. x86-64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include #ifdef __x86_64__ #define MAX_GPR_REGS 6 #define MAX_SSE_REGS 8 struct register_args { /* Registers for argument passing. */ UINT64 gpr[MAX_GPR_REGS]; __int128_t sse[MAX_SSE_REGS]; }; extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, void *raddr, void (*fnaddr)(void), unsigned ssecount); /* All reference to register classes here is identical to the code in gcc/config/i386/i386.c. Do *not* change one without the other. */ /* Register class used for passing given 64bit part of the argument. These represent classes as documented by the PS ABI, with the exception of SSESF, SSEDF classes, that are basically SSE class, just gcc will use SF or DFmode move instead of DImode to avoid reformatting penalties. Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves whenever possible (upper half does contain padding). */ enum x86_64_reg_class { X86_64_NO_CLASS, X86_64_INTEGER_CLASS, X86_64_INTEGERSI_CLASS, X86_64_SSE_CLASS, X86_64_SSESF_CLASS, X86_64_SSEDF_CLASS, X86_64_SSEUP_CLASS, X86_64_X87_CLASS, X86_64_X87UP_CLASS, X86_64_COMPLEX_X87_CLASS, X86_64_MEMORY_CLASS }; #define MAX_CLASSES 4 #define SSE_CLASS_P(X) ((X) >= X86_64_SSE_CLASS && X <= X86_64_SSEUP_CLASS) /* x86-64 register passing implementation. See x86-64 ABI for details. Goal of this code is to classify each 8bytes of incoming argument by the register class and assign registers accordingly. */ /* Return the union class of CLASS1 and CLASS2. See the x86-64 PS ABI for details. */ static enum x86_64_reg_class merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) { /* Rule #1: If both classes are equal, this is the resulting class. */ if (class1 == class2) return class1; /* Rule #2: If one of the classes is NO_CLASS, the resulting class is the other class. */ if (class1 == X86_64_NO_CLASS) return class2; if (class2 == X86_64_NO_CLASS) return class1; /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */ if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS) return X86_64_MEMORY_CLASS; /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */ if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS) || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS)) return X86_64_INTEGERSI_CLASS; if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS) return X86_64_INTEGER_CLASS; /* Rule #5: If one of the classes is X87, X87UP, or COMPLEX_X87 class, MEMORY is used. */ if (class1 == X86_64_X87_CLASS || class1 == X86_64_X87UP_CLASS || class1 == X86_64_COMPLEX_X87_CLASS || class2 == X86_64_X87_CLASS || class2 == X86_64_X87UP_CLASS || class2 == X86_64_COMPLEX_X87_CLASS) return X86_64_MEMORY_CLASS; /* Rule #6: Otherwise class SSE is used. */ return X86_64_SSE_CLASS; } /* Classify the argument of type TYPE and mode MODE. CLASSES will be filled by the register class used to pass each word of the operand. The number of words is returned. In case the parameter should be passed in memory, 0 is returned. As a special case for zero sized containers, classes[0] will be NO_CLASS and 1 is returned. See the x86-64 PS ABI for details. */ static int classify_argument (ffi_type *type, enum x86_64_reg_class classes[], size_t byte_offset) { switch (type->type) { case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_POINTER: { int size = byte_offset + type->size; if (size <= 4) { classes[0] = X86_64_INTEGERSI_CLASS; return 1; } else if (size <= 8) { classes[0] = X86_64_INTEGER_CLASS; return 1; } else if (size <= 12) { classes[0] = X86_64_INTEGER_CLASS; classes[1] = X86_64_INTEGERSI_CLASS; return 2; } else if (size <= 16) { classes[0] = classes[1] = X86_64_INTEGERSI_CLASS; return 2; } else FFI_ASSERT (0); } case FFI_TYPE_FLOAT: if (!(byte_offset % 8)) classes[0] = X86_64_SSESF_CLASS; else classes[0] = X86_64_SSE_CLASS; return 1; case FFI_TYPE_DOUBLE: classes[0] = X86_64_SSEDF_CLASS; return 1; case FFI_TYPE_LONGDOUBLE: classes[0] = X86_64_X87_CLASS; classes[1] = X86_64_X87UP_CLASS; return 2; case FFI_TYPE_STRUCT: { const int UNITS_PER_WORD = 8; int words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; ffi_type **ptr; int i; enum x86_64_reg_class subclasses[MAX_CLASSES]; /* If the struct is larger than 32 bytes, pass it on the stack. */ if (type->size > 32) return 0; for (i = 0; i < words; i++) classes[i] = X86_64_NO_CLASS; /* Zero sized arrays or structures are NO_CLASS. We return 0 to signalize memory class, so handle it as special case. */ if (!words) { classes[0] = X86_64_NO_CLASS; return 1; } /* Merge the fields of structure. */ for (ptr = type->elements; *ptr != NULL; ptr++) { int num; byte_offset = ALIGN (byte_offset, (*ptr)->alignment); num = classify_argument (*ptr, subclasses, byte_offset % 8); if (num == 0) return 0; for (i = 0; i < num; i++) { int pos = byte_offset / 8; classes[i + pos] = merge_classes (subclasses[i], classes[i + pos]); } byte_offset += (*ptr)->size; } if (words > 2) { /* When size > 16 bytes, if the first one isn't X86_64_SSE_CLASS or any other ones aren't X86_64_SSEUP_CLASS, everything should be passed in memory. */ if (classes[0] != X86_64_SSE_CLASS) return 0; for (i = 1; i < words; i++) if (classes[i] != X86_64_SSEUP_CLASS) return 0; } /* Final merger cleanup. */ for (i = 0; i < words; i++) { /* If one class is MEMORY, everything should be passed in memory. */ if (classes[i] == X86_64_MEMORY_CLASS) return 0; /* The X86_64_SSEUP_CLASS should be always preceded by X86_64_SSE_CLASS or X86_64_SSEUP_CLASS. */ if (classes[i] == X86_64_SSEUP_CLASS && classes[i - 1] != X86_64_SSE_CLASS && classes[i - 1] != X86_64_SSEUP_CLASS) { /* The first one should never be X86_64_SSEUP_CLASS. */ FFI_ASSERT (i != 0); classes[i] = X86_64_SSE_CLASS; } /* If X86_64_X87UP_CLASS isn't preceded by X86_64_X87_CLASS, everything should be passed in memory. */ if (classes[i] == X86_64_X87UP_CLASS && (classes[i - 1] != X86_64_X87_CLASS)) { /* The first one should never be X86_64_X87UP_CLASS. */ FFI_ASSERT (i != 0); return 0; } } return words; } default: FFI_ASSERT(0); } return 0; /* Never reached. */ } /* Examine the argument and return set number of register required in each class. Return zero iff parameter should be passed in memory, otherwise the number of registers. */ static int examine_argument (ffi_type *type, enum x86_64_reg_class classes[MAX_CLASSES], _Bool in_return, int *pngpr, int *pnsse) { int i, n, ngpr, nsse; n = classify_argument (type, classes, 0); if (n == 0) return 0; ngpr = nsse = 0; for (i = 0; i < n; ++i) switch (classes[i]) { case X86_64_INTEGER_CLASS: case X86_64_INTEGERSI_CLASS: ngpr++; break; case X86_64_SSE_CLASS: case X86_64_SSESF_CLASS: case X86_64_SSEDF_CLASS: nsse++; break; case X86_64_NO_CLASS: case X86_64_SSEUP_CLASS: break; case X86_64_X87_CLASS: case X86_64_X87UP_CLASS: case X86_64_COMPLEX_X87_CLASS: return in_return != 0; default: abort (); } *pngpr = ngpr; *pnsse = nsse; return n; } /* Perform machine dependent cif processing. */ ffi_status ffi_prep_cif_machdep (ffi_cif *cif) { int gprcount, ssecount, i, avn, n, ngpr, nsse, flags; enum x86_64_reg_class classes[MAX_CLASSES]; size_t bytes; gprcount = ssecount = 0; flags = cif->rtype->type; if (flags != FFI_TYPE_VOID) { n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); if (n == 0) { /* The return value is passed in memory. A pointer to that memory is the first argument. Allocate a register for it. */ gprcount++; /* We don't have to do anything in asm for the return. */ flags = FFI_TYPE_VOID; } else if (flags == FFI_TYPE_STRUCT) { /* Mark which registers the result appears in. */ _Bool sse0 = SSE_CLASS_P (classes[0]); _Bool sse1 = n == 2 && SSE_CLASS_P (classes[1]); if (sse0 && !sse1) flags |= 1 << 8; else if (!sse0 && sse1) flags |= 1 << 9; else if (sse0 && sse1) flags |= 1 << 10; /* Mark the true size of the structure. */ flags |= cif->rtype->size << 12; } } /* Go over all arguments and determine the way they should be passed. If it's in a register and there is space for it, let that be so. If not, add it's size to the stack byte count. */ for (bytes = 0, i = 0, avn = cif->nargs; i < avn; i++) { if (examine_argument (cif->arg_types[i], classes, 0, &ngpr, &nsse) == 0 || gprcount + ngpr > MAX_GPR_REGS || ssecount + nsse > MAX_SSE_REGS) { long align = cif->arg_types[i]->alignment; if (align < 8) align = 8; bytes = ALIGN (bytes, align); bytes += cif->arg_types[i]->size; } else { gprcount += ngpr; ssecount += nsse; } } if (ssecount) flags |= 1 << 11; cif->flags = flags; cif->bytes = ALIGN (bytes, 8); return FFI_OK; } void ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) { enum x86_64_reg_class classes[MAX_CLASSES]; char *stack, *argp; ffi_type **arg_types; int gprcount, ssecount, ngpr, nsse, i, avn; _Bool ret_in_memory; struct register_args *reg_args; /* Can't call 32-bit mode from 64-bit mode. */ FFI_ASSERT (cif->abi == FFI_UNIX64); /* If the return value is a struct and we don't have a return value address then we need to make one. Note the setting of flags to VOID above in ffi_prep_cif_machdep. */ ret_in_memory = (cif->rtype->type == FFI_TYPE_STRUCT && (cif->flags & 0xff) == FFI_TYPE_VOID); if (rvalue == NULL && ret_in_memory) rvalue = alloca (cif->rtype->size); /* Allocate the space for the arguments, plus 4 words of temp space. */ stack = alloca (sizeof (struct register_args) + cif->bytes + 4*8); reg_args = (struct register_args *) stack; argp = stack + sizeof (struct register_args); gprcount = ssecount = 0; /* If the return value is passed in memory, add the pointer as the first integer argument. */ if (ret_in_memory) reg_args->gpr[gprcount++] = (long) rvalue; avn = cif->nargs; arg_types = cif->arg_types; for (i = 0; i < avn; ++i) { size_t size = arg_types[i]->size; int n; n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); if (n == 0 || gprcount + ngpr > MAX_GPR_REGS || ssecount + nsse > MAX_SSE_REGS) { long align = arg_types[i]->alignment; /* Stack arguments are *always* at least 8 byte aligned. */ if (align < 8) align = 8; /* Pass this argument in memory. */ argp = (void *) ALIGN (argp, align); memcpy (argp, avalue[i], size); argp += size; } else { /* The argument is passed entirely in registers. */ char *a = (char *) avalue[i]; int j; for (j = 0; j < n; j++, a += 8, size -= 8) { switch (classes[j]) { case X86_64_INTEGER_CLASS: case X86_64_INTEGERSI_CLASS: reg_args->gpr[gprcount] = 0; memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8); gprcount++; break; case X86_64_SSE_CLASS: case X86_64_SSEDF_CLASS: reg_args->sse[ssecount++] = *(UINT64 *) a; break; case X86_64_SSESF_CLASS: reg_args->sse[ssecount++] = *(UINT32 *) a; break; default: abort(); } } } } ffi_call_unix64 (stack, cif->bytes + sizeof (struct register_args), cif->flags, rvalue, fn, ssecount); } extern void ffi_closure_unix64(void); ffi_status ffi_prep_closure_loc (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, void *codeloc) { volatile unsigned short *tramp; tramp = (volatile unsigned short *) &closure->tramp[0]; tramp[0] = 0xbb49; /* mov , %r11 */ *(void * volatile *) &tramp[1] = ffi_closure_unix64; tramp[5] = 0xba49; /* mov , %r10 */ *(void * volatile *) &tramp[6] = codeloc; /* Set the carry bit iff the function uses any sse registers. This is clc or stc, together with the first byte of the jmp. */ tramp[10] = cif->flags & (1 << 11) ? 0x49f9 : 0x49f8; tramp[11] = 0xe3ff; /* jmp *%r11 */ closure->cif = cif; closure->fun = fun; closure->user_data = user_data; return FFI_OK; } int ffi_closure_unix64_inner(ffi_closure *closure, void *rvalue, struct register_args *reg_args, char *argp) { ffi_cif *cif; void **avalue; ffi_type **arg_types; long i, avn; int gprcount, ssecount, ngpr, nsse; int ret; cif = closure->cif; avalue = alloca(cif->nargs * sizeof(void *)); gprcount = ssecount = 0; ret = cif->rtype->type; if (ret != FFI_TYPE_VOID) { enum x86_64_reg_class classes[MAX_CLASSES]; int n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); if (n == 0) { /* The return value goes in memory. Arrange for the closure return value to go directly back to the original caller. */ rvalue = (void *) reg_args->gpr[gprcount++]; /* We don't have to do anything in asm for the return. */ ret = FFI_TYPE_VOID; } else if (ret == FFI_TYPE_STRUCT && n == 2) { /* Mark which register the second word of the structure goes in. */ _Bool sse0 = SSE_CLASS_P (classes[0]); _Bool sse1 = SSE_CLASS_P (classes[1]); if (!sse0 && sse1) ret |= 1 << 8; else if (sse0 && !sse1) ret |= 1 << 9; } } avn = cif->nargs; arg_types = cif->arg_types; for (i = 0; i < avn; ++i) { enum x86_64_reg_class classes[MAX_CLASSES]; int n; n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); if (n == 0 || gprcount + ngpr > MAX_GPR_REGS || ssecount + nsse > MAX_SSE_REGS) { long align = arg_types[i]->alignment; /* Stack arguments are *always* at least 8 byte aligned. */ if (align < 8) align = 8; /* Pass this argument in memory. */ argp = (void *) ALIGN (argp, align); avalue[i] = argp; argp += arg_types[i]->size; } /* If the argument is in a single register, or two consecutive integer registers, then we can use that address directly. */ else if (n == 1 || (n == 2 && !(SSE_CLASS_P (classes[0]) || SSE_CLASS_P (classes[1])))) { /* The argument is in a single register. */ if (SSE_CLASS_P (classes[0])) { avalue[i] = ®_args->sse[ssecount]; ssecount += n; } else { avalue[i] = ®_args->gpr[gprcount]; gprcount += n; } } /* Otherwise, allocate space to make them consecutive. */ else { char *a = alloca (16); int j; avalue[i] = a; for (j = 0; j < n; j++, a += 8) { if (SSE_CLASS_P (classes[j])) memcpy (a, ®_args->sse[ssecount++], 8); else memcpy (a, ®_args->gpr[gprcount++], 8); } } } /* Invoke the closure. */ closure->fun (cif, rvalue, avalue, closure->user_data); /* Tell assembly how to perform return type promotions. */ return ret; } #endif /* __x86_64__ */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/x86/ffitarget.h0000644000175000017500000000667611545150464022413 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- ffitarget.h - Copyright (c) 1996-2003, 2010 Red Hat, Inc. Copyright (C) 2008 Free Software Foundation, Inc. Target configuration macros for x86 and x86-64. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H /* ---- System specific configurations ----------------------------------- */ /* For code common to all platforms on x86 and x86_64. */ #define X86_ANY #if defined (X86_64) && defined (__i386__) #undef X86_64 #define X86 #endif #ifdef X86_WIN64 #define FFI_SIZEOF_ARG 8 #define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ #endif /* ---- Generic type definitions ----------------------------------------- */ #ifndef LIBFFI_ASM #ifdef X86_WIN64 #ifdef _MSC_VER typedef unsigned __int64 ffi_arg; typedef __int64 ffi_sarg; #else typedef unsigned long long ffi_arg; typedef long long ffi_sarg; #endif #else typedef unsigned long ffi_arg; typedef signed long ffi_sarg; #endif typedef enum ffi_abi { FFI_FIRST_ABI = 0, /* ---- Intel x86 Win32 ---------- */ #ifdef X86_WIN32 FFI_SYSV, FFI_STDCALL, FFI_LAST_ABI, /* TODO: Add fastcall support for the sake of completeness */ FFI_DEFAULT_ABI = FFI_SYSV #elif defined(X86_WIN64) FFI_WIN64, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_WIN64 #else /* ---- Intel x86 and AMD x86-64 - */ FFI_SYSV, FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ FFI_LAST_ABI, #if defined(__i386__) || defined(__i386) FFI_DEFAULT_ABI = FFI_SYSV #else FFI_DEFAULT_ABI = FFI_UNIX64 #endif #endif } ffi_abi; #endif /* ---- Definitions for closures ----------------------------------------- */ #define FFI_CLOSURES 1 #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) #define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) #if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) #define FFI_TRAMPOLINE_SIZE 24 #define FFI_NATIVE_RAW_API 0 #else #ifdef X86_WIN32 #define FFI_TRAMPOLINE_SIZE 13 #else #ifdef X86_WIN64 #define FFI_TRAMPOLINE_SIZE 29 #define FFI_NATIVE_RAW_API 0 #define FFI_NO_RAW_API 1 #else #define FFI_TRAMPOLINE_SIZE 10 #endif #endif #ifndef X86_WIN64 #define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ #endif #endif #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/x86/freebsd.S0000644000175000017500000002633511545150464022017 0ustar chr1schr1s/* ----------------------------------------------------------------------- freebsd.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc. Copyright (c) 2008 Björn König X86 Foreign Function Interface for FreeBSD Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef __x86_64__ #define LIBFFI_ASM #include #include .text .globl ffi_prep_args .align 4 .globl ffi_call_SYSV .type ffi_call_SYSV,@function ffi_call_SYSV: .LFB1: pushl %ebp .LCFI0: movl %esp,%ebp .LCFI1: /* Make room for all of the new args. */ movl 16(%ebp),%ecx subl %ecx,%esp movl %esp,%eax /* Place all of the ffi_prep_args in position */ pushl 12(%ebp) pushl %eax call *8(%ebp) /* Return stack to previous state and call the function */ addl $8,%esp call *28(%ebp) /* Load %ecx with the return type code */ movl 20(%ebp),%ecx /* Protect %esi. We're going to pop it in the epilogue. */ pushl %esi /* If the return value pointer is NULL, assume no return value. */ cmpl $0,24(%ebp) jne 0f /* Even if there is no space for the return value, we are obliged to handle floating-point values. */ cmpl $FFI_TYPE_FLOAT,%ecx jne noretval fstp %st(0) jmp epilogue 0: call 1f .Lstore_table: .long noretval-.Lstore_table /* FFI_TYPE_VOID */ .long retint-.Lstore_table /* FFI_TYPE_INT */ .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ .long retint-.Lstore_table /* FFI_TYPE_POINTER */ .long retstruct1b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_1B */ .long retstruct2b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_2B */ 1: pop %esi add (%esi, %ecx, 4), %esi jmp *%esi /* Sign/zero extend as appropriate. */ retsint8: movsbl %al, %eax jmp retint retsint16: movswl %ax, %eax jmp retint retuint8: movzbl %al, %eax jmp retint retuint16: movzwl %ax, %eax jmp retint retfloat: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstps (%ecx) jmp epilogue retdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpl (%ecx) jmp epilogue retlongdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpt (%ecx) jmp epilogue retint64: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp epilogue retstruct1b: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movb %al,0(%ecx) jmp epilogue retstruct2b: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movw %ax,0(%ecx) jmp epilogue retint: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) retstruct: /* Nothing to do! */ noretval: epilogue: popl %esi movl %ebp,%esp popl %ebp ret .LFE1: .ffi_call_SYSV_end: .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV .align 4 FFI_HIDDEN (ffi_closure_SYSV) .globl ffi_closure_SYSV .type ffi_closure_SYSV, @function ffi_closure_SYSV: .LFB2: pushl %ebp .LCFI2: movl %esp, %ebp .LCFI3: subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ #if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ call ffi_closure_SYSV_inner #else movl %ebx, 8(%esp) .LCFI7: call 1f 1: popl %ebx addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx call ffi_closure_SYSV_inner@PLT movl 8(%esp), %ebx #endif movl -12(%ebp), %ecx cmpl $FFI_TYPE_INT, %eax je .Lcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lcls_retllong cmpl $FFI_TYPE_SMALL_STRUCT_1B, %eax je .Lcls_retstruct1b cmpl $FFI_TYPE_SMALL_STRUCT_2B, %eax je .Lcls_retstruct2b cmpl $FFI_TYPE_STRUCT, %eax je .Lcls_retstruct .Lcls_epilogue: movl %ebp, %esp popl %ebp ret .Lcls_retint: movl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retfloat: flds (%ecx) jmp .Lcls_epilogue .Lcls_retdouble: fldl (%ecx) jmp .Lcls_epilogue .Lcls_retldouble: fldt (%ecx) jmp .Lcls_epilogue .Lcls_retllong: movl (%ecx), %eax movl 4(%ecx), %edx jmp .Lcls_epilogue .Lcls_retstruct1b: movsbl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct2b: movswl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct: movl %ebp, %esp popl %ebp ret $4 .LFE2: .size ffi_closure_SYSV, .-ffi_closure_SYSV #if !FFI_NO_RAW_API #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 .align 4 FFI_HIDDEN (ffi_closure_raw_SYSV) .globl ffi_closure_raw_SYSV .type ffi_closure_raw_SYSV, @function ffi_closure_raw_SYSV: .LFB3: pushl %ebp .LCFI4: movl %esp, %ebp .LCFI5: pushl %esi .LCFI6: subl $36, %esp movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl %edx, 12(%esp) /* user_data */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ movl %edx, 8(%esp) /* raw_args */ leal -24(%ebp), %edx movl %edx, 4(%esp) /* &res */ movl %esi, (%esp) /* cif */ call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ cmpl $FFI_TYPE_INT, %eax je .Lrcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lrcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lrcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lrcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lrcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lrcls_retllong .Lrcls_epilogue: addl $36, %esp popl %esi popl %ebp ret .Lrcls_retint: movl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retfloat: flds -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retdouble: fldl -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retldouble: fldt -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retllong: movl -24(%ebp), %eax movl -20(%ebp), %edx jmp .Lrcls_epilogue .LFE3: .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV #endif .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .long 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #ifdef __PIC__ .ascii "zR\0" /* CIE Augmentation */ #else .ascii "\0" /* CIE Augmentation */ #endif .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ .byte 0x8 /* CIE RA Column */ #ifdef __PIC__ .byte 0x1 /* .uleb128 0x1; Augmentation size */ .byte 0x1b /* FDE Encoding (pcrel sdata4) */ #endif .byte 0xc /* DW_CFA_def_cfa */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x88 /* DW_CFA_offset, column 0x8 */ .byte 0x1 /* .uleb128 0x1 */ .align 4 .LECIE1: .LSFDE1: .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ #ifdef __PIC__ .long .LFB1-. /* FDE initial location */ #else .long .LFB1 /* FDE initial location */ #endif .long .LFE1-.LFB1 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI0-.LFB1 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI1-.LCFI0 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ .align 4 .LEFDE1: .LSFDE2: .long .LEFDE2-.LASFDE2 /* FDE Length */ .LASFDE2: .long .LASFDE2-.Lframe1 /* FDE CIE offset */ #ifdef __PIC__ .long .LFB2-. /* FDE initial location */ #else .long .LFB2 #endif .long .LFE2-.LFB2 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI2-.LFB2 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI3-.LCFI2 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ #if !defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE && defined __PIC__ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI7-.LCFI3 .byte 0x83 /* DW_CFA_offset, column 0x3 */ .byte 0xa /* .uleb128 0xa */ #endif .align 4 .LEFDE2: #if !FFI_NO_RAW_API .LSFDE3: .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ #ifdef __PIC__ .long .LFB3-. /* FDE initial location */ #else .long .LFB3 #endif .long .LFE3-.LFB3 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI4-.LFB3 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI5-.LCFI4 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI6-.LCFI5 .byte 0x86 /* DW_CFA_offset, column 0x6 */ .byte 0x3 /* .uleb128 0x3 */ .align 4 .LEFDE3: #endif #endif /* ifndef __x86_64__ */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/x86/sysv.S0000644000175000017500000002670711545150464021414 0ustar chr1schr1s/* ----------------------------------------------------------------------- sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008, 2010 Red Hat, Inc. X86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifndef __x86_64__ #define LIBFFI_ASM #include #include .text .globl ffi_prep_args .align 4 .globl ffi_call_SYSV .type ffi_call_SYSV,@function ffi_call_SYSV: .LFB1: pushl %ebp .LCFI0: movl %esp,%ebp .LCFI1: /* Make room for all of the new args. */ movl 16(%ebp),%ecx subl %ecx,%esp /* Align the stack pointer to 16-bytes */ andl $0xfffffff0, %esp movl %esp,%eax /* Place all of the ffi_prep_args in position */ pushl 12(%ebp) pushl %eax call *8(%ebp) /* Return stack to previous state and call the function */ addl $8,%esp call *28(%ebp) /* Load %ecx with the return type code */ movl 20(%ebp),%ecx /* Protect %esi. We're going to pop it in the epilogue. */ pushl %esi /* If the return value pointer is NULL, assume no return value. */ cmpl $0,24(%ebp) jne 0f /* Even if there is no space for the return value, we are obliged to handle floating-point values. */ cmpl $FFI_TYPE_FLOAT,%ecx jne noretval fstp %st(0) jmp epilogue 0: call 1f .Lstore_table: .long noretval-.Lstore_table /* FFI_TYPE_VOID */ .long retint-.Lstore_table /* FFI_TYPE_INT */ .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ .long retint-.Lstore_table /* FFI_TYPE_POINTER */ 1: pop %esi add (%esi, %ecx, 4), %esi jmp *%esi /* Sign/zero extend as appropriate. */ retsint8: movsbl %al, %eax jmp retint retsint16: movswl %ax, %eax jmp retint retuint8: movzbl %al, %eax jmp retint retuint16: movzwl %ax, %eax jmp retint retfloat: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstps (%ecx) jmp epilogue retdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpl (%ecx) jmp epilogue retlongdouble: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx fstpt (%ecx) jmp epilogue retint64: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp epilogue retint: /* Load %ecx with the pointer to storage for the return value */ movl 24(%ebp),%ecx movl %eax,0(%ecx) retstruct: /* Nothing to do! */ noretval: epilogue: popl %esi movl %ebp,%esp popl %ebp ret .LFE1: .ffi_call_SYSV_end: .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV .align 4 FFI_HIDDEN (ffi_closure_SYSV) .globl ffi_closure_SYSV .type ffi_closure_SYSV, @function ffi_closure_SYSV: .LFB2: pushl %ebp .LCFI2: movl %esp, %ebp .LCFI3: subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ #if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ call ffi_closure_SYSV_inner #else movl %ebx, 8(%esp) .LCFI7: call 1f 1: popl %ebx addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx call ffi_closure_SYSV_inner@PLT movl 8(%esp), %ebx #endif movl -12(%ebp), %ecx cmpl $FFI_TYPE_INT, %eax je .Lcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lcls_retllong cmpl $FFI_TYPE_STRUCT, %eax je .Lcls_retstruct .Lcls_epilogue: movl %ebp, %esp popl %ebp ret .Lcls_retint: movl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retfloat: flds (%ecx) jmp .Lcls_epilogue .Lcls_retdouble: fldl (%ecx) jmp .Lcls_epilogue .Lcls_retldouble: fldt (%ecx) jmp .Lcls_epilogue .Lcls_retllong: movl (%ecx), %eax movl 4(%ecx), %edx jmp .Lcls_epilogue .Lcls_retstruct: movl %ebp, %esp popl %ebp ret $4 .LFE2: .size ffi_closure_SYSV, .-ffi_closure_SYSV #if !FFI_NO_RAW_API /* Precalculate for e.g. the Solaris 10/x86 assembler. */ #if FFI_TRAMPOLINE_SIZE == 10 #define RAW_CLOSURE_CIF_OFFSET 12 #define RAW_CLOSURE_FUN_OFFSET 16 #define RAW_CLOSURE_USER_DATA_OFFSET 20 #elif FFI_TRAMPOLINE_SIZE == 24 #define RAW_CLOSURE_CIF_OFFSET 24 #define RAW_CLOSURE_FUN_OFFSET 28 #define RAW_CLOSURE_USER_DATA_OFFSET 32 #else #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #endif #define CIF_FLAGS_OFFSET 20 .align 4 FFI_HIDDEN (ffi_closure_raw_SYSV) .globl ffi_closure_raw_SYSV .type ffi_closure_raw_SYSV, @function ffi_closure_raw_SYSV: .LFB3: pushl %ebp .LCFI4: movl %esp, %ebp .LCFI5: pushl %esi .LCFI6: subl $36, %esp movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl %edx, 12(%esp) /* user_data */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ movl %edx, 8(%esp) /* raw_args */ leal -24(%ebp), %edx movl %edx, 4(%esp) /* &res */ movl %esi, (%esp) /* cif */ call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ cmpl $FFI_TYPE_INT, %eax je .Lrcls_retint /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ cmpl $FFI_TYPE_UINT64, %eax jge 0f cmpl $FFI_TYPE_UINT8, %eax jge .Lrcls_retint 0: cmpl $FFI_TYPE_FLOAT, %eax je .Lrcls_retfloat cmpl $FFI_TYPE_DOUBLE, %eax je .Lrcls_retdouble cmpl $FFI_TYPE_LONGDOUBLE, %eax je .Lrcls_retldouble cmpl $FFI_TYPE_SINT64, %eax je .Lrcls_retllong .Lrcls_epilogue: addl $36, %esp popl %esi popl %ebp ret .Lrcls_retint: movl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retfloat: flds -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retdouble: fldl -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retldouble: fldt -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retllong: movl -24(%ebp), %eax movl -20(%ebp), %edx jmp .Lrcls_epilogue .LFE3: .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV #endif .section .eh_frame,EH_FRAME_FLAGS,@progbits .Lframe1: .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ .LSCIE1: .long 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #ifdef HAVE_AS_ASCII_PSEUDO_OP #ifdef __PIC__ .ascii "zR\0" /* CIE Augmentation */ #else .ascii "\0" /* CIE Augmentation */ #endif #elif defined HAVE_AS_STRING_PSEUDO_OP #ifdef __PIC__ .string "zR" /* CIE Augmentation */ #else .string "" /* CIE Augmentation */ #endif #else #error missing .ascii/.string #endif .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ .byte 0x8 /* CIE RA Column */ #ifdef __PIC__ .byte 0x1 /* .uleb128 0x1; Augmentation size */ .byte 0x1b /* FDE Encoding (pcrel sdata4) */ #endif .byte 0xc /* DW_CFA_def_cfa */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x88 /* DW_CFA_offset, column 0x8 */ .byte 0x1 /* .uleb128 0x1 */ .align 4 .LECIE1: .LSFDE1: .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB1-. /* FDE initial location */ #elif defined __PIC__ .long .LFB1@rel #else .long .LFB1 #endif .long .LFE1-.LFB1 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI0-.LFB1 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI1-.LCFI0 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ .align 4 .LEFDE1: .LSFDE2: .long .LEFDE2-.LASFDE2 /* FDE Length */ .LASFDE2: .long .LASFDE2-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB2-. /* FDE initial location */ #elif defined __PIC__ .long .LFB2@rel #else .long .LFB2 #endif .long .LFE2-.LFB2 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI2-.LFB2 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI3-.LCFI2 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ #if !defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE && defined __PIC__ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI7-.LCFI3 .byte 0x83 /* DW_CFA_offset, column 0x3 */ .byte 0xa /* .uleb128 0xa */ #endif .align 4 .LEFDE2: #if !FFI_NO_RAW_API .LSFDE3: .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB3-. /* FDE initial location */ #elif defined __PIC__ .long .LFB3@rel #else .long .LFB3 #endif .long .LFE3-.LFB3 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI4-.LFB3 .byte 0xe /* DW_CFA_def_cfa_offset */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI5-.LCFI4 .byte 0xd /* DW_CFA_def_cfa_register */ .byte 0x5 /* .uleb128 0x5 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI6-.LCFI5 .byte 0x86 /* DW_CFA_offset, column 0x6 */ .byte 0x3 /* .uleb128 0x3 */ .align 4 .LEFDE3: #endif #endif /* ifndef __x86_64__ */ #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/x86/unix64.S0000644000175000017500000002621711545150464021541 0ustar chr1schr1s/* ----------------------------------------------------------------------- unix64.S - Copyright (c) 2002 Bo Thorsen Copyright (c) 2008 Red Hat, Inc x86-64 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #ifdef __x86_64__ #define LIBFFI_ASM #include #include .text /* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, void *raddr, void (*fnaddr)(void)); Bit o trickiness here -- ARGS+BYTES is the base of the stack frame for this function. This has been allocated by ffi_call. We also deallocate some of the stack that has been alloca'd. */ .align 2 .globl ffi_call_unix64 .type ffi_call_unix64,@function ffi_call_unix64: .LUW0: movq (%rsp), %r10 /* Load return address. */ leaq (%rdi, %rsi), %rax /* Find local stack base. */ movq %rdx, (%rax) /* Save flags. */ movq %rcx, 8(%rax) /* Save raddr. */ movq %rbp, 16(%rax) /* Save old frame pointer. */ movq %r10, 24(%rax) /* Relocate return address. */ movq %rax, %rbp /* Finalize local stack frame. */ .LUW1: movq %rdi, %r10 /* Save a copy of the register area. */ movq %r8, %r11 /* Save a copy of the target fn. */ movl %r9d, %eax /* Set number of SSE registers. */ /* Load up all argument registers. */ movq (%r10), %rdi movq 8(%r10), %rsi movq 16(%r10), %rdx movq 24(%r10), %rcx movq 32(%r10), %r8 movq 40(%r10), %r9 testl %eax, %eax jnz .Lload_sse .Lret_from_load_sse: /* Deallocate the reg arg area. */ leaq 176(%r10), %rsp /* Call the user function. */ call *%r11 /* Deallocate stack arg area; local stack frame in redzone. */ leaq 24(%rbp), %rsp movq 0(%rbp), %rcx /* Reload flags. */ movq 8(%rbp), %rdi /* Reload raddr. */ movq 16(%rbp), %rbp /* Reload old frame pointer. */ .LUW2: /* The first byte of the flags contains the FFI_TYPE. */ movzbl %cl, %r10d leaq .Lstore_table(%rip), %r11 movslq (%r11, %r10, 4), %r10 addq %r11, %r10 jmp *%r10 .Lstore_table: .long .Lst_void-.Lstore_table /* FFI_TYPE_VOID */ .long .Lst_sint32-.Lstore_table /* FFI_TYPE_INT */ .long .Lst_float-.Lstore_table /* FFI_TYPE_FLOAT */ .long .Lst_double-.Lstore_table /* FFI_TYPE_DOUBLE */ .long .Lst_ldouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ .long .Lst_uint8-.Lstore_table /* FFI_TYPE_UINT8 */ .long .Lst_sint8-.Lstore_table /* FFI_TYPE_SINT8 */ .long .Lst_uint16-.Lstore_table /* FFI_TYPE_UINT16 */ .long .Lst_sint16-.Lstore_table /* FFI_TYPE_SINT16 */ .long .Lst_uint32-.Lstore_table /* FFI_TYPE_UINT32 */ .long .Lst_sint32-.Lstore_table /* FFI_TYPE_SINT32 */ .long .Lst_int64-.Lstore_table /* FFI_TYPE_UINT64 */ .long .Lst_int64-.Lstore_table /* FFI_TYPE_SINT64 */ .long .Lst_struct-.Lstore_table /* FFI_TYPE_STRUCT */ .long .Lst_int64-.Lstore_table /* FFI_TYPE_POINTER */ .align 2 .Lst_void: ret .align 2 .Lst_uint8: movzbq %al, %rax movq %rax, (%rdi) ret .align 2 .Lst_sint8: movsbq %al, %rax movq %rax, (%rdi) ret .align 2 .Lst_uint16: movzwq %ax, %rax movq %rax, (%rdi) .align 2 .Lst_sint16: movswq %ax, %rax movq %rax, (%rdi) ret .align 2 .Lst_uint32: movl %eax, %eax movq %rax, (%rdi) .align 2 .Lst_sint32: cltq movq %rax, (%rdi) ret .align 2 .Lst_int64: movq %rax, (%rdi) ret .align 2 .Lst_float: movss %xmm0, (%rdi) ret .align 2 .Lst_double: movsd %xmm0, (%rdi) ret .Lst_ldouble: fstpt (%rdi) ret .align 2 .Lst_struct: leaq -20(%rsp), %rsi /* Scratch area in redzone. */ /* We have to locate the values now, and since we don't want to write too much data into the user's return value, we spill the value to a 16 byte scratch area first. Bits 8, 9, and 10 control where the values are located. Only one of the three bits will be set; see ffi_prep_cif_machdep for the pattern. */ movd %xmm0, %r10 movd %xmm1, %r11 testl $0x100, %ecx cmovnz %rax, %rdx cmovnz %r10, %rax testl $0x200, %ecx cmovnz %r10, %rdx testl $0x400, %ecx cmovnz %r10, %rax cmovnz %r11, %rdx movq %rax, (%rsi) movq %rdx, 8(%rsi) /* Bits 12-31 contain the true size of the structure. Copy from the scratch area to the true destination. */ shrl $12, %ecx rep movsb ret /* Many times we can avoid loading any SSE registers at all. It's not worth an indirect jump to load the exact set of SSE registers needed; zero or all is a good compromise. */ .align 2 .LUW3: .Lload_sse: movdqa 48(%r10), %xmm0 movdqa 64(%r10), %xmm1 movdqa 80(%r10), %xmm2 movdqa 96(%r10), %xmm3 movdqa 112(%r10), %xmm4 movdqa 128(%r10), %xmm5 movdqa 144(%r10), %xmm6 movdqa 160(%r10), %xmm7 jmp .Lret_from_load_sse .LUW4: .size ffi_call_unix64,.-ffi_call_unix64 .align 2 .globl ffi_closure_unix64 .type ffi_closure_unix64,@function ffi_closure_unix64: .LUW5: /* The carry flag is set by the trampoline iff SSE registers are used. Don't clobber it before the branch instruction. */ leaq -200(%rsp), %rsp .LUW6: movq %rdi, (%rsp) movq %rsi, 8(%rsp) movq %rdx, 16(%rsp) movq %rcx, 24(%rsp) movq %r8, 32(%rsp) movq %r9, 40(%rsp) jc .Lsave_sse .Lret_from_save_sse: movq %r10, %rdi leaq 176(%rsp), %rsi movq %rsp, %rdx leaq 208(%rsp), %rcx call ffi_closure_unix64_inner@PLT /* Deallocate stack frame early; return value is now in redzone. */ addq $200, %rsp .LUW7: /* The first byte of the return value contains the FFI_TYPE. */ movzbl %al, %r10d leaq .Lload_table(%rip), %r11 movslq (%r11, %r10, 4), %r10 addq %r11, %r10 jmp *%r10 .Lload_table: .long .Lld_void-.Lload_table /* FFI_TYPE_VOID */ .long .Lld_int32-.Lload_table /* FFI_TYPE_INT */ .long .Lld_float-.Lload_table /* FFI_TYPE_FLOAT */ .long .Lld_double-.Lload_table /* FFI_TYPE_DOUBLE */ .long .Lld_ldouble-.Lload_table /* FFI_TYPE_LONGDOUBLE */ .long .Lld_int8-.Lload_table /* FFI_TYPE_UINT8 */ .long .Lld_int8-.Lload_table /* FFI_TYPE_SINT8 */ .long .Lld_int16-.Lload_table /* FFI_TYPE_UINT16 */ .long .Lld_int16-.Lload_table /* FFI_TYPE_SINT16 */ .long .Lld_int32-.Lload_table /* FFI_TYPE_UINT32 */ .long .Lld_int32-.Lload_table /* FFI_TYPE_SINT32 */ .long .Lld_int64-.Lload_table /* FFI_TYPE_UINT64 */ .long .Lld_int64-.Lload_table /* FFI_TYPE_SINT64 */ .long .Lld_struct-.Lload_table /* FFI_TYPE_STRUCT */ .long .Lld_int64-.Lload_table /* FFI_TYPE_POINTER */ .align 2 .Lld_void: ret .align 2 .Lld_int8: movzbl -24(%rsp), %eax ret .align 2 .Lld_int16: movzwl -24(%rsp), %eax ret .align 2 .Lld_int32: movl -24(%rsp), %eax ret .align 2 .Lld_int64: movq -24(%rsp), %rax ret .align 2 .Lld_float: movss -24(%rsp), %xmm0 ret .align 2 .Lld_double: movsd -24(%rsp), %xmm0 ret .align 2 .Lld_ldouble: fldt -24(%rsp) ret .align 2 .Lld_struct: /* There are four possibilities here, %rax/%rdx, %xmm0/%rax, %rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading both rdx and xmm1 with the second word. For the remaining, bit 8 set means xmm0 gets the second word, and bit 9 means that rax gets the second word. */ movq -24(%rsp), %rcx movq -16(%rsp), %rdx movq -16(%rsp), %xmm1 testl $0x100, %eax cmovnz %rdx, %rcx movd %rcx, %xmm0 testl $0x200, %eax movq -24(%rsp), %rax cmovnz %rdx, %rax ret /* See the comment above .Lload_sse; the same logic applies here. */ .align 2 .LUW8: .Lsave_sse: movdqa %xmm0, 48(%rsp) movdqa %xmm1, 64(%rsp) movdqa %xmm2, 80(%rsp) movdqa %xmm3, 96(%rsp) movdqa %xmm4, 112(%rsp) movdqa %xmm5, 128(%rsp) movdqa %xmm6, 144(%rsp) movdqa %xmm7, 160(%rsp) jmp .Lret_from_save_sse .LUW9: .size ffi_closure_unix64,.-ffi_closure_unix64 #ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE .section .eh_frame,"a",@unwind #else .section .eh_frame,"a",@progbits #endif .Lframe1: .long .LECIE1-.LSCIE1 /* CIE Length */ .LSCIE1: .long 0 /* CIE Identifier Tag */ .byte 1 /* CIE Version */ .ascii "zR\0" /* CIE Augmentation */ .uleb128 1 /* CIE Code Alignment Factor */ .sleb128 -8 /* CIE Data Alignment Factor */ .byte 0x10 /* CIE RA Column */ .uleb128 1 /* Augmentation size */ .byte 0x1b /* FDE Encoding (pcrel sdata4) */ .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ .uleb128 7 .uleb128 8 .byte 0x80+16 /* DW_CFA_offset, %rip offset 1*-8 */ .uleb128 1 .align 8 .LECIE1: .LSFDE1: .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ #if HAVE_AS_X86_PCREL .long .LUW0-. /* FDE initial location */ #else .long .LUW0@rel #endif .long .LUW4-.LUW0 /* FDE address range */ .uleb128 0x0 /* Augmentation size */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW1-.LUW0 /* New stack frame based off rbp. This is a itty bit of unwind trickery in that the CFA *has* changed. There is no easy way to describe it correctly on entry to the function. Fortunately, it doesn't matter too much since at all points we can correctly unwind back to ffi_call. Note that the location to which we moved the return address is (the new) CFA-8, so from the perspective of the unwind info, it hasn't moved. */ .byte 0xc /* DW_CFA_def_cfa, %rbp offset 32 */ .uleb128 6 .uleb128 32 .byte 0x80+6 /* DW_CFA_offset, %rbp offset 2*-8 */ .uleb128 2 .byte 0xa /* DW_CFA_remember_state */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW2-.LUW1 .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ .uleb128 7 .uleb128 8 .byte 0xc0+6 /* DW_CFA_restore, %rbp */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW3-.LUW2 .byte 0xb /* DW_CFA_restore_state */ .align 8 .LEFDE1: .LSFDE3: .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ #if HAVE_AS_X86_PCREL .long .LUW5-. /* FDE initial location */ #else .long .LUW5@rel #endif .long .LUW9-.LUW5 /* FDE address range */ .uleb128 0x0 /* Augmentation size */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW6-.LUW5 .byte 0xe /* DW_CFA_def_cfa_offset */ .uleb128 208 .byte 0xa /* DW_CFA_remember_state */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW7-.LUW6 .byte 0xe /* DW_CFA_def_cfa_offset */ .uleb128 8 .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LUW8-.LUW7 .byte 0xb /* DW_CFA_restore_state */ .align 8 .LEFDE3: #endif /* __x86_64__ */ #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/x86/win32.S0000644000175000017500000007015411545150464021345 0ustar chr1schr1s/* ----------------------------------------------------------------------- win32.S - Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc. Copyright (c) 2001 John Beniton Copyright (c) 2002 Ranjit Mathew Copyright (c) 2009 Daniel Witte X86 Foreign Function Interface Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #define LIBFFI_ASM #include #include #ifdef _MSC_VER .386 .MODEL FLAT, C EXTRN ffi_closure_SYSV_inner:NEAR _TEXT SEGMENT ffi_call_win32 PROC NEAR, ffi_prep_args : NEAR PTR DWORD, ecif : NEAR PTR DWORD, cif_bytes : DWORD, cif_flags : DWORD, rvalue : NEAR PTR DWORD, fn : NEAR PTR DWORD ;; Make room for all of the new args. mov ecx, cif_bytes sub esp, ecx mov eax, esp ;; Place all of the ffi_prep_args in position push ecif push eax call ffi_prep_args ;; Return stack to previous state and call the function add esp, 8 call fn ;; cdecl: we restore esp in the epilogue, so there's no need to ;; remove the space we pushed for the args. ;; stdcall: the callee has already cleaned the stack. ;; Load ecx with the return type code mov ecx, cif_flags ;; If the return value pointer is NULL, assume no return value. cmp rvalue, 0 jne ca_jumptable ;; Even if there is no space for the return value, we are ;; obliged to handle floating-point values. cmp ecx, FFI_TYPE_FLOAT jne ca_epilogue fstp st(0) jmp ca_epilogue ca_jumptable: jmp [ca_jumpdata + 4 * ecx] ca_jumpdata: ;; Do not insert anything here between label and jump table. dd offset ca_epilogue ;; FFI_TYPE_VOID dd offset ca_retint ;; FFI_TYPE_INT dd offset ca_retfloat ;; FFI_TYPE_FLOAT dd offset ca_retdouble ;; FFI_TYPE_DOUBLE dd offset ca_retlongdouble ;; FFI_TYPE_LONGDOUBLE dd offset ca_retint8 ;; FFI_TYPE_UINT8 dd offset ca_retint8 ;; FFI_TYPE_SINT8 dd offset ca_retint16 ;; FFI_TYPE_UINT16 dd offset ca_retint16 ;; FFI_TYPE_SINT16 dd offset ca_retint ;; FFI_TYPE_UINT32 dd offset ca_retint ;; FFI_TYPE_SINT32 dd offset ca_retint64 ;; FFI_TYPE_UINT64 dd offset ca_retint64 ;; FFI_TYPE_SINT64 dd offset ca_epilogue ;; FFI_TYPE_STRUCT dd offset ca_retint ;; FFI_TYPE_POINTER dd offset ca_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B dd offset ca_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset ca_retint ;; FFI_TYPE_SMALL_STRUCT_4B ca_retint8: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue mov [ecx + 0], al jmp ca_epilogue ca_retint16: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue mov [ecx + 0], ax jmp ca_epilogue ca_retint: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue mov [ecx + 0], eax jmp ca_epilogue ca_retint64: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue mov [ecx + 0], eax mov [ecx + 4], edx jmp ca_epilogue ca_retfloat: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue fstp DWORD PTR [ecx] jmp ca_epilogue ca_retdouble: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue fstp QWORD PTR [ecx] jmp ca_epilogue ca_retlongdouble: ;; Load %ecx with the pointer to storage for the return value mov ecx, rvalue fstp TBYTE PTR [ecx] jmp ca_epilogue ca_epilogue: ;; Epilogue code is autogenerated. ret ffi_call_win32 ENDP ffi_closure_SYSV PROC NEAR FORCEFRAME ;; the ffi_closure ctx is passed in eax by the trampoline. sub esp, 40 lea edx, [ebp - 24] mov [ebp - 12], edx ;; resp lea edx, [ebp + 8] mov [esp + 8], edx ;; args lea edx, [ebp - 12] mov [esp + 4], edx ;; &resp mov [esp], eax ;; closure call ffi_closure_SYSV_inner mov ecx, [ebp - 12] cs_jumptable: jmp [cs_jumpdata + 4 * eax] cs_jumpdata: ;; Do not insert anything here between the label and jump table. dd offset cs_epilogue ;; FFI_TYPE_VOID dd offset cs_retint ;; FFI_TYPE_INT dd offset cs_retfloat ;; FFI_TYPE_FLOAT dd offset cs_retdouble ;; FFI_TYPE_DOUBLE dd offset cs_retlongdouble ;; FFI_TYPE_LONGDOUBLE dd offset cs_retint8 ;; FFI_TYPE_UINT8 dd offset cs_retint8 ;; FFI_TYPE_SINT8 dd offset cs_retint16 ;; FFI_TYPE_UINT16 dd offset cs_retint16 ;; FFI_TYPE_SINT16 dd offset cs_retint ;; FFI_TYPE_UINT32 dd offset cs_retint ;; FFI_TYPE_SINT32 dd offset cs_retint64 ;; FFI_TYPE_UINT64 dd offset cs_retint64 ;; FFI_TYPE_SINT64 dd offset cs_retstruct ;; FFI_TYPE_STRUCT dd offset cs_retint ;; FFI_TYPE_POINTER dd offset cs_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B dd offset cs_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cs_retint ;; FFI_TYPE_SMALL_STRUCT_4B cs_retint8: mov al, [ecx] jmp cs_epilogue cs_retint16: mov ax, [ecx] jmp cs_epilogue cs_retint: mov eax, [ecx] jmp cs_epilogue cs_retint64: mov eax, [ecx + 0] mov edx, [ecx + 4] jmp cs_epilogue cs_retfloat: fld DWORD PTR [ecx] jmp cs_epilogue cs_retdouble: fld QWORD PTR [ecx] jmp cs_epilogue cs_retlongdouble: fld TBYTE PTR [ecx] jmp cs_epilogue cs_retstruct: ;; Caller expects us to pop struct return value pointer hidden arg. ;; Epilogue code is autogenerated. ret 4 cs_epilogue: ;; Epilogue code is autogenerated. ret ffi_closure_SYSV ENDP #if !FFI_NO_RAW_API #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) AND NOT 3) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 ffi_closure_raw_SYSV PROC NEAR USES esi ;; the ffi_closure ctx is passed in eax by the trampoline. sub esp, 40 mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data mov [esp + 12], edx ;; user_data lea edx, [ebp + 8] mov [esp + 8], edx ;; raw_args lea edx, [ebp - 24] mov [esp + 4], edx ;; &res mov [esp], esi ;; cif call DWORD PTR [eax + RAW_CLOSURE_FUN_OFFSET] ;; closure->fun mov eax, [esi + CIF_FLAGS_OFFSET] ;; cif->flags lea ecx, [ebp - 24] cr_jumptable: jmp [cr_jumpdata + 4 * eax] cr_jumpdata: ;; Do not insert anything here between the label and jump table. dd offset cr_epilogue ;; FFI_TYPE_VOID dd offset cr_retint ;; FFI_TYPE_INT dd offset cr_retfloat ;; FFI_TYPE_FLOAT dd offset cr_retdouble ;; FFI_TYPE_DOUBLE dd offset cr_retlongdouble ;; FFI_TYPE_LONGDOUBLE dd offset cr_retint8 ;; FFI_TYPE_UINT8 dd offset cr_retint8 ;; FFI_TYPE_SINT8 dd offset cr_retint16 ;; FFI_TYPE_UINT16 dd offset cr_retint16 ;; FFI_TYPE_SINT16 dd offset cr_retint ;; FFI_TYPE_UINT32 dd offset cr_retint ;; FFI_TYPE_SINT32 dd offset cr_retint64 ;; FFI_TYPE_UINT64 dd offset cr_retint64 ;; FFI_TYPE_SINT64 dd offset cr_epilogue ;; FFI_TYPE_STRUCT dd offset cr_retint ;; FFI_TYPE_POINTER dd offset cr_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B dd offset cr_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cr_retint ;; FFI_TYPE_SMALL_STRUCT_4B cr_retint8: mov al, [ecx] jmp cr_epilogue cr_retint16: mov ax, [ecx] jmp cr_epilogue cr_retint: mov eax, [ecx] jmp cr_epilogue cr_retint64: mov eax, [ecx + 0] mov edx, [ecx + 4] jmp cr_epilogue cr_retfloat: fld DWORD PTR [ecx] jmp cr_epilogue cr_retdouble: fld QWORD PTR [ecx] jmp cr_epilogue cr_retlongdouble: fld TBYTE PTR [ecx] jmp cr_epilogue cr_epilogue: ;; Epilogue code is autogenerated. ret ffi_closure_raw_SYSV ENDP #endif /* !FFI_NO_RAW_API */ ffi_closure_STDCALL PROC NEAR FORCEFRAME ;; the ffi_closure ctx is passed in eax by the trampoline. sub esp, 40 lea edx, [ebp - 24] mov [ebp - 12], edx ;; resp lea edx, [ebp + 12] ;; account for stub return address on stack mov [esp + 8], edx ;; args lea edx, [ebp - 12] mov [esp + 4], edx ;; &resp mov [esp], eax ;; closure call ffi_closure_SYSV_inner mov ecx, [ebp - 12] cd_jumptable: jmp [cd_jumpdata + 4 * eax] cd_jumpdata: ;; Do not insert anything here between the label and jump table. dd offset cd_epilogue ;; FFI_TYPE_VOID dd offset cd_retint ;; FFI_TYPE_INT dd offset cd_retfloat ;; FFI_TYPE_FLOAT dd offset cd_retdouble ;; FFI_TYPE_DOUBLE dd offset cd_retlongdouble ;; FFI_TYPE_LONGDOUBLE dd offset cd_retint8 ;; FFI_TYPE_UINT8 dd offset cd_retint8 ;; FFI_TYPE_SINT8 dd offset cd_retint16 ;; FFI_TYPE_UINT16 dd offset cd_retint16 ;; FFI_TYPE_SINT16 dd offset cd_retint ;; FFI_TYPE_UINT32 dd offset cd_retint ;; FFI_TYPE_SINT32 dd offset cd_retint64 ;; FFI_TYPE_UINT64 dd offset cd_retint64 ;; FFI_TYPE_SINT64 dd offset cd_epilogue ;; FFI_TYPE_STRUCT dd offset cd_retint ;; FFI_TYPE_POINTER dd offset cd_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B dd offset cd_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B dd offset cd_retint ;; FFI_TYPE_SMALL_STRUCT_4B cd_retint8: mov al, [ecx] jmp cd_epilogue cd_retint16: mov ax, [ecx] jmp cd_epilogue cd_retint: mov eax, [ecx] jmp cd_epilogue cd_retint64: mov eax, [ecx + 0] mov edx, [ecx + 4] jmp cd_epilogue cd_retfloat: fld DWORD PTR [ecx] jmp cd_epilogue cd_retdouble: fld QWORD PTR [ecx] jmp cd_epilogue cd_retlongdouble: fld TBYTE PTR [ecx] jmp cd_epilogue cd_epilogue: ;; Epilogue code is autogenerated. ret ffi_closure_STDCALL ENDP _TEXT ENDS END #else .text # This assumes we are using gas. .balign 16 .globl _ffi_call_win32 #ifndef __OS2__ .def _ffi_call_win32; .scl 2; .type 32; .endef #endif _ffi_call_win32: .LFB1: pushl %ebp .LCFI0: movl %esp,%ebp .LCFI1: # Make room for all of the new args. movl 16(%ebp),%ecx subl %ecx,%esp movl %esp,%eax # Place all of the ffi_prep_args in position pushl 12(%ebp) pushl %eax call *8(%ebp) # Return stack to previous state and call the function addl $8,%esp # FIXME: Align the stack to a 128-bit boundary to avoid # potential performance hits. call *28(%ebp) # stdcall functions pop arguments off the stack themselves # Load %ecx with the return type code movl 20(%ebp),%ecx # If the return value pointer is NULL, assume no return value. cmpl $0,24(%ebp) jne 0f # Even if there is no space for the return value, we are # obliged to handle floating-point values. cmpl $FFI_TYPE_FLOAT,%ecx jne .Lnoretval fstp %st(0) jmp .Lepilogue 0: call 1f # Do not insert anything here between the call and the jump table. .Lstore_table: .long .Lnoretval /* FFI_TYPE_VOID */ .long .Lretint /* FFI_TYPE_INT */ .long .Lretfloat /* FFI_TYPE_FLOAT */ .long .Lretdouble /* FFI_TYPE_DOUBLE */ .long .Lretlongdouble /* FFI_TYPE_LONGDOUBLE */ .long .Lretuint8 /* FFI_TYPE_UINT8 */ .long .Lretsint8 /* FFI_TYPE_SINT8 */ .long .Lretuint16 /* FFI_TYPE_UINT16 */ .long .Lretsint16 /* FFI_TYPE_SINT16 */ .long .Lretint /* FFI_TYPE_UINT32 */ .long .Lretint /* FFI_TYPE_SINT32 */ .long .Lretint64 /* FFI_TYPE_UINT64 */ .long .Lretint64 /* FFI_TYPE_SINT64 */ .long .Lretstruct /* FFI_TYPE_STRUCT */ .long .Lretint /* FFI_TYPE_POINTER */ .long .Lretstruct1b /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lretstruct2b /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lretstruct4b /* FFI_TYPE_SMALL_STRUCT_4B */ 1: add %ecx, %ecx add %ecx, %ecx add (%esp),%ecx add $4, %esp jmp *(%ecx) /* Sign/zero extend as appropriate. */ .Lretsint8: movsbl %al, %eax jmp .Lretint .Lretsint16: movswl %ax, %eax jmp .Lretint .Lretuint8: movzbl %al, %eax jmp .Lretint .Lretuint16: movzwl %ax, %eax jmp .Lretint .Lretint: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx movl %eax,0(%ecx) jmp .Lepilogue .Lretfloat: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx fstps (%ecx) jmp .Lepilogue .Lretdouble: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx fstpl (%ecx) jmp .Lepilogue .Lretlongdouble: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx fstpt (%ecx) jmp .Lepilogue .Lretint64: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx movl %eax,0(%ecx) movl %edx,4(%ecx) jmp .Lepilogue .Lretstruct1b: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx movb %al,0(%ecx) jmp .Lepilogue .Lretstruct2b: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx movw %ax,0(%ecx) jmp .Lepilogue .Lretstruct4b: # Load %ecx with the pointer to storage for the return value movl 24(%ebp),%ecx movl %eax,0(%ecx) jmp .Lepilogue .Lretstruct: # Nothing to do! .Lnoretval: .Lepilogue: movl %ebp,%esp popl %ebp ret .ffi_call_win32_end: .LFE1: # This assumes we are using gas. .balign 16 .globl _ffi_closure_SYSV #ifndef __OS2__ .def _ffi_closure_SYSV; .scl 2; .type 32; .endef #endif _ffi_closure_SYSV: .LFB3: pushl %ebp .LCFI4: movl %esp, %ebp .LCFI5: subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 8(%ebp), %edx movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ call _ffi_closure_SYSV_inner movl -12(%ebp), %ecx 0: call 1f # Do not insert anything here between the call and the jump table. .Lcls_store_table: .long .Lcls_noretval /* FFI_TYPE_VOID */ .long .Lcls_retint /* FFI_TYPE_INT */ .long .Lcls_retfloat /* FFI_TYPE_FLOAT */ .long .Lcls_retdouble /* FFI_TYPE_DOUBLE */ .long .Lcls_retldouble /* FFI_TYPE_LONGDOUBLE */ .long .Lcls_retuint8 /* FFI_TYPE_UINT8 */ .long .Lcls_retsint8 /* FFI_TYPE_SINT8 */ .long .Lcls_retuint16 /* FFI_TYPE_UINT16 */ .long .Lcls_retsint16 /* FFI_TYPE_SINT16 */ .long .Lcls_retint /* FFI_TYPE_UINT32 */ .long .Lcls_retint /* FFI_TYPE_SINT32 */ .long .Lcls_retllong /* FFI_TYPE_UINT64 */ .long .Lcls_retllong /* FFI_TYPE_SINT64 */ .long .Lcls_retstruct /* FFI_TYPE_STRUCT */ .long .Lcls_retint /* FFI_TYPE_POINTER */ .long .Lcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ 1: add %eax, %eax add %eax, %eax add (%esp),%eax add $4, %esp jmp *(%eax) /* Sign/zero extend as appropriate. */ .Lcls_retsint8: movsbl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retsint16: movswl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retuint8: movzbl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retuint16: movzwl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retint: movl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retfloat: flds (%ecx) jmp .Lcls_epilogue .Lcls_retdouble: fldl (%ecx) jmp .Lcls_epilogue .Lcls_retldouble: fldt (%ecx) jmp .Lcls_epilogue .Lcls_retllong: movl (%ecx), %eax movl 4(%ecx), %edx jmp .Lcls_epilogue .Lcls_retstruct1: movsbl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct2: movswl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct4: movl (%ecx), %eax jmp .Lcls_epilogue .Lcls_retstruct: # Caller expects us to pop struct return value pointer hidden arg. movl %ebp, %esp popl %ebp ret $0x4 .Lcls_noretval: .Lcls_epilogue: movl %ebp, %esp popl %ebp ret .ffi_closure_SYSV_end: .LFE3: #if !FFI_NO_RAW_API #define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) #define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) #define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) #define CIF_FLAGS_OFFSET 20 # This assumes we are using gas. .balign 16 .globl _ffi_closure_raw_SYSV #ifndef __OS2__ .def _ffi_closure_raw_SYSV; .scl 2; .type 32; .endef #endif _ffi_closure_raw_SYSV: .LFB4: pushl %ebp .LCFI6: movl %esp, %ebp .LCFI7: pushl %esi .LCFI8: subl $36, %esp movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ movl %edx, 12(%esp) /* user_data */ leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ movl %edx, 8(%esp) /* raw_args */ leal -24(%ebp), %edx movl %edx, 4(%esp) /* &res */ movl %esi, (%esp) /* cif */ call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ 0: call 1f # Do not insert anything here between the call and the jump table. .Lrcls_store_table: .long .Lrcls_noretval /* FFI_TYPE_VOID */ .long .Lrcls_retint /* FFI_TYPE_INT */ .long .Lrcls_retfloat /* FFI_TYPE_FLOAT */ .long .Lrcls_retdouble /* FFI_TYPE_DOUBLE */ .long .Lrcls_retldouble /* FFI_TYPE_LONGDOUBLE */ .long .Lrcls_retuint8 /* FFI_TYPE_UINT8 */ .long .Lrcls_retsint8 /* FFI_TYPE_SINT8 */ .long .Lrcls_retuint16 /* FFI_TYPE_UINT16 */ .long .Lrcls_retsint16 /* FFI_TYPE_SINT16 */ .long .Lrcls_retint /* FFI_TYPE_UINT32 */ .long .Lrcls_retint /* FFI_TYPE_SINT32 */ .long .Lrcls_retllong /* FFI_TYPE_UINT64 */ .long .Lrcls_retllong /* FFI_TYPE_SINT64 */ .long .Lrcls_retstruct /* FFI_TYPE_STRUCT */ .long .Lrcls_retint /* FFI_TYPE_POINTER */ .long .Lrcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lrcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lrcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ 1: add %eax, %eax add %eax, %eax add (%esp),%eax add $4, %esp jmp *(%eax) /* Sign/zero extend as appropriate. */ .Lrcls_retsint8: movsbl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retsint16: movswl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retuint8: movzbl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retuint16: movzwl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retint: movl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retfloat: flds -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retdouble: fldl -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retldouble: fldt -24(%ebp) jmp .Lrcls_epilogue .Lrcls_retllong: movl -24(%ebp), %eax movl -20(%ebp), %edx jmp .Lrcls_epilogue .Lrcls_retstruct1: movsbl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retstruct2: movswl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retstruct4: movl -24(%ebp), %eax jmp .Lrcls_epilogue .Lrcls_retstruct: # Nothing to do! .Lrcls_noretval: .Lrcls_epilogue: addl $36, %esp popl %esi popl %ebp ret .ffi_closure_raw_SYSV_end: .LFE4: #endif /* !FFI_NO_RAW_API */ # This assumes we are using gas. .balign 16 .globl _ffi_closure_STDCALL #ifndef __OS2__ .def _ffi_closure_STDCALL; .scl 2; .type 32; .endef #endif _ffi_closure_STDCALL: .LFB5: pushl %ebp .LCFI9: movl %esp, %ebp .LCFI10: subl $40, %esp leal -24(%ebp), %edx movl %edx, -12(%ebp) /* resp */ leal 12(%ebp), %edx /* account for stub return address on stack */ movl %edx, 4(%esp) /* args */ leal -12(%ebp), %edx movl %edx, (%esp) /* &resp */ call _ffi_closure_SYSV_inner movl -12(%ebp), %ecx 0: call 1f # Do not insert anything here between the call and the jump table. .Lscls_store_table: .long .Lscls_noretval /* FFI_TYPE_VOID */ .long .Lscls_retint /* FFI_TYPE_INT */ .long .Lscls_retfloat /* FFI_TYPE_FLOAT */ .long .Lscls_retdouble /* FFI_TYPE_DOUBLE */ .long .Lscls_retldouble /* FFI_TYPE_LONGDOUBLE */ .long .Lscls_retuint8 /* FFI_TYPE_UINT8 */ .long .Lscls_retsint8 /* FFI_TYPE_SINT8 */ .long .Lscls_retuint16 /* FFI_TYPE_UINT16 */ .long .Lscls_retsint16 /* FFI_TYPE_SINT16 */ .long .Lscls_retint /* FFI_TYPE_UINT32 */ .long .Lscls_retint /* FFI_TYPE_SINT32 */ .long .Lscls_retllong /* FFI_TYPE_UINT64 */ .long .Lscls_retllong /* FFI_TYPE_SINT64 */ .long .Lscls_retstruct /* FFI_TYPE_STRUCT */ .long .Lscls_retint /* FFI_TYPE_POINTER */ .long .Lscls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ .long .Lscls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ .long .Lscls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ 1: add %eax, %eax add %eax, %eax add (%esp),%eax add $4, %esp jmp *(%eax) /* Sign/zero extend as appropriate. */ .Lscls_retsint8: movsbl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retsint16: movswl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retuint8: movzbl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retuint16: movzwl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retint: movl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retfloat: flds (%ecx) jmp .Lscls_epilogue .Lscls_retdouble: fldl (%ecx) jmp .Lscls_epilogue .Lscls_retldouble: fldt (%ecx) jmp .Lscls_epilogue .Lscls_retllong: movl (%ecx), %eax movl 4(%ecx), %edx jmp .Lscls_epilogue .Lscls_retstruct1: movsbl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retstruct2: movswl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retstruct4: movl (%ecx), %eax jmp .Lscls_epilogue .Lscls_retstruct: # Nothing to do! .Lscls_noretval: .Lscls_epilogue: movl %ebp, %esp popl %ebp ret .ffi_closure_STDCALL_end: .LFE5: #ifndef __OS2__ .section .eh_frame,"w" #endif .Lframe1: .LSCIE1: .long .LECIE1-.LASCIE1 /* Length of Common Information Entry */ .LASCIE1: .long 0x0 /* CIE Identifier Tag */ .byte 0x1 /* CIE Version */ #ifdef __PIC__ .ascii "zR\0" /* CIE Augmentation */ #else .ascii "\0" /* CIE Augmentation */ #endif .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ .byte 0x8 /* CIE RA Column */ #ifdef __PIC__ .byte 0x1 /* .uleb128 0x1; Augmentation size */ .byte 0x1b /* FDE Encoding (pcrel sdata4) */ #endif .byte 0xc /* DW_CFA_def_cfa CFA = r4 + 4 = 4(%esp) */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x4 /* .uleb128 0x4 */ .byte 0x88 /* DW_CFA_offset, column 0x8 %eip at CFA + 1 * -4 */ .byte 0x1 /* .uleb128 0x1 */ .align 4 .LECIE1: .LSFDE1: .long .LEFDE1-.LASFDE1 /* FDE Length */ .LASFDE1: .long .LASFDE1-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB1-. /* FDE initial location */ #else .long .LFB1 #endif .long .LFE1-.LFB1 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif /* DW_CFA_xxx CFI instructions go here. */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI0-.LFB1 .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI1-.LCFI0 .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ .byte 0x5 /* .uleb128 0x5 */ /* End of DW_CFA_xxx CFI instructions. */ .align 4 .LEFDE1: .LSFDE3: .long .LEFDE3-.LASFDE3 /* FDE Length */ .LASFDE3: .long .LASFDE3-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB3-. /* FDE initial location */ #else .long .LFB3 #endif .long .LFE3-.LFB3 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif /* DW_CFA_xxx CFI instructions go here. */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI4-.LFB3 .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI5-.LCFI4 .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ .byte 0x5 /* .uleb128 0x5 */ /* End of DW_CFA_xxx CFI instructions. */ .align 4 .LEFDE3: #if !FFI_NO_RAW_API .LSFDE4: .long .LEFDE4-.LASFDE4 /* FDE Length */ .LASFDE4: .long .LASFDE4-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB4-. /* FDE initial location */ #else .long .LFB4 #endif .long .LFE4-.LFB4 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif /* DW_CFA_xxx CFI instructions go here. */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI6-.LFB4 .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI7-.LCFI6 .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ .byte 0x5 /* .uleb128 0x5 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI8-.LCFI7 .byte 0x86 /* DW_CFA_offset, column 0x6 %esi at CFA + 3 * -4 */ .byte 0x3 /* .uleb128 0x3 */ /* End of DW_CFA_xxx CFI instructions. */ .align 4 .LEFDE4: #endif /* !FFI_NO_RAW_API */ .LSFDE5: .long .LEFDE5-.LASFDE5 /* FDE Length */ .LASFDE5: .long .LASFDE5-.Lframe1 /* FDE CIE offset */ #if defined __PIC__ && defined HAVE_AS_X86_PCREL .long .LFB5-. /* FDE initial location */ #else .long .LFB5 #endif .long .LFE5-.LFB5 /* FDE address range */ #ifdef __PIC__ .byte 0x0 /* .uleb128 0x0; Augmentation size */ #endif /* DW_CFA_xxx CFI instructions go here. */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI9-.LFB5 .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ .byte 0x8 /* .uleb128 0x8 */ .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ .byte 0x2 /* .uleb128 0x2 */ .byte 0x4 /* DW_CFA_advance_loc4 */ .long .LCFI10-.LCFI9 .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ .byte 0x5 /* .uleb128 0x5 */ /* End of DW_CFA_xxx CFI instructions. */ .align 4 .LEFDE5: #endif /* !_MSC_VER */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/x86/win64.S0000644000175000017500000002173311545150464021351 0ustar chr1schr1s#define LIBFFI_ASM #include #include /* Constants for ffi_call_win64 */ #define STACK 0 #define PREP_ARGS_FN 32 #define ECIF 40 #define CIF_BYTES 48 #define CIF_FLAGS 56 #define RVALUE 64 #define FN 72 /* ffi_call_win64 (void (*prep_args_fn)(char *, extended_cif *), extended_cif *ecif, unsigned bytes, unsigned flags, unsigned *rvalue, void (*fn)()); */ #ifdef _MSC_VER PUBLIC ffi_call_win64 EXTRN __chkstk:NEAR EXTRN ffi_closure_win64_inner:NEAR _TEXT SEGMENT ;;; ffi_closure_win64 will be called with these registers set: ;;; rax points to 'closure' ;;; r11 contains a bit mask that specifies which of the ;;; first four parameters are float or double ;;; ;;; It must move the parameters passed in registers to their stack location, ;;; call ffi_closure_win64_inner for the actual work, then return the result. ;;; ffi_closure_win64 PROC FRAME ;; copy register arguments onto stack test r11, 1 jne first_is_float mov QWORD PTR [rsp+8], rcx jmp second first_is_float: movlpd QWORD PTR [rsp+8], xmm0 second: test r11, 2 jne second_is_float mov QWORD PTR [rsp+16], rdx jmp third second_is_float: movlpd QWORD PTR [rsp+16], xmm1 third: test r11, 4 jne third_is_float mov QWORD PTR [rsp+24], r8 jmp fourth third_is_float: movlpd QWORD PTR [rsp+24], xmm2 fourth: test r11, 8 jne fourth_is_float mov QWORD PTR [rsp+32], r9 jmp done fourth_is_float: movlpd QWORD PTR [rsp+32], xmm3 done: .ALLOCSTACK 40 sub rsp, 40 .ENDPROLOG mov rcx, rax ; context is first parameter mov rdx, rsp ; stack is second parameter add rdx, 48 ; point to start of arguments mov rax, ffi_closure_win64_inner call rax ; call the real closure function add rsp, 40 movd xmm0, rax ; If the closure returned a float, ; ffi_closure_win64_inner wrote it to rax ret 0 ffi_closure_win64 ENDP ffi_call_win64 PROC FRAME ;; copy registers onto stack mov QWORD PTR [rsp+32], r9 mov QWORD PTR [rsp+24], r8 mov QWORD PTR [rsp+16], rdx mov QWORD PTR [rsp+8], rcx .PUSHREG rbp push rbp .ALLOCSTACK 48 sub rsp, 48 ; 00000030H .SETFRAME rbp, 32 lea rbp, QWORD PTR [rsp+32] .ENDPROLOG mov eax, DWORD PTR CIF_BYTES[rbp] add rax, 15 and rax, -16 call __chkstk sub rsp, rax lea rax, QWORD PTR [rsp+32] mov QWORD PTR STACK[rbp], rax mov rdx, QWORD PTR ECIF[rbp] mov rcx, QWORD PTR STACK[rbp] call QWORD PTR PREP_ARGS_FN[rbp] mov rsp, QWORD PTR STACK[rbp] movlpd xmm3, QWORD PTR [rsp+24] movd r9, xmm3 movlpd xmm2, QWORD PTR [rsp+16] movd r8, xmm2 movlpd xmm1, QWORD PTR [rsp+8] movd rdx, xmm1 movlpd xmm0, QWORD PTR [rsp] movd rcx, xmm0 call QWORD PTR FN[rbp] ret_struct4b$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_4B jne ret_struct2b$ mov rcx, QWORD PTR RVALUE[rbp] mov DWORD PTR [rcx], eax jmp ret_void$ ret_struct2b$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_2B jne ret_struct1b$ mov rcx, QWORD PTR RVALUE[rbp] mov WORD PTR [rcx], ax jmp ret_void$ ret_struct1b$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_1B jne ret_uint8$ mov rcx, QWORD PTR RVALUE[rbp] mov BYTE PTR [rcx], al jmp ret_void$ ret_uint8$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT8 jne ret_sint8$ mov rcx, QWORD PTR RVALUE[rbp] movzx rax, al mov QWORD PTR [rcx], rax jmp ret_void$ ret_sint8$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT8 jne ret_uint16$ mov rcx, QWORD PTR RVALUE[rbp] movsx rax, al mov QWORD PTR [rcx], rax jmp ret_void$ ret_uint16$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT16 jne ret_sint16$ mov rcx, QWORD PTR RVALUE[rbp] movzx rax, ax mov QWORD PTR [rcx], rax jmp SHORT ret_void$ ret_sint16$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT16 jne ret_uint32$ mov rcx, QWORD PTR RVALUE[rbp] movsx rax, ax mov QWORD PTR [rcx], rax jmp SHORT ret_void$ ret_uint32$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT32 jne ret_sint32$ mov rcx, QWORD PTR RVALUE[rbp] mov eax, eax mov QWORD PTR [rcx], rax jmp SHORT ret_void$ ret_sint32$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT32 jne ret_float$ mov rcx, QWORD PTR RVALUE[rbp] cdqe mov QWORD PTR [rcx], rax jmp SHORT ret_void$ ret_float$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_FLOAT jne SHORT ret_double$ mov rax, QWORD PTR RVALUE[rbp] movss DWORD PTR [rax], xmm0 jmp SHORT ret_void$ ret_double$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_DOUBLE jne SHORT ret_sint64$ mov rax, QWORD PTR RVALUE[rbp] movlpd QWORD PTR [rax], xmm0 jmp SHORT ret_void$ ret_sint64$: cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT64 jne ret_void$ mov rcx, QWORD PTR RVALUE[rbp] mov QWORD PTR [rcx], rax jmp SHORT ret_void$ ret_void$: xor rax, rax lea rsp, QWORD PTR [rbp+16] pop rbp ret 0 ffi_call_win64 ENDP _TEXT ENDS END #else .text .extern _ffi_closure_win64_inner # ffi_closure_win64 will be called with these registers set: # rax points to 'closure' # r11 contains a bit mask that specifies which of the # first four parameters are float or double # # It must move the parameters passed in registers to their stack location, # call ffi_closure_win64_inner for the actual work, then return the result. # .balign 16 .globl _ffi_closure_win64 _ffi_closure_win64: # copy register arguments onto stack test $1,%r11 jne .Lfirst_is_float mov %rcx, 8(%rsp) jmp .Lsecond .Lfirst_is_float: movlpd %xmm0, 8(%rsp) .Lsecond: test $2, %r11 jne .Lsecond_is_float mov %rdx, 16(%rsp) jmp .Lthird .Lsecond_is_float: movlpd %xmm1, 16(%rsp) .Lthird: test $4, %r11 jne .Lthird_is_float mov %r8,24(%rsp) jmp .Lfourth .Lthird_is_float: movlpd %xmm2, 24(%rsp) .Lfourth: test $8, %r11 jne .Lfourth_is_float mov %r9, 32(%rsp) jmp .Ldone .Lfourth_is_float: movlpd %xmm3, 32(%rsp) .Ldone: #.ALLOCSTACK 40 sub $40, %rsp #.ENDPROLOG mov %rax, %rcx # context is first parameter mov %rsp, %rdx # stack is second parameter add $48, %rdx # point to start of arguments mov $_ffi_closure_win64_inner, %rax callq *%rax # call the real closure function add $40, %rsp movq %rax, %xmm0 # If the closure returned a float, # ffi_closure_win64_inner wrote it to rax retq .ffi_closure_win64_end: .balign 16 .globl _ffi_call_win64 _ffi_call_win64: # copy registers onto stack mov %r9,32(%rsp) mov %r8,24(%rsp) mov %rdx,16(%rsp) mov %rcx,8(%rsp) #.PUSHREG rbp push %rbp #.ALLOCSTACK 48 sub $48,%rsp #.SETFRAME rbp, 32 lea 32(%rsp),%rbp #.ENDPROLOG mov CIF_BYTES(%rbp),%eax add $15, %rax and $-16, %rax cmpq $0x1000, %rax jb Lch_done Lch_probe: subq $0x1000,%rsp orl $0x0, (%rsp) subq $0x1000,%rax cmpq $0x1000,%rax ja Lch_probe Lch_done: subq %rax, %rsp orl $0x0, (%rsp) lea 32(%rsp), %rax mov %rax, STACK(%rbp) mov ECIF(%rbp), %rdx mov STACK(%rbp), %rcx callq *PREP_ARGS_FN(%rbp) mov STACK(%rbp), %rsp movlpd 24(%rsp), %xmm3 movd %xmm3, %r9 movlpd 16(%rsp), %xmm2 movd %xmm2, %r8 movlpd 8(%rsp), %xmm1 movd %xmm1, %rdx movlpd (%rsp), %xmm0 movd %xmm0, %rcx callq *FN(%rbp) .Lret_struct4b: cmpl $FFI_TYPE_SMALL_STRUCT_4B, CIF_FLAGS(%rbp) jne .Lret_struct2b mov RVALUE(%rbp), %rcx mov %eax, (%rcx) jmp .Lret_void .Lret_struct2b: cmpl $FFI_TYPE_SMALL_STRUCT_2B, CIF_FLAGS(%rbp) jne .Lret_struct1b mov RVALUE(%rbp), %rcx mov %ax, (%rcx) jmp .Lret_void .Lret_struct1b: cmpl $FFI_TYPE_SMALL_STRUCT_1B, CIF_FLAGS(%rbp) jne .Lret_uint8 mov RVALUE(%rbp), %rcx mov %al, (%rcx) jmp .Lret_void .Lret_uint8: cmpl $FFI_TYPE_UINT8, CIF_FLAGS(%rbp) jne .Lret_sint8 mov RVALUE(%rbp), %rcx movzbq %al, %rax movq %rax, (%rcx) jmp .Lret_void .Lret_sint8: cmpl $FFI_TYPE_SINT8, CIF_FLAGS(%rbp) jne .Lret_uint16 mov RVALUE(%rbp), %rcx movsbq %al, %rax movq %rax, (%rcx) jmp .Lret_void .Lret_uint16: cmpl $FFI_TYPE_UINT16, CIF_FLAGS(%rbp) jne .Lret_sint16 mov RVALUE(%rbp), %rcx movzwq %ax, %rax movq %rax, (%rcx) jmp .Lret_void .Lret_sint16: cmpl $FFI_TYPE_SINT16, CIF_FLAGS(%rbp) jne .Lret_uint32 mov RVALUE(%rbp), %rcx movswq %ax, %rax movq %rax, (%rcx) jmp .Lret_void .Lret_uint32: cmpl $FFI_TYPE_UINT32, CIF_FLAGS(%rbp) jne .Lret_sint32 mov RVALUE(%rbp), %rcx movl %eax, %eax movq %rax, (%rcx) jmp .Lret_void .Lret_sint32: cmpl $FFI_TYPE_SINT32, CIF_FLAGS(%rbp) jne .Lret_float mov RVALUE(%rbp), %rcx cltq movq %rax, (%rcx) jmp .Lret_void .Lret_float: cmpl $FFI_TYPE_FLOAT, CIF_FLAGS(%rbp) jne .Lret_double mov RVALUE(%rbp), %rax movss %xmm0, (%rax) jmp .Lret_void .Lret_double: cmpl $FFI_TYPE_DOUBLE, CIF_FLAGS(%rbp) jne .Lret_sint64 mov RVALUE(%rbp), %rax movlpd %xmm0, (%rax) jmp .Lret_void .Lret_sint64: cmpl $FFI_TYPE_SINT64, CIF_FLAGS(%rbp) jne .Lret_void mov RVALUE(%rbp), %rcx mov %rax, (%rcx) jmp .Lret_void .Lret_void: xor %rax, %rax lea 16(%rbp), %rsp pop %rbp retq .ffi_call_win64_end: #endif /* !_MSC_VER */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/config/default.exp0000644000175000017500000000003011545150464024465 0ustar chr1schr1sload_lib "standard.exp" mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/lib/libffi-dg.exp0000644000175000017500000002427511545150464024206 0ustar chr1schr1s# Copyright (C) 2003, 2005, 2008, 2009, 2010 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. proc load_gcc_lib { filename } { global srcdir load_file $srcdir/lib/$filename } load_lib dg.exp load_lib libgloss.exp load_gcc_lib target-libpath.exp load_gcc_lib wrapper.exp # Define libffi callbacks for dg.exp. proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } { # To get all \n in dg-output test strings to match printf output # in a system that outputs it as \015\012 (i.e. not just \012), we # need to change all \n into \r?\n. As there is no dejagnu flag # or hook to do that, we simply change the text being tested. # Unfortunately, we have to know that the variable is called # dg-output-text and lives in the caller of libffi-dg-test, which # is two calls up. Overriding proc dg-output would be longer and # would necessarily have the same assumption. upvar 2 dg-output-text output_match if { [llength $output_match] > 1 } { regsub -all "\n" [lindex $output_match 1] "\r?\n" x set output_match [lreplace $output_match 1 1 $x] } # Set up the compiler flags, based on what we're going to do. set options [list] switch $do_what { "compile" { set compile_type "assembly" set output_file "[file rootname [file tail $prog]].s" } "link" { set compile_type "executable" set output_file "[file rootname [file tail $prog]].exe" # The following line is needed for targets like the i960 where # the default output file is b.out. Sigh. } "run" { set compile_type "executable" # FIXME: "./" is to cope with "." not being in $PATH. # Should this be handled elsewhere? # YES. set output_file "./[file rootname [file tail $prog]].exe" # This is the only place where we care if an executable was # created or not. If it was, dg.exp will try to run it. remote_file build delete $output_file; } default { perror "$do_what: not a valid dg-do keyword" return "" } } if { $extra_tool_flags != "" } { lappend options "additional_flags=$extra_tool_flags" } set comp_output [libffi_target_compile "$prog" "$output_file" "$compile_type" $options]; return [list $comp_output $output_file] } proc libffi-dg-test { prog do_what extra_tool_flags } { return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags] } proc libffi-init { args } { global gluefile wrap_flags; global srcdir global blddirffi global objdir global TOOL_OPTIONS global tool global libffi_include global libffi_link_flags global tool_root_dir global ld_library_path set blddirffi [pwd]/.. verbose "libffi $blddirffi" set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] if {$gccdir != ""} { set gccdir [file dirname $gccdir] } verbose "gccdir $gccdir" set ld_library_path "." append ld_library_path ":${gccdir}" set compiler "${gccdir}/xgcc" if { [is_remote host] == 0 && [which $compiler] != 0 } { foreach i "[exec $compiler --print-multi-lib]" { set mldir "" regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir set mldir [string trimright $mldir "\;@"] if { "$mldir" == "." } { continue } if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } { append ld_library_path ":${gccdir}/${mldir}" } } } # add the library path for libffi. append ld_library_path ":${blddirffi}/.libs" verbose "ld_library_path: $ld_library_path" # Point to the Libffi headers in libffi. set libffi_include "${blddirffi}/include" verbose "libffi_include $libffi_include" set libffi_dir "${blddirffi}/.libs" verbose "libffi_dir $libffi_dir" if { $libffi_dir != "" } { set libffi_dir [file dirname ${libffi_dir}] set libffi_link_flags "-L${libffi_dir}/.libs" } set_ld_library_path_env_vars libffi_maybe_build_wrapper "${objdir}/testglue.o" } proc libffi_exit { } { global gluefile; if [info exists gluefile] { file_on_build delete $gluefile; unset gluefile; } } proc libffi_target_compile { source dest type options } { global gluefile wrap_flags; global srcdir global blddirffi global TOOL_OPTIONS global libffi_link_flags global libffi_include global target_triplet if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { lappend options "libs=${gluefile}" lappend options "ldflags=$wrap_flags" } # TOOL_OPTIONS must come first, so that it doesn't override testcase # specific options. if [info exists TOOL_OPTIONS] { lappend options [concat "additional_flags=$TOOL_OPTIONS" $options]; } # search for ffi_mips.h in srcdir, too lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include -I${libffi_include}/.." lappend options "additional_flags=${libffi_link_flags}" # Darwin needs a stack execution allowed flag. if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"] || [istarget "*-*-darwin2*"] } { lappend options "additional_flags=-Wl,-allow_stack_execute" } # If you're building the compiler with --prefix set to a place # where it's not yet installed, then the linker won't be able to # find the libgcc used by libffi.dylib. We could pass the # -dylib_file option, but that's complicated, and it's much easier # to just make the linker find libgcc using -L options. if { [string match "*-*-darwin*" $target_triplet] } { lappend options "libs= -shared-libgcc" } if { [string match "*-*-openbsd*" $target_triplet] } { lappend options "libs= -lpthread" } lappend options "libs= -lffi" verbose "options: $options" return [target_compile $source $dest $type $options] } # Utility routines. # # search_for -- looks for a string match in a file # proc search_for { file pattern } { set fd [open $file r] while { [gets $fd cur_line]>=0 } { if [string match "*$pattern*" $cur_line] then { close $fd return 1 } } close $fd return 0 } # Modified dg-runtest that can cycle through a list of optimization options # as c-torture does. proc libffi-dg-runtest { testcases default-extra-flags } { global runtests foreach test $testcases { # If we're only testing specific files and this isn't one of # them, skip it. if ![runtest_file_p $runtests $test] { continue } # Look for a loop within the source code - if we don't find one, # don't pass -funroll[-all]-loops. global torture_with_loops torture_without_loops if [expr [search_for $test "for*("]+[search_for $test "while*("]] { set option_list $torture_with_loops } else { set option_list $torture_without_loops } set nshort [file tail [file dirname $test]]/[file tail $test] foreach flags $option_list { verbose "Testing $nshort, $flags" 1 dg-test $test $flags ${default-extra-flags} } } } # Like check_conditional_xfail, but callable from a dg test. proc dg-xfail-if { args } { set args [lreplace $args 0 0] set selector "target [join [lindex $args 1]]" if { [dg-process-target $selector] == "S" } { global compiler_conditional_xfail_data set compiler_conditional_xfail_data $args } } proc check-flags { args } { # The args are within another list; pull them out. set args [lindex $args 0] # The next two arguments are optional. If they were not specified, # use the defaults. if { [llength $args] == 2 } { lappend $args [list "*"] } if { [llength $args] == 3 } { lappend $args [list ""] } # If the option strings are the defaults, or the same as the # defaults, there is no need to call check_conditional_xfail to # compare them to the actual options. if { [string compare [lindex $args 2] "*"] == 0 && [string compare [lindex $args 3] "" ] == 0 } { set result 1 } else { # The target list might be an effective-target keyword, so replace # the original list with "*-*-*", since we already know it matches. set result [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]] } return $result } proc dg-skip-if { args } { # Verify the number of arguments. The last two are optional. set args [lreplace $args 0 0] if { [llength $args] < 2 || [llength $args] > 4 } { error "dg-skip-if 2: need 2, 3, or 4 arguments" } # Don't bother if we're already skipping the test. upvar dg-do-what dg-do-what if { [lindex ${dg-do-what} 1] == "N" } { return } set selector [list target [lindex $args 1]] if { [dg-process-target $selector] == "S" } { if [check-flags $args] { upvar dg-do-what dg-do-what set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] } } } # We need to make sure that additional_files and additional_sources # are both cleared out after every test. It is not enough to clear # them out *before* the next test run because gcc-target-compile gets # run directly from some .exp files (outside of any test). (Those # uses should eventually be eliminated.) # Because the DG framework doesn't provide a hook that is run at the # end of a test, we must replace dg-test with a wrapper. if { [info procs saved-dg-test] == [list] } { rename dg-test saved-dg-test proc dg-test { args } { global additional_files global additional_sources global errorInfo if { [ catch { eval saved-dg-test $args } errmsg ] } { set saved_info $errorInfo set additional_files "" set additional_sources "" error $errmsg $saved_info } set additional_files "" set additional_sources "" } } # Local Variables: # tcl-indent-level:4 # End: mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/lib/target-libpath.exp0000644000175000017500000002176411545150464025272 0ustar chr1schr1s# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GCC; see the file COPYING3. If not see # . # This file was contributed by John David Anglin (dave.anglin@nrc-cnrc.gc.ca) set orig_environment_saved 0 set orig_ld_library_path_saved 0 set orig_ld_run_path_saved 0 set orig_shlib_path_saved 0 set orig_ld_libraryn32_path_saved 0 set orig_ld_library64_path_saved 0 set orig_ld_library_path_32_saved 0 set orig_ld_library_path_64_saved 0 set orig_dyld_library_path_saved 0 ####################################### # proc set_ld_library_path_env_vars { } ####################################### proc set_ld_library_path_env_vars { } { global ld_library_path global orig_environment_saved global orig_ld_library_path_saved global orig_ld_run_path_saved global orig_shlib_path_saved global orig_ld_libraryn32_path_saved global orig_ld_library64_path_saved global orig_ld_library_path_32_saved global orig_ld_library_path_64_saved global orig_dyld_library_path_saved global orig_ld_library_path global orig_ld_run_path global orig_shlib_path global orig_ld_libraryn32_path global orig_ld_library64_path global orig_ld_library_path_32 global orig_ld_library_path_64 global orig_dyld_library_path global GCC_EXEC_PREFIX # Set the relocated compiler prefix, but only if the user hasn't specified one. if { [info exists GCC_EXEC_PREFIX] && ![info exists env(GCC_EXEC_PREFIX)] } { setenv GCC_EXEC_PREFIX "$GCC_EXEC_PREFIX" } # Setting the ld library path causes trouble when testing cross-compilers. if { [is_remote target] } { return } if { $orig_environment_saved == 0 } { global env set orig_environment_saved 1 # Save the original environment. if [info exists env(LD_LIBRARY_PATH)] { set orig_ld_library_path "$env(LD_LIBRARY_PATH)" set orig_ld_library_path_saved 1 } if [info exists env(LD_RUN_PATH)] { set orig_ld_run_path "$env(LD_RUN_PATH)" set orig_ld_run_path_saved 1 } if [info exists env(SHLIB_PATH)] { set orig_shlib_path "$env(SHLIB_PATH)" set orig_shlib_path_saved 1 } if [info exists env(LD_LIBRARYN32_PATH)] { set orig_ld_libraryn32_path "$env(LD_LIBRARYN32_PATH)" set orig_ld_libraryn32_path_saved 1 } if [info exists env(LD_LIBRARY64_PATH)] { set orig_ld_library64_path "$env(LD_LIBRARY64_PATH)" set orig_ld_library64_path_saved 1 } if [info exists env(LD_LIBRARY_PATH_32)] { set orig_ld_library_path_32 "$env(LD_LIBRARY_PATH_32)" set orig_ld_library_path_32_saved 1 } if [info exists env(LD_LIBRARY_PATH_64)] { set orig_ld_library_path_64 "$env(LD_LIBRARY_PATH_64)" set orig_ld_library_path_64_saved 1 } if [info exists env(DYLD_LIBRARY_PATH)] { set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)" set orig_dyld_library_path_saved 1 } } # We need to set ld library path in the environment. Currently, # unix.exp doesn't set the environment correctly for all systems. # It only sets SHLIB_PATH and LD_LIBRARY_PATH when it executes a # program. We also need the environment set for compilations, etc. # # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH # (for the 64-bit ABI). The same applies to Darwin (DYLD_LIBRARY_PATH), # Solaris 32 bit (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64), # and HP-UX (SHLIB_PATH). In some cases, the variables are independent # of LD_LIBRARY_PATH, and in other cases LD_LIBRARY_PATH is used if the # variable is not defined. # # Doing this is somewhat of a hack as ld_library_path gets repeated in # SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables. if { $orig_ld_library_path_saved } { setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path" } else { setenv LD_LIBRARY_PATH "$ld_library_path" } if { $orig_ld_run_path_saved } { setenv LD_RUN_PATH "$ld_library_path:$orig_ld_run_path" } else { setenv LD_RUN_PATH "$ld_library_path" } # The default shared library dynamic path search for 64-bit # HP-UX executables searches LD_LIBRARY_PATH before SHLIB_PATH. # LD_LIBRARY_PATH isn't used for 32-bit executables. Thus, we # set LD_LIBRARY_PATH and SHLIB_PATH as if they were independent. if { $orig_shlib_path_saved } { setenv SHLIB_PATH "$ld_library_path:$orig_shlib_path" } else { setenv SHLIB_PATH "$ld_library_path" } if { $orig_ld_libraryn32_path_saved } { setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_libraryn32_path" } elseif { $orig_ld_library_path_saved } { setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_library_path" } else { setenv LD_LIBRARYN32_PATH "$ld_library_path" } if { $orig_ld_library64_path_saved } { setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library64_path" } elseif { $orig_ld_library_path_saved } { setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library_path" } else { setenv LD_LIBRARY64_PATH "$ld_library_path" } if { $orig_ld_library_path_32_saved } { setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path_32" } elseif { $orig_ld_library_path_saved } { setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path" } else { setenv LD_LIBRARY_PATH_32 "$ld_library_path" } if { $orig_ld_library_path_64_saved } { setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path_64" } elseif { $orig_ld_library_path_saved } { setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path" } else { setenv LD_LIBRARY_PATH_64 "$ld_library_path" } if { $orig_dyld_library_path_saved } { setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path" } else { setenv DYLD_LIBRARY_PATH "$ld_library_path" } verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path" } ####################################### # proc restore_ld_library_path_env_vars { } ####################################### proc restore_ld_library_path_env_vars { } { global orig_environment_saved global orig_ld_library_path_saved global orig_ld_run_path_saved global orig_shlib_path_saved global orig_ld_libraryn32_path_saved global orig_ld_library64_path_saved global orig_ld_library_path_32_saved global orig_ld_library_path_64_saved global orig_dyld_library_path_saved global orig_ld_library_path global orig_ld_run_path global orig_shlib_path global orig_ld_libraryn32_path global orig_ld_library64_path global orig_ld_library_path_32 global orig_ld_library_path_64 global orig_dyld_library_path if { $orig_environment_saved == 0 } { return } if { $orig_ld_library_path_saved } { setenv LD_LIBRARY_PATH "$orig_ld_library_path" } elseif [info exists env(LD_LIBRARY_PATH)] { unsetenv LD_LIBRARY_PATH } if { $orig_ld_run_path_saved } { setenv LD_RUN_PATH "$orig_ld_run_path" } elseif [info exists env(LD_RUN_PATH)] { unsetenv LD_RUN_PATH } if { $orig_shlib_path_saved } { setenv SHLIB_PATH "$orig_shlib_path" } elseif [info exists env(SHLIB_PATH)] { unsetenv SHLIB_PATH } if { $orig_ld_libraryn32_path_saved } { setenv LD_LIBRARYN32_PATH "$orig_ld_libraryn32_path" } elseif [info exists env(LD_LIBRARYN32_PATH)] { unsetenv LD_LIBRARYN32_PATH } if { $orig_ld_library64_path_saved } { setenv LD_LIBRARY64_PATH "$orig_ld_library64_path" } elseif [info exists env(LD_LIBRARY64_PATH)] { unsetenv LD_LIBRARY64_PATH } if { $orig_ld_library_path_32_saved } { setenv LD_LIBRARY_PATH_32 "$orig_ld_library_path_32" } elseif [info exists env(LD_LIBRARY_PATH_32)] { unsetenv LD_LIBRARY_PATH_32 } if { $orig_ld_library_path_64_saved } { setenv LD_LIBRARY_PATH_64 "$orig_ld_library_path_64" } elseif [info exists env(LD_LIBRARY_PATH_64)] { unsetenv LD_LIBRARY_PATH_64 } if { $orig_dyld_library_path_saved } { setenv DYLD_LIBRARY_PATH "$orig_dyld_library_path" } elseif [info exists env(DYLD_LIBRARY_PATH)] { unsetenv DYLD_LIBRARY_PATH } } ####################################### # proc get_shlib_extension { } ####################################### proc get_shlib_extension { } { global shlib_ext if { [ istarget *-*-darwin* ] } { set shlib_ext "dylib" } elseif { [ istarget *-*-cygwin* ] || [ istarget *-*-mingw* ] } { set shlib_ext "dll" } elseif { [ istarget hppa*-*-hpux* ] } { set shlib_ext "sl" } else { set shlib_ext "so" } return $shlib_ext } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/lib/wrapper.exp0000644000175000017500000000352511545150464024036 0ustar chr1schr1s# Copyright (C) 2004, 2007 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GCC; see the file COPYING3. If not see # . # This file contains GCC-specifics for status wrappers for test programs. # ${tool}_maybe_build_wrapper -- Build wrapper object if the target # needs it. FILENAME is the path to the wrapper file. If there are # additional arguments, they are command-line options to provide to # the compiler when compiling FILENAME. proc ${tool}_maybe_build_wrapper { filename args } { global gluefile wrap_flags if { [target_info needs_status_wrapper] != "" \ && [target_info needs_status_wrapper] != "0" \ && ![info exists gluefile] } { set saved_wrap_compile_flags [target_info wrap_compile_flags] set flags [join $args " "] # The wrapper code may contain code that gcc objects on. This # became true for dejagnu-1.4.4. The set of warnings and code # that gcc objects on may change, so just make sure -w is always # passed to turn off all warnings. set_currtarget_info wrap_compile_flags \ "$saved_wrap_compile_flags -w $flags" set result [build_wrapper $filename] set_currtarget_info wrap_compile_flags "$saved_wrap_compile_flags" if { $result != "" } { set gluefile [lindex $result 0] set wrap_flags [lindex $result 1] } } } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/call.exp0000644000175000017500000000241311545150464024663 0ustar chr1schr1s# Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING3. If not see # . # libffi testsuite that uses the 'dg.exp' driver. load_lib libffi-dg.exp dg-init libffi-init global srcdir subdir dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" "" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" "" dg-finish # Local Variables: # tcl-indent-level:4 # End: mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn0.c0000644000175000017500000000565111545150464025624 0ustar chr1schr1s/* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(unsigned long long *)args[0] + (int)(*(int *)args[1]) + (int)(*(unsigned long long *)args[2]) + (int)*(int *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(unsigned long long *)args[5]) + (int)*(int *)args[6] + (int)(*(int *)args[7]) + (int)(*(double *)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]), (int)(*(unsigned long long *)args[2]), (int)*(int *)args[3], (int)(*(signed short *)args[4]), (int)(*(unsigned long long *)args[5]), (int)*(int *)args[6], (int)(*(int *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(int *)args[14]),*(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type0)(unsigned long long, int, unsigned long long, int, signed short, unsigned long long, int, int, double, int, int, float, int, int, int, int); int main (void) { ffi_cif cif; void * code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = &ffi_type_sint; cl_arg_types[2] = &ffi_type_uint64; cl_arg_types[3] = &ffi_type_sint; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_uint64; cl_arg_types[6] = &ffi_type_sint; cl_arg_types[7] = &ffi_type_sint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_sint; cl_arg_types[10] = &ffi_type_sint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_sint; cl_arg_types[14] = &ffi_type_sint; cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type0)code)) (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13, 19, 21, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ printf("res: %d\n",res); /* { dg-output "\nres: 680" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn1.c0000644000175000017500000000547111545150464025625 0ustar chr1schr1s/* Area: closure_call. Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(float *)args[0] +(int)(*(float *)args[1]) + (int)(*(float *)args[2]) + (int)*(float *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) + (int)*(float *)args[6] + (int)(*(int *)args[7]) + (int)(*(double*)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(float *)args[0], (int)(*(float *)args[1]), (int)(*(float *)args[2]), (int)*(float *)args[3], (int)(*(signed short *)args[4]), (int)(*(float *)args[5]), (int)*(float *)args[6], (int)(*(int *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type1)(float, float, float, float, signed short, float, float, int, double, int, int, float, int, int, int, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; cl_arg_types[3] = &ffi_type_float; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_float; cl_arg_types[6] = &ffi_type_float; cl_arg_types[7] = &ffi_type_sint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_sint; cl_arg_types[10] = &ffi_type_sint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_sint; cl_arg_types[14] = &ffi_type_sint; cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type1)code)) (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, 19, 21, 1); /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ printf("res: %d\n",res); /* { dg-output "\nres: 255" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn2.c0000644000175000017500000000551411545150464025624 0ustar chr1schr1s/* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn2(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(double *)args[0] +(int)(*(double *)args[1]) + (int)(*(double *)args[2]) + (int)*(double *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(double *)args[5]) + (int)*(double *)args[6] + (int)(*(int *)args[7]) + (int)(*(double *)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(float *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(double *)args[0], (int)(*(double *)args[1]), (int)(*(double *)args[2]), (int)*(double *)args[3], (int)(*(signed short *)args[4]), (int)(*(double *)args[5]), (int)*(double *)args[6], (int)(*(int *)args[7]), (int)(*(double*)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(float *)args[13]), (int)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type2)(double, double, double, double, signed short, double, double, int, double, int, int, float, int, float, int, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; cl_arg_types[0] = &ffi_type_double; cl_arg_types[1] = &ffi_type_double; cl_arg_types[2] = &ffi_type_double; cl_arg_types[3] = &ffi_type_double; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_double; cl_arg_types[6] = &ffi_type_double; cl_arg_types[7] = &ffi_type_sint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_sint; cl_arg_types[10] = &ffi_type_sint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_float; cl_arg_types[14] = &ffi_type_sint; cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn2, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type2)code)) (1, 2, 3, 4, 127, 5, 6, 8, 9, 10, 11, 12.0, 13, 19.0, 21, 1); /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ printf("res: %d\n",res); /* { dg-output "\nres: 255" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn3.c0000644000175000017500000000553711545150464025632 0ustar chr1schr1s/* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn3(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(float *)args[0] +(int)(*(float *)args[1]) + (int)(*(float *)args[2]) + (int)*(float *)args[3] + (int)(*(float *)args[4]) + (int)(*(float *)args[5]) + (int)*(float *)args[6] + (int)(*(float *)args[7]) + (int)(*(double *)args[8]) + (int)*(int *)args[9] + (int)(*(float *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(float *)args[13]) + (int)(*(float *)args[14]) + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(float *)args[0], (int)(*(float *)args[1]), (int)(*(float *)args[2]), (int)*(float *)args[3], (int)(*(float *)args[4]), (int)(*(float *)args[5]), (int)*(float *)args[6], (int)(*(float *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(float *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(float *)args[13]), (int)(*(float *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type3)(float, float, float, float, float, float, float, float, double, int, float, float, int, float, float, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; cl_arg_types[3] = &ffi_type_float; cl_arg_types[4] = &ffi_type_float; cl_arg_types[5] = &ffi_type_float; cl_arg_types[6] = &ffi_type_float; cl_arg_types[7] = &ffi_type_float; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_sint; cl_arg_types[10] = &ffi_type_float; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_float; cl_arg_types[14] = &ffi_type_float; cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn3, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type3)code)) (1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9, 10, 11.11, 12.0, 13, 19.19, 21.21, 1); /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 19 21 1 3: 135" } */ printf("res: %d\n",res); /* { dg-output "\nres: 135" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn4.c0000644000175000017500000000571011545150464025624 0ustar chr1schr1s/* Area: closure_call Purpose: Check multiple long long values passing. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20031026 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(unsigned long long *)args[0] + (int)*(unsigned long long *)args[1] + (int)*(unsigned long long *)args[2] + (int)*(unsigned long long *)args[3] + (int)*(unsigned long long *)args[4] + (int)*(unsigned long long *)args[5] + (int)*(unsigned long long *)args[6] + (int)*(unsigned long long *)args[7] + (int)*(unsigned long long *)args[8] + (int)*(unsigned long long *)args[9] + (int)*(unsigned long long *)args[10] + (int)*(unsigned long long *)args[11] + (int)*(unsigned long long *)args[12] + (int)*(unsigned long long *)args[13] + (int)*(unsigned long long *)args[14] + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(unsigned long long *)args[0], (int)*(unsigned long long *)args[1], (int)*(unsigned long long *)args[2], (int)*(unsigned long long *)args[3], (int)*(unsigned long long *)args[4], (int)*(unsigned long long *)args[5], (int)*(unsigned long long *)args[6], (int)*(unsigned long long *)args[7], (int)*(unsigned long long *)args[8], (int)*(unsigned long long *)args[9], (int)*(unsigned long long *)args[10], (int)*(unsigned long long *)args[11], (int)*(unsigned long long *)args[12], (int)*(unsigned long long *)args[13], (int)*(unsigned long long *)args[14], *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type0)(unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int i, res; for (i = 0; i < 15; i++) { cl_arg_types[i] = &ffi_type_uint64; } cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type0)code)) (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11LL, 12LL, 13LL, 19LL, 21LL, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ printf("res: %d\n",res); /* { dg-output "\nres: 680" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn5.c0000644000175000017500000000577111545150464025634 0ustar chr1schr1s/* Area: closure_call Purpose: Check multiple long long values passing. Exceed the limit of gpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20031026 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn5(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(unsigned long long *)args[0] + (int)*(unsigned long long *)args[1] + (int)*(unsigned long long *)args[2] + (int)*(unsigned long long *)args[3] + (int)*(unsigned long long *)args[4] + (int)*(unsigned long long *)args[5] + (int)*(unsigned long long *)args[6] + (int)*(unsigned long long *)args[7] + (int)*(unsigned long long *)args[8] + (int)*(unsigned long long *)args[9] + (int)*(int *)args[10] + (int)*(unsigned long long *)args[11] + (int)*(unsigned long long *)args[12] + (int)*(unsigned long long *)args[13] + (int)*(unsigned long long *)args[14] + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(unsigned long long *)args[0], (int)*(unsigned long long *)args[1], (int)*(unsigned long long *)args[2], (int)*(unsigned long long *)args[3], (int)*(unsigned long long *)args[4], (int)*(unsigned long long *)args[5], (int)*(unsigned long long *)args[6], (int)*(unsigned long long *)args[7], (int)*(unsigned long long *)args[8], (int)*(unsigned long long *)args[9], (int)*(int *)args[10], (int)*(unsigned long long *)args[11], (int)*(unsigned long long *)args[12], (int)*(unsigned long long *)args[13], (int)*(unsigned long long *)args[14], *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type0)(unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, unsigned long long, int, unsigned long long, unsigned long long, unsigned long long, unsigned long long, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int i, res; for (i = 0; i < 10; i++) { cl_arg_types[i] = &ffi_type_uint64; } cl_arg_types[10] = &ffi_type_sint; for (i = 11; i < 15; i++) { cl_arg_types[i] = &ffi_type_uint64; } cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn5, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type0)code)) (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11, 12LL, 13LL, 19LL, 21LL, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ printf("res: %d\n",res); /* { dg-output "\nres: 680" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/closure_fn6.c0000644000175000017500000000602311545150464025624 0ustar chr1schr1s/* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC. Limitations: none. PR: PR23404 Originator: 20050830 */ /* { dg-do run } */ #include "ffitest.h" static void closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(unsigned long long *)args[0] + (int)(*(unsigned long long *)args[1]) + (int)(*(unsigned long long *)args[2]) + (int)*(unsigned long long *)args[3] + (int)(*(int *)args[4]) + (int)(*(double *)args[5]) + (int)*(double *)args[6] + (int)(*(float *)args[7]) + (int)(*(double *)args[8]) + (int)*(double *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(double *)args[14]) + (int)*(double *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(unsigned long long *)args[0], (int)(*(unsigned long long *)args[1]), (int)(*(unsigned long long *)args[2]), (int)*(unsigned long long *)args[3], (int)(*(int *)args[4]), (int)(*(double *)args[5]), (int)*(double *)args[6], (int)(*(float *)args[7]), (int)(*(double *)args[8]), (int)*(double *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(double *)args[14]), (int)(*(double *)args[15]), (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_test_type0)(unsigned long long, unsigned long long, unsigned long long, unsigned long long, int, double, double, float, double, double, int, float, int, int, double, double); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = &ffi_type_uint64; cl_arg_types[2] = &ffi_type_uint64; cl_arg_types[3] = &ffi_type_uint64; cl_arg_types[4] = &ffi_type_sint; cl_arg_types[5] = &ffi_type_double; cl_arg_types[6] = &ffi_type_double; cl_arg_types[7] = &ffi_type_float; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_double; cl_arg_types[10] = &ffi_type_sint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_sint; cl_arg_types[14] = &ffi_type_double; cl_arg_types[15] = &ffi_type_double; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, (void *) 3 /* userdata */, code) == FFI_OK); res = (*((closure_test_type0)code)) (1, 2, 3, 4, 127, 429., 7., 8., 9.5, 10., 11, 12., 13, 19, 21., 1.); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ printf("res: %d\n",res); /* { dg-output "\nres: 680" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/closure_loc_fn0.c0000644000175000017500000000603011545150464026451 0ustar chr1schr1s/* Area: closure_call Purpose: Check multiple values passing from different type. Also, exceed the limit of gpr and fpr registers on PowerPC Darwin. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void closure_loc_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(unsigned long long *)args[0] + (int)(*(int *)args[1]) + (int)(*(unsigned long long *)args[2]) + (int)*(int *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(unsigned long long *)args[5]) + (int)*(int *)args[6] + (int)(*(int *)args[7]) + (int)(*(double *)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]), (int)(*(unsigned long long *)args[2]), (int)*(int *)args[3], (int)(*(signed short *)args[4]), (int)(*(unsigned long long *)args[5]), (int)*(int *)args[6], (int)(*(int *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(int *)args[14]),*(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); } typedef int (*closure_loc_test_type0)(unsigned long long, int, unsigned long long, int, signed short, unsigned long long, int, int, double, int, int, float, int, int, int, int); int main (void) { ffi_cif cif; ffi_closure *pcl; ffi_type * cl_arg_types[17]; int res; void *codeloc; cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = &ffi_type_sint; cl_arg_types[2] = &ffi_type_uint64; cl_arg_types[3] = &ffi_type_sint; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_uint64; cl_arg_types[6] = &ffi_type_sint; cl_arg_types[7] = &ffi_type_sint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_sint; cl_arg_types[10] = &ffi_type_sint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_sint; cl_arg_types[13] = &ffi_type_sint; cl_arg_types[14] = &ffi_type_sint; cl_arg_types[15] = &ffi_type_sint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); pcl = ffi_closure_alloc(sizeof(ffi_closure), &codeloc); CHECK(pcl != NULL); CHECK(codeloc != NULL); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_loc_test_fn0, (void *) 3 /* userdata */, codeloc) == FFI_OK); CHECK(memcmp(pcl, codeloc, sizeof(*pcl)) == 0); res = (*((closure_loc_test_type0)codeloc)) (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13, 19, 21, 1); /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ printf("res: %d\n",res); /* { dg-output "\nres: 680" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/closure_stdcall.c0000644000175000017500000000345511545150464026567 0ustar chr1schr1s/* Area: closure_call (stdcall convention) Purpose: Check handling when caller expects stdcall callee Limitations: none. PR: none. Originator: */ /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ #include "ffitest.h" static void closure_test_stdcall(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata) { *(ffi_arg*)resp = (int)*(int *)args[0] + (int)(*(int *)args[1]) + (int)(*(int *)args[2]) + (int)(*(int *)args[3]) + (int)(intptr_t)userdata; printf("%d %d %d %d: %d\n", (int)*(int *)args[0], (int)(*(int *)args[1]), (int)(*(int *)args[2]), (int)(*(int *)args[3]), (int)*(ffi_arg *)resp); } typedef int (__stdcall *closure_test_type0)(int, int, int, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; int res; void* sp_pre; void* sp_post; char buf[1024]; cl_arg_types[0] = &ffi_type_uint; cl_arg_types[1] = &ffi_type_uint; cl_arg_types[2] = &ffi_type_uint; cl_arg_types[3] = &ffi_type_uint; cl_arg_types[4] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 4, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall, (void *) 3 /* userdata */, code) == FFI_OK); asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); res = (*(closure_test_type0)code)(0, 1, 2, 3); asm volatile (" movl %%esp,%0" : "=g" (sp_post)); /* { dg-output "0 1 2 3: 9" } */ printf("res: %d\n",res); /* { dg-output "\nres: 9" } */ sprintf(buf, "mismatch: pre=%p vs post=%p", sp_pre, sp_post); printf("stack pointer %s\n", (sp_pre == sp_post ? "match" : buf)); /* { dg-output "\nstack pointer match" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_12byte.c0000644000175000017500000000474211545150464025354 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_12byte { int a; int b; int c; } cls_struct_12byte; cls_struct_12byte cls_struct_12byte_fn(struct cls_struct_12byte b1, struct cls_struct_12byte b2) { struct cls_struct_12byte result; result.a = b1.a + b2.a; result.b = b1.b + b2.b; result.c = b1.c + b2.c; printf("%d %d %d %d %d %d: %d %d %d\n", b1.a, b1.b, b1.c, b2.a, b2.b, b2.c, result.a, result.b, result.c); return result; } static void cls_struct_12byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args , void* userdata __UNUSED__) { struct cls_struct_12byte b1, b2; b1 = *(struct cls_struct_12byte*)(args[0]); b2 = *(struct cls_struct_12byte*)(args[1]); *(cls_struct_12byte*)resp = cls_struct_12byte_fn(b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_12byte h_dbl = { 7, 4, 9 }; struct cls_struct_12byte j_dbl = { 1, 5, 3 }; struct cls_struct_12byte res_dbl; cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &h_dbl; args_dbl[1] = &j_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_12byte_fn), &res_dbl, args_dbl); /* { dg-output "7 4 9 1 5 3: 8 9 12" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 8 9 12" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_12byte_gn, NULL, code) == FFI_OK); res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; res_dbl = ((cls_struct_12byte(*)(cls_struct_12byte, cls_struct_12byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 4 9 1 5 3: 8 9 12" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 8 9 12" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_16byte.c0000644000175000017500000000503311545150464025352 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_16byte { int a; double b; int c; } cls_struct_16byte; cls_struct_16byte cls_struct_16byte_fn(struct cls_struct_16byte b1, struct cls_struct_16byte b2) { struct cls_struct_16byte result; result.a = b1.a + b2.a; result.b = b1.b + b2.b; result.c = b1.c + b2.c; printf("%d %g %d %d %g %d: %d %g %d\n", b1.a, b1.b, b1.c, b2.a, b2.b, b2.c, result.a, result.b, result.c); return result; } static void cls_struct_16byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_16byte b1, b2; b1 = *(struct cls_struct_16byte*)(args[0]); b2 = *(struct cls_struct_16byte*)(args[1]); *(cls_struct_16byte*)resp = cls_struct_16byte_fn(b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_16byte h_dbl = { 7, 8.0, 9 }; struct cls_struct_16byte j_dbl = { 1, 9.0, 3 }; struct cls_struct_16byte res_dbl; cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &h_dbl; args_dbl[1] = &j_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_16byte_fn), &res_dbl, args_dbl); /* { dg-output "7 8 9 1 9 3: 8 17 12" } */ printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 8 17 12" } */ res_dbl.a = 0; res_dbl.b = 0.0; res_dbl.c = 0; CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_16byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_16byte(*)(cls_struct_16byte, cls_struct_16byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 8 9 1 9 3: 8 17 12" } */ printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 8 17 12" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_18byte.c0000644000175000017500000000532411545150464025357 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Double alignment check on darwin. Limitations: none. PR: none. Originator: 20030915 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_18byte { double a; unsigned char b; unsigned char c; double d; } cls_struct_18byte; cls_struct_18byte cls_struct_18byte_fn(struct cls_struct_18byte a1, struct cls_struct_18byte a2) { struct cls_struct_18byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; printf("%g %d %d %g %g %d %d %g: %g %d %d %g\n", a1.a, a1.b, a1.c, a1.d, a2.a, a2.b, a2.c, a2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_18byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_18byte a1, a2; a1 = *(struct cls_struct_18byte*)(args[0]); a2 = *(struct cls_struct_18byte*)(args[1]); *(cls_struct_18byte*)resp = cls_struct_18byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 }; struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 }; struct cls_struct_18byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_18byte_fn), &res_dbl, args_dbl); /* { dg-output "1 127 126 3 4 125 124 5: 5 252 250 8" } */ printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 5 252 250 8" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_18byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_18byte(*)(cls_struct_18byte, cls_struct_18byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 127 126 3 4 125 124 5: 5 252 250 8" } */ printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 5 252 250 8" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_19byte.c0000644000175000017500000000562611545150464025365 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Double alignment check on darwin. Limitations: none. PR: none. Originator: 20030915 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_19byte { double a; unsigned char b; unsigned char c; double d; unsigned char e; } cls_struct_19byte; cls_struct_19byte cls_struct_19byte_fn(struct cls_struct_19byte a1, struct cls_struct_19byte a2) { struct cls_struct_19byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; result.e = a1.e + a2.e; printf("%g %d %d %g %d %g %d %d %g %d: %g %d %d %g %d\n", a1.a, a1.b, a1.c, a1.d, a1.e, a2.a, a2.b, a2.c, a2.d, a2.e, result.a, result.b, result.c, result.d, result.e); return result; } static void cls_struct_19byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_19byte a1, a2; a1 = *(struct cls_struct_19byte*)(args[0]); a2 = *(struct cls_struct_19byte*)(args[1]); *(cls_struct_19byte*)resp = cls_struct_19byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[6]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 }; struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 }; struct cls_struct_19byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_uchar; cls_struct_fields[5] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_19byte_fn), &res_dbl, args_dbl); /* { dg-output "1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */ printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e); /* { dg-output "\nres: 5 252 250 8 239" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_19byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_19byte(*)(cls_struct_19byte, cls_struct_19byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */ printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e); /* { dg-output "\nres: 5 252 250 8 239" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_1_1byte.c0000644000175000017500000000437711545150464025516 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Limitations: none. PR: none. Originator: 20030902 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_1_1byte { unsigned char a; } cls_struct_1_1byte; cls_struct_1_1byte cls_struct_1_1byte_fn(struct cls_struct_1_1byte a1, struct cls_struct_1_1byte a2) { struct cls_struct_1_1byte result; result.a = a1.a + a2.a; printf("%d %d: %d\n", a1.a, a2.a, result.a); return result; } static void cls_struct_1_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_1_1byte a1, a2; a1 = *(struct cls_struct_1_1byte*)(args[0]); a2 = *(struct cls_struct_1_1byte*)(args[1]); *(cls_struct_1_1byte*)resp = cls_struct_1_1byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[2]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_1_1byte g_dbl = { 12 }; struct cls_struct_1_1byte f_dbl = { 178 }; struct cls_struct_1_1byte res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_1_1byte_fn), &res_dbl, args_dbl); /* { dg-output "12 178: 190" } */ printf("res: %d\n", res_dbl.a); /* { dg-output "\nres: 190" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_1_1byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_1_1byte(*)(cls_struct_1_1byte, cls_struct_1_1byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 178: 190" } */ printf("res: %d\n", res_dbl.a); /* { dg-output "\nres: 190" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_20byte.c0000644000175000017500000000475311545150464025355 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_20byte { double a; double b; int c; } cls_struct_20byte; cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1, struct cls_struct_20byte a2) { struct cls_struct_20byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%g %g %d %g %g %d: %g %g %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_20byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_20byte a1, a2; a1 = *(struct cls_struct_20byte*)(args[0]); a2 = *(struct cls_struct_20byte*)(args[1]); *(cls_struct_20byte*)resp = cls_struct_20byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 }; struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 }; struct cls_struct_20byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_20byte_fn), &res_dbl, args_dbl); /* { dg-output "1 2 3 4 5 7: 5 7 10" } */ printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */ printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_20byte1.c0000644000175000017500000000475511545150464025440 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_20byte { int a; double b; double c; } cls_struct_20byte; cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1, struct cls_struct_20byte a2) { struct cls_struct_20byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %g %g %d %g %g: %d %g %g\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_20byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_20byte a1, a2; a1 = *(struct cls_struct_20byte*)(args[0]); a2 = *(struct cls_struct_20byte*)(args[1]); *(cls_struct_20byte*)resp = cls_struct_20byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 }; struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 }; struct cls_struct_20byte res_dbl; cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_20byte_fn), &res_dbl, args_dbl); /* { dg-output "1 2 3 4 5 7: 5 7 10" } */ printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */ printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 5 7 10" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_24byte.c0000644000175000017500000000647011545150464025357 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_24byte { double a; double b; int c; float d; } cls_struct_24byte; cls_struct_24byte cls_struct_24byte_fn(struct cls_struct_24byte b0, struct cls_struct_24byte b1, struct cls_struct_24byte b2, struct cls_struct_24byte b3) { struct cls_struct_24byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; printf("%g %g %d %g %g %g %d %g %g %g %d %g %g %g %d %g: %g %g %d %g\n", b0.a, b0.b, b0.c, b0.d, b1.a, b1.b, b1.c, b1.d, b2.a, b2.b, b2.c, b2.d, b3.a, b3.b, b3.c, b2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_24byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_24byte b0, b1, b2, b3; b0 = *(struct cls_struct_24byte*)(args[0]); b1 = *(struct cls_struct_24byte*)(args[1]); b2 = *(struct cls_struct_24byte*)(args[2]); b3 = *(struct cls_struct_24byte*)(args[3]); *(cls_struct_24byte*)resp = cls_struct_24byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_24byte e_dbl = { 9.0, 2.0, 6, 5.0 }; struct cls_struct_24byte f_dbl = { 1.0, 2.0, 3, 7.0 }; struct cls_struct_24byte g_dbl = { 4.0, 5.0, 7, 9.0 }; struct cls_struct_24byte h_dbl = { 8.0, 6.0, 1, 4.0 }; struct cls_struct_24byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = &ffi_type_float; cls_struct_fields[4] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_24byte_fn), &res_dbl, args_dbl); /* { dg-output "9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */ printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 22 15 17 25" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_24byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_24byte(*)(cls_struct_24byte, cls_struct_24byte, cls_struct_24byte, cls_struct_24byte)) (code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */ printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 22 15 17 25" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_2byte.c0000644000175000017500000000460011545150464025264 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_2byte { unsigned char a; unsigned char b; } cls_struct_2byte; cls_struct_2byte cls_struct_2byte_fn(struct cls_struct_2byte a1, struct cls_struct_2byte a2) { struct cls_struct_2byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_2byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_2byte a1, a2; a1 = *(struct cls_struct_2byte*)(args[0]); a2 = *(struct cls_struct_2byte*)(args[1]); *(cls_struct_2byte*)resp = cls_struct_2byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_2byte g_dbl = { 12, 127 }; struct cls_struct_2byte f_dbl = { 1, 13 }; struct cls_struct_2byte res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_2byte_fn), &res_dbl, args_dbl); /* { dg-output "12 127 1 13: 13 140" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_2byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 127 1 13: 13 140" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 140" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_3_1byte.c0000644000175000017500000000516311545150464025512 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Limitations: none. PR: none. Originator: 20030902 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_3_1byte { unsigned char a; unsigned char b; unsigned char c; } cls_struct_3_1byte; cls_struct_3_1byte cls_struct_3_1byte_fn(struct cls_struct_3_1byte a1, struct cls_struct_3_1byte a2) { struct cls_struct_3_1byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_3_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_3_1byte a1, a2; a1 = *(struct cls_struct_3_1byte*)(args[0]); a2 = *(struct cls_struct_3_1byte*)(args[1]); *(cls_struct_3_1byte*)resp = cls_struct_3_1byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_3_1byte g_dbl = { 12, 13, 14 }; struct cls_struct_3_1byte f_dbl = { 178, 179, 180 }; struct cls_struct_3_1byte res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_3_1byte_fn), &res_dbl, args_dbl); /* { dg-output "12 13 14 178 179 180: 190 192 194" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 190 192 194" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3_1byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_3_1byte(*)(cls_struct_3_1byte, cls_struct_3_1byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 13 14 178 179 180: 190 192 194" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 190 192 194" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_3byte1.c0000644000175000017500000000462511545150464025355 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_3byte { unsigned short a; unsigned char b; } cls_struct_3byte; cls_struct_3byte cls_struct_3byte_fn(struct cls_struct_3byte a1, struct cls_struct_3byte a2) { struct cls_struct_3byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_3byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_3byte a1, a2; a1 = *(struct cls_struct_3byte*)(args[0]); a2 = *(struct cls_struct_3byte*)(args[1]); *(cls_struct_3byte*)resp = cls_struct_3byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_3byte g_dbl = { 12, 119 }; struct cls_struct_3byte f_dbl = { 1, 15 }; struct cls_struct_3byte res_dbl; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_3byte_fn), &res_dbl, args_dbl); /* { dg-output "12 119 1 15: 13 134" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 134" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_3byte(*)(cls_struct_3byte, cls_struct_3byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 119 1 15: 13 134" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 13 134" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_3byte2.c0000644000175000017500000000467311545150464025361 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_3byte_1 { unsigned char a; unsigned short b; } cls_struct_3byte_1; cls_struct_3byte_1 cls_struct_3byte_fn1(struct cls_struct_3byte_1 a1, struct cls_struct_3byte_1 a2) { struct cls_struct_3byte_1 result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_3byte_gn1(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_3byte_1 a1, a2; a1 = *(struct cls_struct_3byte_1*)(args[0]); a2 = *(struct cls_struct_3byte_1*)(args[1]); *(cls_struct_3byte_1*)resp = cls_struct_3byte_fn1(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_3byte_1 g_dbl = { 15, 125 }; struct cls_struct_3byte_1 f_dbl = { 9, 19 }; struct cls_struct_3byte_1 res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_3byte_fn1), &res_dbl, args_dbl); /* { dg-output "15 125 9 19: 24 144" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 24 144" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn1, NULL, code) == FFI_OK); res_dbl = ((cls_struct_3byte_1(*)(cls_struct_3byte_1, cls_struct_3byte_1))(code))(g_dbl, f_dbl); /* { dg-output "\n15 125 9 19: 24 144" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 24 144" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_4_1byte.c0000644000175000017500000000545411545150464025516 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Especially with small structures which may fit in one register. Depending on the ABI. Limitations: none. PR: none. Originator: 20030902 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_4_1byte { unsigned char a; unsigned char b; unsigned char c; unsigned char d; } cls_struct_4_1byte; cls_struct_4_1byte cls_struct_4_1byte_fn(struct cls_struct_4_1byte a1, struct cls_struct_4_1byte a2) { struct cls_struct_4_1byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a2.a, a2.b, a2.c, a2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_4_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_4_1byte a1, a2; a1 = *(struct cls_struct_4_1byte*)(args[0]); a2 = *(struct cls_struct_4_1byte*)(args[1]); *(cls_struct_4_1byte*)resp = cls_struct_4_1byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 }; struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 }; struct cls_struct_4_1byte res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_uchar; cls_struct_fields[4] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_4_1byte_fn), &res_dbl, args_dbl); /* { dg-output "12 13 14 15 178 179 180 181: 190 192 194 196" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 190 192 194 196" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4_1byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(code))(g_dbl, f_dbl); /* { dg-output "\n12 13 14 15 178 179 180 181: 190 192 194 196" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 190 192 194 196" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_4byte.c0000644000175000017500000000454311545150464025274 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_4byte { unsigned short a; unsigned short b; } cls_struct_4byte; cls_struct_4byte cls_struct_4byte_fn(struct cls_struct_4byte a1, struct cls_struct_4byte a2) { struct cls_struct_4byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_4byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_4byte a1, a2; a1 = *(struct cls_struct_4byte*)(args[0]); a2 = *(struct cls_struct_4byte*)(args[1]); *(cls_struct_4byte*)resp = cls_struct_4byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_4byte g_dbl = { 127, 120 }; struct cls_struct_4byte f_dbl = { 12, 128 }; struct cls_struct_4byte res_dbl; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_4byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 12 128: 139 248" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 139 248" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_4byte(*)(cls_struct_4byte, cls_struct_4byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 12 128: 139 248" } */ printf("res: %d %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 139 248" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_5_1_byte.c0000644000175000017500000000571611545150464025657 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20050708 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_5byte { unsigned char a; unsigned char b; unsigned char c; unsigned char d; unsigned char e; } cls_struct_5byte; cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1, struct cls_struct_5byte a2) { struct cls_struct_5byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; result.e = a1.e + a2.e; printf("%d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a1.e, a2.a, a2.b, a2.c, a2.d, a2.e, result.a, result.b, result.c, result.d, result.e); return result; } static void cls_struct_5byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_5byte a1, a2; a1 = *(struct cls_struct_5byte*)(args[0]); a2 = *(struct cls_struct_5byte*)(args[1]); *(cls_struct_5byte*)resp = cls_struct_5byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[6]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 }; struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 }; struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 }; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_uchar; cls_struct_fields[4] = &ffi_type_uchar; cls_struct_fields[5] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_5byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 3 4 12 128 9 3 4: 139 248 10 6 8" } */ printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e); /* { dg-output "\nres: 139 248 10 6 8" } */ res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; res_dbl.d = 0; res_dbl.e = 0; CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 3 4 12 128 9 3 4: 139 248 10 6 8" } */ printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e); /* { dg-output "\nres: 139 248 10 6 8" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_5byte.c0000644000175000017500000000512411545150464025271 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_5byte { unsigned short a; unsigned short b; unsigned char c; } cls_struct_5byte; cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1, struct cls_struct_5byte a2) { struct cls_struct_5byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_5byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_5byte a1, a2; a1 = *(struct cls_struct_5byte*)(args[0]); a2 = *(struct cls_struct_5byte*)(args[1]); *(cls_struct_5byte*)resp = cls_struct_5byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_5byte g_dbl = { 127, 120, 1 }; struct cls_struct_5byte f_dbl = { 12, 128, 9 }; struct cls_struct_5byte res_dbl = { 0, 0, 0 }; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_5byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 12 128 9: 139 248 10" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 139 248 10" } */ res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 12 128 9: 139 248 10" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 139 248 10" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_64byte.c0000644000175000017500000000752011545150464025360 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_64byte { double a; double b; double c; double d; double e; double f; double g; double h; } cls_struct_64byte; cls_struct_64byte cls_struct_64byte_fn(struct cls_struct_64byte b0, struct cls_struct_64byte b1, struct cls_struct_64byte b2, struct cls_struct_64byte b3) { struct cls_struct_64byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; printf("%g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h); return result; } static void cls_struct_64byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_64byte b0, b1, b2, b3; b0 = *(struct cls_struct_64byte*)(args[0]); b1 = *(struct cls_struct_64byte*)(args[1]); b2 = *(struct cls_struct_64byte*)(args[2]); b3 = *(struct cls_struct_64byte*)(args[3]); *(cls_struct_64byte*)resp = cls_struct_64byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[9]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_64byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0 }; struct cls_struct_64byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0 }; struct cls_struct_64byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0 }; struct cls_struct_64byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0 }; struct cls_struct_64byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_64byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18" } */ printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_64byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_64byte(*)(cls_struct_64byte, cls_struct_64byte, cls_struct_64byte, cls_struct_64byte)) (code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18" } */ printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_6_1_byte.c0000644000175000017500000000621611545150464025654 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20050708 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_6byte { unsigned char a; unsigned char b; unsigned char c; unsigned char d; unsigned char e; unsigned char f; } cls_struct_6byte; cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1, struct cls_struct_6byte a2) { struct cls_struct_6byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; result.e = a1.e + a2.e; result.f = a1.f + a2.f; printf("%d %d %d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, result.a, result.b, result.c, result.d, result.e, result.f); return result; } static void cls_struct_6byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_6byte a1, a2; a1 = *(struct cls_struct_6byte*)(args[0]); a2 = *(struct cls_struct_6byte*)(args[1]); *(cls_struct_6byte*)resp = cls_struct_6byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[7]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 }; struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 }; struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 }; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_uchar; cls_struct_fields[4] = &ffi_type_uchar; cls_struct_fields[5] = &ffi_type_uchar; cls_struct_fields[6] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_6byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 3 4 5 12 128 9 3 4 5: 139 248 10 6 8 10" } */ printf("res: %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f); /* { dg-output "\nres: 139 248 10 6 8 10" } */ res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; res_dbl.d = 0; res_dbl.e = 0; res_dbl.f = 0; CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 3 4 5 12 128 9 3 4 5: 139 248 10 6 8 10" } */ printf("res: %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f); /* { dg-output "\nres: 139 248 10 6 8 10" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_6byte.c0000644000175000017500000000532011545150464025270 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_6byte { unsigned short a; unsigned short b; unsigned char c; unsigned char d; } cls_struct_6byte; cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1, struct cls_struct_6byte a2) { struct cls_struct_6byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a2.a, a2.b, a2.c, a2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_6byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_6byte a1, a2; a1 = *(struct cls_struct_6byte*)(args[0]); a2 = *(struct cls_struct_6byte*)(args[1]); *(cls_struct_6byte*)resp = cls_struct_6byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 }; struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 }; struct cls_struct_6byte res_dbl; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_uchar; cls_struct_fields[4] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_6byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 128 12 128 9 127: 139 248 10 255" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 255" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 128 12 128 9 127: 139 248 10 255" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 255" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_7_1_byte.c0000644000175000017500000000651611545150464025660 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20050708 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_7byte { unsigned char a; unsigned char b; unsigned char c; unsigned char d; unsigned char e; unsigned char f; unsigned char g; } cls_struct_7byte; cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1, struct cls_struct_7byte a2) { struct cls_struct_7byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; result.e = a1.e + a2.e; result.f = a1.f + a2.f; result.g = a1.g + a2.g; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, result.a, result.b, result.c, result.d, result.e, result.f, result.g); return result; } static void cls_struct_7byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_7byte a1, a2; a1 = *(struct cls_struct_7byte*)(args[0]); a2 = *(struct cls_struct_7byte*)(args[1]); *(cls_struct_7byte*)resp = cls_struct_7byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[8]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 }; struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 }; struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 }; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_uchar; cls_struct_fields[4] = &ffi_type_uchar; cls_struct_fields[5] = &ffi_type_uchar; cls_struct_fields[6] = &ffi_type_uchar; cls_struct_fields[7] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_7byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 3 4 5 6 12 128 9 3 4 5 6: 139 248 10 6 8 10 12" } */ printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 139 248 10 6 8 10 12" } */ res_dbl.a = 0; res_dbl.b = 0; res_dbl.c = 0; res_dbl.d = 0; res_dbl.e = 0; res_dbl.f = 0; res_dbl.g = 0; CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 3 4 5 6 12 128 9 3 4 5 6: 139 248 10 6 8 10 12" } */ printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 139 248 10 6 8 10 12" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_7byte.c0000644000175000017500000000532011545150464025271 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_7byte { unsigned short a; unsigned short b; unsigned char c; unsigned short d; } cls_struct_7byte; cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1, struct cls_struct_7byte a2) { struct cls_struct_7byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; result.d = a1.d + a2.d; printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, a2.a, a2.b, a2.c, a2.d, result.a, result.b, result.c, result.d); return result; } static void cls_struct_7byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_7byte a1, a2; a1 = *(struct cls_struct_7byte*)(args[0]); a2 = *(struct cls_struct_7byte*)(args[1]); *(cls_struct_7byte*)resp = cls_struct_7byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 }; struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 }; struct cls_struct_7byte res_dbl; cls_struct_fields[0] = &ffi_type_ushort; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = &ffi_type_ushort; cls_struct_fields[4] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_7byte_fn), &res_dbl, args_dbl); /* { dg-output "127 120 1 254 12 128 9 255: 139 248 10 509" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 509" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl); /* { dg-output "\n127 120 1 254 12 128 9 255: 139 248 10 509" } */ printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); /* { dg-output "\nres: 139 248 10 509" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_8byte.c0000644000175000017500000000445111545150464025276 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Check overlapping. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_8byte { int a; float b; } cls_struct_8byte; cls_struct_8byte cls_struct_8byte_fn(struct cls_struct_8byte a1, struct cls_struct_8byte a2) { struct cls_struct_8byte result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; printf("%d %g %d %g: %d %g\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); return result; } static void cls_struct_8byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_8byte a1, a2; a1 = *(struct cls_struct_8byte*)(args[0]); a2 = *(struct cls_struct_8byte*)(args[1]); *(cls_struct_8byte*)resp = cls_struct_8byte_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_8byte g_dbl = { 1, 2.0 }; struct cls_struct_8byte f_dbl = { 4, 5.0 }; struct cls_struct_8byte res_dbl; cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_8byte_fn), &res_dbl, args_dbl); /* { dg-output "1 2 4 5: 5 7" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 5 7" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_8byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_8byte(*)(cls_struct_8byte, cls_struct_8byte))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 4 5: 5 7" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 5 7" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_9byte1.c0000644000175000017500000000461711545150464025364 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Darwin/AIX do double-word alignment of the struct if the first element is a double. Check that it does not here. Limitations: none. PR: none. Originator: 20030914 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_9byte { int a; double b; } cls_struct_9byte; cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1, struct cls_struct_9byte b2) { struct cls_struct_9byte result; result.a = b1.a + b2.a; result.b = b1.b + b2.b; printf("%d %g %d %g: %d %g\n", b1.a, b1.b, b2.a, b2.b, result.a, result.b); return result; } static void cls_struct_9byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_9byte b1, b2; b1 = *(struct cls_struct_9byte*)(args[0]); b2 = *(struct cls_struct_9byte*)(args[1]); *(cls_struct_9byte*)resp = cls_struct_9byte_fn(b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_9byte h_dbl = { 7, 8.0}; struct cls_struct_9byte j_dbl = { 1, 9.0}; struct cls_struct_9byte res_dbl; cls_struct_fields[0] = &ffi_type_sint; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &h_dbl; args_dbl[1] = &j_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_9byte_fn), &res_dbl, args_dbl); /* { dg-output "7 8 1 9: 8 17" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 8 1 9: 8 17" } */ printf("res: %d %g\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_9byte2.c0000644000175000017500000000461411545150464025362 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Depending on the ABI. Darwin/AIX do double-word alignment of the struct if the first element is a double. Check that it does here. Limitations: none. PR: none. Originator: 20030914 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_9byte { double a; int b; } cls_struct_9byte; cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1, struct cls_struct_9byte b2) { struct cls_struct_9byte result; result.a = b1.a + b2.a; result.b = b1.b + b2.b; printf("%g %d %g %d: %g %d\n", b1.a, b1.b, b2.a, b2.b, result.a, result.b); return result; } static void cls_struct_9byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_9byte b1, b2; b1 = *(struct cls_struct_9byte*)(args[0]); b2 = *(struct cls_struct_9byte*)(args[1]); *(cls_struct_9byte*)resp = cls_struct_9byte_fn(b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_9byte h_dbl = { 7.0, 8}; struct cls_struct_9byte j_dbl = { 1.0, 9}; struct cls_struct_9byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &h_dbl; args_dbl[1] = &j_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_9byte_fn), &res_dbl, args_dbl); /* { dg-output "7 8 1 9: 8 17" } */ printf("res: %g %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl); /* { dg-output "\n7 8 1 9: 8 17" } */ printf("res: %g %d\n", res_dbl.a, res_dbl.b); /* { dg-output "\nres: 8 17" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_double.c0000644000175000017500000000472611545150464026674 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of double. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; double b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_float.c0000644000175000017500000000477111545150464026527 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of float. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; float b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, (double)a1.b, a1.c, a2.a, (double)a2.b, a2.c, result.a, (double)result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_longdouble.c0000644000175000017500000000501311545150464027542 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of long double. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; long double b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, (double)a1.b, a1.c, a2.a, (double)a2.b, a2.c, result.a, (double)result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split.c0000644000175000017500000000724511545150464030766 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of long double. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" typedef struct cls_struct_align { long double a; long double b; long double c; long double d; long double e; long double f; long double g; } cls_struct_align; cls_struct_align cls_struct_align_fn( cls_struct_align a1, cls_struct_align a2) { struct cls_struct_align r; r.a = a1.a + a2.a; r.b = a1.b + a2.b; r.c = a1.c + a2.c; r.d = a1.d + a2.d; r.e = a1.e + a2.e; r.f = a1.f + a2.f; r.g = a1.g + a2.g; printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: " "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, r.a, r.b, r.c, r.d, r.e, r.f, r.g); return r; } cls_struct_align cls_struct_align_fn2( cls_struct_align a1) { struct cls_struct_align r; r.a = a1.a + 1; r.b = a1.b + 1; r.c = a1.c + 1; r.d = a1.d + 1; r.e = a1.e + 1; r.f = a1.f + 1; r.g = a1.g + 1; printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg: " "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, r.a, r.b, r.c, r.d, r.e, r.f, r.g); return r; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[8]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_longdouble; cls_struct_fields[3] = &ffi_type_longdouble; cls_struct_fields[4] = &ffi_type_longdouble; cls_struct_fields[5] = &ffi_type_longdouble; cls_struct_fields[6] = &ffi_type_longdouble; cls_struct_fields[7] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c0000644000175000017500000000640711545150464031047 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of long double. Limitations: none. PR: none. Originator: Blake Chaffin 6/18/2007 */ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" typedef struct cls_struct_align { long double a; long double b; long double c; long double d; long double e; double f; long double g; } cls_struct_align; cls_struct_align cls_struct_align_fn( cls_struct_align a1, cls_struct_align a2) { struct cls_struct_align r; r.a = a1.a + a2.a; r.b = a1.b + a2.b; r.c = a1.c + a2.c; r.d = a1.d + a2.d; r.e = a1.e + a2.e; r.f = a1.f + a2.f; r.g = a1.g + a2.g; printf("%Lg %Lg %Lg %Lg %Lg %g %Lg %Lg %Lg %Lg %Lg %Lg %g %Lg: " "%Lg %Lg %Lg %Lg %Lg %g %Lg\n", a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, r.a, r.b, r.c, r.d, r.e, r.f, r.g); return r; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[8]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_longdouble; cls_struct_fields[2] = &ffi_type_longdouble; cls_struct_fields[3] = &ffi_type_longdouble; cls_struct_fields[4] = &ffi_type_longdouble; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_longdouble; cls_struct_fields[7] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_pointer.c0000644000175000017500000000520411545150464027072 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of pointer. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; void *b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = (void *)((uintptr_t)a1.b + (uintptr_t)a2.b); result.c = a1.c + a2.c; printf("%d %" PRIuPTR " %d %d %" PRIuPTR " %d: %d %" PRIuPTR " %d\n", a1.a, (uintptr_t)a1.b, a1.c, a2.a, (uintptr_t)a2.b, a2.c, result.a, (uintptr_t)result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, (void *)4951, 127 }; struct cls_struct_align f_dbl = { 1, (void *)9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_pointer; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_sint16.c0000644000175000017500000000473211545150464026543 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of sint16. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; signed short b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sshort; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_sint32.c0000644000175000017500000000472611545150464026544 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of sint32. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; signed int b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sint; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_sint64.c0000644000175000017500000000511111545150464026536 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of sint64. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; signed long long b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %" PRIdLL " %d %d %" PRIdLL " %d: %d %" PRIdLL " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_sint64; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_uint16.c0000644000175000017500000000473411545150464026547 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of uint16. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; unsigned short b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_ushort; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_uint32.c0000644000175000017500000000473011545150464026541 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of uint32. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; unsigned int b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_align_uint64.c0000644000175000017500000000511411545150464026543 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure alignment of uint64. Limitations: none. PR: none. Originator: 20031203 */ /* { dg-do run } */ /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ #include "ffitest.h" typedef struct cls_struct_align { unsigned char a; unsigned long long b; unsigned char c; } cls_struct_align; cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, struct cls_struct_align a2) { struct cls_struct_align result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%d %" PRIdLL " %d %d %" PRIdLL " %d: %d %" PRIdLL " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } static void cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_align a1, a2; a1 = *(struct cls_struct_align*)(args[0]); a2 = *(struct cls_struct_align*)(args[1]); *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[4]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct cls_struct_align g_dbl = { 12, 4951, 127 }; struct cls_struct_align f_dbl = { 1, 9320, 13 }; struct cls_struct_align res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint64; cls_struct_fields[2] = &ffi_type_uchar; cls_struct_fields[3] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &g_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); /* { dg-output "\nres: 13 14271 140" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_dbls_struct.c0000644000175000017500000000250411545150464026570 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check double arguments in structs. Limitations: none. PR: none. Originator: Blake Chaffin 6/23/2007 */ /* { dg-do run } */ #include "ffitest.h" typedef struct Dbls { double x; double y; } Dbls; void closure_test_fn(Dbls p) { printf("%.1f %.1f\n", p.x, p.y); } void closure_test_gn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, void** args, void* userdata __UNUSED__) { closure_test_fn(*(Dbls*)args[0]); } int main(int argc __UNUSED__, char** argv __UNUSED__) { ffi_cif cif; void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type* cl_arg_types[1]; ffi_type ts1_type; ffi_type* ts1_type_elements[4]; ts1_type.size = 0; ts1_type.alignment = 0; ts1_type.type = FFI_TYPE_STRUCT; ts1_type.elements = ts1_type_elements; ts1_type_elements[0] = &ffi_type_double; ts1_type_elements[1] = &ffi_type_double; ts1_type_elements[2] = NULL; cl_arg_types[0] = &ts1_type; Dbls arg = { 1.0, 2.0 }; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_void, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_gn, NULL, code) == FFI_OK); ((void*(*)(Dbls))(code))(arg); /* { dg-output "1.0 2.0\n" } */ closure_test_fn(arg); /* { dg-output "1.0 2.0\n" } */ return 0; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_double.c0000644000175000017500000000207111545150464025511 0ustar chr1schr1s/* Area: closure_call Purpose: Check return value double. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_double_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(double *)resp = *(double *)args[0]; printf("%f: %f\n",*(double *)args[0], *(double *)resp); } typedef double (*cls_ret_double)(double); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; double res; cl_arg_types[0] = &ffi_type_double; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_double, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code) == FFI_OK); res = (*((cls_ret_double)code))(21474.789); /* { dg-output "21474.789000: 21474.789000" } */ printf("res: %.6f\n", res); /* { dg-output "\nres: 21474.789000" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_double_va.c0000644000175000017500000000265011545150464026202 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Test doubles passed in variable argument lists. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-output "" { xfail avr32*-*-* } } */ /* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */ #include "ffitest.h" static void cls_double_va_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { char* format = *(char**)args[0]; double doubleValue = *(double*)args[1]; *(ffi_arg*)resp = printf(format, doubleValue); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; ffi_type* arg_types[3]; char* format = "%.1f\n"; double doubleArg = 7; ffi_arg res = 0; arg_types[0] = &ffi_type_pointer; arg_types[1] = &ffi_type_double; arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK); args[0] = &format; args[1] = &doubleArg; args[2] = NULL; ffi_call(&cif, FFI_FN(printf), &res, args); // { dg-output "7.0" } printf("res: %d\n", (int) res); // { dg-output "\nres: 4" } CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK); res = ((int(*)(char*, double))(code))(format, doubleArg); // { dg-output "\n7.0" } printf("res: %d\n", (int) res); // { dg-output "\nres: 4" } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_float.c0000644000175000017500000000204611545150464025346 0ustar chr1schr1s/* Area: closure_call Purpose: Check return value float. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_float_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(float *)resp = *(float *)args[0]; printf("%g: %g\n",*(float *)args[0], *(float *)resp); } typedef float (*cls_ret_float)(float); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; float res; cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_float, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_float_fn, NULL, code) == FFI_OK); res = ((((cls_ret_float)code)(-2122.12))); /* { dg-output "\\-2122.12: \\-2122.12" } */ printf("res: %.6f\n", res); /* { dg-output "\nres: \-2122.120117" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_longdouble.c0000644000175000017500000000537711545150464026405 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check long double arguments. Limitations: none. PR: none. Originator: Blake Chaffin */ /* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail arm*-*-* strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" long double cls_ldouble_fn( long double a1, long double a2, long double a3, long double a4, long double a5, long double a6, long double a7, long double a8) { long double r = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8; printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: %Lg\n", a1, a2, a3, a4, a5, a6, a7, a8, r); return r; } static void cls_ldouble_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { long double a1 = *(long double*)args[0]; long double a2 = *(long double*)args[1]; long double a3 = *(long double*)args[2]; long double a4 = *(long double*)args[3]; long double a5 = *(long double*)args[4]; long double a6 = *(long double*)args[5]; long double a7 = *(long double*)args[6]; long double a8 = *(long double*)args[7]; *(long double*)resp = cls_ldouble_fn( a1, a2, a3, a4, a5, a6, a7, a8); } int main(void) { ffi_cif cif; void* code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[9]; ffi_type* arg_types[9]; long double res = 0; long double arg1 = 1; long double arg2 = 2; long double arg3 = 3; long double arg4 = 4; long double arg5 = 5; long double arg6 = 6; long double arg7 = 7; long double arg8 = 8; arg_types[0] = &ffi_type_longdouble; arg_types[1] = &ffi_type_longdouble; arg_types[2] = &ffi_type_longdouble; arg_types[3] = &ffi_type_longdouble; arg_types[4] = &ffi_type_longdouble; arg_types[5] = &ffi_type_longdouble; arg_types[6] = &ffi_type_longdouble; arg_types[7] = &ffi_type_longdouble; arg_types[8] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 8, &ffi_type_longdouble, arg_types) == FFI_OK); args[0] = &arg1; args[1] = &arg2; args[2] = &arg3; args[3] = &arg4; args[4] = &arg5; args[5] = &arg6; args[6] = &arg7; args[7] = &arg8; args[8] = NULL; ffi_call(&cif, FFI_FN(cls_ldouble_fn), &res, args); /* { dg-output "1 2 3 4 5 6 7 8: 36" } */ printf("res: %Lg\n", res); /* { dg-output "\nres: 36" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ldouble_gn, NULL, code) == FFI_OK); res = ((long double(*)(long double, long double, long double, long double, long double, long double, long double, long double))(code))(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); /* { dg-output "\n1 2 3 4 5 6 7 8: 36" } */ printf("res: %Lg\n", res); /* { dg-output "\nres: 36" } */ return 0; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_longdouble_va.c0000644000175000017500000000271611545150464027065 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Test long doubles passed in variable argument lists. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-output "" { xfail avr32*-*-* x86_64-*-mingw* } } */ /* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */ #include "ffitest.h" static void cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { char* format = *(char**)args[0]; long double ldValue = *(long double*)args[1]; *(ffi_arg*)resp = printf(format, ldValue); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; ffi_type* arg_types[3]; char* format = "%.1Lf\n"; long double ldArg = 7; ffi_arg res = 0; arg_types[0] = &ffi_type_pointer; arg_types[1] = &ffi_type_longdouble; arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, arg_types) == FFI_OK); args[0] = &format; args[1] = &ldArg; args[2] = NULL; ffi_call(&cif, FFI_FN(printf), &res, args); // { dg-output "7.0" } printf("res: %d\n", (int) res); // { dg-output "\nres: 4" } CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK); res = ((int(*)(char*, long double))(code))(format, ldArg); // { dg-output "\n7.0" } printf("res: %d\n", (int) res); // { dg-output "\nres: 4" } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_schar.c0000644000175000017500000000315511545150464026555 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check passing of multiple signed char values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" signed char test_func_fn(signed char a1, signed char a2) { signed char result; result = a1 + a2; printf("%d %d: %d\n", a1, a2, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { signed char a1, a2; a1 = *(signed char *)avals[0]; a2 = *(signed char *)avals[1]; *(ffi_arg *)rval = test_func_fn(a1, a2); } typedef signed char (*test_type)(signed char, signed char); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[3]; ffi_type * cl_arg_types[3]; ffi_arg res_call; signed char a, b, res_closure; a = 2; b = 125; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = NULL; cl_arg_types[0] = &ffi_type_schar; cl_arg_types[1] = &ffi_type_schar; cl_arg_types[2] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_schar, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "2 125: 127" } */ printf("res: %d\n", (signed char)res_call); /* { dg-output "\nres: 127" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(2, 125); /* { dg-output "\n2 125: 127" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 127" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_sshort.c0000644000175000017500000000322511545150464026775 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check passing of multiple signed short values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" signed short test_func_fn(signed short a1, signed short a2) { signed short result; result = a1 + a2; printf("%d %d: %d\n", a1, a2, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { signed short a1, a2; a1 = *(signed short *)avals[0]; a2 = *(signed short *)avals[1]; *(ffi_arg *)rval = test_func_fn(a1, a2); } typedef signed short (*test_type)(signed short, signed short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[3]; ffi_type * cl_arg_types[3]; ffi_arg res_call; unsigned short a, b, res_closure; a = 2; b = 32765; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = NULL; cl_arg_types[0] = &ffi_type_sshort; cl_arg_types[1] = &ffi_type_sshort; cl_arg_types[2] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sshort, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "2 32765: 32767" } */ printf("res: %d\n", (unsigned short)res_call); /* { dg-output "\nres: 32767" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(2, 32765); /* { dg-output "\n2 32765: 32767" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32767" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_sshortchar.c0000644000175000017500000000401511545150464027631 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check passing of multiple signed short/char values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" signed short test_func_fn(signed char a1, signed short a2, signed char a3, signed short a4) { signed short result; result = a1 + a2 + a3 + a4; printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { signed char a1, a3; signed short a2, a4; a1 = *(signed char *)avals[0]; a2 = *(signed short *)avals[1]; a3 = *(signed char *)avals[2]; a4 = *(signed short *)avals[3]; *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); } typedef signed short (*test_type)(signed char, signed short, signed char, signed short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[5]; ffi_type * cl_arg_types[5]; ffi_arg res_call; signed char a, c; signed short b, d, res_closure; a = 1; b = 32765; c = 127; d = -128; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = &c; args_dbl[3] = &d; args_dbl[4] = NULL; cl_arg_types[0] = &ffi_type_schar; cl_arg_types[1] = &ffi_type_sshort; cl_arg_types[2] = &ffi_type_schar; cl_arg_types[3] = &ffi_type_sshort; cl_arg_types[4] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_sshort, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "1 32765 127 -128: 32765" } */ printf("res: %d\n", (signed short)res_call); /* { dg-output "\nres: 32765" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(1, 32765, 127, -128); /* { dg-output "\n1 32765 127 -128: 32765" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32765" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_uchar.c0000644000175000017500000000434711545150464026563 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check passing of multiple unsigned char values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" unsigned char test_func_fn(unsigned char a1, unsigned char a2, unsigned char a3, unsigned char a4) { unsigned char result; result = a1 + a2 + a3 + a4; printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { unsigned char a1, a2, a3, a4; a1 = *(unsigned char *)avals[0]; a2 = *(unsigned char *)avals[1]; a3 = *(unsigned char *)avals[2]; a4 = *(unsigned char *)avals[3]; *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); } typedef unsigned char (*test_type)(unsigned char, unsigned char, unsigned char, unsigned char); void test_func(ffi_cif *cif __UNUSED__, void *rval __UNUSED__, void **avals, void *data __UNUSED__) { printf("%d %d %d %d\n", *(unsigned char *)avals[0], *(unsigned char *)avals[1], *(unsigned char *)avals[2], *(unsigned char *)avals[3]); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[5]; ffi_type * cl_arg_types[5]; ffi_arg res_call; unsigned char a, b, c, d, res_closure; a = 1; b = 2; c = 127; d = 125; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = &c; args_dbl[3] = &d; args_dbl[4] = NULL; cl_arg_types[0] = &ffi_type_uchar; cl_arg_types[1] = &ffi_type_uchar; cl_arg_types[2] = &ffi_type_uchar; cl_arg_types[3] = &ffi_type_uchar; cl_arg_types[4] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_uchar, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "1 2 127 125: 255" } */ printf("res: %d\n", (unsigned char)res_call); /* { dg-output "\nres: 255" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(1, 2, 127, 125); /* { dg-output "\n1 2 127 125: 255" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 255" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_ushort.c0000644000175000017500000000325311545150464027000 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check passing of multiple unsigned short values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" unsigned short test_func_fn(unsigned short a1, unsigned short a2) { unsigned short result; result = a1 + a2; printf("%d %d: %d\n", a1, a2, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { unsigned short a1, a2; a1 = *(unsigned short *)avals[0]; a2 = *(unsigned short *)avals[1]; *(ffi_arg *)rval = test_func_fn(a1, a2); } typedef unsigned short (*test_type)(unsigned short, unsigned short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[3]; ffi_type * cl_arg_types[3]; ffi_arg res_call; unsigned short a, b, res_closure; a = 2; b = 32765; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = NULL; cl_arg_types[0] = &ffi_type_ushort; cl_arg_types[1] = &ffi_type_ushort; cl_arg_types[2] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_ushort, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "2 32765: 32767" } */ printf("res: %d\n", (unsigned short)res_call); /* { dg-output "\nres: 32767" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(2, 32765); /* { dg-output "\n2 32765: 32767" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 32767" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_multi_ushortchar.c0000644000175000017500000000403611545150464027636 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check passing of multiple unsigned short/char values. Limitations: none. PR: PR13221. Originator: 20031129 */ /* { dg-do run } */ #include "ffitest.h" unsigned short test_func_fn(unsigned char a1, unsigned short a2, unsigned char a3, unsigned short a4) { unsigned short result; result = a1 + a2 + a3 + a4; printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); return result; } static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, void *data __UNUSED__) { unsigned char a1, a3; unsigned short a2, a4; a1 = *(unsigned char *)avals[0]; a2 = *(unsigned short *)avals[1]; a3 = *(unsigned char *)avals[2]; a4 = *(unsigned short *)avals[3]; *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); } typedef unsigned short (*test_type)(unsigned char, unsigned short, unsigned char, unsigned short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void * args_dbl[5]; ffi_type * cl_arg_types[5]; ffi_arg res_call; unsigned char a, c; unsigned short b, d, res_closure; a = 1; b = 2; c = 127; d = 128; args_dbl[0] = &a; args_dbl[1] = &b; args_dbl[2] = &c; args_dbl[3] = &d; args_dbl[4] = NULL; cl_arg_types[0] = &ffi_type_uchar; cl_arg_types[1] = &ffi_type_ushort; cl_arg_types[2] = &ffi_type_uchar; cl_arg_types[3] = &ffi_type_ushort; cl_arg_types[4] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_ushort, cl_arg_types) == FFI_OK); ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); /* { dg-output "1 2 127 128: 258" } */ printf("res: %d\n", (unsigned short)res_call); /* { dg-output "\nres: 258" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); res_closure = (*((test_type)code))(1, 2, 127, 128); /* { dg-output "\n1 2 127 128: 258" } */ printf("res: %d\n", res_closure); /* { dg-output "\nres: 258" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_pointer.c0000644000175000017500000000357211545150464025726 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check pointer arguments. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" void* cls_pointer_fn(void* a1, void* a2) { void* result = (void*)((intptr_t)a1 + (intptr_t)a2); printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(uintptr_t) a1, (unsigned int)(uintptr_t) a2, (unsigned int)(uintptr_t) result); return result; } static void cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { void* a1 = *(void**)(args[0]); void* a2 = *(void**)(args[1]); *(void**)resp = cls_pointer_fn(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; // ffi_type cls_pointer_type; ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); cls_pointer_type.alignment = 0; cls_pointer_type.type = FFI_TYPE_POINTER; cls_pointer_type.elements = NULL;*/ void* arg1 = (void*)0x12345678; void* arg2 = (void*)0x89abcdef; ffi_arg res = 0; arg_types[0] = &ffi_type_pointer; arg_types[1] = &ffi_type_pointer; arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, arg_types) == FFI_OK); args[0] = &arg1; args[1] = &arg2; args[2] = NULL; ffi_call(&cif, FFI_FN(cls_pointer_fn), &res, args); /* { dg-output "0x12345678 0x89abcdef: 0x9be02467" } */ printf("res: 0x%08x\n", (unsigned int) res); /* { dg-output "\nres: 0x9be02467" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); /* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */ printf("res: 0x%08x\n", (unsigned int) res); /* { dg-output "\nres: 0x9be02467" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_pointer_stack.c0000644000175000017500000001013011545150464027077 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check pointer arguments across multiple hideous stack frames. Limitations: none. PR: none. Originator: Blake Chaffin 6/7/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" static long dummyVar; long dummy_func( long double a1, char b1, long double a2, char b2, long double a3, char b3, long double a4, char b4) { return a1 + b1 + a2 + b2 + a3 + b3 + a4 + b4; } void* cls_pointer_fn2(void* a1, void* a2) { long double trample1 = (intptr_t)a1 + (intptr_t)a2; char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; long double trample3 = (intptr_t)trample1 + (intptr_t)a1; char trample4 = trample2 + ((char*)&a1)[1]; long double trample5 = (intptr_t)trample3 + (intptr_t)a2; char trample6 = trample4 + ((char*)&a2)[1]; long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; char trample8 = trample6 + trample2; dummyVar = dummy_func(trample1, trample2, trample3, trample4, trample5, trample6, trample7, trample8); void* result = (void*)((intptr_t)a1 + (intptr_t)a2); printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(uintptr_t) a1, (unsigned int)(uintptr_t) a2, (unsigned int)(uintptr_t) result); return result; } void* cls_pointer_fn1(void* a1, void* a2) { long double trample1 = (intptr_t)a1 + (intptr_t)a2; char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; long double trample3 = (intptr_t)trample1 + (intptr_t)a1; char trample4 = trample2 + ((char*)&a1)[1]; long double trample5 = (intptr_t)trample3 + (intptr_t)a2; char trample6 = trample4 + ((char*)&a2)[1]; long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; char trample8 = trample6 + trample2; dummyVar = dummy_func(trample1, trample2, trample3, trample4, trample5, trample6, trample7, trample8); void* result = (void*)((intptr_t)a1 + (intptr_t)a2); printf("0x%08x 0x%08x: 0x%08x\n", (unsigned int)(intptr_t) a1, (unsigned int)(intptr_t) a2, (unsigned int)(intptr_t) result); result = cls_pointer_fn2(result, a1); return result; } static void cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { void* a1 = *(void**)(args[0]); void* a2 = *(void**)(args[1]); long double trample1 = (intptr_t)a1 + (intptr_t)a2; char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; long double trample3 = (intptr_t)trample1 + (intptr_t)a1; char trample4 = trample2 + ((char*)&a1)[1]; long double trample5 = (intptr_t)trample3 + (intptr_t)a2; char trample6 = trample4 + ((char*)&a2)[1]; long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; char trample8 = trample6 + trample2; dummyVar = dummy_func(trample1, trample2, trample3, trample4, trample5, trample6, trample7, trample8); *(void**)resp = cls_pointer_fn1(a1, a2); } int main (void) { ffi_cif cif; void *code; ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[3]; // ffi_type cls_pointer_type; ffi_type* arg_types[3]; /* cls_pointer_type.size = sizeof(void*); cls_pointer_type.alignment = 0; cls_pointer_type.type = FFI_TYPE_POINTER; cls_pointer_type.elements = NULL;*/ void* arg1 = (void*)0x01234567; void* arg2 = (void*)0x89abcdef; ffi_arg res = 0; arg_types[0] = &ffi_type_pointer; arg_types[1] = &ffi_type_pointer; arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, arg_types) == FFI_OK); args[0] = &arg1; args[1] = &arg2; args[2] = NULL; printf("\n"); ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args); printf("res: 0x%08x\n", (unsigned int) res); // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } // { dg-output "\nres: 0x8bf258bd" } CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); res = (ffi_arg)((void*(*)(void*, void*))(code))(arg1, arg2); printf("res: 0x%08x\n", (unsigned int) res); // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } // { dg-output "\nres: 0x8bf258bd" } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_schar.c0000644000175000017500000000205311545150464025337 0ustar chr1schr1s/* Area: closure_call Purpose: Check return value schar. Limitations: none. PR: none. Originator: 20031108 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_schar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = *(signed char *)args[0]; printf("%d: %d\n",*(signed char *)args[0], (int)*(ffi_arg *)(resp)); } typedef signed char (*cls_ret_schar)(signed char); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; signed char res; cl_arg_types[0] = &ffi_type_schar; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_schar, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_schar_fn, NULL, code) == FFI_OK); res = (*((cls_ret_schar)code))(127); /* { dg-output "127: 127" } */ printf("res: %d\n", res); /* { dg-output "\nres: 127" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_sint.c0000644000175000017500000000204511545150464025215 0ustar chr1schr1s/* Area: closure_call Purpose: Check return value sint32. Limitations: none. PR: none. Originator: 20031108 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_sint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = *(signed int *)args[0]; printf("%d: %d\n",*(signed int *)args[0], (int)*(ffi_arg *)(resp)); } typedef signed int (*cls_ret_sint)(signed int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; signed int res; cl_arg_types[0] = &ffi_type_sint; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sint_fn, NULL, code) == FFI_OK); res = (*((cls_ret_sint)code))(65534); /* { dg-output "65534: 65534" } */ printf("res: %d\n",res); /* { dg-output "\nres: 65534" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_sshort.c0000644000175000017500000000206511545150464025564 0ustar chr1schr1s/* Area: closure_call Purpose: Check return value sshort. Limitations: none. PR: none. Originator: 20031108 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_sshort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = *(signed short *)args[0]; printf("%d: %d\n",*(signed short *)args[0], (int)*(ffi_arg *)(resp)); } typedef signed short (*cls_ret_sshort)(signed short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; signed short res; cl_arg_types[0] = &ffi_type_sshort; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sshort, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sshort_fn, NULL, code) == FFI_OK); res = (*((cls_ret_sshort)code))(255); /* { dg-output "255: 255" } */ printf("res: %d\n",res); /* { dg-output "\nres: 255" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_uchar.c0000644000175000017500000000206211545150464025341 0ustar chr1schr1s/* Area: closure_call Purpose: Check return value uchar. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_uchar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = *(unsigned char *)args[0]; printf("%d: %d\n",*(unsigned char *)args[0], (int)*(ffi_arg *)(resp)); } typedef unsigned char (*cls_ret_uchar)(unsigned char); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned char res; cl_arg_types[0] = &ffi_type_uchar; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uchar, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uchar_fn, NULL, code) == FFI_OK); res = (*((cls_ret_uchar)code))(127); /* { dg-output "127: 127" } */ printf("res: %d\n",res); /* { dg-output "\nres: 127" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_uint.c0000644000175000017500000000210311545150464025212 0ustar chr1schr1s/* Area: closure_call Purpose: Check return value uint. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_uint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg *)resp = *(unsigned int *)args[0]; printf("%d: %d\n",*(unsigned int *)args[0], (int)*(ffi_arg *)(resp)); } typedef unsigned int (*cls_ret_uint)(unsigned int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned int res; cl_arg_types[0] = &ffi_type_uint; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uint_fn, NULL, code) == FFI_OK); res = (*((cls_ret_uint)code))(2147483647); /* { dg-output "2147483647: 2147483647" } */ printf("res: %d\n",res); /* { dg-output "\nres: 2147483647" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_ulonglong.c0000644000175000017500000000264411545150464026251 0ustar chr1schr1s/* Area: closure_call Purpose: Check return value long long. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ #include "ffitest.h" static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(unsigned long long *)resp= *(unsigned long long *)args[0]; printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0], *(unsigned long long *)(resp)); } typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned long long res; cl_arg_types[0] = &ffi_type_uint64; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint64, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); res = (*((cls_ret_ulonglong)code))(214LL); /* { dg-output "214: 214" } */ printf("res: %" PRIdLL "\n", res); /* { dg-output "\nres: 214" } */ res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); /* { dg-output "\n9223372035854775808: 9223372035854775808" } */ printf("res: %" PRIdLL "\n", res); /* { dg-output "\nres: 9223372035854775808" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/cls_ushort.c0000644000175000017500000000211011545150464025555 0ustar chr1schr1s/* Area: closure_call Purpose: Check return value ushort. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" static void cls_ret_ushort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = *(unsigned short *)args[0]; printf("%d: %d\n",*(unsigned short *)args[0], (int)*(ffi_arg *)(resp)); } typedef unsigned short (*cls_ret_ushort)(unsigned short); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[2]; unsigned short res; cl_arg_types[0] = &ffi_type_ushort; cl_arg_types[1] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_ushort, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ushort_fn, NULL, code) == FFI_OK); res = (*((cls_ret_ushort)code))(65535); /* { dg-output "65535: 65535" } */ printf("res: %d\n",res); /* { dg-output "\nres: 65535" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/err_bad_abi.c0000644000175000017500000000143311545150464025610 0ustar chr1schr1s/* Area: ffi_prep_cif, ffi_prep_closure Purpose: Test error return for bad ABIs. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail *-*-* } } */ #include "ffitest.h" static void dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, void** args __UNUSED__, void* userdata __UNUSED__) {} int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type* arg_types[1]; arg_types[0] = NULL; CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void, arg_types) == FFI_BAD_ABI); CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, arg_types) == FFI_OK); cif.abi= 255; CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/err_bad_typedef.c0000644000175000017500000000070211545150464026513 0ustar chr1schr1s/* Area: ffi_prep_cif Purpose: Test error return for bad typedefs. Limitations: none. PR: none. Originator: Blake Chaffin 6/6/2007 */ /* { dg-do run { xfail *-*-* } } */ #include "ffitest.h" int main (void) { ffi_cif cif; ffi_type* arg_types[1]; arg_types[0] = NULL; ffi_type badType = ffi_type_void; badType.size = 0; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &badType, arg_types) == FFI_BAD_TYPEDEF); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/ffitest.h0000644000175000017500000000461711545150464025057 0ustar chr1schr1s#include #include #include #include #include #include "fficonfig.h" #if defined HAVE_STDINT_H #include #endif #if defined HAVE_INTTYPES_H #include #endif #define MAX_ARGS 256 #define CHECK(x) !(x) ? abort() : 0 /* Define __UNUSED__ that also other compilers than gcc can run the tests. */ #undef __UNUSED__ #if defined(__GNUC__) #define __UNUSED__ __attribute__((__unused__)) #else #define __UNUSED__ #endif /* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a file open. */ #ifdef HAVE_MMAP_ANON # undef HAVE_MMAP_DEV_ZERO # include # ifndef MAP_FAILED # define MAP_FAILED -1 # endif # if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) # define MAP_ANONYMOUS MAP_ANON # endif # define USING_MMAP #endif #ifdef HAVE_MMAP_DEV_ZERO # include # ifndef MAP_FAILED # define MAP_FAILED -1 # endif # define USING_MMAP #endif /* MinGW kludge. */ #ifdef _WIN64 #define PRIdLL "I64d" #define PRIuLL "I64u" #else #define PRIdLL "lld" #define PRIuLL "llu" #endif /* Tru64 UNIX kludge. */ #if defined(__alpha__) && defined(__osf__) /* Tru64 UNIX V4.0 doesn't support %lld/%lld, but long is 64-bit. */ #undef PRIdLL #define PRIdLL "ld" #undef PRIuLL #define PRIuLL "lu" #define PRId64 "ld" #define PRIu64 "lu" #define PRIuPTR "lu" #endif /* PA HP-UX kludge. */ #if defined(__hppa__) && defined(__hpux__) && !defined(PRIuPTR) #define PRIuPTR "lu" #endif /* Solaris < 10 kludge. */ #if defined(__sun__) && defined(__svr4__) && !defined(PRIuPTR) #if defined(__arch64__) || defined (__x86_64__) #define PRIuPTR "lu" #else #define PRIuPTR "u" #endif #endif #ifdef USING_MMAP static inline void * allocate_mmap (size_t size) { void *page; #if defined (HAVE_MMAP_DEV_ZERO) static int dev_zero_fd = -1; #endif #ifdef HAVE_MMAP_DEV_ZERO if (dev_zero_fd == -1) { dev_zero_fd = open ("/dev/zero", O_RDONLY); if (dev_zero_fd == -1) { perror ("open /dev/zero: %m"); exit (1); } } #endif #ifdef HAVE_MMAP_ANON page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #endif #ifdef HAVE_MMAP_DEV_ZERO page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, dev_zero_fd, 0); #endif if (page == (void *) MAP_FAILED) { perror ("virtual memory exhausted"); exit (1); } return page; } #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/float.c0000644000175000017500000000207411545150464024506 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value float. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static int floating(int a, float b, double c, long double d) { int i; i = (int) ((float)a/b + ((float)c/(float)d)); return i; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; float f; signed int si1; double d; long double ld; args[0] = &ffi_type_sint; values[0] = &si1; args[1] = &ffi_type_float; values[1] = &f; args[2] = &ffi_type_double; values[2] = &d; args[3] = &ffi_type_longdouble; values[3] = &ld; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_sint, args) == FFI_OK); si1 = 6; f = 3.14159; d = (double)1.0/(double)3.0; ld = 2.71828182846L; floating (si1, f, d, ld); ffi_call(&cif, FFI_FN(floating), &rint, values); printf ("%d vs %d\n", (int)rint, floating (si1, f, d, ld)); CHECK((int)rint == floating(si1, f, d, ld)); exit (0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/float1.c0000644000175000017500000000213211545150464024562 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value double. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" #include "float.h" typedef union { double d; unsigned char c[sizeof (double)]; } value_type; #define CANARY 0xba static double dblit(float f) { return f/3.0; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float f; value_type result[2]; unsigned int i; args[0] = &ffi_type_float; values[0] = &f; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_double, args) == FFI_OK); f = 3.14159; /* Put a canary in the return array. This is a regression test for a buffer overrun. */ memset(result[1].c, CANARY, sizeof (double)); ffi_call(&cif, FFI_FN(dblit), &result[0].d, values); /* These are not always the same!! Check for a reasonable delta */ CHECK(result[0].d - dblit(f) < DBL_EPSILON); /* Check the canary. */ for (i = 0; i < sizeof (double); ++i) CHECK(result[1].c[i] == CANARY); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/float2.c0000644000175000017500000000270711545150464024573 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value long double. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-excess-errors "fails" { target x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" #include "float.h" static long double ldblit(float f) { return (long double) (((long double) f)/ (long double) 3.0); } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float f; long double ld; args[0] = &ffi_type_float; values[0] = &f; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_longdouble, args) == FFI_OK); f = 3.14159; #if 1 /* This is ifdef'd out for now. long double support under SunOS/gcc is pretty much non-existent. You'll get the odd bus error in library routines like printf(). */ printf ("%Lf\n", ldblit(f)); #endif ld = 666; ffi_call(&cif, FFI_FN(ldblit), &ld, values); #if 1 /* This is ifdef'd out for now. long double support under SunOS/gcc is pretty much non-existent. You'll get the odd bus error in library routines like printf(). */ printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON); #endif /* These are not always the same!! Check for a reasonable delta */ if (ld - ldblit(f) < LDBL_EPSILON) puts("long double return value tests ok!"); else CHECK(0); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/float3.c0000644000175000017500000000264411545150464024574 0ustar chr1schr1s/* Area: ffi_call Purpose: Check float arguments with different orders. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" #include "float.h" static double floating_1(float a, double b, long double c) { return (double) a + b + (double) c; } static double floating_2(long double a, double b, float c) { return (double) a + b + (double) c; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; double rd; float f; double d; long double ld; args[0] = &ffi_type_float; values[0] = &f; args[1] = &ffi_type_double; values[1] = &d; args[2] = &ffi_type_longdouble; values[2] = &ld; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_double, args) == FFI_OK); f = 3.14159; d = (double)1.0/(double)3.0; ld = 2.71828182846L; floating_1 (f, d, ld); ffi_call(&cif, FFI_FN(floating_1), &rd, values); CHECK(rd - floating_1(f, d, ld) < DBL_EPSILON); args[0] = &ffi_type_longdouble; values[0] = &ld; args[1] = &ffi_type_double; values[1] = &d; args[2] = &ffi_type_float; values[2] = &f; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_double, args) == FFI_OK); floating_2 (ld, d, f); ffi_call(&cif, FFI_FN(floating_2), &rd, values); CHECK(rd - floating_2(ld, d, f) < DBL_EPSILON); exit (0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/float4.c0000644000175000017500000000241211545150464024566 0ustar chr1schr1s/* Area: ffi_call Purpose: Check denorm double value. Limitations: none. PR: PR26483. Originator: From the original ffitest.c */ /* { dg-do run } */ /* { dg-options "-mieee" { target alpha*-*-* } } */ #include "ffitest.h" #include "float.h" typedef union { double d; unsigned char c[sizeof (double)]; } value_type; #define CANARY 0xba static double dblit(double d) { return d; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; double d; value_type result[2]; unsigned int i; args[0] = &ffi_type_double; values[0] = &d; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_double, args) == FFI_OK); d = DBL_MIN / 2; /* Put a canary in the return array. This is a regression test for a buffer overrun. */ memset(result[1].c, CANARY, sizeof (double)); ffi_call(&cif, FFI_FN(dblit), &result[0].d, values); /* The standard delta check doesn't work for denorms. Since we didn't do any arithmetic, we should get the original result back, and hence an exact check should be OK here. */ CHECK(result[0].d == dblit(d)); /* Check the canary. */ for (i = 0; i < sizeof (double); ++i) CHECK(result[1].c[i] == CANARY); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/huge_struct.c0000644000175000017500000003401011545150464025730 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check large structure returns. Limitations: none. PR: none. Originator: Blake Chaffin 6/18/2007 */ /* { dg-excess-errors "" { target x86_64-*-mingw* x86_64-*-cygwin* } } */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */ /* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" typedef struct BigStruct{ uint8_t a; int8_t b; uint16_t c; int16_t d; uint32_t e; int32_t f; uint64_t g; int64_t h; float i; double j; long double k; char* l; uint8_t m; int8_t n; uint16_t o; int16_t p; uint32_t q; int32_t r; uint64_t s; int64_t t; float u; double v; long double w; char* x; uint8_t y; int8_t z; uint16_t aa; int16_t bb; uint32_t cc; int32_t dd; uint64_t ee; int64_t ff; float gg; double hh; long double ii; char* jj; uint8_t kk; int8_t ll; uint16_t mm; int16_t nn; uint32_t oo; int32_t pp; uint64_t qq; int64_t rr; float ss; double tt; long double uu; char* vv; uint8_t ww; int8_t xx; } BigStruct; BigStruct test_large_fn( uint8_t ui8_1, int8_t si8_1, uint16_t ui16_1, int16_t si16_1, uint32_t ui32_1, int32_t si32_1, uint64_t ui64_1, int64_t si64_1, float f_1, double d_1, long double ld_1, char* p_1, uint8_t ui8_2, int8_t si8_2, uint16_t ui16_2, int16_t si16_2, uint32_t ui32_2, int32_t si32_2, uint64_t ui64_2, int64_t si64_2, float f_2, double d_2, long double ld_2, char* p_2, uint8_t ui8_3, int8_t si8_3, uint16_t ui16_3, int16_t si16_3, uint32_t ui32_3, int32_t si32_3, uint64_t ui64_3, int64_t si64_3, float f_3, double d_3, long double ld_3, char* p_3, uint8_t ui8_4, int8_t si8_4, uint16_t ui16_4, int16_t si16_4, uint32_t ui32_4, int32_t si32_4, uint64_t ui64_4, int64_t si64_4, float f_4, double d_4, long double ld_4, char* p_4, uint8_t ui8_5, int8_t si8_5) { BigStruct retVal = { ui8_1 + 1, si8_1 + 1, ui16_1 + 1, si16_1 + 1, ui32_1 + 1, si32_1 + 1, ui64_1 + 1, si64_1 + 1, f_1 + 1, d_1 + 1, ld_1 + 1, (char*)((intptr_t)p_1 + 1), ui8_2 + 2, si8_2 + 2, ui16_2 + 2, si16_2 + 2, ui32_2 + 2, si32_2 + 2, ui64_2 + 2, si64_2 + 2, f_2 + 2, d_2 + 2, ld_2 + 2, (char*)((intptr_t)p_2 + 2), ui8_3 + 3, si8_3 + 3, ui16_3 + 3, si16_3 + 3, ui32_3 + 3, si32_3 + 3, ui64_3 + 3, si64_3 + 3, f_3 + 3, d_3 + 3, ld_3 + 3, (char*)((intptr_t)p_3 + 3), ui8_4 + 4, si8_4 + 4, ui16_4 + 4, si16_4 + 4, ui32_4 + 4, si32_4 + 4, ui64_4 + 4, si64_4 + 4, f_4 + 4, d_4 + 4, ld_4 + 4, (char*)((intptr_t)p_4 + 4), ui8_5 + 5, si8_5 + 5}; printf("%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %hhu %hhd: " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %hhu %hhd\n", ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, (unsigned long)p_1, ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, (unsigned long)p_2, ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, (unsigned long)p_3, ui8_4, si8_4, ui16_4, si16_4, ui32_4, si32_4, ui64_4, si64_4, f_4, d_4, ld_4, (unsigned long)p_4, ui8_5, si8_5, retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); return retVal; } static void cls_large_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { uint8_t ui8_1 = *(uint8_t*)args[0]; int8_t si8_1 = *(int8_t*)args[1]; uint16_t ui16_1 = *(uint16_t*)args[2]; int16_t si16_1 = *(int16_t*)args[3]; uint32_t ui32_1 = *(uint32_t*)args[4]; int32_t si32_1 = *(int32_t*)args[5]; uint64_t ui64_1 = *(uint64_t*)args[6]; int64_t si64_1 = *(int64_t*)args[7]; float f_1 = *(float*)args[8]; double d_1 = *(double*)args[9]; long double ld_1 = *(long double*)args[10]; char* p_1 = *(char**)args[11]; uint8_t ui8_2 = *(uint8_t*)args[12]; int8_t si8_2 = *(int8_t*)args[13]; uint16_t ui16_2 = *(uint16_t*)args[14]; int16_t si16_2 = *(int16_t*)args[15]; uint32_t ui32_2 = *(uint32_t*)args[16]; int32_t si32_2 = *(int32_t*)args[17]; uint64_t ui64_2 = *(uint64_t*)args[18]; int64_t si64_2 = *(int64_t*)args[19]; float f_2 = *(float*)args[20]; double d_2 = *(double*)args[21]; long double ld_2 = *(long double*)args[22]; char* p_2 = *(char**)args[23]; uint8_t ui8_3 = *(uint8_t*)args[24]; int8_t si8_3 = *(int8_t*)args[25]; uint16_t ui16_3 = *(uint16_t*)args[26]; int16_t si16_3 = *(int16_t*)args[27]; uint32_t ui32_3 = *(uint32_t*)args[28]; int32_t si32_3 = *(int32_t*)args[29]; uint64_t ui64_3 = *(uint64_t*)args[30]; int64_t si64_3 = *(int64_t*)args[31]; float f_3 = *(float*)args[32]; double d_3 = *(double*)args[33]; long double ld_3 = *(long double*)args[34]; char* p_3 = *(char**)args[35]; uint8_t ui8_4 = *(uint8_t*)args[36]; int8_t si8_4 = *(int8_t*)args[37]; uint16_t ui16_4 = *(uint16_t*)args[38]; int16_t si16_4 = *(int16_t*)args[39]; uint32_t ui32_4 = *(uint32_t*)args[40]; int32_t si32_4 = *(int32_t*)args[41]; uint64_t ui64_4 = *(uint64_t*)args[42]; int64_t si64_4 = *(int64_t*)args[43]; float f_4 = *(float*)args[44]; double d_4 = *(double*)args[45]; long double ld_4 = *(long double*)args[46]; char* p_4 = *(char**)args[47]; uint8_t ui8_5 = *(uint8_t*)args[48]; int8_t si8_5 = *(int8_t*)args[49]; *(BigStruct*)resp = test_large_fn( ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, p_1, ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, p_2, ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, p_3, ui8_4, si8_4, ui16_4, si16_4, ui32_4, si32_4, ui64_4, si64_4, f_4, d_4, ld_4, p_4, ui8_5, si8_5); } int main(int argc __UNUSED__, const char** argv __UNUSED__) { void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_cif cif; ffi_type* argTypes[51]; void* argValues[51]; ffi_type ret_struct_type; ffi_type* st_fields[51]; BigStruct retVal; memset (&retVal, 0, sizeof(retVal)); ret_struct_type.size = 0; ret_struct_type.alignment = 0; ret_struct_type.type = FFI_TYPE_STRUCT; ret_struct_type.elements = st_fields; st_fields[0] = st_fields[12] = st_fields[24] = st_fields[36] = st_fields[48] = &ffi_type_uint8; st_fields[1] = st_fields[13] = st_fields[25] = st_fields[37] = st_fields[49] = &ffi_type_sint8; st_fields[2] = st_fields[14] = st_fields[26] = st_fields[38] = &ffi_type_uint16; st_fields[3] = st_fields[15] = st_fields[27] = st_fields[39] = &ffi_type_sint16; st_fields[4] = st_fields[16] = st_fields[28] = st_fields[40] = &ffi_type_uint32; st_fields[5] = st_fields[17] = st_fields[29] = st_fields[41] = &ffi_type_sint32; st_fields[6] = st_fields[18] = st_fields[30] = st_fields[42] = &ffi_type_uint64; st_fields[7] = st_fields[19] = st_fields[31] = st_fields[43] = &ffi_type_sint64; st_fields[8] = st_fields[20] = st_fields[32] = st_fields[44] = &ffi_type_float; st_fields[9] = st_fields[21] = st_fields[33] = st_fields[45] = &ffi_type_double; st_fields[10] = st_fields[22] = st_fields[34] = st_fields[46] = &ffi_type_longdouble; st_fields[11] = st_fields[23] = st_fields[35] = st_fields[47] = &ffi_type_pointer; st_fields[50] = NULL; uint8_t ui8 = 1; int8_t si8 = 2; uint16_t ui16 = 3; int16_t si16 = 4; uint32_t ui32 = 5; int32_t si32 = 6; uint64_t ui64 = 7; int64_t si64 = 8; float f = 9; double d = 10; long double ld = 11; char* p = (char*)0x12345678; argTypes[0] = argTypes[12] = argTypes[24] = argTypes[36] = argTypes[48] = &ffi_type_uint8; argValues[0] = argValues[12] = argValues[24] = argValues[36] = argValues[48] = &ui8; argTypes[1] = argTypes[13] = argTypes[25] = argTypes[37] = argTypes[49] = &ffi_type_sint8; argValues[1] = argValues[13] = argValues[25] = argValues[37] = argValues[49] = &si8; argTypes[2] = argTypes[14] = argTypes[26] = argTypes[38] = &ffi_type_uint16; argValues[2] = argValues[14] = argValues[26] = argValues[38] = &ui16; argTypes[3] = argTypes[15] = argTypes[27] = argTypes[39] = &ffi_type_sint16; argValues[3] = argValues[15] = argValues[27] = argValues[39] = &si16; argTypes[4] = argTypes[16] = argTypes[28] = argTypes[40] = &ffi_type_uint32; argValues[4] = argValues[16] = argValues[28] = argValues[40] = &ui32; argTypes[5] = argTypes[17] = argTypes[29] = argTypes[41] = &ffi_type_sint32; argValues[5] = argValues[17] = argValues[29] = argValues[41] = &si32; argTypes[6] = argTypes[18] = argTypes[30] = argTypes[42] = &ffi_type_uint64; argValues[6] = argValues[18] = argValues[30] = argValues[42] = &ui64; argTypes[7] = argTypes[19] = argTypes[31] = argTypes[43] = &ffi_type_sint64; argValues[7] = argValues[19] = argValues[31] = argValues[43] = &si64; argTypes[8] = argTypes[20] = argTypes[32] = argTypes[44] = &ffi_type_float; argValues[8] = argValues[20] = argValues[32] = argValues[44] = &f; argTypes[9] = argTypes[21] = argTypes[33] = argTypes[45] = &ffi_type_double; argValues[9] = argValues[21] = argValues[33] = argValues[45] = &d; argTypes[10] = argTypes[22] = argTypes[34] = argTypes[46] = &ffi_type_longdouble; argValues[10] = argValues[22] = argValues[34] = argValues[46] = &ld; argTypes[11] = argTypes[23] = argTypes[35] = argTypes[47] = &ffi_type_pointer; argValues[11] = argValues[23] = argValues[35] = argValues[47] = &p; argTypes[50] = NULL; argValues[50] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 50, &ret_struct_type, argTypes) == FFI_OK); ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues); // { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } printf("res: %hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %hhu %hhd\n", retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK); retVal = ((BigStruct(*)( uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, uint8_t, int8_t))(code))( ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, ui8, si8); // { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } printf("res: %hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " "%hhu %hhd %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %hhu %hhd\n", retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } return 0; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/many.c0000644000175000017500000000252611545150464024347 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value float, with many arguments Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" #include static float many(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13) { #if 0 printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n", (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, (double) f6, (double) f7, (double) f8, (double) f9, (double) f10, (double) f11, (double) f12, (double) f13); #endif return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); } int main (void) { ffi_cif cif; ffi_type *args[13]; void *values[13]; float fa[13]; float f, ff; int i; for (i = 0; i < 13; i++) { args[i] = &ffi_type_float; values[i] = &fa[i]; fa[i] = (float) i; } /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, &ffi_type_float, args) == FFI_OK); ffi_call(&cif, FFI_FN(many), &f, values); ff = many(fa[0], fa[1], fa[2], fa[3], fa[4], fa[5], fa[6], fa[7], fa[8], fa[9], fa[10],fa[11],fa[12]); if (f - ff < FLT_EPSILON) exit(0); else abort(); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/many_win32.c0000644000175000017500000000242211545150464025364 0ustar chr1schr1s/* Area: ffi_call Purpose: Check stdcall many call on X86_WIN32 systems. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ #include "ffitest.h" #include static float __attribute__((stdcall)) stdcall_many(float f1, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9, float f10, float f11, float f12, float f13) { return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); } int main (void) { ffi_cif cif; ffi_type *args[13]; void *values[13]; float fa[13]; float f, ff; unsigned long ul; for (ul = 0; ul < 13; ul++) { args[ul] = &ffi_type_float; values[ul] = &fa[ul]; fa[ul] = (float) ul; } /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 13, &ffi_type_float, args) == FFI_OK); ff = stdcall_many(fa[0], fa[1], fa[2], fa[3], fa[4], fa[5], fa[6], fa[7], fa[8], fa[9], fa[10], fa[11], fa[12]); ffi_call(&cif, FFI_FN(stdcall_many), &f, values); if (f - ff < FLT_EPSILON) printf("stdcall many arg tests ok!\n"); else CHECK(0); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/negint.c0000644000175000017500000000167211545150464024670 0ustar chr1schr1s/* Area: ffi_call Purpose: Check that negative integers are passed correctly. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ /* { dg-options -O2 } */ #include "ffitest.h" static int checking(int a, short b, signed char c) { return (a < 0 && b < 0 && c < 0); } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; signed int si; signed short ss; signed char sc; args[0] = &ffi_type_sint; values[0] = &si; args[1] = &ffi_type_sshort; values[1] = &ss; args[2] = &ffi_type_schar; values[2] = ≻ /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_sint, args) == FFI_OK); si = -6; ss = -12; sc = -1; checking (si, ss, sc); ffi_call(&cif, FFI_FN(checking), &rint, values); printf ("%d vs %d\n", (int)rint, checking (si, ss, sc)); CHECK(rint != 0); exit (0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct.c0000644000175000017500000001112711545150464026266 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_16byte1 { double a; float b; int c; } cls_struct_16byte1; typedef struct cls_struct_16byte2 { int ii; double dd; float ff; } cls_struct_16byte2; typedef struct cls_struct_combined { cls_struct_16byte1 d; cls_struct_16byte2 e; } cls_struct_combined; cls_struct_combined cls_struct_combined_fn(struct cls_struct_16byte1 b0, struct cls_struct_16byte2 b1, struct cls_struct_combined b2) { struct cls_struct_combined result; result.d.a = b0.a + b1.dd + b2.d.a; result.d.b = b0.b + b1.ff + b2.d.b; result.d.c = b0.c + b1.ii + b2.d.c; result.e.ii = b0.c + b1.ii + b2.e.ii; result.e.dd = b0.a + b1.dd + b2.e.dd; result.e.ff = b0.b + b1.ff + b2.e.ff; printf("%g %g %d %d %g %g %g %g %d %d %g %g: %g %g %d %d %g %g\n", b0.a, b0.b, b0.c, b1.ii, b1.dd, b1.ff, b2.d.a, b2.d.b, b2.d.c, b2.e.ii, b2.e.dd, b2.e.ff, result.d.a, result.d.b, result.d.c, result.e.ii, result.e.dd, result.e.ff); return result; } static void cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_16byte1 b0; struct cls_struct_16byte2 b1; struct cls_struct_combined b2; b0 = *(struct cls_struct_16byte1*)(args[0]); b1 = *(struct cls_struct_16byte2*)(args[1]); b2 = *(struct cls_struct_combined*)(args[2]); *(cls_struct_combined*)resp = cls_struct_combined_fn(b0, b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type* cls_struct_fields1[5]; ffi_type* cls_struct_fields2[5]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, {3, 1.0, 8.0}}; struct cls_struct_combined res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = NULL; cls_struct_fields1[0] = &ffi_type_sint; cls_struct_fields1[1] = &ffi_type_double; cls_struct_fields1[2] = &ffi_type_float; cls_struct_fields1[3] = NULL; cls_struct_fields2[0] = &cls_struct_type; cls_struct_fields2[1] = &cls_struct_type1; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type2, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = NULL; ffi_call(&cif, FFI_FN(cls_struct_combined_fn), &res_dbl, args_dbl); /* { dg-output "9 2 6 1 2 3 4 5 6 3 1 8: 15 10 13 10 12 13" } */ CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1, cls_struct_16byte2, cls_struct_combined)) (code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8: 15 10 13 10 12 13" } */ CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct1.c0000644000175000017500000001165011545150464026350 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_16byte1 { double a; float b; int c; } cls_struct_16byte1; typedef struct cls_struct_16byte2 { int ii; double dd; float ff; } cls_struct_16byte2; typedef struct cls_struct_combined { cls_struct_16byte1 d; cls_struct_16byte2 e; } cls_struct_combined; cls_struct_combined cls_struct_combined_fn(struct cls_struct_16byte1 b0, struct cls_struct_16byte2 b1, struct cls_struct_combined b2, struct cls_struct_16byte1 b3) { struct cls_struct_combined result; result.d.a = b0.a + b1.dd + b2.d.a; result.d.b = b0.b + b1.ff + b2.d.b; result.d.c = b0.c + b1.ii + b2.d.c; result.e.ii = b0.c + b1.ii + b2.e.ii; result.e.dd = b0.a + b1.dd + b2.e.dd; result.e.ff = b0.b + b1.ff + b2.e.ff; printf("%g %g %d %d %g %g %g %g %d %d %g %g %g %g %d: %g %g %d %d %g %g\n", b0.a, b0.b, b0.c, b1.ii, b1.dd, b1.ff, b2.d.a, b2.d.b, b2.d.c, b2.e.ii, b2.e.dd, b2.e.ff, b3.a, b3.b, b3.c, result.d.a, result.d.b, result.d.c, result.e.ii, result.e.dd, result.e.ff); return result; } static void cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct cls_struct_16byte1 b0; struct cls_struct_16byte2 b1; struct cls_struct_combined b2; struct cls_struct_16byte1 b3; b0 = *(struct cls_struct_16byte1*)(args[0]); b1 = *(struct cls_struct_16byte2*)(args[1]); b2 = *(struct cls_struct_combined*)(args[2]); b3 = *(struct cls_struct_16byte1*)(args[3]); *(cls_struct_combined*)resp = cls_struct_combined_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[5]; ffi_type* cls_struct_fields1[5]; ffi_type* cls_struct_fields2[5]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, {3, 1.0, 8.0}}; struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4}; struct cls_struct_combined res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_float; cls_struct_fields[2] = &ffi_type_sint; cls_struct_fields[3] = NULL; cls_struct_fields1[0] = &ffi_type_sint; cls_struct_fields1[1] = &ffi_type_double; cls_struct_fields1[2] = &ffi_type_float; cls_struct_fields1[3] = NULL; cls_struct_fields2[0] = &cls_struct_type; cls_struct_fields2[1] = &cls_struct_type1; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type2, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_combined_fn), &res_dbl, args_dbl); /* { dg-output "9 2 6 1 2 3 4 5 6 3 1 8 3 2 4: 15 10 13 10 12 13" } */ CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1, cls_struct_16byte2, cls_struct_combined, cls_struct_16byte1)) (code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8 3 2 4: 15 10 13 10 12 13" } */ CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); // CHECK( 1 == 0); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct10.c0000644000175000017500000000676711545150464026445 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned long long a; unsigned char b; } A; typedef struct B { unsigned char y; struct A x; unsigned int z; } B; typedef struct C { unsigned long long d; unsigned char e; } C; static B B_fn(struct A b2, struct B b3, struct C b4) { struct B result; result.x.a = b2.a + b3.x.a + b3.z + b4.d; result.x.b = b2.b + b3.x.b + b3.y + b4.e; result.y = b2.b + b3.x.b + b4.e; printf("%d %d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, b3.z, (int)b4.d, b4.e, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; struct C b2; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); b2 = *(struct C*)(args[2]); *(B*)resp = B_fn(b0, b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[4]; ffi_type* cls_struct_fields2[3]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct A e_dbl = { 1LL, 7}; struct B f_dbl = { 99, {12LL , 127}, 255}; struct C g_dbl = { 2LL, 9}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &ffi_type_uchar; cls_struct_fields1[1] = &cls_struct_type; cls_struct_fields1[2] = &ffi_type_uint; cls_struct_fields1[3] = NULL; cls_struct_fields2[0] = &ffi_type_uint64; cls_struct_fields2[1] = &ffi_type_uchar; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99 255 2 9: 270 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 255 2 9: 270 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct2.c0000644000175000017500000000530411545150464026350 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20030911 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned long a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; B B_fn(struct A b0, struct B b1) { struct B result; result.x.a = b0.a + b1.x.a; result.x.b = b0.b + b1.x.b + b1.y; result.y = b0.b + b1.x.b; printf("%lu %d %lu %d %d: %lu %d %d\n", b0.a, b0.b, b1.x.a, b1.x.b, b1.y, result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); *(B*)resp = B_fn(b0, b1); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; struct A e_dbl = { 1, 7}; struct B f_dbl = {{12 , 127}, 99}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_ulong; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct3.c0000644000175000017500000000533411545150464026354 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20030911 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned long long a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; B B_fn(struct A b0, struct B b1) { struct B result; result.x.a = b0.a + b1.x.a; result.x.b = b0.b + b1.x.b + b1.y; result.y = b0.b + b1.x.b; printf("%d %d %d %d %d: %d %d %d\n", (int)b0.a, b0.b, (int)b1.x.a, b1.x.b, b1.y, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); *(B*)resp = B_fn(b0, b1); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; struct A e_dbl = { 1LL, 7}; struct B f_dbl = {{12LL , 127}, 99}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct4.c0000644000175000017500000000533311545150464026354 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: PR 25630. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { double a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; static B B_fn(struct A b2, struct B b3) { struct B result; result.x.a = b2.a + b3.x.a; result.x.b = b2.b + b3.x.b + b3.y; result.y = b2.b + b3.x.b; printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); *(B*)resp = B_fn(b0, b1); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; struct A e_dbl = { 1.0, 7}; struct B f_dbl = {{12.0 , 127}, 99}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct5.c0000644000175000017500000000534111545150464026354 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { long double a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; static B B_fn(struct A b2, struct B b3) { struct B result; result.x.a = b2.a + b3.x.a; result.x.b = b2.b + b3.x.b + b3.y; result.y = b2.b + b3.x.b; printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); *(B*)resp = B_fn(b0, b1); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; struct A e_dbl = { 1.0, 7}; struct B f_dbl = {{12.0 , 127}, 99}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_longdouble; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct6.c0000644000175000017500000000655611545150464026366 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: PR 25630. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { double a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; typedef struct C { long d; unsigned char e; } C; static B B_fn(struct A b2, struct B b3, struct C b4) { struct B result; result.x.a = b2.a + b3.x.a + b4.d; result.x.b = b2.b + b3.x.b + b3.y + b4.e; result.y = b2.b + b3.x.b + b4.e; printf("%d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, (int)b4.d, b4.e, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; struct C b2; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); b2 = *(struct C*)(args[2]); *(B*)resp = B_fn(b0, b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type* cls_struct_fields2[3]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct A e_dbl = { 1.0, 7}; struct B f_dbl = {{12.0 , 127}, 99}; struct C g_dbl = { 2, 9}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; cls_struct_fields2[0] = &ffi_type_slong; cls_struct_fields2[1] = &ffi_type_uchar; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct7.c0000644000175000017500000000534311545150464026360 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned long long a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; static B B_fn(struct A b2, struct B b3) { struct B result; result.x.a = b2.a + b3.x.a; result.x.b = b2.b + b3.x.b + b3.y; result.y = b2.b + b3.x.b; printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); *(B*)resp = B_fn(b0, b1); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[3]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type cls_struct_type, cls_struct_type1; ffi_type* dbl_arg_types[3]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; struct A e_dbl = { 1LL, 7}; struct B f_dbl = {{12.0 , 127}, 99}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct8.c0000644000175000017500000000660711545150464026365 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned long long a; unsigned char b; } A; typedef struct B { struct A x; unsigned char y; } B; typedef struct C { unsigned long long d; unsigned char e; } C; static B B_fn(struct A b2, struct B b3, struct C b4) { struct B result; result.x.a = b2.a + b3.x.a + b4.d; result.x.b = b2.b + b3.x.b + b3.y + b4.e; result.y = b2.b + b3.x.b + b4.e; printf("%d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, (int)b3.x.a, b3.x.b, b3.y, (int)b4.d, b4.e, (int)result.x.a, result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; struct C b2; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); b2 = *(struct C*)(args[2]); *(B*)resp = B_fn(b0, b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type* cls_struct_fields2[3]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct A e_dbl = { 1LL, 7}; struct B f_dbl = {{12LL , 127}, 99}; struct C g_dbl = { 2LL, 9}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_uint64; cls_struct_fields[1] = &ffi_type_uchar; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; cls_struct_fields2[0] = &ffi_type_uint64; cls_struct_fields2[1] = &ffi_type_uchar; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/nested_struct9.c0000644000175000017500000000657711545150464026374 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Contains structs as parameter of the struct itself. Sample taken from Alan Modras patch to src/prep_cif.c. Limitations: none. PR: none. Originator: 20051010 */ /* { dg-do run } */ #include "ffitest.h" typedef struct A { unsigned char a; unsigned long long b; } A; typedef struct B { struct A x; unsigned char y; } B; typedef struct C { unsigned long d; unsigned char e; } C; static B B_fn(struct A b2, struct B b3, struct C b4) { struct B result; result.x.a = b2.a + b3.x.a + b4.d; result.x.b = b2.b + b3.x.b + b3.y + b4.e; result.y = b2.b + b3.x.b + b4.e; printf("%d %d %d %d %d %d %d: %d %d %d\n", b2.a, (int)b2.b, b3.x.a, (int)b3.x.b, b3.y, (int)b4.d, b4.e, result.x.a, (int)result.x.b, result.y); return result; } static void B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct A b0; struct B b1; struct C b2; b0 = *(struct A*)(args[0]); b1 = *(struct B*)(args[1]); b2 = *(struct C*)(args[2]); *(B*)resp = B_fn(b0, b1, b2); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[4]; ffi_type* cls_struct_fields[3]; ffi_type* cls_struct_fields1[3]; ffi_type* cls_struct_fields2[3]; ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; ffi_type* dbl_arg_types[4]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; cls_struct_type1.size = 0; cls_struct_type1.alignment = 0; cls_struct_type1.type = FFI_TYPE_STRUCT; cls_struct_type1.elements = cls_struct_fields1; cls_struct_type2.size = 0; cls_struct_type2.alignment = 0; cls_struct_type2.type = FFI_TYPE_STRUCT; cls_struct_type2.elements = cls_struct_fields2; struct A e_dbl = { 1, 7LL}; struct B f_dbl = {{12.0 , 127}, 99}; struct C g_dbl = { 2, 9}; struct B res_dbl; cls_struct_fields[0] = &ffi_type_uchar; cls_struct_fields[1] = &ffi_type_uint64; cls_struct_fields[2] = NULL; cls_struct_fields1[0] = &cls_struct_type; cls_struct_fields1[1] = &ffi_type_uchar; cls_struct_fields1[2] = NULL; cls_struct_fields2[0] = &ffi_type_ulong; cls_struct_fields2[1] = &ffi_type_uchar; cls_struct_fields2[2] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type1; dbl_arg_types[2] = &cls_struct_type2; dbl_arg_types[3] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = NULL; ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/problem1.c0000644000175000017500000000442611545150464025125 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure passing with different structure size. Limitations: none. PR: none. Originator: 20030828 */ /* { dg-do run } */ #include "ffitest.h" typedef struct my_ffi_struct { double a; double b; double c; } my_ffi_struct; my_ffi_struct callee(struct my_ffi_struct a1, struct my_ffi_struct a2) { struct my_ffi_struct result; result.a = a1.a + a2.a; result.b = a1.b + a2.b; result.c = a1.c + a2.c; printf("%g %g %g %g %g %g: %g %g %g\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); return result; } void stub(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct my_ffi_struct a1; struct my_ffi_struct a2; a1 = *(struct my_ffi_struct*)(args[0]); a2 = *(struct my_ffi_struct*)(args[1]); *(my_ffi_struct *)resp = callee(a1, a2); } int main(void) { ffi_type* my_ffi_struct_fields[4]; ffi_type my_ffi_struct_type; ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args[4]; ffi_type* arg_types[3]; struct my_ffi_struct g = { 1.0, 2.0, 3.0 }; struct my_ffi_struct f = { 1.0, 2.0, 3.0 }; struct my_ffi_struct res; my_ffi_struct_type.size = 0; my_ffi_struct_type.alignment = 0; my_ffi_struct_type.type = FFI_TYPE_STRUCT; my_ffi_struct_type.elements = my_ffi_struct_fields; my_ffi_struct_fields[0] = &ffi_type_double; my_ffi_struct_fields[1] = &ffi_type_double; my_ffi_struct_fields[2] = &ffi_type_double; my_ffi_struct_fields[3] = NULL; arg_types[0] = &my_ffi_struct_type; arg_types[1] = &my_ffi_struct_type; arg_types[2] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &my_ffi_struct_type, arg_types) == FFI_OK); args[0] = &g; args[1] = &f; args[2] = NULL; ffi_call(&cif, FFI_FN(callee), &res, args); /* { dg-output "1 2 3 1 2 3: 2 4 6" } */ printf("res: %g %g %g\n", res.a, res.b, res.c); /* { dg-output "\nres: 2 4 6" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, stub, NULL, code) == FFI_OK); res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(code))(g, f); /* { dg-output "\n1 2 3 1 2 3: 2 4 6" } */ printf("res: %g %g %g\n", res.a, res.b, res.c); /* { dg-output "\nres: 2 4 6" } */ exit(0);; } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/promotion.c0000644000175000017500000000251111545150464025423 0ustar chr1schr1s/* Area: ffi_call Purpose: Promotion test. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static int promotion(signed char sc, signed short ss, unsigned char uc, unsigned short us) { int r = (int) sc + (int) ss + (int) uc + (int) us; return r; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; signed char sc; unsigned char uc; signed short ss; unsigned short us; unsigned long ul; args[0] = &ffi_type_schar; args[1] = &ffi_type_sshort; args[2] = &ffi_type_uchar; args[3] = &ffi_type_ushort; values[0] = ≻ values[1] = &ss; values[2] = &uc; values[3] = &us; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_sint, args) == FFI_OK); us = 0; ul = 0; for (sc = (signed char) -127; sc <= (signed char) 120; sc += 1) for (ss = -30000; ss <= 30000; ss += 10000) for (uc = (unsigned char) 0; uc <= (unsigned char) 200; uc += 20) for (us = 0; us <= 60000; us += 10000) { ul++; ffi_call(&cif, FFI_FN(promotion), &rint, values); CHECK((int)rint == (signed char) sc + (signed short) ss + (unsigned char) uc + (unsigned short) us); } printf("%lu promotion tests run\n", ul); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/pyobjc-tc.c0000644000175000017500000000460611545150464025276 0ustar chr1schr1s/* Area: ffi_call Purpose: Check different structures. Limitations: none. PR: none. Originator: Ronald Oussoren 20030824 */ /* { dg-do run } */ #include "ffitest.h" typedef struct Point { float x; float y; } Point; typedef struct Size { float h; float w; } Size; typedef struct Rect { Point o; Size s; } Rect; int doit(int o, char* s, Point p, Rect r, int last) { printf("CALLED WITH %d %s {%f %f} {{%f %f} {%f %f}} %d\n", o, s, p.x, p.y, r.o.x, r.o.y, r.s.h, r.s.w, last); return 42; } int main(void) { ffi_type point_type; ffi_type size_type; ffi_type rect_type; ffi_cif cif; ffi_type* arglist[6]; void* values[6]; int r; /* * First set up FFI types for the 3 struct types */ point_type.size = 0; /*sizeof(Point);*/ point_type.alignment = 0; /*__alignof__(Point);*/ point_type.type = FFI_TYPE_STRUCT; point_type.elements = malloc(3 * sizeof(ffi_type*)); point_type.elements[0] = &ffi_type_float; point_type.elements[1] = &ffi_type_float; point_type.elements[2] = NULL; size_type.size = 0;/* sizeof(Size);*/ size_type.alignment = 0;/* __alignof__(Size);*/ size_type.type = FFI_TYPE_STRUCT; size_type.elements = malloc(3 * sizeof(ffi_type*)); size_type.elements[0] = &ffi_type_float; size_type.elements[1] = &ffi_type_float; size_type.elements[2] = NULL; rect_type.size = 0;/*sizeof(Rect);*/ rect_type.alignment =0;/* __alignof__(Rect);*/ rect_type.type = FFI_TYPE_STRUCT; rect_type.elements = malloc(3 * sizeof(ffi_type*)); rect_type.elements[0] = &point_type; rect_type.elements[1] = &size_type; rect_type.elements[2] = NULL; /* * Create a CIF */ arglist[0] = &ffi_type_sint; arglist[1] = &ffi_type_pointer; arglist[2] = &point_type; arglist[3] = &rect_type; arglist[4] = &ffi_type_sint; arglist[5] = NULL; r = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 5, &ffi_type_sint, arglist); if (r != FFI_OK) { abort(); } /* And call the function through the CIF */ { Point p = { 1.0, 2.0 }; Rect r = { { 9.0, 10.0}, { -1.0, -2.0 } }; int o = 0; int l = 42; char* m = "myMethod"; ffi_arg result; values[0] = &o; values[1] = &m; values[2] = &p; values[3] = &r; values[4] = &l; values[5] = NULL; printf("CALLING WITH %d %s {%f %f} {{%f %f} {%f %f}} %d\n", o, m, p.x, p.y, r.o.x, r.o.y, r.s.h, r.s.w, l); ffi_call(&cif, FFI_FN(doit), &result, values); printf ("The result is %d\n", (int)result); } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_dbl.c0000644000175000017500000000132711545150464025541 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value double. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static double return_dbl(double dbl) { return 2 * dbl; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; double dbl, rdbl; args[0] = &ffi_type_double; values[0] = &dbl; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_double, args) == FFI_OK); for (dbl = -127.3; dbl < 127; dbl++) { ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); printf ("%f vs %f\n", rdbl, return_dbl(dbl)); CHECK(rdbl == 2 * dbl); } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_dbl1.c0000644000175000017500000000175411545150464025626 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value double. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static double return_dbl(double dbl1, float fl2, unsigned int in3, double dbl4) { return dbl1 + fl2 + in3 + dbl4; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; double dbl1, dbl4, rdbl; float fl2; unsigned int in3; args[0] = &ffi_type_double; args[1] = &ffi_type_float; args[2] = &ffi_type_uint; args[3] = &ffi_type_double; values[0] = &dbl1; values[1] = &fl2; values[2] = &in3; values[3] = &dbl4; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_double, args) == FFI_OK); dbl1 = 127.0; fl2 = 128.0; in3 = 255; dbl4 = 512.7; ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); printf ("%f vs %f\n", rdbl, return_dbl(dbl1, fl2, in3, dbl4)); CHECK(rdbl == dbl1 + fl2 + in3 + dbl4); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_dbl2.c0000644000175000017500000000175511545150464025630 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value double. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static double return_dbl(double dbl1, double dbl2, unsigned int in3, double dbl4) { return dbl1 + dbl2 + in3 + dbl4; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; double dbl1, dbl2, dbl4, rdbl; unsigned int in3; args[0] = &ffi_type_double; args[1] = &ffi_type_double; args[2] = &ffi_type_uint; args[3] = &ffi_type_double; values[0] = &dbl1; values[1] = &dbl2; values[2] = &in3; values[3] = &dbl4; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_double, args) == FFI_OK); dbl1 = 127.0; dbl2 = 128.0; in3 = 255; dbl4 = 512.7; ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); printf ("%f vs %f\n", rdbl, return_dbl(dbl1, dbl2, in3, dbl4)); CHECK(rdbl == dbl1 + dbl2 + in3 + dbl4); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_fl.c0000644000175000017500000000130211545150464025372 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value float. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static float return_fl(float fl) { return 2 * fl; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float fl, rfl; args[0] = &ffi_type_float; values[0] = &fl; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_float, args) == FFI_OK); for (fl = -127.0; fl < 127; fl++) { ffi_call(&cif, FFI_FN(return_fl), &rfl, values); printf ("%f vs %f\n", rfl, return_fl(fl)); CHECK(rfl == 2 * fl); } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_fl1.c0000644000175000017500000000136311545150464025462 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value float. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static float return_fl(float fl1, float fl2) { return fl1 + fl2; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float fl1, fl2, rfl; args[0] = &ffi_type_float; args[1] = &ffi_type_float; values[0] = &fl1; values[1] = &fl2; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_float, args) == FFI_OK); fl1 = 127.0; fl2 = 128.0; ffi_call(&cif, FFI_FN(return_fl), &rfl, values); printf ("%f vs %f\n", rfl, return_fl(fl1, fl2)); CHECK(rfl == fl1 + fl2); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_fl2.c0000644000175000017500000000211311545150464025455 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value float. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" /* Use volatile float to avoid false negative on ix86. See PR target/323. */ static float return_fl(float fl1, float fl2, float fl3, float fl4) { volatile float sum; sum = fl1 + fl2 + fl3 + fl4; return sum; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float fl1, fl2, fl3, fl4, rfl; volatile float sum; args[0] = &ffi_type_float; args[1] = &ffi_type_float; args[2] = &ffi_type_float; args[3] = &ffi_type_float; values[0] = &fl1; values[1] = &fl2; values[2] = &fl3; values[3] = &fl4; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_float, args) == FFI_OK); fl1 = 127.0; fl2 = 128.0; fl3 = 255.1; fl4 = 512.7; ffi_call(&cif, FFI_FN(return_fl), &rfl, values); printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, fl3, fl4)); sum = fl1 + fl2 + fl3 + fl4; CHECK(rfl == sum); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_fl3.c0000644000175000017500000000170711545150464025466 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value float. Limitations: none. PR: none. Originator: 20050212 */ /* { dg-do run } */ #include "ffitest.h" static float return_fl(float fl1, float fl2, unsigned int in3, float fl4) { return fl1 + fl2 + in3 + fl4; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; float fl1, fl2, fl4, rfl; unsigned int in3; args[0] = &ffi_type_float; args[1] = &ffi_type_float; args[2] = &ffi_type_uint; args[3] = &ffi_type_float; values[0] = &fl1; values[1] = &fl2; values[2] = &in3; values[3] = &fl4; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &ffi_type_float, args) == FFI_OK); fl1 = 127.0; fl2 = 128.0; in3 = 255; fl4 = 512.7; ffi_call(&cif, FFI_FN(return_fl), &rfl, values); printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, in3, fl4)); CHECK(rfl == fl1 + fl2 + in3 + fl4); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_ldl.c0000644000175000017500000000135311545150464025552 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value long double. Limitations: none. PR: none. Originator: 20071113 */ /* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ #include "ffitest.h" static long double return_ldl(long double ldl) { return 2*ldl; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; long double ldl, rldl; args[0] = &ffi_type_longdouble; values[0] = &ldl; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_longdouble, args) == FFI_OK); for (ldl = -127.0; ldl < 127.0; ldl++) { ffi_call(&cif, FFI_FN(return_ldl), &rldl, values); CHECK(rldl == 2 * ldl); } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_ll.c0000644000175000017500000000152511545150464025407 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value long long. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static long long return_ll(long long ll) { return ll; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; long long rlonglong; long long ll; args[0] = &ffi_type_sint64; values[0] = ≪ /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sint64, args) == FFI_OK); for (ll = 0LL; ll < 100LL; ll++) { ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); CHECK(rlonglong == ll); } for (ll = 55555555555000LL; ll < 55555555555100LL; ll++) { ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); CHECK(rlonglong == ll); } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_ll1.c0000644000175000017500000000204111545150464025462 0ustar chr1schr1s/* Area: ffi_call Purpose: Check if long long are passed in the corresponding regs on ppc. Limitations: none. PR: 20104. Originator: 20050222 */ /* { dg-do run } */ /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ #include "ffitest.h" static long long return_ll(int ll0, long long ll1, int ll2) { return ll0 + ll1 + ll2; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; long long rlonglong; long long ll1; unsigned ll0, ll2; args[0] = &ffi_type_sint; args[1] = &ffi_type_sint64; args[2] = &ffi_type_sint; values[0] = &ll0; values[1] = &ll1; values[2] = &ll2; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_sint64, args) == FFI_OK); ll0 = 11111111; ll1 = 11111111111000LL; ll2 = 11111111; ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); printf("res: %" PRIdLL ", %" PRIdLL "\n", rlonglong, ll0 + ll1 + ll2); /* { dg-output "res: 11111133333222, 11111133333222" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_sc.c0000644000175000017500000000132311545150464025401 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value signed char. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static signed char return_sc(signed char sc) { return sc; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; signed char sc; args[0] = &ffi_type_schar; values[0] = ≻ /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_schar, args) == FFI_OK); for (sc = (signed char) -127; sc < (signed char) 127; sc++) { ffi_call(&cif, FFI_FN(return_sc), &rint, values); CHECK(rint == (ffi_arg) sc); } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_sl.c0000644000175000017500000000133311545150464025413 0ustar chr1schr1s/* Area: ffi_call Purpose: Check if long as return type is handled correctly. Limitations: none. PR: none. */ /* { dg-do run } */ #include "ffitest.h" static long return_sl(long l1, long l2) { return l1 - l2; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg res; unsigned long l1, l2; args[0] = &ffi_type_slong; args[1] = &ffi_type_slong; values[0] = &l1; values[1] = &l2; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_slong, args) == FFI_OK); l1 = 1073741823L; l2 = 1073741824L; ffi_call(&cif, FFI_FN(return_sl), &res, values); printf("res: %ld, %ld\n", (long)res, l1 - l2); /* { dg-output "res: -1, -1" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_uc.c0000644000175000017500000000135111545150464025404 0ustar chr1schr1s/* Area: ffi_call Purpose: Check return value unsigned char. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static unsigned char return_uc(unsigned char uc) { return uc; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; unsigned char uc; args[0] = &ffi_type_uchar; values[0] = &uc; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uchar, args) == FFI_OK); for (uc = (unsigned char) '\x00'; uc < (unsigned char) '\xff'; uc++) { ffi_call(&cif, FFI_FN(return_uc), &rint, values); CHECK(rint == (signed int) uc); } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/return_ul.c0000644000175000017500000000153011545150464025414 0ustar chr1schr1s/* Area: ffi_call Purpose: Check if unsigned long as return type is handled correctly. Limitations: none. PR: none. Originator: 20060724 */ /* { dg-do run } */ #include "ffitest.h" static unsigned long return_ul(unsigned long ul1, unsigned long ul2) { return ul1 + ul2; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg res; unsigned long ul1, ul2; args[0] = &ffi_type_ulong; args[1] = &ffi_type_ulong; values[0] = &ul1; values[1] = &ul2; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_ulong, args) == FFI_OK); ul1 = 1073741823L; ul2 = 1073741824L; ffi_call(&cif, FFI_FN(return_ul), &res, values); printf("res: %lu, %lu\n", (unsigned long)res, ul1 + ul2); /* { dg-output "res: 2147483647, 2147483647" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/stret_large.c0000644000175000017500000001113411545150464025711 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure returning with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: Blake Chaffin 6/21/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" // 13 FPRs: 104 bytes // 14 FPRs: 112 bytes typedef struct struct_108byte { double a; double b; double c; double d; double e; double f; double g; double h; double i; double j; double k; double l; double m; int n; } struct_108byte; struct_108byte cls_struct_108byte_fn( struct_108byte b0, struct_108byte b1, struct_108byte b2, struct_108byte b3) { struct_108byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; result.i = b0.i + b1.i + b2.i + b3.i; result.j = b0.j + b1.j + b2.j + b3.j; result.k = b0.k + b1.k + b2.k + b3.k; result.l = b0.l + b1.l + b2.l + b3.l; result.m = b0.m + b1.m + b2.m + b3.m; result.n = b0.n + b1.n + b2.n + b3.n; printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h, result.i, result.j, result.k, result.l, result.m, result.n); return result; } static void cls_struct_108byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct_108byte b0, b1, b2, b3; b0 = *(struct_108byte*)(args[0]); b1 = *(struct_108byte*)(args[1]); b2 = *(struct_108byte*)(args[2]); b3 = *(struct_108byte*)(args[3]); *(struct_108byte*)resp = cls_struct_108byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[15]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct_108byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 7 }; struct_108byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 4 }; struct_108byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 3 }; struct_108byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 2 }; struct_108byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = &ffi_type_double; cls_struct_fields[9] = &ffi_type_double; cls_struct_fields[10] = &ffi_type_double; cls_struct_fields[11] = &ffi_type_double; cls_struct_fields[12] = &ffi_type_double; cls_struct_fields[13] = &ffi_type_sint32; cls_struct_fields[14] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_108byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_108byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_108byte(*)(struct_108byte, struct_108byte, struct_108byte, struct_108byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/stret_large2.c0000644000175000017500000001140211545150464025771 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure returning with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: Blake Chaffin 6/21/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" // 13 FPRs: 104 bytes // 14 FPRs: 112 bytes typedef struct struct_116byte { double a; double b; double c; double d; double e; double f; double g; double h; double i; double j; double k; double l; double m; double n; int o; } struct_116byte; struct_116byte cls_struct_116byte_fn( struct_116byte b0, struct_116byte b1, struct_116byte b2, struct_116byte b3) { struct_116byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; result.i = b0.i + b1.i + b2.i + b3.i; result.j = b0.j + b1.j + b2.j + b3.j; result.k = b0.k + b1.k + b2.k + b3.k; result.l = b0.l + b1.l + b2.l + b3.l; result.m = b0.m + b1.m + b2.m + b3.m; result.n = b0.n + b1.n + b2.n + b3.n; result.o = b0.o + b1.o + b2.o + b3.o; printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h, result.i, result.j, result.k, result.l, result.m, result.n, result.o); return result; } static void cls_struct_116byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct_116byte b0, b1, b2, b3; b0 = *(struct_116byte*)(args[0]); b1 = *(struct_116byte*)(args[1]); b2 = *(struct_116byte*)(args[2]); b3 = *(struct_116byte*)(args[3]); *(struct_116byte*)resp = cls_struct_116byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[16]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct_116byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 7 }; struct_116byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 6.0, 4 }; struct_116byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 7.0, 3 }; struct_116byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 8.0, 2 }; struct_116byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = &ffi_type_double; cls_struct_fields[9] = &ffi_type_double; cls_struct_fields[10] = &ffi_type_double; cls_struct_fields[11] = &ffi_type_double; cls_struct_fields[12] = &ffi_type_double; cls_struct_fields[13] = &ffi_type_double; cls_struct_fields[14] = &ffi_type_sint32; cls_struct_fields[15] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_116byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_116byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_116byte(*)(struct_116byte, struct_116byte, struct_116byte, struct_116byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/stret_medium.c0000644000175000017500000000733511545150464026107 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure returning with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: Blake Chaffin 6/21/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ #include "ffitest.h" typedef struct struct_72byte { double a; double b; double c; double d; double e; double f; double g; double h; double i; } struct_72byte; struct_72byte cls_struct_72byte_fn( struct_72byte b0, struct_72byte b1, struct_72byte b2, struct_72byte b3) { struct_72byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; result.i = b0.i + b1.i + b2.i + b3.i; printf("%g %g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h, result.i); return result; } static void cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct_72byte b0, b1, b2, b3; b0 = *(struct_72byte*)(args[0]); b1 = *(struct_72byte*)(args[1]); b2 = *(struct_72byte*)(args[2]); b3 = *(struct_72byte*)(args[3]); *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[10]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7.0 }; struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0 }; struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3.0 }; struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2.0 }; struct_72byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = &ffi_type_double; cls_struct_fields[9] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18 16" } */ printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/stret_medium2.c0000644000175000017500000000746111545150464026171 0ustar chr1schr1s/* Area: ffi_call, closure_call Purpose: Check structure returning with different structure size. Depending on the ABI. Check bigger struct which overlaps the gp and fp register count on Darwin/AIX/ppc64. Limitations: none. PR: none. Originator: Blake Chaffin 6/21/2007 */ /* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ #include "ffitest.h" typedef struct struct_72byte { double a; double b; double c; double d; double e; double f; double g; double h; long long i; } struct_72byte; struct_72byte cls_struct_72byte_fn( struct_72byte b0, struct_72byte b1, struct_72byte b2, struct_72byte b3) { struct_72byte result; result.a = b0.a + b1.a + b2.a + b3.a; result.b = b0.b + b1.b + b2.b + b3.b; result.c = b0.c + b1.c + b2.c + b3.c; result.d = b0.d + b1.d + b2.d + b3.d; result.e = b0.e + b1.e + b2.e + b3.e; result.f = b0.f + b1.f + b2.f + b3.f; result.g = b0.g + b1.g + b2.g + b3.g; result.h = b0.h + b1.h + b2.h + b3.h; result.i = b0.i + b1.i + b2.i + b3.i; printf("%g %g %g %g %g %g %g %g %" PRIdLL "\n", result.a, result.b, result.c, result.d, result.e, result.f, result.g, result.h, result.i); return result; } static void cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { struct_72byte b0, b1, b2, b3; b0 = *(struct_72byte*)(args[0]); b1 = *(struct_72byte*)(args[1]); b2 = *(struct_72byte*)(args[2]); b3 = *(struct_72byte*)(args[3]); *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); void* args_dbl[5]; ffi_type* cls_struct_fields[10]; ffi_type cls_struct_type; ffi_type* dbl_arg_types[5]; cls_struct_type.size = 0; cls_struct_type.alignment = 0; cls_struct_type.type = FFI_TYPE_STRUCT; cls_struct_type.elements = cls_struct_fields; struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7 }; struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4 }; struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3 }; struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2 }; struct_72byte res_dbl; cls_struct_fields[0] = &ffi_type_double; cls_struct_fields[1] = &ffi_type_double; cls_struct_fields[2] = &ffi_type_double; cls_struct_fields[3] = &ffi_type_double; cls_struct_fields[4] = &ffi_type_double; cls_struct_fields[5] = &ffi_type_double; cls_struct_fields[6] = &ffi_type_double; cls_struct_fields[7] = &ffi_type_double; cls_struct_fields[8] = &ffi_type_sint64; cls_struct_fields[9] = NULL; dbl_arg_types[0] = &cls_struct_type; dbl_arg_types[1] = &cls_struct_type; dbl_arg_types[2] = &cls_struct_type; dbl_arg_types[3] = &cls_struct_type; dbl_arg_types[4] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, dbl_arg_types) == FFI_OK); args_dbl[0] = &e_dbl; args_dbl[1] = &f_dbl; args_dbl[2] = &g_dbl; args_dbl[3] = &h_dbl; args_dbl[4] = NULL; ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); /* { dg-output "22 15 17 25 6 13 19 18 16" } */ printf("res: %g %g %g %g %g %g %g %g %" PRIdLL "\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK); res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ printf("res: %g %g %g %g %g %g %g %g %" PRIdLL "\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/strlen.c0000644000175000017500000000151411545150464024706 0ustar chr1schr1s/* Area: ffi_call Purpose: Check strlen function call. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" static size_t my_strlen(char *s) { return (strlen(s)); } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; char *s; args[0] = &ffi_type_pointer; values[0] = (void*) &s; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_sint, args) == FFI_OK); s = "a"; ffi_call(&cif, FFI_FN(my_strlen), &rint, values); CHECK(rint == 1); s = "1234567"; ffi_call(&cif, FFI_FN(my_strlen), &rint, values); CHECK(rint == 7); s = "1234567890123456789012345"; ffi_call(&cif, FFI_FN(my_strlen), &rint, values); CHECK(rint == 25); exit (0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/strlen_win32.c0000644000175000017500000000174511545150464025736 0ustar chr1schr1s/* Area: ffi_call Purpose: Check stdcall strlen call on X86_WIN32 systems. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ #include "ffitest.h" static size_t __attribute__((stdcall)) my_stdcall_strlen(char *s) { return (strlen(s)); } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; char *s; args[0] = &ffi_type_pointer; values[0] = (void*) &s; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 1, &ffi_type_sint, args) == FFI_OK); s = "a"; ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); CHECK(rint == 1); s = "1234567"; ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); CHECK(rint == 7); s = "1234567890123456789012345"; ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); CHECK(rint == 25); printf("stdcall strlen tests passed\n"); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/struct1.c0000644000175000017500000000254011545150464025004 0ustar chr1schr1s/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { unsigned char uc; double d; unsigned int ui; } test_structure_1; static test_structure_1 struct1(test_structure_1 ts) { ts.uc++; ts.d--; ts.ui++; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts1_type; ffi_type *ts1_type_elements[4]; ts1_type.size = 0; ts1_type.alignment = 0; ts1_type.type = FFI_TYPE_STRUCT; ts1_type.elements = ts1_type_elements; ts1_type_elements[0] = &ffi_type_uchar; ts1_type_elements[1] = &ffi_type_double; ts1_type_elements[2] = &ffi_type_uint; ts1_type_elements[3] = NULL; test_structure_1 ts1_arg; /* This is a hack to get a properly aligned result buffer */ test_structure_1 *ts1_result = (test_structure_1 *) malloc (sizeof(test_structure_1)); args[0] = &ts1_type; values[0] = &ts1_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts1_type, args) == FFI_OK); ts1_arg.uc = '\x01'; ts1_arg.d = 3.14159; ts1_arg.ui = 555; ffi_call(&cif, FFI_FN(struct1), ts1_result, values); CHECK(ts1_result->ui == 556); CHECK(ts1_result->d == 3.14159 - 1); free (ts1_result); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/struct2.c0000644000175000017500000000260611545150464025010 0ustar chr1schr1s/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { double d1; double d2; } test_structure_2; static test_structure_2 struct2(test_structure_2 ts) { ts.d1--; ts.d2--; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; test_structure_2 ts2_arg; ffi_type ts2_type; ffi_type *ts2_type_elements[3]; ts2_type.size = 0; ts2_type.alignment = 0; ts2_type.type = FFI_TYPE_STRUCT; ts2_type.elements = ts2_type_elements; ts2_type_elements[0] = &ffi_type_double; ts2_type_elements[1] = &ffi_type_double; ts2_type_elements[2] = NULL; /* This is a hack to get a properly aligned result buffer */ test_structure_2 *ts2_result = (test_structure_2 *) malloc (sizeof(test_structure_2)); args[0] = &ts2_type; values[0] = &ts2_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts2_type, args) == FFI_OK); ts2_arg.d1 = 5.55; ts2_arg.d2 = 6.66; printf ("%g\n", ts2_arg.d1); printf ("%g\n", ts2_arg.d2); ffi_call(&cif, FFI_FN(struct2), ts2_result, values); printf ("%g\n", ts2_result->d1); printf ("%g\n", ts2_result->d2); CHECK(ts2_result->d1 == 5.55 - 1); CHECK(ts2_result->d2 == 6.66 - 1); free (ts2_result); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/struct3.c0000644000175000017500000000230411545150464025004 0ustar chr1schr1s/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { int si; } test_structure_3; static test_structure_3 struct3(test_structure_3 ts) { ts.si = -(ts.si*2); return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; int compare_value; ffi_type ts3_type; ffi_type *ts3_type_elements[2]; ts3_type.size = 0; ts3_type.alignment = 0; ts3_type.type = FFI_TYPE_STRUCT; ts3_type.elements = ts3_type_elements; ts3_type_elements[0] = &ffi_type_sint; ts3_type_elements[1] = NULL; test_structure_3 ts3_arg; test_structure_3 *ts3_result = (test_structure_3 *) malloc (sizeof(test_structure_3)); args[0] = &ts3_type; values[0] = &ts3_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts3_type, args) == FFI_OK); ts3_arg.si = -123; compare_value = ts3_arg.si; ffi_call(&cif, FFI_FN(struct3), ts3_result, values); printf ("%d %d\n", ts3_result->si, -(compare_value*2)); CHECK(ts3_result->si == -(compare_value*2)); free (ts3_result); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/struct4.c0000644000175000017500000000247211545150464025013 0ustar chr1schr1s/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { unsigned ui1; unsigned ui2; unsigned ui3; } test_structure_4; static test_structure_4 struct4(test_structure_4 ts) { ts.ui3 = ts.ui1 * ts.ui2 * ts.ui3; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts4_type; ffi_type *ts4_type_elements[4]; ts4_type.size = 0; ts4_type.alignment = 0; ts4_type.type = FFI_TYPE_STRUCT; test_structure_4 ts4_arg; ts4_type.elements = ts4_type_elements; ts4_type_elements[0] = &ffi_type_uint; ts4_type_elements[1] = &ffi_type_uint; ts4_type_elements[2] = &ffi_type_uint; ts4_type_elements[3] = NULL; /* This is a hack to get a properly aligned result buffer */ test_structure_4 *ts4_result = (test_structure_4 *) malloc (sizeof(test_structure_4)); args[0] = &ts4_type; values[0] = &ts4_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts4_type, args) == FFI_OK); ts4_arg.ui1 = 2; ts4_arg.ui2 = 3; ts4_arg.ui3 = 4; ffi_call (&cif, FFI_FN(struct4), ts4_result, values); CHECK(ts4_result->ui3 == 2U * 3U * 4U); free (ts4_result); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/struct5.c0000644000175000017500000000256611545150464025020 0ustar chr1schr1s/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { char c1; char c2; } test_structure_5; static test_structure_5 struct5(test_structure_5 ts1, test_structure_5 ts2) { ts1.c1 += ts2.c1; ts1.c2 -= ts2.c2; return ts1; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts5_type; ffi_type *ts5_type_elements[3]; ts5_type.size = 0; ts5_type.alignment = 0; ts5_type.type = FFI_TYPE_STRUCT; ts5_type.elements = ts5_type_elements; ts5_type_elements[0] = &ffi_type_schar; ts5_type_elements[1] = &ffi_type_schar; ts5_type_elements[2] = NULL; test_structure_5 ts5_arg1, ts5_arg2; /* This is a hack to get a properly aligned result buffer */ test_structure_5 *ts5_result = (test_structure_5 *) malloc (sizeof(test_structure_5)); args[0] = &ts5_type; args[1] = &ts5_type; values[0] = &ts5_arg1; values[1] = &ts5_arg2; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ts5_type, args) == FFI_OK); ts5_arg1.c1 = 2; ts5_arg1.c2 = 6; ts5_arg2.c1 = 5; ts5_arg2.c2 = 3; ffi_call (&cif, FFI_FN(struct5), ts5_result, values); CHECK(ts5_result->c1 == 7); CHECK(ts5_result->c2 == 3); free (ts5_result); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/struct6.c0000644000175000017500000000247211545150464025015 0ustar chr1schr1s/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { float f; double d; } test_structure_6; static test_structure_6 struct6 (test_structure_6 ts) { ts.f += 1; ts.d += 1; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts6_type; ffi_type *ts6_type_elements[3]; ts6_type.size = 0; ts6_type.alignment = 0; ts6_type.type = FFI_TYPE_STRUCT; ts6_type.elements = ts6_type_elements; ts6_type_elements[0] = &ffi_type_float; ts6_type_elements[1] = &ffi_type_double; ts6_type_elements[2] = NULL; test_structure_6 ts6_arg; /* This is a hack to get a properly aligned result buffer */ test_structure_6 *ts6_result = (test_structure_6 *) malloc (sizeof(test_structure_6)); args[0] = &ts6_type; values[0] = &ts6_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts6_type, args) == FFI_OK); ts6_arg.f = 5.55f; ts6_arg.d = 6.66; printf ("%g\n", ts6_arg.f); printf ("%g\n", ts6_arg.d); ffi_call(&cif, FFI_FN(struct6), ts6_result, values); CHECK(ts6_result->f == 5.55f + 1); CHECK(ts6_result->d == 6.66 + 1); free (ts6_result); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/struct7.c0000644000175000017500000000310511545150464025010 0ustar chr1schr1s/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { float f1; float f2; double d; } test_structure_7; static test_structure_7 struct7 (test_structure_7 ts) { ts.f1 += 1; ts.f2 += 1; ts.d += 1; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts7_type; ffi_type *ts7_type_elements[4]; ts7_type.size = 0; ts7_type.alignment = 0; ts7_type.type = FFI_TYPE_STRUCT; ts7_type.elements = ts7_type_elements; ts7_type_elements[0] = &ffi_type_float; ts7_type_elements[1] = &ffi_type_float; ts7_type_elements[2] = &ffi_type_double; ts7_type_elements[3] = NULL; test_structure_7 ts7_arg; /* This is a hack to get a properly aligned result buffer */ test_structure_7 *ts7_result = (test_structure_7 *) malloc (sizeof(test_structure_7)); args[0] = &ts7_type; values[0] = &ts7_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts7_type, args) == FFI_OK); ts7_arg.f1 = 5.55f; ts7_arg.f2 = 55.5f; ts7_arg.d = 6.66; printf ("%g\n", ts7_arg.f1); printf ("%g\n", ts7_arg.f2); printf ("%g\n", ts7_arg.d); ffi_call(&cif, FFI_FN(struct7), ts7_result, values); printf ("%g\n", ts7_result->f1); printf ("%g\n", ts7_result->f2); printf ("%g\n", ts7_result->d); CHECK(ts7_result->f1 == 5.55f + 1); CHECK(ts7_result->f2 == 55.5f + 1); CHECK(ts7_result->d == 6.66 + 1); free (ts7_result); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/struct8.c0000644000175000017500000000342011545150464025011 0ustar chr1schr1s/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { float f1; float f2; float f3; float f4; } test_structure_8; static test_structure_8 struct8 (test_structure_8 ts) { ts.f1 += 1; ts.f2 += 1; ts.f3 += 1; ts.f4 += 1; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts8_type; ffi_type *ts8_type_elements[5]; ts8_type.size = 0; ts8_type.alignment = 0; ts8_type.type = FFI_TYPE_STRUCT; ts8_type.elements = ts8_type_elements; ts8_type_elements[0] = &ffi_type_float; ts8_type_elements[1] = &ffi_type_float; ts8_type_elements[2] = &ffi_type_float; ts8_type_elements[3] = &ffi_type_float; ts8_type_elements[4] = NULL; test_structure_8 ts8_arg; /* This is a hack to get a properly aligned result buffer */ test_structure_8 *ts8_result = (test_structure_8 *) malloc (sizeof(test_structure_8)); args[0] = &ts8_type; values[0] = &ts8_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts8_type, args) == FFI_OK); ts8_arg.f1 = 5.55f; ts8_arg.f2 = 55.5f; ts8_arg.f3 = -5.55f; ts8_arg.f4 = -55.5f; printf ("%g\n", ts8_arg.f1); printf ("%g\n", ts8_arg.f2); printf ("%g\n", ts8_arg.f3); printf ("%g\n", ts8_arg.f4); ffi_call(&cif, FFI_FN(struct8), ts8_result, values); printf ("%g\n", ts8_result->f1); printf ("%g\n", ts8_result->f2); printf ("%g\n", ts8_result->f3); printf ("%g\n", ts8_result->f4); CHECK(ts8_result->f1 == 5.55f + 1); CHECK(ts8_result->f2 == 55.5f + 1); CHECK(ts8_result->f3 == -5.55f + 1); CHECK(ts8_result->f4 == -55.5f + 1); free (ts8_result); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/struct9.c0000644000175000017500000000256211545150464025020 0ustar chr1schr1s/* Area: ffi_call Purpose: Check structures. Limitations: none. PR: none. Originator: From the original ffitest.c */ /* { dg-do run } */ #include "ffitest.h" typedef struct { float f; int i; } test_structure_9; static test_structure_9 struct9 (test_structure_9 ts) { ts.f += 1; ts.i += 1; return ts; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_type ts9_type; ffi_type *ts9_type_elements[3]; ts9_type.size = 0; ts9_type.alignment = 0; ts9_type.type = FFI_TYPE_STRUCT; ts9_type.elements = ts9_type_elements; ts9_type_elements[0] = &ffi_type_float; ts9_type_elements[1] = &ffi_type_sint; ts9_type_elements[2] = NULL; test_structure_9 ts9_arg; /* This is a hack to get a properly aligned result buffer */ test_structure_9 *ts9_result = (test_structure_9 *) malloc (sizeof(test_structure_9)); args[0] = &ts9_type; values[0] = &ts9_arg; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts9_type, args) == FFI_OK); ts9_arg.f = 5.55f; ts9_arg.i = 5; printf ("%g\n", ts9_arg.f); printf ("%d\n", ts9_arg.i); ffi_call(&cif, FFI_FN(struct9), ts9_result, values); printf ("%g\n", ts9_result->f); printf ("%d\n", ts9_result->i); CHECK(ts9_result->f == 5.55f + 1); CHECK(ts9_result->i == 5 + 1); free (ts9_result); exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.call/testclosure.c0000644000175000017500000000317511545150464025760 0ustar chr1schr1s/* Area: closure_call Purpose: Check return value float. Limitations: none. PR: 41908. Originator: 20091102 */ /* { dg-do run } */ #include "ffitest.h" typedef struct cls_struct_combined { float a; float b; float c; float d; } cls_struct_combined; void cls_struct_combined_fn(struct cls_struct_combined arg) { printf("%g %g %g %g\n", arg.a, arg.b, arg.c, arg.d); fflush(stdout); } static void cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, void** args, void* userdata __UNUSED__) { struct cls_struct_combined a0; a0 = *(struct cls_struct_combined*)(args[0]); cls_struct_combined_fn(a0); } int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type* cls_struct_fields0[5]; ffi_type cls_struct_type0; ffi_type* dbl_arg_types[5]; cls_struct_type0.size = 0; cls_struct_type0.alignment = 0; cls_struct_type0.type = FFI_TYPE_STRUCT; cls_struct_type0.elements = cls_struct_fields0; struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0}; cls_struct_fields0[0] = &ffi_type_float; cls_struct_fields0[1] = &ffi_type_float; cls_struct_fields0[2] = &ffi_type_float; cls_struct_fields0[3] = &ffi_type_float; cls_struct_fields0[4] = NULL; dbl_arg_types[0] = &cls_struct_type0; dbl_arg_types[1] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_void, dbl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); ((void(*)(cls_struct_combined)) (code))(g_dbl); /* { dg-output "4 5 1 8" } */ exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.special/ffitestcxx.h0000644000175000017500000000330311545150464026276 0ustar chr1schr1s#include #include #include #include #include "fficonfig.h" #define MAX_ARGS 256 /* Define __UNUSED__ that also other compilers than gcc can run the tests. */ #undef __UNUSED__ #if defined(__GNUC__) #define __UNUSED__ __attribute__((__unused__)) #else #define __UNUSED__ #endif #define CHECK(x) (!(x) ? abort() : (void)0) /* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a file open. */ #ifdef HAVE_MMAP_ANON # undef HAVE_MMAP_DEV_ZERO # include # ifndef MAP_FAILED # define MAP_FAILED -1 # endif # if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) # define MAP_ANONYMOUS MAP_ANON # endif # define USING_MMAP #endif #ifdef HAVE_MMAP_DEV_ZERO # include # ifndef MAP_FAILED # define MAP_FAILED -1 # endif # define USING_MMAP #endif /* MinGW kludge. */ #ifdef _WIN64 #define PRIdLL "I64d" #define PRIuLL "I64u" #else #define PRIdLL "lld" #define PRIuLL "llu" #endif #ifdef USING_MMAP static inline void * allocate_mmap (size_t size) { void *page; #if defined (HAVE_MMAP_DEV_ZERO) static int dev_zero_fd = -1; #endif #ifdef HAVE_MMAP_DEV_ZERO if (dev_zero_fd == -1) { dev_zero_fd = open ("/dev/zero", O_RDONLY); if (dev_zero_fd == -1) { perror ("open /dev/zero: %m"); exit (1); } } #endif #ifdef HAVE_MMAP_ANON page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); #endif #ifdef HAVE_MMAP_DEV_ZERO page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, dev_zero_fd, 0); #endif if (page == (char *) MAP_FAILED) { perror ("virtual memory exhausted"); exit (1); } return page; } #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.special/special.exp0000644000175000017500000000232311545150464026075 0ustar chr1schr1s# Copyright (C) 2003, 2006, 2009 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING3. If not see # . load_lib libffi-dg.exp dg-init libffi-init global srcdir subdir global cxx_options set cxx_options " -shared-libgcc -lstdc++" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os" dg-finish # Local Variables: # tcl-indent-level:4 # End: mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.special/unwindtest.cc0000644000175000017500000000733311545150464026460 0ustar chr1schr1s/* Area: ffi_closure, unwind info Purpose: Check if the unwind information is passed correctly. Limitations: none. PR: none. Originator: Jeff Sturm */ /* { dg-do run } */ #include "ffitestcxx.h" #if defined HAVE_STDINT_H #include #endif #if defined HAVE_INTTYPES_H #include #endif void closure_test_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, void** args __UNUSED__, void* userdata __UNUSED__) { throw 9; } typedef void (*closure_test_type)(); void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) { *(ffi_arg*)resp = (int)*(float *)args[0] +(int)(*(float *)args[1]) + (int)(*(float *)args[2]) + (int)*(float *)args[3] + (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) + (int)*(float *)args[6] + (int)(*(int *)args[7]) + (int)(*(double*)args[8]) + (int)*(int *)args[9] + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + (int)*(int *)args[12] + (int)(*(int *)args[13]) + (int)(*(int *)args[14]) + *(int *)args[15] + (int)(intptr_t)userdata; printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", (int)*(float *)args[0], (int)(*(float *)args[1]), (int)(*(float *)args[2]), (int)*(float *)args[3], (int)(*(signed short *)args[4]), (int)(*(float *)args[5]), (int)*(float *)args[6], (int)(*(int *)args[7]), (int)(*(double *)args[8]), (int)*(int *)args[9], (int)(*(int *)args[10]), (int)(*(float *)args[11]), (int)*(int *)args[12], (int)(*(int *)args[13]), (int)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, (int)*(ffi_arg*)resp); throw (int)*(ffi_arg*)resp; } typedef int (*closure_test_type1)(float, float, float, float, signed short, float, float, int, double, int, int, float, int, int, int, int); int main (void) { ffi_cif cif; void *code; ffi_closure *pcl = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure), &code); ffi_type * cl_arg_types[17]; { cl_arg_types[1] = NULL; CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn, NULL, code) == FFI_OK); try { (*((closure_test_type)(code)))(); } catch (int exception_code) { CHECK(exception_code == 9); } printf("part one OK\n"); /* { dg-output "part one OK" } */ } { cl_arg_types[0] = &ffi_type_float; cl_arg_types[1] = &ffi_type_float; cl_arg_types[2] = &ffi_type_float; cl_arg_types[3] = &ffi_type_float; cl_arg_types[4] = &ffi_type_sshort; cl_arg_types[5] = &ffi_type_float; cl_arg_types[6] = &ffi_type_float; cl_arg_types[7] = &ffi_type_uint; cl_arg_types[8] = &ffi_type_double; cl_arg_types[9] = &ffi_type_uint; cl_arg_types[10] = &ffi_type_uint; cl_arg_types[11] = &ffi_type_float; cl_arg_types[12] = &ffi_type_uint; cl_arg_types[13] = &ffi_type_uint; cl_arg_types[14] = &ffi_type_uint; cl_arg_types[15] = &ffi_type_uint; cl_arg_types[16] = NULL; /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, &ffi_type_sint, cl_arg_types) == FFI_OK); CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1, (void *) 3 /* userdata */, code) == FFI_OK); try { (*((closure_test_type1)code)) (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, 19, 21, 1); /* { dg-output "\n1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ } catch (int exception_code) { CHECK(exception_code == 255); } printf("part two OK\n"); /* { dg-output "\npart two OK" } */ } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc0000644000175000017500000000201611545150464030270 0ustar chr1schr1s/* Area: ffi_call, unwind info Purpose: Check if the unwind information is passed correctly. Limitations: none. PR: none. Originator: Andreas Tobler 20061213 */ /* { dg-do run } */ #include "ffitestcxx.h" static int checking(int a __UNUSED__, short b __UNUSED__, signed char c __UNUSED__) { throw 9; } int main (void) { ffi_cif cif; ffi_type *args[MAX_ARGS]; void *values[MAX_ARGS]; ffi_arg rint; signed int si; signed short ss; signed char sc; args[0] = &ffi_type_sint; values[0] = &si; args[1] = &ffi_type_sshort; values[1] = &ss; args[2] = &ffi_type_schar; values[2] = ≻ /* Initialize the cif */ CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &ffi_type_sint, args) == FFI_OK); si = -6; ss = -12; sc = -1; { try { ffi_call(&cif, FFI_FN(checking), &rint, values); } catch (int exception_code) { CHECK(exception_code == 9); } printf("part one OK\n"); /* { dg-output "part one OK" } */ } exit(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/eif-call-newvar.js0000644000175000017500000000037111545150464025202 0ustar chr1schr1s// |jit-test| mjitalways;debug setDebug(true); function callee() { assertJit(); evalInFrame(1, "var x = 'success'"); } function caller() { assertJit(); callee(); return x; } assertEq(caller(), "success"); assertEq(typeof x, "undefined"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/eif-call-typechange.js0000644000175000017500000000036311545150464026030 0ustar chr1schr1s// |jit-test| mjitalways;debug setDebug(true); function callee() { assertJit(); evalInFrame(1, "x = 'success'"); } function caller() { assertJit(); var x = ({ dana : "zuul" }); callee(); return x; } assertEq(caller(), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/eif-call.js0000644000175000017500000000035111545150464023700 0ustar chr1schr1s// |jit-test| mjitalways;debug setDebug(true); function callee() { assertJit(); evalInFrame(1, "x = 'success'"); } function caller() { assertJit(); var x = "failure"; callee(); return x; } assertEq(caller(), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/eif-getter-newvar.js0000644000175000017500000000037011545150464025560 0ustar chr1schr1s// |jit-test| mjitalways;debug setDebug(true); this.__defineGetter__("someProperty", function () { evalInFrame(1, "var x = 'success'"); }); function caller(obj) { assertJit(); obj.someProperty; return x; } assertEq(caller(this), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/eif-getter-typechange.js0000644000175000017500000000042711545150464026410 0ustar chr1schr1s// |jit-test| mjitalways;debug setDebug(true); this.__defineGetter__("someProperty", function () { evalInFrame(1, "var x = 'success'"); }); function caller(obj) { assertJit(); var x = ({ dana : 'zuul' }); obj.someProperty; return x; } assertEq(caller(this), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/eif-getter.js0000644000175000017500000000041111545150464024254 0ustar chr1schr1s// |jit-test| mjitalways;debug setDebug(true); this.__defineGetter__("someProperty", function () { evalInFrame(1, "x = 'success'"); }); function caller(obj) { assertJit(); var x = "failure"; obj.someProperty; return x; } assertEq(caller(this), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/eif-trap-newvar.js0000644000175000017500000000030511545150464025232 0ustar chr1schr1s// |jit-test| mjitalways;debug setDebug(true); function nop(){} function caller(obj) { assertJit(); return x; } trap(caller, 7, "var x = 'success'; nop()"); assertEq(caller(this), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/eif-trap-typechange.js0000644000175000017500000000054111545150464026061 0ustar chr1schr1s// |jit-test| mjitalways;debug setDebug(true); function nop(){} function caller(obj) { assertJit(); var x = ({ dana : "zuul" }); return x; } // 0 is the pc of "assertJit()", we want the pc of "return x", 2 lines below. var pc = line2pc(caller, pc2line(caller, 0) + 2); trap(caller, pc, "x = 'success'; nop()"); assertEq(caller(this), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/eif-trap.js0000644000175000017500000000032711545150464023736 0ustar chr1schr1s// |jit-test| mjitalways;debug setDebug(true); function nop(){} function caller(obj) { assertJit(); var x = "failure"; return x; } trap(caller, 14, "x = 'success'; nop()"); assertEq(caller(this), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/simple-trap-1.js0000644000175000017500000000025211545150464024617 0ustar chr1schr1s// |jit-test| debug setDebug(true); var x = "failure"; function main() { x = "success"; } /* The JSOP_STOP in a. */ trap(main, 11, ""); main(); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/simple-trap-2.js0000644000175000017500000000033011545150464024615 0ustar chr1schr1s// |jit-test| debug setDebug(true); var x = "notset"; function main() { x = "failure"; } function success() { x = "success"; } /* The JSOP_STOP in a. */ trap(main, 10, "success()"); main(); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/simple-untrap.js0000644000175000017500000000035011545150464025023 0ustar chr1schr1s// |jit-test| debug setDebug(true); var x = "notset"; function main() { x = "success"; } function failure() { x = "failure"; } /* The JSOP_STOP in a. */ trap(main, 8, "failure()"); untrap(main, 8); main(); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/test-debugger-1.js0000644000175000017500000000033311545150464025123 0ustar chr1schr1s// |jit-test| debug var result = "unset"; function main() { result = "failure"; debugger; } function nop() { } setDebuggerHandler("result = 'success'; nop()"); setDebug(true); main(); assertEq(result, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/test-debugger-2.js0000644000175000017500000000023011545150464025120 0ustar chr1schr1s// |jit-test| debug function main() { debugger; return "failure"; } setDebuggerHandler("'success'"); setDebug(true); assertEq(main(), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/test-throwhook-1.js0000644000175000017500000000051711545150464025367 0ustar chr1schr1s// |jit-test| debug var result1 = "unset"; var result2 = "failure"; function main() { result1 = "failure"; try { throw "something"; } catch(e) { result2 = "success"; } } function nop() { } setDebug(true); setThrowHook("result1 = 'success'; nop()"); main(); assertEq(result1, "success"); assertEq(result2, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/test-throwhook-2.js0000644000175000017500000000031411545150464025363 0ustar chr1schr1s// |jit-test| debug function main() { try { throw "something"; } catch(e) { return "failure"; } return "unset"; } setDebug(true); setThrowHook("'success'"); assertEq(main(), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/trap-force-return-1.js0000644000175000017500000000024011545150464025736 0ustar chr1schr1s// |jit-test| debug setDebug(true); function main() { return "failure"; } /* JSOP_RETURN in main. */ trap(main, 3, "'success'"); assertEq(main(), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/trap-force-return-2.js0000644000175000017500000000021011545150464025734 0ustar chr1schr1s// |jit-test| debug setDebug(true); function main() { return 1; } /* JSOP_RETURN in main. */ trap(main, 1, "0"); assertEq(main(), 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/trap-from-add-inline.js0000644000175000017500000000040511545150464026135 0ustar chr1schr1s// |jit-test| debug setDebug(true); x = "notset"; function main() { /* The JSOP_STOP in a. */ a = { valueOf: function () { trap(main, 36, "success()"); } }; a + ""; x = "failure"; } function success() { x = "success"; } main(); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/trap-from-add-ool.js0000644000175000017500000000043011545150464025446 0ustar chr1schr1s// |jit-test| debug setDebug(true); x = "notset"; function main() { /* The JSOP_STOP in a. */ a = { valueOf: function () { trap(main, 57, "success()"); } }; b = ""; eval(); a + b; x = "failure"; } function success() { x = "success"; } main(); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/trap-own-callsite.js0000644000175000017500000000046311545150464025575 0ustar chr1schr1s// |jit-test| debug setDebug(true); x = "notset"; function myparent(nested) { if (nested) { /* myparent call in myparent. */ trap(myparent, 39, "failure()"); } else { x = "success"; myparent(true); } } function failure() { x = "failure"; } myparent(false); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/trap-parent-from-trap.js0000644000175000017500000000050311545150464026365 0ustar chr1schr1s// |jit-test| debug setDebug(true); x = "notset"; function child() { x = "failure1"; /* JSOP_STOP in parent. */ trap(parent, 10, "success()"); } function parent() { x = "failure2"; } /* First op in parent. */ trap(parent, 0, "child()"); function success() { x = "success"; } parent(); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/trap-parent.js0000644000175000017500000000040111545150464024455 0ustar chr1schr1s// |jit-test| debug setDebug(true); x = "notset"; function child() { /* JSOP_STOP in parent. */ trap(parent, 17, "success()"); } function parent() { child(); x = "failure"; } function success() { x = "success"; } parent() assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/trap-self-as-parent.js0000644000175000017500000000050711545150464026014 0ustar chr1schr1s// |jit-test| debug setDebug(true); x = "notset"; function myparent(nested) { if (nested) { /* noop call in myparent */ trap(myparent, 50, "success()"); } else { myparent(true); x = "failure"; noop(); } } function noop() { } function success() { x = "success"; } myparent(); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/trap-self-from-trap.js0000644000175000017500000000071111545150464026026 0ustar chr1schr1s// |jit-test| debug setDebug(true); x = "notset"; function doNothing() { } function myparent(nested) { if (nested) { /* JSOP_CALL to doNothing in myparent with nested = true. */ trap(myparent, 24, "success()"); doNothing(); } else { doNothing(); } } /* JSOP_CALL to doNothing in myparent with nested = false. */ trap(myparent, 35, "myparent(true)"); function success() { x = "success"; } myparent(false); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/trap-self.js0000644000175000017500000000033111545150464024117 0ustar chr1schr1s// |jit-test| debug setDebug(true); x = "notset"; function main() { /* The JSOP_STOP in a. */ trap(main, 25, "success()"); x = "failure"; } function success() { x = "success"; } main(); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/untrap-cross-global.js0000644000175000017500000000014611545150464026124 0ustar chr1schr1s// |jit-test| debug var otherGlobal = newGlobal('new-compartment'); var f = otherGlobal.untrap; f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/untrap-own-trapsite.js0000644000175000017500000000041311545150464026166 0ustar chr1schr1s// |jit-test| debug setDebug(true); x = "notset"; function child() { /* JSOP_STOP in parent */ untrap(parent, 10); x = "success"; } function parent() { x = "failure"; } /* JSOP_STOP in parent */ trap(parent, 10, "child()"); parent(); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug563000/untrap-self.js0000644000175000017500000000040311545150464024462 0ustar chr1schr1s// |jit-test| debug setDebug(true); x = "notset"; function main() { /* JSOP_STOP in main. */ untrap(main, 23); x = "success"; } function failure() { x = "failure"; } /* JSOP_STOP in main. */ trap(main, 23, "failure()"); main(); assertEq(x, "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/closures.c0000644000175000017500000004010611545150464021627 0ustar chr1schr1s/* ----------------------------------------------------------------------- closures.c - Copyright (c) 2007 Red Hat, Inc. Copyright (C) 2007, 2009 Free Software Foundation, Inc Code to allocate and deallocate memory for closures. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #if defined __linux__ && !defined _GNU_SOURCE #define _GNU_SOURCE 1 #endif #include #include #ifndef FFI_MMAP_EXEC_WRIT # if __gnu_linux__ /* This macro indicates it may be forbidden to map anonymous memory with both write and execute permission. Code compiled when this option is defined will attempt to map such pages once, but if it fails, it falls back to creating a temporary file in a writable and executable filesystem and mapping pages from it into separate locations in the virtual memory space, one location writable and another executable. */ # define FFI_MMAP_EXEC_WRIT 1 # define HAVE_MNTENT 1 # endif # if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__) /* Windows systems may have Data Execution Protection (DEP) enabled, which requires the use of VirtualMalloc/VirtualFree to alloc/free executable memory. */ # define FFI_MMAP_EXEC_WRIT 1 # endif #endif #if FFI_MMAP_EXEC_WRIT && !defined FFI_MMAP_EXEC_SELINUX # ifdef __linux__ /* When defined to 1 check for SELinux and if SELinux is active, don't attempt PROT_EXEC|PROT_WRITE mapping at all, as that might cause audit messages. */ # define FFI_MMAP_EXEC_SELINUX 1 # endif #endif #if FFI_CLOSURES # if FFI_MMAP_EXEC_WRIT #define USE_LOCKS 1 #define USE_DL_PREFIX 1 #ifdef __GNUC__ #ifndef USE_BUILTIN_FFS #define USE_BUILTIN_FFS 1 #endif #endif /* We need to use mmap, not sbrk. */ #define HAVE_MORECORE 0 /* We could, in theory, support mremap, but it wouldn't buy us anything. */ #define HAVE_MREMAP 0 /* We have no use for this, so save some code and data. */ #define NO_MALLINFO 1 /* We need all allocations to be in regular segments, otherwise we lose track of the corresponding code address. */ #define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T /* Don't allocate more than a page unless needed. */ #define DEFAULT_GRANULARITY ((size_t)malloc_getpagesize) #if FFI_CLOSURE_TEST /* Don't release single pages, to avoid a worst-case scenario of continuously allocating and releasing single pages, but release pairs of pages, which should do just as well given that allocations are likely to be small. */ #define DEFAULT_TRIM_THRESHOLD ((size_t)malloc_getpagesize) #endif #include #include #include #include #ifndef _MSC_VER #include #endif #include #include #if !defined(X86_WIN32) && !defined(X86_WIN64) #ifdef HAVE_MNTENT #include #endif /* HAVE_MNTENT */ #include #include /* We don't want sys/mman.h to be included after we redefine mmap and dlmunmap. */ #include #define LACKS_SYS_MMAN_H 1 #if FFI_MMAP_EXEC_SELINUX #include #include static int selinux_enabled = -1; static int selinux_enabled_check (void) { struct statfs sfs; FILE *f; char *buf = NULL; size_t len = 0; if (statfs ("/selinux", &sfs) >= 0 && (unsigned int) sfs.f_type == 0xf97cff8cU) return 1; f = fopen ("/proc/mounts", "r"); if (f == NULL) return 0; while (getline (&buf, &len, f) >= 0) { char *p = strchr (buf, ' '); if (p == NULL) break; p = strchr (p + 1, ' '); if (p == NULL) break; if (strncmp (p + 1, "selinuxfs ", 10) == 0) { free (buf); fclose (f); return 1; } } free (buf); fclose (f); return 0; } #define is_selinux_enabled() (selinux_enabled >= 0 ? selinux_enabled \ : (selinux_enabled = selinux_enabled_check ())) #else #define is_selinux_enabled() 0 #endif /* !FFI_MMAP_EXEC_SELINUX */ #elif defined (__CYGWIN__) #include /* Cygwin is Linux-like, but not quite that Linux-like. */ #define is_selinux_enabled() 0 #endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ /* Declare all functions defined in dlmalloc.c as static. */ static void *dlmalloc(size_t); static void dlfree(void*); static void *dlcalloc(size_t, size_t) MAYBE_UNUSED; static void *dlrealloc(void *, size_t) MAYBE_UNUSED; static void *dlmemalign(size_t, size_t) MAYBE_UNUSED; static void *dlvalloc(size_t) MAYBE_UNUSED; static int dlmallopt(int, int) MAYBE_UNUSED; static size_t dlmalloc_footprint(void) MAYBE_UNUSED; static size_t dlmalloc_max_footprint(void) MAYBE_UNUSED; static void** dlindependent_calloc(size_t, size_t, void**) MAYBE_UNUSED; static void** dlindependent_comalloc(size_t, size_t*, void**) MAYBE_UNUSED; static void *dlpvalloc(size_t) MAYBE_UNUSED; static int dlmalloc_trim(size_t) MAYBE_UNUSED; static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED; static void dlmalloc_stats(void) MAYBE_UNUSED; #if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) /* Use these for mmap and munmap within dlmalloc.c. */ static void *dlmmap(void *, size_t, int, int, int, off_t); static int dlmunmap(void *, size_t); #endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) */ #define mmap dlmmap #define munmap dlmunmap #include "dlmalloc.c" #undef mmap #undef munmap #if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) /* A mutex used to synchronize access to *exec* variables in this file. */ static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER; /* A file descriptor of a temporary file from which we'll map executable pages. */ static int execfd = -1; /* The amount of space already allocated from the temporary file. */ static size_t execsize = 0; /* Open a temporary file name, and immediately unlink it. */ static int open_temp_exec_file_name (char *name) { int fd = mkstemp (name); if (fd != -1) unlink (name); return fd; } /* Open a temporary file in the named directory. */ static int open_temp_exec_file_dir (const char *dir) { static const char suffix[] = "/ffiXXXXXX"; int lendir = strlen (dir); char *tempname = __builtin_alloca (lendir + sizeof (suffix)); if (!tempname) return -1; memcpy (tempname, dir, lendir); memcpy (tempname + lendir, suffix, sizeof (suffix)); return open_temp_exec_file_name (tempname); } /* Open a temporary file in the directory in the named environment variable. */ static int open_temp_exec_file_env (const char *envvar) { const char *value = getenv (envvar); if (!value) return -1; return open_temp_exec_file_dir (value); } #ifdef HAVE_MNTENT /* Open a temporary file in an executable and writable mount point listed in the mounts file. Subsequent calls with the same mounts keep searching for mount points in the same file. Providing NULL as the mounts file closes the file. */ static int open_temp_exec_file_mnt (const char *mounts) { static const char *last_mounts; static FILE *last_mntent; if (mounts != last_mounts) { if (last_mntent) endmntent (last_mntent); last_mounts = mounts; if (mounts) last_mntent = setmntent (mounts, "r"); else last_mntent = NULL; } if (!last_mntent) return -1; for (;;) { int fd; struct mntent mnt; char buf[MAXPATHLEN * 3]; if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf))) return -1; if (hasmntopt (&mnt, "ro") || hasmntopt (&mnt, "noexec") || access (mnt.mnt_dir, W_OK)) continue; fd = open_temp_exec_file_dir (mnt.mnt_dir); if (fd != -1) return fd; } } #endif /* HAVE_MNTENT */ /* Instructions to look for a location to hold a temporary file that can be mapped in for execution. */ static struct { int (*func)(const char *); const char *arg; int repeat; } open_temp_exec_file_opts[] = { { open_temp_exec_file_env, "TMPDIR", 0 }, { open_temp_exec_file_dir, "/tmp", 0 }, { open_temp_exec_file_dir, "/var/tmp", 0 }, { open_temp_exec_file_dir, "/dev/shm", 0 }, { open_temp_exec_file_env, "HOME", 0 }, #ifdef HAVE_MNTENT { open_temp_exec_file_mnt, "/etc/mtab", 1 }, { open_temp_exec_file_mnt, "/proc/mounts", 1 }, #endif /* HAVE_MNTENT */ }; /* Current index into open_temp_exec_file_opts. */ static int open_temp_exec_file_opts_idx = 0; /* Reset a current multi-call func, then advances to the next entry. If we're at the last, go back to the first and return nonzero, otherwise return zero. */ static int open_temp_exec_file_opts_next (void) { if (open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat) open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func (NULL); open_temp_exec_file_opts_idx++; if (open_temp_exec_file_opts_idx == (sizeof (open_temp_exec_file_opts) / sizeof (*open_temp_exec_file_opts))) { open_temp_exec_file_opts_idx = 0; return 1; } return 0; } /* Return a file descriptor of a temporary zero-sized file in a writable and exexutable filesystem. */ static int open_temp_exec_file (void) { int fd; do { fd = open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func (open_temp_exec_file_opts[open_temp_exec_file_opts_idx].arg); if (!open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat || fd == -1) { if (open_temp_exec_file_opts_next ()) break; } } while (fd == -1); return fd; } /* Map in a chunk of memory from the temporary exec file into separate locations in the virtual memory address space, one writable and one executable. Returns the address of the writable portion, after storing an offset to the corresponding executable portion at the last word of the requested chunk. */ static void * dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset) { void *ptr; if (execfd == -1) { open_temp_exec_file_opts_idx = 0; retry_open: execfd = open_temp_exec_file (); if (execfd == -1) return MFAIL; } offset = execsize; if (ftruncate (execfd, offset + length)) return MFAIL; flags &= ~(MAP_PRIVATE | MAP_ANONYMOUS); flags |= MAP_SHARED; ptr = mmap (NULL, length, (prot & ~PROT_WRITE) | PROT_EXEC, flags, execfd, offset); if (ptr == MFAIL) { if (!offset) { close (execfd); goto retry_open; } ftruncate (execfd, offset); return MFAIL; } else if (!offset && open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat) open_temp_exec_file_opts_next (); start = mmap (start, length, prot, flags, execfd, offset); if (start == MFAIL) { munmap (ptr, length); ftruncate (execfd, offset); return start; } mmap_exec_offset ((char *)start, length) = (char*)ptr - (char*)start; execsize += length; return start; } /* Map in a writable and executable chunk of memory if possible. Failing that, fall back to dlmmap_locked. */ static void * dlmmap (void *start, size_t length, int prot, int flags, int fd, off_t offset) { void *ptr; assert (start == NULL && length % malloc_getpagesize == 0 && prot == (PROT_READ | PROT_WRITE) && flags == (MAP_PRIVATE | MAP_ANONYMOUS) && fd == -1 && offset == 0); #if FFI_CLOSURE_TEST printf ("mapping in %zi\n", length); #endif if (execfd == -1 && !is_selinux_enabled ()) { ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset); if (ptr != MFAIL || (errno != EPERM && errno != EACCES)) /* Cool, no need to mess with separate segments. */ return ptr; /* If MREMAP_DUP is ever introduced and implemented, try mmap with ((prot & ~PROT_WRITE) | PROT_EXEC) and mremap with MREMAP_DUP and prot at this point. */ } if (execsize == 0 || execfd == -1) { pthread_mutex_lock (&open_temp_exec_file_mutex); ptr = dlmmap_locked (start, length, prot, flags, offset); pthread_mutex_unlock (&open_temp_exec_file_mutex); return ptr; } return dlmmap_locked (start, length, prot, flags, offset); } /* Release memory at the given address, as well as the corresponding executable page if it's separate. */ static int dlmunmap (void *start, size_t length) { /* We don't bother decreasing execsize or truncating the file, since we can't quite tell whether we're unmapping the end of the file. We don't expect frequent deallocation anyway. If we did, we could locate pages in the file by writing to the pages being deallocated and checking that the file contents change. Yuck. */ msegmentptr seg = segment_holding (gm, start); void *code; #if FFI_CLOSURE_TEST printf ("unmapping %zi\n", length); #endif if (seg && (code = add_segment_exec_offset (start, seg)) != start) { int ret = munmap (code, length); if (ret) return ret; } return munmap (start, length); } #if FFI_CLOSURE_FREE_CODE /* Return segment holding given code address. */ static msegmentptr segment_holding_code (mstate m, char* addr) { msegmentptr sp = &m->seg; for (;;) { if (addr >= add_segment_exec_offset (sp->base, sp) && addr < add_segment_exec_offset (sp->base, sp) + sp->size) return sp; if ((sp = sp->next) == 0) return 0; } } #endif #endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) */ /* Allocate a chunk of memory with the given size. Returns a pointer to the writable address, and sets *CODE to the executable corresponding virtual address. */ void * ffi_closure_alloc (size_t size, void **code) { void *ptr; if (!code) return NULL; ptr = dlmalloc (size); if (ptr) { msegmentptr seg = segment_holding (gm, ptr); *code = add_segment_exec_offset (ptr, seg); } return ptr; } /* Release a chunk of memory allocated with ffi_closure_alloc. If FFI_CLOSURE_FREE_CODE is nonzero, the given address can be the writable or the executable address given. Otherwise, only the writable address can be provided here. */ void ffi_closure_free (void *ptr) { #if FFI_CLOSURE_FREE_CODE msegmentptr seg = segment_holding_code (gm, ptr); if (seg) ptr = sub_segment_exec_offset (ptr, seg); #endif dlfree (ptr); } #if FFI_CLOSURE_TEST /* Do some internal sanity testing to make sure allocation and deallocation of pages are working as intended. */ int main () { void *p[3]; #define GET(idx, len) do { p[idx] = dlmalloc (len); printf ("allocated %zi for p[%i]\n", (len), (idx)); } while (0) #define PUT(idx) do { printf ("freeing p[%i]\n", (idx)); dlfree (p[idx]); } while (0) GET (0, malloc_getpagesize / 2); GET (1, 2 * malloc_getpagesize - 64 * sizeof (void*)); PUT (1); GET (1, 2 * malloc_getpagesize); GET (2, malloc_getpagesize / 2); PUT (1); PUT (0); PUT (2); return 0; } #endif /* FFI_CLOSURE_TEST */ # else /* ! FFI_MMAP_EXEC_WRIT */ /* On many systems, memory returned by malloc is writable and executable, so just use it. */ #include void * ffi_closure_alloc (size_t size, void **code) { if (!code) return NULL; return *code = malloc (size); } void ffi_closure_free (void *ptr) { free (ptr); } # endif /* ! FFI_MMAP_EXEC_WRIT */ #endif /* FFI_CLOSURES */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/debug.c0000644000175000017500000000427111545150464021061 0ustar chr1schr1s/* ----------------------------------------------------------------------- debug.c - Copyright (c) 1996 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include #include /* General debugging routines */ void ffi_stop_here(void) { /* This function is only useful for debugging purposes. Place a breakpoint on ffi_stop_here to be notified of significant events. */ } /* This function should only be called via the FFI_ASSERT() macro */ void ffi_assert(char *expr, char *file, int line) { fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line); ffi_stop_here(); abort(); } /* Perform a sanity check on an ffi_type structure */ void ffi_type_test(ffi_type *a, char *file, int line) { FFI_ASSERT_AT(a != NULL, file, line); FFI_ASSERT_AT(a->type <= FFI_TYPE_LAST, file, line); FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->size > 0, file, line); FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->alignment > 0, file, line); FFI_ASSERT_AT(a->type != FFI_TYPE_STRUCT || a->elements != NULL, file, line); } mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/dlmalloc.c0000644000175000017500000054601611545150464021572 0ustar chr1schr1s/* This is a version (aka dlmalloc) of malloc/free/realloc written by Doug Lea and released to the public domain, as explained at http://creativecommons.org/licenses/publicdomain. Send questions, comments, complaints, performance data, etc to dl@cs.oswego.edu * Version 2.8.3 Thu Sep 22 11:16:15 2005 Doug Lea (dl at gee) Note: There may be an updated version of this malloc obtainable at ftp://gee.cs.oswego.edu/pub/misc/malloc.c Check before installing! * Quickstart This library is all in one file to simplify the most common usage: ftp it, compile it (-O3), and link it into another program. All of the compile-time options default to reasonable values for use on most platforms. You might later want to step through various compile-time and dynamic tuning options. For convenience, an include file for code using this malloc is at: ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.3.h You don't really need this .h file unless you call functions not defined in your system include files. The .h file contains only the excerpts from this file needed for using this malloc on ANSI C/C++ systems, so long as you haven't changed compile-time options about naming and tuning parameters. If you do, then you can create your own malloc.h that does include all settings by cutting at the point indicated below. Note that you may already by default be using a C library containing a malloc that is based on some version of this malloc (for example in linux). You might still want to use the one in this file to customize settings or to avoid overheads associated with library versions. * Vital statistics: Supported pointer/size_t representation: 4 or 8 bytes size_t MUST be an unsigned type of the same width as pointers. (If you are using an ancient system that declares size_t as a signed type, or need it to be a different width than pointers, you can use a previous release of this malloc (e.g. 2.7.2) supporting these.) Alignment: 8 bytes (default) This suffices for nearly all current machines and C compilers. However, you can define MALLOC_ALIGNMENT to be wider than this if necessary (up to 128bytes), at the expense of using more space. Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes) 8 or 16 bytes (if 8byte sizes) Each malloced chunk has a hidden word of overhead holding size and status information, and additional cross-check word if FOOTERS is defined. Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead) 8-byte ptrs: 32 bytes (including overhead) Even a request for zero bytes (i.e., malloc(0)) returns a pointer to something of the minimum allocatable size. The maximum overhead wastage (i.e., number of extra bytes allocated than were requested in malloc) is less than or equal to the minimum size, except for requests >= mmap_threshold that are serviced via mmap(), where the worst case wastage is about 32 bytes plus the remainder from a system page (the minimal mmap unit); typically 4096 or 8192 bytes. Security: static-safe; optionally more or less The "security" of malloc refers to the ability of malicious code to accentuate the effects of errors (for example, freeing space that is not currently malloc'ed or overwriting past the ends of chunks) in code that calls malloc. This malloc guarantees not to modify any memory locations below the base of heap, i.e., static variables, even in the presence of usage errors. The routines additionally detect most improper frees and reallocs. All this holds as long as the static bookkeeping for malloc itself is not corrupted by some other means. This is only one aspect of security -- these checks do not, and cannot, detect all possible programming errors. If FOOTERS is defined nonzero, then each allocated chunk carries an additional check word to verify that it was malloced from its space. These check words are the same within each execution of a program using malloc, but differ across executions, so externally crafted fake chunks cannot be freed. This improves security by rejecting frees/reallocs that could corrupt heap memory, in addition to the checks preventing writes to statics that are always on. This may further improve security at the expense of time and space overhead. (Note that FOOTERS may also be worth using with MSPACES.) By default detected errors cause the program to abort (calling "abort()"). You can override this to instead proceed past errors by defining PROCEED_ON_ERROR. In this case, a bad free has no effect, and a malloc that encounters a bad address caused by user overwrites will ignore the bad address by dropping pointers and indices to all known memory. This may be appropriate for programs that should continue if at all possible in the face of programming errors, although they may run out of memory because dropped memory is never reclaimed. If you don't like either of these options, you can define CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything else. And if if you are sure that your program using malloc has no errors or vulnerabilities, you can define INSECURE to 1, which might (or might not) provide a small performance improvement. Thread-safety: NOT thread-safe unless USE_LOCKS defined When USE_LOCKS is defined, each public call to malloc, free, etc is surrounded with either a pthread mutex or a win32 spinlock (depending on WIN32). This is not especially fast, and can be a major bottleneck. It is designed only to provide minimal protection in concurrent environments, and to provide a basis for extensions. If you are using malloc in a concurrent program, consider instead using ptmalloc, which is derived from a version of this malloc. (See http://www.malloc.de). System requirements: Any combination of MORECORE and/or MMAP/MUNMAP This malloc can use unix sbrk or any emulation (invoked using the CALL_MORECORE macro) and/or mmap/munmap or any emulation (invoked using CALL_MMAP/CALL_MUNMAP) to get and release system memory. On most unix systems, it tends to work best if both MORECORE and MMAP are enabled. On Win32, it uses emulations based on VirtualAlloc. It also uses common C library functions like memset. Compliance: I believe it is compliant with the Single Unix Specification (See http://www.unix.org). Also SVID/XPG, ANSI C, and probably others as well. * Overview of algorithms This is not the fastest, most space-conserving, most portable, or most tunable malloc ever written. However it is among the fastest while also being among the most space-conserving, portable and tunable. Consistent balance across these factors results in a good general-purpose allocator for malloc-intensive programs. In most ways, this malloc is a best-fit allocator. Generally, it chooses the best-fitting existing chunk for a request, with ties broken in approximately least-recently-used order. (This strategy normally maintains low fragmentation.) However, for requests less than 256bytes, it deviates from best-fit when there is not an exactly fitting available chunk by preferring to use space adjacent to that used for the previous small request, as well as by breaking ties in approximately most-recently-used order. (These enhance locality of series of small allocations.) And for very large requests (>= 256Kb by default), it relies on system memory mapping facilities, if supported. (This helps avoid carrying around and possibly fragmenting memory used only for large chunks.) All operations (except malloc_stats and mallinfo) have execution times that are bounded by a constant factor of the number of bits in a size_t, not counting any clearing in calloc or copying in realloc, or actions surrounding MORECORE and MMAP that have times proportional to the number of non-contiguous regions returned by system allocation routines, which is often just 1. The implementation is not very modular and seriously overuses macros. Perhaps someday all C compilers will do as good a job inlining modular code as can now be done by brute-force expansion, but now, enough of them seem not to. Some compilers issue a lot of warnings about code that is dead/unreachable only on some platforms, and also about intentional uses of negation on unsigned types. All known cases of each can be ignored. For a longer but out of date high-level description, see http://gee.cs.oswego.edu/dl/html/malloc.html * MSPACES If MSPACES is defined, then in addition to malloc, free, etc., this file also defines mspace_malloc, mspace_free, etc. These are versions of malloc routines that take an "mspace" argument obtained using create_mspace, to control all internal bookkeeping. If ONLY_MSPACES is defined, only these versions are compiled. So if you would like to use this allocator for only some allocations, and your system malloc for others, you can compile with ONLY_MSPACES and then do something like... static mspace mymspace = create_mspace(0,0); // for example #define mymalloc(bytes) mspace_malloc(mymspace, bytes) (Note: If you only need one instance of an mspace, you can instead use "USE_DL_PREFIX" to relabel the global malloc.) You can similarly create thread-local allocators by storing mspaces as thread-locals. For example: static __thread mspace tlms = 0; void* tlmalloc(size_t bytes) { if (tlms == 0) tlms = create_mspace(0, 0); return mspace_malloc(tlms, bytes); } void tlfree(void* mem) { mspace_free(tlms, mem); } Unless FOOTERS is defined, each mspace is completely independent. You cannot allocate from one and free to another (although conformance is only weakly checked, so usage errors are not always caught). If FOOTERS is defined, then each chunk carries around a tag indicating its originating mspace, and frees are directed to their originating spaces. ------------------------- Compile-time options --------------------------- Be careful in setting #define values for numerical constants of type size_t. On some systems, literal values are not automatically extended to size_t precision unless they are explicitly casted. WIN32 default: defined if _WIN32 defined Defining WIN32 sets up defaults for MS environment and compilers. Otherwise defaults are for unix. MALLOC_ALIGNMENT default: (size_t)8 Controls the minimum alignment for malloc'ed chunks. It must be a power of two and at least 8, even on machines for which smaller alignments would suffice. It may be defined as larger than this though. Note however that code and data structures are optimized for the case of 8-byte alignment. MSPACES default: 0 (false) If true, compile in support for independent allocation spaces. This is only supported if HAVE_MMAP is true. ONLY_MSPACES default: 0 (false) If true, only compile in mspace versions, not regular versions. USE_LOCKS default: 0 (false) Causes each call to each public routine to be surrounded with pthread or WIN32 mutex lock/unlock. (If set true, this can be overridden on a per-mspace basis for mspace versions.) FOOTERS default: 0 If true, provide extra checking and dispatching by placing information in the footers of allocated chunks. This adds space and time overhead. INSECURE default: 0 If true, omit checks for usage errors and heap space overwrites. USE_DL_PREFIX default: NOT defined Causes compiler to prefix all public routines with the string 'dl'. This can be useful when you only want to use this malloc in one part of a program, using your regular system malloc elsewhere. ABORT default: defined as abort() Defines how to abort on failed checks. On most systems, a failed check cannot die with an "assert" or even print an informative message, because the underlying print routines in turn call malloc, which will fail again. Generally, the best policy is to simply call abort(). It's not very useful to do more than this because many errors due to overwriting will show up as address faults (null, odd addresses etc) rather than malloc-triggered checks, so will also abort. Also, most compilers know that abort() does not return, so can better optimize code conditionally calling it. PROCEED_ON_ERROR default: defined as 0 (false) Controls whether detected bad addresses cause them to bypassed rather than aborting. If set, detected bad arguments to free and realloc are ignored. And all bookkeeping information is zeroed out upon a detected overwrite of freed heap space, thus losing the ability to ever return it from malloc again, but enabling the application to proceed. If PROCEED_ON_ERROR is defined, the static variable malloc_corruption_error_count is compiled in and can be examined to see if errors have occurred. This option generates slower code than the default abort policy. DEBUG default: NOT defined The DEBUG setting is mainly intended for people trying to modify this code or diagnose problems when porting to new platforms. However, it may also be able to better isolate user errors than just using runtime checks. The assertions in the check routines spell out in more detail the assumptions and invariants underlying the algorithms. The checking is fairly extensive, and will slow down execution noticeably. Calling malloc_stats or mallinfo with DEBUG set will attempt to check every non-mmapped allocated and free chunk in the course of computing the summaries. ABORT_ON_ASSERT_FAILURE default: defined as 1 (true) Debugging assertion failures can be nearly impossible if your version of the assert macro causes malloc to be called, which will lead to a cascade of further failures, blowing the runtime stack. ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(), which will usually make debugging easier. MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32 The action to take before "return 0" when malloc fails to be able to return memory because there is none available. HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES True if this system supports sbrk or an emulation of it. MORECORE default: sbrk The name of the sbrk-style system routine to call to obtain more memory. See below for guidance on writing custom MORECORE functions. The type of the argument to sbrk/MORECORE varies across systems. It cannot be size_t, because it supports negative arguments, so it is normally the signed type of the same width as size_t (sometimes declared as "intptr_t"). It doesn't much matter though. Internally, we only call it with arguments less than half the max value of a size_t, which should work across all reasonable possibilities, although sometimes generating compiler warnings. See near the end of this file for guidelines for creating a custom version of MORECORE. MORECORE_CONTIGUOUS default: 1 (true) If true, take advantage of fact that consecutive calls to MORECORE with positive arguments always return contiguous increasing addresses. This is true of unix sbrk. It does not hurt too much to set it true anyway, since malloc copes with non-contiguities. Setting it false when definitely non-contiguous saves time and possibly wasted space it would take to discover this though. MORECORE_CANNOT_TRIM default: NOT defined True if MORECORE cannot release space back to the system when given negative arguments. This is generally necessary only if you are using a hand-crafted MORECORE function that cannot handle negative arguments. HAVE_MMAP default: 1 (true) True if this system supports mmap or an emulation of it. If so, and HAVE_MORECORE is not true, MMAP is used for all system allocation. If set and HAVE_MORECORE is true as well, MMAP is primarily used to directly allocate very large blocks. It is also used as a backup strategy in cases where MORECORE fails to provide space from system. Note: A single call to MUNMAP is assumed to be able to unmap memory that may have be allocated using multiple calls to MMAP, so long as they are adjacent. HAVE_MREMAP default: 1 on linux, else 0 If true realloc() uses mremap() to re-allocate large blocks and extend or shrink allocation spaces. MMAP_CLEARS default: 1 on unix True if mmap clears memory so calloc doesn't need to. This is true for standard unix mmap using /dev/zero. USE_BUILTIN_FFS default: 0 (i.e., not used) Causes malloc to use the builtin ffs() function to compute indices. Some compilers may recognize and intrinsify ffs to be faster than the supplied C version. Also, the case of x86 using gcc is special-cased to an asm instruction, so is already as fast as it can be, and so this setting has no effect. (On most x86s, the asm version is only slightly faster than the C version.) malloc_getpagesize default: derive from system includes, or 4096. The system page size. To the extent possible, this malloc manages memory from the system in page-size units. This may be (and usually is) a function rather than a constant. This is ignored if WIN32, where page size is determined using getSystemInfo during initialization. USE_DEV_RANDOM default: 0 (i.e., not used) Causes malloc to use /dev/random to initialize secure magic seed for stamping footers. Otherwise, the current time is used. NO_MALLINFO default: 0 If defined, don't compile "mallinfo". This can be a simple way of dealing with mismatches between system declarations and those in this file. MALLINFO_FIELD_TYPE default: size_t The type of the fields in the mallinfo struct. This was originally defined as "int" in SVID etc, but is more usefully defined as size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set REALLOC_ZERO_BYTES_FREES default: not defined This should be set if a call to realloc with zero bytes should be the same as a call to free. Some people think it should. Otherwise, since this malloc returns a unique pointer for malloc(0), so does realloc(p, 0). LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H LACKS_STDLIB_H default: NOT defined unless on WIN32 Define these if your system does not have these header files. You might need to manually insert some of the declarations they provide. DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS, system_info.dwAllocationGranularity in WIN32, otherwise 64K. Also settable using mallopt(M_GRANULARITY, x) The unit for allocating and deallocating memory from the system. On most systems with contiguous MORECORE, there is no reason to make this more than a page. However, systems with MMAP tend to either require or encourage larger granularities. You can increase this value to prevent system allocation functions to be called so often, especially if they are slow. The value must be at least one page and must be a power of two. Setting to 0 causes initialization to either page size or win32 region size. (Note: In previous versions of malloc, the equivalent of this option was called "TOP_PAD") DEFAULT_TRIM_THRESHOLD default: 2MB Also settable using mallopt(M_TRIM_THRESHOLD, x) The maximum amount of unused top-most memory to keep before releasing via malloc_trim in free(). Automatic trimming is mainly useful in long-lived programs using contiguous MORECORE. Because trimming via sbrk can be slow on some systems, and can sometimes be wasteful (in cases where programs immediately afterward allocate more large chunks) the value should be high enough so that your overall system performance would improve by releasing this much memory. As a rough guide, you might set to a value close to the average size of a process (program) running on your system. Releasing this much memory would allow such a process to run in memory. Generally, it is worth tuning trim thresholds when a program undergoes phases where several large chunks are allocated and released in ways that can reuse each other's storage, perhaps mixed with phases where there are no such chunks at all. The trim value must be greater than page size to have any useful effect. To disable trimming completely, you can set to MAX_SIZE_T. Note that the trick some people use of mallocing a huge space and then freeing it at program startup, in an attempt to reserve system memory, doesn't have the intended effect under automatic trimming, since that memory will immediately be returned to the system. DEFAULT_MMAP_THRESHOLD default: 256K Also settable using mallopt(M_MMAP_THRESHOLD, x) The request size threshold for using MMAP to directly service a request. Requests of at least this size that cannot be allocated using already-existing space will be serviced via mmap. (If enough normal freed space already exists it is used instead.) Using mmap segregates relatively large chunks of memory so that they can be individually obtained and released from the host system. A request serviced through mmap is never reused by any other request (at least not directly; the system may just so happen to remap successive requests to the same locations). Segregating space in this way has the benefits that: Mmapped space can always be individually released back to the system, which helps keep the system level memory demands of a long-lived program low. Also, mapped memory doesn't become `locked' between other chunks, as can happen with normally allocated chunks, which means that even trimming via malloc_trim would not release them. However, it has the disadvantage that the space cannot be reclaimed, consolidated, and then used to service later requests, as happens with normal chunks. The advantages of mmap nearly always outweigh disadvantages for "large" chunks, but the value of "large" may vary across systems. The default is an empirically derived value that works well in most systems. You can disable mmap by setting to MAX_SIZE_T. */ #ifndef WIN32 #ifdef _WIN32 #define WIN32 1 #endif /* _WIN32 */ #endif /* WIN32 */ #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include #define HAVE_MMAP 1 #define HAVE_MORECORE 0 #define LACKS_UNISTD_H #define LACKS_SYS_PARAM_H #define LACKS_SYS_MMAN_H #define LACKS_STRING_H #define LACKS_STRINGS_H #define LACKS_SYS_TYPES_H #define LACKS_ERRNO_H #define MALLOC_FAILURE_ACTION #define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ #endif /* WIN32 */ #ifdef __OS2__ #define INCL_DOS #include #define HAVE_MMAP 1 #define HAVE_MORECORE 0 #define LACKS_SYS_MMAN_H #endif /* __OS2__ */ #if defined(DARWIN) || defined(_DARWIN) /* Mac OSX docs advise not to use sbrk; it seems better to use mmap */ #ifndef HAVE_MORECORE #define HAVE_MORECORE 0 #define HAVE_MMAP 1 #endif /* HAVE_MORECORE */ #endif /* DARWIN */ #ifndef LACKS_SYS_TYPES_H #include /* For size_t */ #endif /* LACKS_SYS_TYPES_H */ /* The maximum possible size_t value has all bits set */ #define MAX_SIZE_T (~(size_t)0) #ifndef ONLY_MSPACES #define ONLY_MSPACES 0 #endif /* ONLY_MSPACES */ #ifndef MSPACES #if ONLY_MSPACES #define MSPACES 1 #else /* ONLY_MSPACES */ #define MSPACES 0 #endif /* ONLY_MSPACES */ #endif /* MSPACES */ #ifndef MALLOC_ALIGNMENT #define MALLOC_ALIGNMENT ((size_t)8U) #endif /* MALLOC_ALIGNMENT */ #ifndef FOOTERS #define FOOTERS 0 #endif /* FOOTERS */ #ifndef ABORT #define ABORT abort() #endif /* ABORT */ #ifndef ABORT_ON_ASSERT_FAILURE #define ABORT_ON_ASSERT_FAILURE 1 #endif /* ABORT_ON_ASSERT_FAILURE */ #ifndef PROCEED_ON_ERROR #define PROCEED_ON_ERROR 0 #endif /* PROCEED_ON_ERROR */ #ifndef USE_LOCKS #define USE_LOCKS 0 #endif /* USE_LOCKS */ #ifndef INSECURE #define INSECURE 0 #endif /* INSECURE */ #ifndef HAVE_MMAP #define HAVE_MMAP 1 #endif /* HAVE_MMAP */ #ifndef MMAP_CLEARS #define MMAP_CLEARS 1 #endif /* MMAP_CLEARS */ #ifndef HAVE_MREMAP #ifdef linux #define HAVE_MREMAP 1 #else /* linux */ #define HAVE_MREMAP 0 #endif /* linux */ #endif /* HAVE_MREMAP */ #ifndef MALLOC_FAILURE_ACTION #define MALLOC_FAILURE_ACTION errno = ENOMEM; #endif /* MALLOC_FAILURE_ACTION */ #ifndef HAVE_MORECORE #if ONLY_MSPACES #define HAVE_MORECORE 0 #else /* ONLY_MSPACES */ #define HAVE_MORECORE 1 #endif /* ONLY_MSPACES */ #endif /* HAVE_MORECORE */ #if !HAVE_MORECORE #define MORECORE_CONTIGUOUS 0 #else /* !HAVE_MORECORE */ #ifndef MORECORE #define MORECORE sbrk #endif /* MORECORE */ #ifndef MORECORE_CONTIGUOUS #define MORECORE_CONTIGUOUS 1 #endif /* MORECORE_CONTIGUOUS */ #endif /* HAVE_MORECORE */ #ifndef DEFAULT_GRANULARITY #if MORECORE_CONTIGUOUS #define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */ #else /* MORECORE_CONTIGUOUS */ #define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U) #endif /* MORECORE_CONTIGUOUS */ #endif /* DEFAULT_GRANULARITY */ #ifndef DEFAULT_TRIM_THRESHOLD #ifndef MORECORE_CANNOT_TRIM #define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U) #else /* MORECORE_CANNOT_TRIM */ #define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T #endif /* MORECORE_CANNOT_TRIM */ #endif /* DEFAULT_TRIM_THRESHOLD */ #ifndef DEFAULT_MMAP_THRESHOLD #if HAVE_MMAP #define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U) #else /* HAVE_MMAP */ #define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T #endif /* HAVE_MMAP */ #endif /* DEFAULT_MMAP_THRESHOLD */ #ifndef USE_BUILTIN_FFS #define USE_BUILTIN_FFS 0 #endif /* USE_BUILTIN_FFS */ #ifndef USE_DEV_RANDOM #define USE_DEV_RANDOM 0 #endif /* USE_DEV_RANDOM */ #ifndef NO_MALLINFO #define NO_MALLINFO 0 #endif /* NO_MALLINFO */ #ifndef MALLINFO_FIELD_TYPE #define MALLINFO_FIELD_TYPE size_t #endif /* MALLINFO_FIELD_TYPE */ /* mallopt tuning options. SVID/XPG defines four standard parameter numbers for mallopt, normally defined in malloc.h. None of these are used in this malloc, so setting them has no effect. But this malloc does support the following options. */ #define M_TRIM_THRESHOLD (-1) #define M_GRANULARITY (-2) #define M_MMAP_THRESHOLD (-3) /* ------------------------ Mallinfo declarations ------------------------ */ #if !NO_MALLINFO /* This version of malloc supports the standard SVID/XPG mallinfo routine that returns a struct containing usage properties and statistics. It should work on any system that has a /usr/include/malloc.h defining struct mallinfo. The main declaration needed is the mallinfo struct that is returned (by-copy) by mallinfo(). The malloinfo struct contains a bunch of fields that are not even meaningful in this version of malloc. These fields are are instead filled by mallinfo() with other numbers that might be of interest. HAVE_USR_INCLUDE_MALLOC_H should be set if you have a /usr/include/malloc.h file that includes a declaration of struct mallinfo. If so, it is included; else a compliant version is declared below. These must be precisely the same for mallinfo() to work. The original SVID version of this struct, defined on most systems with mallinfo, declares all fields as ints. But some others define as unsigned long. If your system defines the fields using a type of different width than listed here, you MUST #include your system version and #define HAVE_USR_INCLUDE_MALLOC_H. */ /* #define HAVE_USR_INCLUDE_MALLOC_H */ #ifdef HAVE_USR_INCLUDE_MALLOC_H #include "/usr/include/malloc.h" #else /* HAVE_USR_INCLUDE_MALLOC_H */ struct mallinfo { MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */ MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */ MALLINFO_FIELD_TYPE smblks; /* always 0 */ MALLINFO_FIELD_TYPE hblks; /* always 0 */ MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */ MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */ MALLINFO_FIELD_TYPE fsmblks; /* always 0 */ MALLINFO_FIELD_TYPE uordblks; /* total allocated space */ MALLINFO_FIELD_TYPE fordblks; /* total free space */ MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */ }; #endif /* HAVE_USR_INCLUDE_MALLOC_H */ #endif /* NO_MALLINFO */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if !ONLY_MSPACES /* ------------------- Declarations of public routines ------------------- */ #ifndef USE_DL_PREFIX #define dlcalloc calloc #define dlfree free #define dlmalloc malloc #define dlmemalign memalign #define dlrealloc realloc #define dlvalloc valloc #define dlpvalloc pvalloc #define dlmallinfo mallinfo #define dlmallopt mallopt #define dlmalloc_trim malloc_trim #define dlmalloc_stats malloc_stats #define dlmalloc_usable_size malloc_usable_size #define dlmalloc_footprint malloc_footprint #define dlmalloc_max_footprint malloc_max_footprint #define dlindependent_calloc independent_calloc #define dlindependent_comalloc independent_comalloc #endif /* USE_DL_PREFIX */ /* malloc(size_t n) Returns a pointer to a newly allocated chunk of at least n bytes, or null if no space is available, in which case errno is set to ENOMEM on ANSI C systems. If n is zero, malloc returns a minimum-sized chunk. (The minimum size is 16 bytes on most 32bit systems, and 32 bytes on 64bit systems.) Note that size_t is an unsigned type, so calls with arguments that would be negative if signed are interpreted as requests for huge amounts of space, which will often fail. The maximum supported value of n differs across systems, but is in all cases less than the maximum representable value of a size_t. */ void* dlmalloc(size_t); /* free(void* p) Releases the chunk of memory pointed to by p, that had been previously allocated using malloc or a related routine such as realloc. It has no effect if p is null. If p was not malloced or already freed, free(p) will by default cause the current program to abort. */ void dlfree(void*); /* calloc(size_t n_elements, size_t element_size); Returns a pointer to n_elements * element_size bytes, with all locations set to zero. */ void* dlcalloc(size_t, size_t); /* realloc(void* p, size_t n) Returns a pointer to a chunk of size n that contains the same data as does chunk p up to the minimum of (n, p's size) bytes, or null if no space is available. The returned pointer may or may not be the same as p. The algorithm prefers extending p in most cases when possible, otherwise it employs the equivalent of a malloc-copy-free sequence. If p is null, realloc is equivalent to malloc. If space is not available, realloc returns null, errno is set (if on ANSI) and p is NOT freed. if n is for fewer bytes than already held by p, the newly unused space is lopped off and freed if possible. realloc with a size argument of zero (re)allocates a minimum-sized chunk. The old unix realloc convention of allowing the last-free'd chunk to be used as an argument to realloc is not supported. */ void* dlrealloc(void*, size_t); /* memalign(size_t alignment, size_t n); Returns a pointer to a newly allocated chunk of n bytes, aligned in accord with the alignment argument. The alignment argument should be a power of two. If the argument is not a power of two, the nearest greater power is used. 8-byte alignment is guaranteed by normal malloc calls, so don't bother calling memalign with an argument of 8 or less. Overreliance on memalign is a sure way to fragment space. */ void* dlmemalign(size_t, size_t); /* valloc(size_t n); Equivalent to memalign(pagesize, n), where pagesize is the page size of the system. If the pagesize is unknown, 4096 is used. */ void* dlvalloc(size_t); /* mallopt(int parameter_number, int parameter_value) Sets tunable parameters The format is to provide a (parameter-number, parameter-value) pair. mallopt then sets the corresponding parameter to the argument value if it can (i.e., so long as the value is meaningful), and returns 1 if successful else 0. SVID/XPG/ANSI defines four standard param numbers for mallopt, normally defined in malloc.h. None of these are use in this malloc, so setting them has no effect. But this malloc also supports other options in mallopt. See below for details. Briefly, supported parameters are as follows (listed defaults are for "typical" configurations). Symbol param # default allowed param values M_TRIM_THRESHOLD -1 2*1024*1024 any (MAX_SIZE_T disables) M_GRANULARITY -2 page size any power of 2 >= page size M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support) */ int dlmallopt(int, int); /* malloc_footprint(); Returns the number of bytes obtained from the system. The total number of bytes allocated by malloc, realloc etc., is less than this value. Unlike mallinfo, this function returns only a precomputed result, so can be called frequently to monitor memory consumption. Even if locks are otherwise defined, this function does not use them, so results might not be up to date. */ size_t dlmalloc_footprint(void); /* malloc_max_footprint(); Returns the maximum number of bytes obtained from the system. This value will be greater than current footprint if deallocated space has been reclaimed by the system. The peak number of bytes allocated by malloc, realloc etc., is less than this value. Unlike mallinfo, this function returns only a precomputed result, so can be called frequently to monitor memory consumption. Even if locks are otherwise defined, this function does not use them, so results might not be up to date. */ size_t dlmalloc_max_footprint(void); #if !NO_MALLINFO /* mallinfo() Returns (by copy) a struct containing various summary statistics: arena: current total non-mmapped bytes allocated from system ordblks: the number of free chunks smblks: always zero. hblks: current number of mmapped regions hblkhd: total bytes held in mmapped regions usmblks: the maximum total allocated space. This will be greater than current total if trimming has occurred. fsmblks: always zero uordblks: current total allocated space (normal or mmapped) fordblks: total free space keepcost: the maximum number of bytes that could ideally be released back to system via malloc_trim. ("ideally" means that it ignores page restrictions etc.) Because these fields are ints, but internal bookkeeping may be kept as longs, the reported values may wrap around zero and thus be inaccurate. */ struct mallinfo dlmallinfo(void); #endif /* NO_MALLINFO */ /* independent_calloc(size_t n_elements, size_t element_size, void* chunks[]); independent_calloc is similar to calloc, but instead of returning a single cleared space, it returns an array of pointers to n_elements independent elements that can hold contents of size elem_size, each of which starts out cleared, and can be independently freed, realloc'ed etc. The elements are guaranteed to be adjacently allocated (this is not guaranteed to occur with multiple callocs or mallocs), which may also improve cache locality in some applications. The "chunks" argument is optional (i.e., may be null, which is probably the most typical usage). If it is null, the returned array is itself dynamically allocated and should also be freed when it is no longer needed. Otherwise, the chunks array must be of at least n_elements in length. It is filled in with the pointers to the chunks. In either case, independent_calloc returns this pointer array, or null if the allocation failed. If n_elements is zero and "chunks" is null, it returns a chunk representing an array with zero elements (which should be freed if not wanted). Each element must be individually freed when it is no longer needed. If you'd like to instead be able to free all at once, you should instead use regular calloc and assign pointers into this space to represent elements. (In this case though, you cannot independently free elements.) independent_calloc simplifies and speeds up implementations of many kinds of pools. It may also be useful when constructing large data structures that initially have a fixed number of fixed-sized nodes, but the number is not known at compile time, and some of the nodes may later need to be freed. For example: struct Node { int item; struct Node* next; }; struct Node* build_list() { struct Node** pool; int n = read_number_of_nodes_needed(); if (n <= 0) return 0; pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0); if (pool == 0) die(); // organize into a linked list... struct Node* first = pool[0]; for (i = 0; i < n-1; ++i) pool[i]->next = pool[i+1]; free(pool); // Can now free the array (or not, if it is needed later) return first; } */ void** dlindependent_calloc(size_t, size_t, void**); /* independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]); independent_comalloc allocates, all at once, a set of n_elements chunks with sizes indicated in the "sizes" array. It returns an array of pointers to these elements, each of which can be independently freed, realloc'ed etc. The elements are guaranteed to be adjacently allocated (this is not guaranteed to occur with multiple callocs or mallocs), which may also improve cache locality in some applications. The "chunks" argument is optional (i.e., may be null). If it is null the returned array is itself dynamically allocated and should also be freed when it is no longer needed. Otherwise, the chunks array must be of at least n_elements in length. It is filled in with the pointers to the chunks. In either case, independent_comalloc returns this pointer array, or null if the allocation failed. If n_elements is zero and chunks is null, it returns a chunk representing an array with zero elements (which should be freed if not wanted). Each element must be individually freed when it is no longer needed. If you'd like to instead be able to free all at once, you should instead use a single regular malloc, and assign pointers at particular offsets in the aggregate space. (In this case though, you cannot independently free elements.) independent_comallac differs from independent_calloc in that each element may have a different size, and also that it does not automatically clear elements. independent_comalloc can be used to speed up allocation in cases where several structs or objects must always be allocated at the same time. For example: struct Head { ... } struct Foot { ... } void send_message(char* msg) { int msglen = strlen(msg); size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) }; void* chunks[3]; if (independent_comalloc(3, sizes, chunks) == 0) die(); struct Head* head = (struct Head*)(chunks[0]); char* body = (char*)(chunks[1]); struct Foot* foot = (struct Foot*)(chunks[2]); // ... } In general though, independent_comalloc is worth using only for larger values of n_elements. For small values, you probably won't detect enough difference from series of malloc calls to bother. Overuse of independent_comalloc can increase overall memory usage, since it cannot reuse existing noncontiguous small chunks that might be available for some of the elements. */ void** dlindependent_comalloc(size_t, size_t*, void**); /* pvalloc(size_t n); Equivalent to valloc(minimum-page-that-holds(n)), that is, round up n to nearest pagesize. */ void* dlpvalloc(size_t); /* malloc_trim(size_t pad); If possible, gives memory back to the system (via negative arguments to sbrk) if there is unused memory at the `high' end of the malloc pool or in unused MMAP segments. You can call this after freeing large blocks of memory to potentially reduce the system-level memory requirements of a program. However, it cannot guarantee to reduce memory. Under some allocation patterns, some large free blocks of memory will be locked between two used chunks, so they cannot be given back to the system. The `pad' argument to malloc_trim represents the amount of free trailing space to leave untrimmed. If this argument is zero, only the minimum amount of memory to maintain internal data structures will be left. Non-zero arguments can be supplied to maintain enough trailing space to service future expected allocations without having to re-obtain memory from the system. Malloc_trim returns 1 if it actually released any memory, else 0. */ int dlmalloc_trim(size_t); /* malloc_usable_size(void* p); Returns the number of bytes you can actually use in an allocated chunk, which may be more than you requested (although often not) due to alignment and minimum size constraints. You can use this many bytes without worrying about overwriting other allocated objects. This is not a particularly great programming practice. malloc_usable_size can be more useful in debugging and assertions, for example: p = malloc(n); assert(malloc_usable_size(p) >= 256); */ size_t dlmalloc_usable_size(void*); /* malloc_stats(); Prints on stderr the amount of space obtained from the system (both via sbrk and mmap), the maximum amount (which may be more than current if malloc_trim and/or munmap got called), and the current number of bytes allocated via malloc (or realloc, etc) but not yet freed. Note that this is the number of bytes allocated, not the number requested. It will be larger than the number requested because of alignment and bookkeeping overhead. Because it includes alignment wastage as being in use, this figure may be greater than zero even when no user-level chunks are allocated. The reported current and maximum system memory can be inaccurate if a program makes other calls to system memory allocation functions (normally sbrk) outside of malloc. malloc_stats prints only the most commonly interesting statistics. More information can be obtained by calling mallinfo. */ void dlmalloc_stats(void); #endif /* ONLY_MSPACES */ #if MSPACES /* mspace is an opaque type representing an independent region of space that supports mspace_malloc, etc. */ typedef void* mspace; /* create_mspace creates and returns a new independent space with the given initial capacity, or, if 0, the default granularity size. It returns null if there is no system memory available to create the space. If argument locked is non-zero, the space uses a separate lock to control access. The capacity of the space will grow dynamically as needed to service mspace_malloc requests. You can control the sizes of incremental increases of this space by compiling with a different DEFAULT_GRANULARITY or dynamically setting with mallopt(M_GRANULARITY, value). */ mspace create_mspace(size_t capacity, int locked); /* destroy_mspace destroys the given space, and attempts to return all of its memory back to the system, returning the total number of bytes freed. After destruction, the results of access to all memory used by the space become undefined. */ size_t destroy_mspace(mspace msp); /* create_mspace_with_base uses the memory supplied as the initial base of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this space is used for bookkeeping, so the capacity must be at least this large. (Otherwise 0 is returned.) When this initial space is exhausted, additional memory will be obtained from the system. Destroying this space will deallocate all additionally allocated space (if possible) but not the initial base. */ mspace create_mspace_with_base(void* base, size_t capacity, int locked); /* mspace_malloc behaves as malloc, but operates within the given space. */ void* mspace_malloc(mspace msp, size_t bytes); /* mspace_free behaves as free, but operates within the given space. If compiled with FOOTERS==1, mspace_free is not actually needed. free may be called instead of mspace_free because freed chunks from any space are handled by their originating spaces. */ void mspace_free(mspace msp, void* mem); /* mspace_realloc behaves as realloc, but operates within the given space. If compiled with FOOTERS==1, mspace_realloc is not actually needed. realloc may be called instead of mspace_realloc because realloced chunks from any space are handled by their originating spaces. */ void* mspace_realloc(mspace msp, void* mem, size_t newsize); /* mspace_calloc behaves as calloc, but operates within the given space. */ void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size); /* mspace_memalign behaves as memalign, but operates within the given space. */ void* mspace_memalign(mspace msp, size_t alignment, size_t bytes); /* mspace_independent_calloc behaves as independent_calloc, but operates within the given space. */ void** mspace_independent_calloc(mspace msp, size_t n_elements, size_t elem_size, void* chunks[]); /* mspace_independent_comalloc behaves as independent_comalloc, but operates within the given space. */ void** mspace_independent_comalloc(mspace msp, size_t n_elements, size_t sizes[], void* chunks[]); /* mspace_footprint() returns the number of bytes obtained from the system for this space. */ size_t mspace_footprint(mspace msp); /* mspace_max_footprint() returns the peak number of bytes obtained from the system for this space. */ size_t mspace_max_footprint(mspace msp); #if !NO_MALLINFO /* mspace_mallinfo behaves as mallinfo, but reports properties of the given space. */ struct mallinfo mspace_mallinfo(mspace msp); #endif /* NO_MALLINFO */ /* mspace_malloc_stats behaves as malloc_stats, but reports properties of the given space. */ void mspace_malloc_stats(mspace msp); /* mspace_trim behaves as malloc_trim, but operates within the given space. */ int mspace_trim(mspace msp, size_t pad); /* An alias for mallopt. */ int mspace_mallopt(int, int); #endif /* MSPACES */ #ifdef __cplusplus }; /* end of extern "C" */ #endif /* __cplusplus */ /* ======================================================================== To make a fully customizable malloc.h header file, cut everything above this line, put into file malloc.h, edit to suit, and #include it on the next line, as well as in programs that use this malloc. ======================================================================== */ /* #include "malloc.h" */ /*------------------------------ internal #includes ---------------------- */ #ifdef _MSC_VER #pragma warning( disable : 4146 ) /* no "unsigned" warnings */ #endif /* _MSC_VER */ #include /* for printing in malloc_stats */ #ifndef LACKS_ERRNO_H #include /* for MALLOC_FAILURE_ACTION */ #endif /* LACKS_ERRNO_H */ #if FOOTERS #include /* for magic initialization */ #endif /* FOOTERS */ #ifndef LACKS_STDLIB_H #include /* for abort() */ #endif /* LACKS_STDLIB_H */ #ifdef DEBUG #if ABORT_ON_ASSERT_FAILURE #define assert(x) if(!(x)) ABORT #else /* ABORT_ON_ASSERT_FAILURE */ #include #endif /* ABORT_ON_ASSERT_FAILURE */ #else /* DEBUG */ #define assert(x) #endif /* DEBUG */ #ifndef LACKS_STRING_H #include /* for memset etc */ #endif /* LACKS_STRING_H */ #if USE_BUILTIN_FFS #ifndef LACKS_STRINGS_H #include /* for ffs */ #endif /* LACKS_STRINGS_H */ #endif /* USE_BUILTIN_FFS */ #if HAVE_MMAP #ifndef LACKS_SYS_MMAN_H #include /* for mmap */ #endif /* LACKS_SYS_MMAN_H */ #ifndef LACKS_FCNTL_H #include #endif /* LACKS_FCNTL_H */ #endif /* HAVE_MMAP */ #if HAVE_MORECORE #ifndef LACKS_UNISTD_H #include /* for sbrk */ #else /* LACKS_UNISTD_H */ #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) extern void* sbrk(ptrdiff_t); #endif /* FreeBSD etc */ #endif /* LACKS_UNISTD_H */ #endif /* HAVE_MMAP */ #ifndef WIN32 #ifndef malloc_getpagesize # ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ # ifndef _SC_PAGE_SIZE # define _SC_PAGE_SIZE _SC_PAGESIZE # endif # endif # ifdef _SC_PAGE_SIZE # define malloc_getpagesize sysconf(_SC_PAGE_SIZE) # else # if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) extern size_t getpagesize(); # define malloc_getpagesize getpagesize() # else # ifdef WIN32 /* use supplied emulation of getpagesize */ # define malloc_getpagesize getpagesize() # else # ifndef LACKS_SYS_PARAM_H # include # endif # ifdef EXEC_PAGESIZE # define malloc_getpagesize EXEC_PAGESIZE # else # ifdef NBPG # ifndef CLSIZE # define malloc_getpagesize NBPG # else # define malloc_getpagesize (NBPG * CLSIZE) # endif # else # ifdef NBPC # define malloc_getpagesize NBPC # else # ifdef PAGESIZE # define malloc_getpagesize PAGESIZE # else /* just guess */ # define malloc_getpagesize ((size_t)4096U) # endif # endif # endif # endif # endif # endif # endif #endif #endif /* ------------------- size_t and alignment properties -------------------- */ /* The byte and bit size of a size_t */ #define SIZE_T_SIZE (sizeof(size_t)) #define SIZE_T_BITSIZE (sizeof(size_t) << 3) /* Some constants coerced to size_t */ /* Annoying but necessary to avoid errors on some plaftorms */ #define SIZE_T_ZERO ((size_t)0) #define SIZE_T_ONE ((size_t)1) #define SIZE_T_TWO ((size_t)2) #define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1) #define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2) #define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES) #define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) /* The bit mask value corresponding to MALLOC_ALIGNMENT */ #define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE) /* True if address a has acceptable alignment */ #define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) /* the number of bytes to offset an address to align it */ #define align_offset(A)\ ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\ ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK)) /* -------------------------- MMAP preliminaries ------------------------- */ /* If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and checks to fail so compiler optimizer can delete code rather than using so many "#if"s. */ /* MORECORE and MMAP must return MFAIL on failure */ #define MFAIL ((void*)(MAX_SIZE_T)) #define CMFAIL ((char*)(MFAIL)) /* defined for convenience */ #if !HAVE_MMAP #define IS_MMAPPED_BIT (SIZE_T_ZERO) #define USE_MMAP_BIT (SIZE_T_ZERO) #define CALL_MMAP(s) MFAIL #define CALL_MUNMAP(a, s) (-1) #define DIRECT_MMAP(s) MFAIL #else /* HAVE_MMAP */ #define IS_MMAPPED_BIT (SIZE_T_ONE) #define USE_MMAP_BIT (SIZE_T_ONE) #if !defined(WIN32) && !defined (__OS2__) #define CALL_MUNMAP(a, s) munmap((a), (s)) #define MMAP_PROT (PROT_READ|PROT_WRITE) #if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) #define MAP_ANONYMOUS MAP_ANON #endif /* MAP_ANON */ #ifdef MAP_ANONYMOUS #define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS) #define CALL_MMAP(s) mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0) #else /* MAP_ANONYMOUS */ /* Nearly all versions of mmap support MAP_ANONYMOUS, so the following is unlikely to be needed, but is supplied just in case. */ #define MMAP_FLAGS (MAP_PRIVATE) static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ #define CALL_MMAP(s) ((dev_zero_fd < 0) ? \ (dev_zero_fd = open("/dev/zero", O_RDWR), \ mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \ mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) #endif /* MAP_ANONYMOUS */ #define DIRECT_MMAP(s) CALL_MMAP(s) #elif defined(__OS2__) /* OS/2 MMAP via DosAllocMem */ static void* os2mmap(size_t size) { void* ptr; if (DosAllocMem(&ptr, size, OBJ_ANY|PAG_COMMIT|PAG_READ|PAG_WRITE) && DosAllocMem(&ptr, size, PAG_COMMIT|PAG_READ|PAG_WRITE)) return MFAIL; return ptr; } #define os2direct_mmap(n) os2mmap(n) /* This function supports releasing coalesed segments */ static int os2munmap(void* ptr, size_t size) { while (size) { ULONG ulSize = size; ULONG ulFlags = 0; if (DosQueryMem(ptr, &ulSize, &ulFlags) != 0) return -1; if ((ulFlags & PAG_BASE) == 0 ||(ulFlags & PAG_COMMIT) == 0 || ulSize > size) return -1; if (DosFreeMem(ptr) != 0) return -1; ptr = ( void * ) ( ( char * ) ptr + ulSize ); size -= ulSize; } return 0; } #define CALL_MMAP(s) os2mmap(s) #define CALL_MUNMAP(a, s) os2munmap((a), (s)) #define DIRECT_MMAP(s) os2direct_mmap(s) #else /* WIN32 */ /* Win32 MMAP via VirtualAlloc */ static void* win32mmap(size_t size) { void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE); return (ptr != 0)? ptr: MFAIL; } /* For direct MMAP, use MEM_TOP_DOWN to minimize interference */ static void* win32direct_mmap(size_t size) { void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, PAGE_EXECUTE_READWRITE); return (ptr != 0)? ptr: MFAIL; } /* This function supports releasing coalesed segments */ static int win32munmap(void* ptr, size_t size) { MEMORY_BASIC_INFORMATION minfo; char* cptr = ptr; while (size) { if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0) return -1; if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr || minfo.State != MEM_COMMIT || minfo.RegionSize > size) return -1; if (VirtualFree(cptr, 0, MEM_RELEASE) == 0) return -1; cptr += minfo.RegionSize; size -= minfo.RegionSize; } return 0; } #define CALL_MMAP(s) win32mmap(s) #define CALL_MUNMAP(a, s) win32munmap((a), (s)) #define DIRECT_MMAP(s) win32direct_mmap(s) #endif /* WIN32 */ #endif /* HAVE_MMAP */ #if HAVE_MMAP && HAVE_MREMAP #define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv)) #else /* HAVE_MMAP && HAVE_MREMAP */ #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL #endif /* HAVE_MMAP && HAVE_MREMAP */ #if HAVE_MORECORE #define CALL_MORECORE(S) MORECORE(S) #else /* HAVE_MORECORE */ #define CALL_MORECORE(S) MFAIL #endif /* HAVE_MORECORE */ /* mstate bit set if continguous morecore disabled or failed */ #define USE_NONCONTIGUOUS_BIT (4U) /* segment bit set in create_mspace_with_base */ #define EXTERN_BIT (8U) /* --------------------------- Lock preliminaries ------------------------ */ #if USE_LOCKS /* When locks are defined, there are up to two global locks: * If HAVE_MORECORE, morecore_mutex protects sequences of calls to MORECORE. In many cases sys_alloc requires two calls, that should not be interleaved with calls by other threads. This does not protect against direct calls to MORECORE by other threads not using this lock, so there is still code to cope the best we can on interference. * magic_init_mutex ensures that mparams.magic and other unique mparams values are initialized only once. */ #if !defined(WIN32) && !defined(__OS2__) /* By default use posix locks */ #include #define MLOCK_T pthread_mutex_t #define INITIAL_LOCK(l) pthread_mutex_init(l, NULL) #define ACQUIRE_LOCK(l) pthread_mutex_lock(l) #define RELEASE_LOCK(l) pthread_mutex_unlock(l) #if HAVE_MORECORE static MLOCK_T morecore_mutex = PTHREAD_MUTEX_INITIALIZER; #endif /* HAVE_MORECORE */ static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER; #elif defined(__OS2__) #define MLOCK_T HMTX #define INITIAL_LOCK(l) DosCreateMutexSem(0, l, 0, FALSE) #define ACQUIRE_LOCK(l) DosRequestMutexSem(*l, SEM_INDEFINITE_WAIT) #define RELEASE_LOCK(l) DosReleaseMutexSem(*l) #if HAVE_MORECORE static MLOCK_T morecore_mutex; #endif /* HAVE_MORECORE */ static MLOCK_T magic_init_mutex; #else /* WIN32 */ /* Because lock-protected regions have bounded times, and there are no recursive lock calls, we can use simple spinlocks. */ #define MLOCK_T long static int win32_acquire_lock (MLOCK_T *sl) { for (;;) { #ifdef InterlockedCompareExchangePointer if (!InterlockedCompareExchange(sl, 1, 0)) return 0; #else /* Use older void* version */ if (!InterlockedCompareExchange((void**)sl, (void*)1, (void*)0)) return 0; #endif /* InterlockedCompareExchangePointer */ Sleep (0); } } static void win32_release_lock (MLOCK_T *sl) { InterlockedExchange (sl, 0); } #define INITIAL_LOCK(l) *(l)=0 #define ACQUIRE_LOCK(l) win32_acquire_lock(l) #define RELEASE_LOCK(l) win32_release_lock(l) #if HAVE_MORECORE static MLOCK_T morecore_mutex; #endif /* HAVE_MORECORE */ static MLOCK_T magic_init_mutex; #endif /* WIN32 */ #define USE_LOCK_BIT (2U) #else /* USE_LOCKS */ #define USE_LOCK_BIT (0U) #define INITIAL_LOCK(l) #endif /* USE_LOCKS */ #if USE_LOCKS && HAVE_MORECORE #define ACQUIRE_MORECORE_LOCK() ACQUIRE_LOCK(&morecore_mutex); #define RELEASE_MORECORE_LOCK() RELEASE_LOCK(&morecore_mutex); #else /* USE_LOCKS && HAVE_MORECORE */ #define ACQUIRE_MORECORE_LOCK() #define RELEASE_MORECORE_LOCK() #endif /* USE_LOCKS && HAVE_MORECORE */ #if USE_LOCKS #define ACQUIRE_MAGIC_INIT_LOCK() ACQUIRE_LOCK(&magic_init_mutex); #define RELEASE_MAGIC_INIT_LOCK() RELEASE_LOCK(&magic_init_mutex); #else /* USE_LOCKS */ #define ACQUIRE_MAGIC_INIT_LOCK() #define RELEASE_MAGIC_INIT_LOCK() #endif /* USE_LOCKS */ /* ----------------------- Chunk representations ------------------------ */ /* (The following includes lightly edited explanations by Colin Plumb.) The malloc_chunk declaration below is misleading (but accurate and necessary). It declares a "view" into memory allowing access to necessary fields at known offsets from a given base. Chunks of memory are maintained using a `boundary tag' method as originally described by Knuth. (See the paper by Paul Wilson ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such techniques.) Sizes of free chunks are stored both in the front of each chunk and at the end. This makes consolidating fragmented chunks into bigger chunks fast. The head fields also hold bits representing whether chunks are free or in use. Here are some pictures to make it clearer. They are "exploded" to show that the state of a chunk can be thought of as extending from the high 31 bits of the head field of its header through the prev_foot and PINUSE_BIT bit of the following chunk header. A chunk that's in use looks like: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk (if P = 1) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| | Size of this chunk 1| +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +- -+ | | +- -+ | : +- size - sizeof(size_t) available payload bytes -+ : | chunk-> +- -+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1| | Size of next chunk (may or may not be in use) | +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ And if it's free, it looks like this: chunk-> +- -+ | User payload (must be in use, or we would have merged!) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| | Size of this chunk 0| +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Next pointer | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Prev pointer | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : +- size - sizeof(struct chunk) unused bytes -+ : | chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of this chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0| | Size of next chunk (must be in use, or we would have merged)| +-+ mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | : +- User payload -+ : | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0| +-+ Note that since we always merge adjacent free chunks, the chunks adjacent to a free chunk must be in use. Given a pointer to a chunk (which can be derived trivially from the payload pointer) we can, in O(1) time, find out whether the adjacent chunks are free, and if so, unlink them from the lists that they are on and merge them with the current chunk. Chunks always begin on even word boundaries, so the mem portion (which is returned to the user) is also on an even word boundary, and thus at least double-word aligned. The P (PINUSE_BIT) bit, stored in the unused low-order bit of the chunk size (which is always a multiple of two words), is an in-use bit for the *previous* chunk. If that bit is *clear*, then the word before the current chunk size contains the previous chunk size, and can be used to find the front of the previous chunk. The very first chunk allocated always has this bit set, preventing access to non-existent (or non-owned) memory. If pinuse is set for any given chunk, then you CANNOT determine the size of the previous chunk, and might even get a memory addressing fault when trying to do so. The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of the chunk size redundantly records whether the current chunk is inuse. This redundancy enables usage checks within free and realloc, and reduces indirection when freeing and consolidating chunks. Each freshly allocated chunk must have both cinuse and pinuse set. That is, each allocated chunk borders either a previously allocated and still in-use chunk, or the base of its memory arena. This is ensured by making all allocations from the the `lowest' part of any found chunk. Further, no free chunk physically borders another one, so each free chunk is known to be preceded and followed by either inuse chunks or the ends of memory. Note that the `foot' of the current chunk is actually represented as the prev_foot of the NEXT chunk. This makes it easier to deal with alignments etc but can be very confusing when trying to extend or adapt this code. The exceptions to all this are 1. The special chunk `top' is the top-most available chunk (i.e., the one bordering the end of available memory). It is treated specially. Top is never included in any bin, is used only if no other chunk is available, and is released back to the system if it is very large (see M_TRIM_THRESHOLD). In effect, the top chunk is treated as larger (and thus less well fitting) than any other available chunk. The top chunk doesn't update its trailing size field since there is no next contiguous chunk that would have to index off it. However, space is still allocated for it (TOP_FOOT_SIZE) to enable separation or merging when space is extended. 3. Chunks allocated via mmap, which have the lowest-order bit (IS_MMAPPED_BIT) set in their prev_foot fields, and do not set PINUSE_BIT in their head fields. Because they are allocated one-by-one, each must carry its own prev_foot field, which is also used to hold the offset this chunk has within its mmapped region, which is needed to preserve alignment. Each mmapped chunk is trailed by the first two fields of a fake next-chunk for sake of usage checks. */ struct malloc_chunk { size_t prev_foot; /* Size of previous chunk (if free). */ size_t head; /* Size and inuse bits. */ struct malloc_chunk* fd; /* double links -- used only if free. */ struct malloc_chunk* bk; }; typedef struct malloc_chunk mchunk; typedef struct malloc_chunk* mchunkptr; typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */ typedef unsigned int bindex_t; /* Described below */ typedef unsigned int binmap_t; /* Described below */ typedef unsigned int flag_t; /* The type of various bit flag sets */ /* ------------------- Chunks sizes and alignments ----------------------- */ #define MCHUNK_SIZE (sizeof(mchunk)) #if FOOTERS #define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) #else /* FOOTERS */ #define CHUNK_OVERHEAD (SIZE_T_SIZE) #endif /* FOOTERS */ /* MMapped chunks need a second word of overhead ... */ #define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) /* ... and additional padding for fake next-chunk at foot */ #define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES) /* The smallest size we can malloc is an aligned minimal chunk */ #define MIN_CHUNK_SIZE\ ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) /* conversion from malloc headers to user pointers, and back */ #define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES)) #define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES)) /* chunk associated with aligned address A */ #define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) /* Bounds on request (not chunk) sizes. */ #define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) #define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) /* pad request bytes into a usable size */ #define pad_request(req) \ (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) /* pad request, checking for minimum (but not maximum) */ #define request2size(req) \ (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req)) /* ------------------ Operations on head and foot fields ----------------- */ /* The head field of a chunk is or'ed with PINUSE_BIT when previous adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in use. If the chunk was obtained with mmap, the prev_foot field has IS_MMAPPED_BIT set, otherwise holding the offset of the base of the mmapped region to the base of the chunk. */ #define PINUSE_BIT (SIZE_T_ONE) #define CINUSE_BIT (SIZE_T_TWO) #define INUSE_BITS (PINUSE_BIT|CINUSE_BIT) /* Head value for fenceposts */ #define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE) /* extraction of fields from head words */ #define cinuse(p) ((p)->head & CINUSE_BIT) #define pinuse(p) ((p)->head & PINUSE_BIT) #define chunksize(p) ((p)->head & ~(INUSE_BITS)) #define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT) #define clear_cinuse(p) ((p)->head &= ~CINUSE_BIT) /* Treat space at ptr +/- offset as a chunk */ #define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s))) #define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s))) /* Ptr to next or previous physical malloc_chunk. */ #define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~INUSE_BITS))) #define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) )) /* extract next chunk's pinuse bit */ #define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT) /* Get/set size at footer */ #define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot) #define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s)) /* Set size, pinuse bit, and foot */ #define set_size_and_pinuse_of_free_chunk(p, s)\ ((p)->head = (s|PINUSE_BIT), set_foot(p, s)) /* Set size, pinuse bit, foot, and clear next pinuse */ #define set_free_with_pinuse(p, s, n)\ (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s)) #define is_mmapped(p)\ (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT)) /* Get the internal overhead associated with chunk p */ #define overhead_for(p)\ (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD) /* Return true if malloced space is not necessarily cleared */ #if MMAP_CLEARS #define calloc_must_clear(p) (!is_mmapped(p)) #else /* MMAP_CLEARS */ #define calloc_must_clear(p) (1) #endif /* MMAP_CLEARS */ /* ---------------------- Overlaid data structures ----------------------- */ /* When chunks are not in use, they are treated as nodes of either lists or trees. "Small" chunks are stored in circular doubly-linked lists, and look like this: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `head:' | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Forward pointer to next chunk in list | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Back pointer to previous chunk in list | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Unused space (may be 0 bytes long) . . . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `foot:' | Size of chunk, in bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Larger chunks are kept in a form of bitwise digital trees (aka tries) keyed on chunksizes. Because malloc_tree_chunks are only for free chunks greater than 256 bytes, their size doesn't impose any constraints on user chunk sizes. Each node looks like: chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Size of previous chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `head:' | Size of chunk, in bytes |P| mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Forward pointer to next chunk of same size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Back pointer to previous chunk of same size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Pointer to left child (child[0]) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Pointer to right child (child[1]) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Pointer to parent | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | bin index of this chunk | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Unused space . . | nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ `foot:' | Size of chunk, in bytes | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Each tree holding treenodes is a tree of unique chunk sizes. Chunks of the same size are arranged in a circularly-linked list, with only the oldest chunk (the next to be used, in our FIFO ordering) actually in the tree. (Tree members are distinguished by a non-null parent pointer.) If a chunk with the same size an an existing node is inserted, it is linked off the existing node using pointers that work in the same way as fd/bk pointers of small chunks. Each tree contains a power of 2 sized range of chunk sizes (the smallest is 0x100 <= x < 0x180), which is is divided in half at each tree level, with the chunks in the smaller half of the range (0x100 <= x < 0x140 for the top nose) in the left subtree and the larger half (0x140 <= x < 0x180) in the right subtree. This is, of course, done by inspecting individual bits. Using these rules, each node's left subtree contains all smaller sizes than its right subtree. However, the node at the root of each subtree has no particular ordering relationship to either. (The dividing line between the subtree sizes is based on trie relation.) If we remove the last chunk of a given size from the interior of the tree, we need to replace it with a leaf node. The tree ordering rules permit a node to be replaced by any leaf below it. The smallest chunk in a tree (a common operation in a best-fit allocator) can be found by walking a path to the leftmost leaf in the tree. Unlike a usual binary tree, where we follow left child pointers until we reach a null, here we follow the right child pointer any time the left one is null, until we reach a leaf with both child pointers null. The smallest chunk in the tree will be somewhere along that path. The worst case number of steps to add, find, or remove a node is bounded by the number of bits differentiating chunks within bins. Under current bin calculations, this ranges from 6 up to 21 (for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case is of course much better. */ struct malloc_tree_chunk { /* The first four fields must be compatible with malloc_chunk */ size_t prev_foot; size_t head; struct malloc_tree_chunk* fd; struct malloc_tree_chunk* bk; struct malloc_tree_chunk* child[2]; struct malloc_tree_chunk* parent; bindex_t index; }; typedef struct malloc_tree_chunk tchunk; typedef struct malloc_tree_chunk* tchunkptr; typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */ /* A little helper macro for trees */ #define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1]) /* ----------------------------- Segments -------------------------------- */ /* Each malloc space may include non-contiguous segments, held in a list headed by an embedded malloc_segment record representing the top-most space. Segments also include flags holding properties of the space. Large chunks that are directly allocated by mmap are not included in this list. They are instead independently created and destroyed without otherwise keeping track of them. Segment management mainly comes into play for spaces allocated by MMAP. Any call to MMAP might or might not return memory that is adjacent to an existing segment. MORECORE normally contiguously extends the current space, so this space is almost always adjacent, which is simpler and faster to deal with. (This is why MORECORE is used preferentially to MMAP when both are available -- see sys_alloc.) When allocating using MMAP, we don't use any of the hinting mechanisms (inconsistently) supported in various implementations of unix mmap, or distinguish reserving from committing memory. Instead, we just ask for space, and exploit contiguity when we get it. It is probably possible to do better than this on some systems, but no general scheme seems to be significantly better. Management entails a simpler variant of the consolidation scheme used for chunks to reduce fragmentation -- new adjacent memory is normally prepended or appended to an existing segment. However, there are limitations compared to chunk consolidation that mostly reflect the fact that segment processing is relatively infrequent (occurring only when getting memory from system) and that we don't expect to have huge numbers of segments: * Segments are not indexed, so traversal requires linear scans. (It would be possible to index these, but is not worth the extra overhead and complexity for most programs on most platforms.) * New segments are only appended to old ones when holding top-most memory; if they cannot be prepended to others, they are held in different segments. Except for the top-most segment of an mstate, each segment record is kept at the tail of its segment. Segments are added by pushing segment records onto the list headed by &mstate.seg for the containing mstate. Segment flags control allocation/merge/deallocation policies: * If EXTERN_BIT set, then we did not allocate this segment, and so should not try to deallocate or merge with others. (This currently holds only for the initial segment passed into create_mspace_with_base.) * If IS_MMAPPED_BIT set, the segment may be merged with other surrounding mmapped segments and trimmed/de-allocated using munmap. * If neither bit is set, then the segment was obtained using MORECORE so can be merged with surrounding MORECORE'd segments and deallocated/trimmed using MORECORE with negative arguments. */ struct malloc_segment { char* base; /* base address */ size_t size; /* allocated size */ struct malloc_segment* next; /* ptr to next segment */ #if FFI_MMAP_EXEC_WRIT /* The mmap magic is supposed to store the address of the executable segment at the very end of the requested block. */ # define mmap_exec_offset(b,s) (*(ptrdiff_t*)((b)+(s)-sizeof(ptrdiff_t))) /* We can only merge segments if their corresponding executable segments are at identical offsets. */ # define check_segment_merge(S,b,s) \ (mmap_exec_offset((b),(s)) == (S)->exec_offset) # define add_segment_exec_offset(p,S) ((char*)(p) + (S)->exec_offset) # define sub_segment_exec_offset(p,S) ((char*)(p) - (S)->exec_offset) /* The removal of sflags only works with HAVE_MORECORE == 0. */ # define get_segment_flags(S) (IS_MMAPPED_BIT) # define set_segment_flags(S,v) \ (((v) != IS_MMAPPED_BIT) ? (ABORT, (v)) : \ (((S)->exec_offset = \ mmap_exec_offset((S)->base, (S)->size)), \ (mmap_exec_offset((S)->base + (S)->exec_offset, (S)->size) != \ (S)->exec_offset) ? (ABORT, (v)) : \ (mmap_exec_offset((S)->base, (S)->size) = 0), (v))) /* We use an offset here, instead of a pointer, because then, when base changes, we don't have to modify this. On architectures with segmented addresses, this might not work. */ ptrdiff_t exec_offset; #else # define get_segment_flags(S) ((S)->sflags) # define set_segment_flags(S,v) ((S)->sflags = (v)) # define check_segment_merge(S,b,s) (1) flag_t sflags; /* mmap and extern flag */ #endif }; #define is_mmapped_segment(S) (get_segment_flags(S) & IS_MMAPPED_BIT) #define is_extern_segment(S) (get_segment_flags(S) & EXTERN_BIT) typedef struct malloc_segment msegment; typedef struct malloc_segment* msegmentptr; /* ---------------------------- malloc_state ----------------------------- */ /* A malloc_state holds all of the bookkeeping for a space. The main fields are: Top The topmost chunk of the currently active segment. Its size is cached in topsize. The actual size of topmost space is topsize+TOP_FOOT_SIZE, which includes space reserved for adding fenceposts and segment records if necessary when getting more space from the system. The size at which to autotrim top is cached from mparams in trim_check, except that it is disabled if an autotrim fails. Designated victim (dv) This is the preferred chunk for servicing small requests that don't have exact fits. It is normally the chunk split off most recently to service another small request. Its size is cached in dvsize. The link fields of this chunk are not maintained since it is not kept in a bin. SmallBins An array of bin headers for free chunks. These bins hold chunks with sizes less than MIN_LARGE_SIZE bytes. Each bin contains chunks of all the same size, spaced 8 bytes apart. To simplify use in double-linked lists, each bin header acts as a malloc_chunk pointing to the real first node, if it exists (else pointing to itself). This avoids special-casing for headers. But to avoid waste, we allocate only the fd/bk pointers of bins, and then use repositioning tricks to treat these as the fields of a chunk. TreeBins Treebins are pointers to the roots of trees holding a range of sizes. There are 2 equally spaced treebins for each power of two from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything larger. Bin maps There is one bit map for small bins ("smallmap") and one for treebins ("treemap). Each bin sets its bit when non-empty, and clears the bit when empty. Bit operations are then used to avoid bin-by-bin searching -- nearly all "search" is done without ever looking at bins that won't be selected. The bit maps conservatively use 32 bits per map word, even if on 64bit system. For a good description of some of the bit-based techniques used here, see Henry S. Warren Jr's book "Hacker's Delight" (and supplement at http://hackersdelight.org/). Many of these are intended to reduce the branchiness of paths through malloc etc, as well as to reduce the number of memory locations read or written. Segments A list of segments headed by an embedded malloc_segment record representing the initial space. Address check support The least_addr field is the least address ever obtained from MORECORE or MMAP. Attempted frees and reallocs of any address less than this are trapped (unless INSECURE is defined). Magic tag A cross-check field that should always hold same value as mparams.magic. Flags Bits recording whether to use MMAP, locks, or contiguous MORECORE Statistics Each space keeps track of current and maximum system memory obtained via MORECORE or MMAP. Locking If USE_LOCKS is defined, the "mutex" lock is acquired and released around every public call using this mspace. */ /* Bin types, widths and sizes */ #define NSMALLBINS (32U) #define NTREEBINS (32U) #define SMALLBIN_SHIFT (3U) #define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) #define TREEBIN_SHIFT (8U) #define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) #define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) #define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) struct malloc_state { binmap_t smallmap; binmap_t treemap; size_t dvsize; size_t topsize; char* least_addr; mchunkptr dv; mchunkptr top; size_t trim_check; size_t magic; mchunkptr smallbins[(NSMALLBINS+1)*2]; tbinptr treebins[NTREEBINS]; size_t footprint; size_t max_footprint; flag_t mflags; #if USE_LOCKS MLOCK_T mutex; /* locate lock among fields that rarely change */ #endif /* USE_LOCKS */ msegment seg; }; typedef struct malloc_state* mstate; /* ------------- Global malloc_state and malloc_params ------------------- */ /* malloc_params holds global properties, including those that can be dynamically set using mallopt. There is a single instance, mparams, initialized in init_mparams. */ struct malloc_params { size_t magic; size_t page_size; size_t granularity; size_t mmap_threshold; size_t trim_threshold; flag_t default_mflags; }; static struct malloc_params mparams; /* The global malloc_state used for all non-"mspace" calls */ static struct malloc_state _gm_; #define gm (&_gm_) #define is_global(M) ((M) == &_gm_) #define is_initialized(M) ((M)->top != 0) /* -------------------------- system alloc setup ------------------------- */ /* Operations on mflags */ #define use_lock(M) ((M)->mflags & USE_LOCK_BIT) #define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT) #define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT) #define use_mmap(M) ((M)->mflags & USE_MMAP_BIT) #define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT) #define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT) #define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT) #define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT) #define set_lock(M,L)\ ((M)->mflags = (L)?\ ((M)->mflags | USE_LOCK_BIT) :\ ((M)->mflags & ~USE_LOCK_BIT)) /* page-align a size */ #define page_align(S)\ (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE)) /* granularity-align a size */ #define granularity_align(S)\ (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE)) #define is_page_aligned(S)\ (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0) #define is_granularity_aligned(S)\ (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0) /* True if segment S holds address A */ #define segment_holds(S, A)\ ((char*)(A) >= S->base && (char*)(A) < S->base + S->size) /* Return segment holding given address */ static msegmentptr segment_holding(mstate m, char* addr) { msegmentptr sp = &m->seg; for (;;) { if (addr >= sp->base && addr < sp->base + sp->size) return sp; if ((sp = sp->next) == 0) return 0; } } /* Return true if segment contains a segment link */ static int has_segment_link(mstate m, msegmentptr ss) { msegmentptr sp = &m->seg; for (;;) { if ((char*)sp >= ss->base && (char*)sp < ss->base + ss->size) return 1; if ((sp = sp->next) == 0) return 0; } } #ifndef MORECORE_CANNOT_TRIM #define should_trim(M,s) ((s) > (M)->trim_check) #else /* MORECORE_CANNOT_TRIM */ #define should_trim(M,s) (0) #endif /* MORECORE_CANNOT_TRIM */ /* TOP_FOOT_SIZE is padding at the end of a segment, including space that may be needed to place segment records and fenceposts when new noncontiguous segments are added. */ #define TOP_FOOT_SIZE\ (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) /* ------------------------------- Hooks -------------------------------- */ /* PREACTION should be defined to return 0 on success, and nonzero on failure. If you are not using locking, you can redefine these to do anything you like. */ #if USE_LOCKS /* Ensure locks are initialized */ #define GLOBALLY_INITIALIZE() (mparams.page_size == 0 && init_mparams()) #define PREACTION(M) ((GLOBALLY_INITIALIZE() || use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0) #define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); } #else /* USE_LOCKS */ #ifndef PREACTION #define PREACTION(M) (0) #endif /* PREACTION */ #ifndef POSTACTION #define POSTACTION(M) #endif /* POSTACTION */ #endif /* USE_LOCKS */ /* CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses. USAGE_ERROR_ACTION is triggered on detected bad frees and reallocs. The argument p is an address that might have triggered the fault. It is ignored by the two predefined actions, but might be useful in custom actions that try to help diagnose errors. */ #if PROCEED_ON_ERROR /* A count of the number of corruption errors causing resets */ int malloc_corruption_error_count; /* default corruption action */ static void reset_on_error(mstate m); #define CORRUPTION_ERROR_ACTION(m) reset_on_error(m) #define USAGE_ERROR_ACTION(m, p) #else /* PROCEED_ON_ERROR */ #ifndef CORRUPTION_ERROR_ACTION #define CORRUPTION_ERROR_ACTION(m) ABORT #endif /* CORRUPTION_ERROR_ACTION */ #ifndef USAGE_ERROR_ACTION #define USAGE_ERROR_ACTION(m,p) ABORT #endif /* USAGE_ERROR_ACTION */ #endif /* PROCEED_ON_ERROR */ /* -------------------------- Debugging setup ---------------------------- */ #if ! DEBUG #define check_free_chunk(M,P) #define check_inuse_chunk(M,P) #define check_malloced_chunk(M,P,N) #define check_mmapped_chunk(M,P) #define check_malloc_state(M) #define check_top_chunk(M,P) #else /* DEBUG */ #define check_free_chunk(M,P) do_check_free_chunk(M,P) #define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P) #define check_top_chunk(M,P) do_check_top_chunk(M,P) #define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N) #define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P) #define check_malloc_state(M) do_check_malloc_state(M) static void do_check_any_chunk(mstate m, mchunkptr p); static void do_check_top_chunk(mstate m, mchunkptr p); static void do_check_mmapped_chunk(mstate m, mchunkptr p); static void do_check_inuse_chunk(mstate m, mchunkptr p); static void do_check_free_chunk(mstate m, mchunkptr p); static void do_check_malloced_chunk(mstate m, void* mem, size_t s); static void do_check_tree(mstate m, tchunkptr t); static void do_check_treebin(mstate m, bindex_t i); static void do_check_smallbin(mstate m, bindex_t i); static void do_check_malloc_state(mstate m); static int bin_find(mstate m, mchunkptr x); static size_t traverse_and_check(mstate m); #endif /* DEBUG */ /* ---------------------------- Indexing Bins ---------------------------- */ #define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) #define small_index(s) ((s) >> SMALLBIN_SHIFT) #define small_index2size(i) ((i) << SMALLBIN_SHIFT) #define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) /* addressing by index. See above about smallbin repositioning */ #define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1]))) #define treebin_at(M,i) (&((M)->treebins[i])) /* assign tree index for size S to variable I */ #if defined(__GNUC__) && defined(i386) #define compute_tree_index(S, I)\ {\ size_t X = S >> TREEBIN_SHIFT;\ if (X == 0)\ I = 0;\ else if (X > 0xFFFF)\ I = NTREEBINS-1;\ else {\ unsigned int K;\ __asm__("bsrl %1,%0\n\t" : "=r" (K) : "rm" (X));\ I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\ }\ } #else /* GNUC */ #define compute_tree_index(S, I)\ {\ size_t X = S >> TREEBIN_SHIFT;\ if (X == 0)\ I = 0;\ else if (X > 0xFFFF)\ I = NTREEBINS-1;\ else {\ unsigned int Y = (unsigned int)X;\ unsigned int N = ((Y - 0x100) >> 16) & 8;\ unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\ N += K;\ N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\ K = 14 - N + ((Y <<= K) >> 15);\ I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\ }\ } #endif /* GNUC */ /* Bit representing maximum resolved size in a treebin at i */ #define bit_for_tree_index(i) \ (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2) /* Shift placing maximum resolved bit in a treebin at i as sign bit */ #define leftshift_for_tree_index(i) \ ((i == NTREEBINS-1)? 0 : \ ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2))) /* The size of the smallest chunk held in bin with index i */ #define minsize_for_tree_index(i) \ ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \ (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1))) /* ------------------------ Operations on bin maps ----------------------- */ /* bit corresponding to given index */ #define idx2bit(i) ((binmap_t)(1) << (i)) /* Mark/Clear bits with given index */ #define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i)) #define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i)) #define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i)) #define mark_treemap(M,i) ((M)->treemap |= idx2bit(i)) #define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i)) #define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i)) /* index corresponding to given bit */ #if defined(__GNUC__) && defined(i386) #define compute_bit2idx(X, I)\ {\ unsigned int J;\ __asm__("bsfl %1,%0\n\t" : "=r" (J) : "rm" (X));\ I = (bindex_t)J;\ } #else /* GNUC */ #if USE_BUILTIN_FFS #define compute_bit2idx(X, I) I = ffs(X)-1 #else /* USE_BUILTIN_FFS */ #define compute_bit2idx(X, I)\ {\ unsigned int Y = X - 1;\ unsigned int K = Y >> (16-4) & 16;\ unsigned int N = K; Y >>= K;\ N += K = Y >> (8-3) & 8; Y >>= K;\ N += K = Y >> (4-2) & 4; Y >>= K;\ N += K = Y >> (2-1) & 2; Y >>= K;\ N += K = Y >> (1-0) & 1; Y >>= K;\ I = (bindex_t)(N + Y);\ } #endif /* USE_BUILTIN_FFS */ #endif /* GNUC */ /* isolate the least set bit of a bitmap */ #define least_bit(x) ((x) & -(x)) /* mask with all bits to left of least bit of x on */ #define left_bits(x) ((x<<1) | -(x<<1)) /* mask with all bits to left of or equal to least bit of x on */ #define same_or_left_bits(x) ((x) | -(x)) /* ----------------------- Runtime Check Support ------------------------- */ /* For security, the main invariant is that malloc/free/etc never writes to a static address other than malloc_state, unless static malloc_state itself has been corrupted, which cannot occur via malloc (because of these checks). In essence this means that we believe all pointers, sizes, maps etc held in malloc_state, but check all of those linked or offsetted from other embedded data structures. These checks are interspersed with main code in a way that tends to minimize their run-time cost. When FOOTERS is defined, in addition to range checking, we also verify footer fields of inuse chunks, which can be used guarantee that the mstate controlling malloc/free is intact. This is a streamlined version of the approach described by William Robertson et al in "Run-time Detection of Heap-based Overflows" LISA'03 http://www.usenix.org/events/lisa03/tech/robertson.html The footer of an inuse chunk holds the xor of its mstate and a random seed, that is checked upon calls to free() and realloc(). This is (probablistically) unguessable from outside the program, but can be computed by any code successfully malloc'ing any chunk, so does not itself provide protection against code that has already broken security through some other means. Unlike Robertson et al, we always dynamically check addresses of all offset chunks (previous, next, etc). This turns out to be cheaper than relying on hashes. */ #if !INSECURE /* Check if address a is at least as high as any from MORECORE or MMAP */ #define ok_address(M, a) ((char*)(a) >= (M)->least_addr) /* Check if address of next chunk n is higher than base chunk p */ #define ok_next(p, n) ((char*)(p) < (char*)(n)) /* Check if p has its cinuse bit on */ #define ok_cinuse(p) cinuse(p) /* Check if p has its pinuse bit on */ #define ok_pinuse(p) pinuse(p) #else /* !INSECURE */ #define ok_address(M, a) (1) #define ok_next(b, n) (1) #define ok_cinuse(p) (1) #define ok_pinuse(p) (1) #endif /* !INSECURE */ #if (FOOTERS && !INSECURE) /* Check if (alleged) mstate m has expected magic field */ #define ok_magic(M) ((M)->magic == mparams.magic) #else /* (FOOTERS && !INSECURE) */ #define ok_magic(M) (1) #endif /* (FOOTERS && !INSECURE) */ /* In gcc, use __builtin_expect to minimize impact of checks */ #if !INSECURE #if defined(__GNUC__) && __GNUC__ >= 3 #define RTCHECK(e) __builtin_expect(e, 1) #else /* GNUC */ #define RTCHECK(e) (e) #endif /* GNUC */ #else /* !INSECURE */ #define RTCHECK(e) (1) #endif /* !INSECURE */ /* macros to set up inuse chunks with or without footers */ #if !FOOTERS #define mark_inuse_foot(M,p,s) /* Set cinuse bit and pinuse bit of next chunk */ #define set_inuse(M,p,s)\ ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) /* Set cinuse and pinuse of this chunk and pinuse of next chunk */ #define set_inuse_and_pinuse(M,p,s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) /* Set size, cinuse and pinuse bit of this chunk */ #define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT)) #else /* FOOTERS */ /* Set foot of inuse chunk to be xor of mstate and seed */ #define mark_inuse_foot(M,p,s)\ (((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic)) #define get_mstate_for(p)\ ((mstate)(((mchunkptr)((char*)(p) +\ (chunksize(p))))->prev_foot ^ mparams.magic)) #define set_inuse(M,p,s)\ ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \ mark_inuse_foot(M,p,s)) #define set_inuse_and_pinuse(M,p,s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\ mark_inuse_foot(M,p,s)) #define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ mark_inuse_foot(M, p, s)) #endif /* !FOOTERS */ /* ---------------------------- setting mparams -------------------------- */ /* Initialize mparams */ static int init_mparams(void) { if (mparams.page_size == 0) { size_t s; mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD; mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD; #if MORECORE_CONTIGUOUS mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT; #else /* MORECORE_CONTIGUOUS */ mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT; #endif /* MORECORE_CONTIGUOUS */ #if (FOOTERS && !INSECURE) { #if USE_DEV_RANDOM int fd; unsigned char buf[sizeof(size_t)]; /* Try to use /dev/urandom, else fall back on using time */ if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 && read(fd, buf, sizeof(buf)) == sizeof(buf)) { s = *((size_t *) buf); close(fd); } else #endif /* USE_DEV_RANDOM */ s = (size_t)(time(0) ^ (size_t)0x55555555U); s |= (size_t)8U; /* ensure nonzero */ s &= ~(size_t)7U; /* improve chances of fault for bad values */ } #else /* (FOOTERS && !INSECURE) */ s = (size_t)0x58585858U; #endif /* (FOOTERS && !INSECURE) */ ACQUIRE_MAGIC_INIT_LOCK(); if (mparams.magic == 0) { mparams.magic = s; /* Set up lock for main malloc area */ INITIAL_LOCK(&gm->mutex); gm->mflags = mparams.default_mflags; } RELEASE_MAGIC_INIT_LOCK(); #if !defined(WIN32) && !defined(__OS2__) mparams.page_size = malloc_getpagesize; mparams.granularity = ((DEFAULT_GRANULARITY != 0)? DEFAULT_GRANULARITY : mparams.page_size); #elif defined (__OS2__) /* if low-memory is used, os2munmap() would break if it were anything other than 64k */ mparams.page_size = 4096u; mparams.granularity = 65536u; #else /* WIN32 */ { SYSTEM_INFO system_info; GetSystemInfo(&system_info); mparams.page_size = system_info.dwPageSize; mparams.granularity = system_info.dwAllocationGranularity; } #endif /* WIN32 */ /* Sanity-check configuration: size_t must be unsigned and as wide as pointer type. ints must be at least 4 bytes. alignment must be at least 8. Alignment, min chunk size, and page size must all be powers of 2. */ if ((sizeof(size_t) != sizeof(char*)) || (MAX_SIZE_T < MIN_CHUNK_SIZE) || (sizeof(int) < 4) || (MALLOC_ALIGNMENT < (size_t)8U) || ((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-SIZE_T_ONE)) != 0) || ((MCHUNK_SIZE & (MCHUNK_SIZE-SIZE_T_ONE)) != 0) || ((mparams.granularity & (mparams.granularity-SIZE_T_ONE)) != 0) || ((mparams.page_size & (mparams.page_size-SIZE_T_ONE)) != 0)) ABORT; } return 0; } /* support for mallopt */ static int change_mparam(int param_number, int value) { size_t val = (size_t)value; init_mparams(); switch(param_number) { case M_TRIM_THRESHOLD: mparams.trim_threshold = val; return 1; case M_GRANULARITY: if (val >= mparams.page_size && ((val & (val-1)) == 0)) { mparams.granularity = val; return 1; } else return 0; case M_MMAP_THRESHOLD: mparams.mmap_threshold = val; return 1; default: return 0; } } #if DEBUG /* ------------------------- Debugging Support --------------------------- */ /* Check properties of any chunk, whether free, inuse, mmapped etc */ static void do_check_any_chunk(mstate m, mchunkptr p) { assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); assert(ok_address(m, p)); } /* Check properties of top chunk */ static void do_check_top_chunk(mstate m, mchunkptr p) { msegmentptr sp = segment_holding(m, (char*)p); size_t sz = chunksize(p); assert(sp != 0); assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); assert(ok_address(m, p)); assert(sz == m->topsize); assert(sz > 0); assert(sz == ((sp->base + sp->size) - (char*)p) - TOP_FOOT_SIZE); assert(pinuse(p)); assert(!next_pinuse(p)); } /* Check properties of (inuse) mmapped chunks */ static void do_check_mmapped_chunk(mstate m, mchunkptr p) { size_t sz = chunksize(p); size_t len = (sz + (p->prev_foot & ~IS_MMAPPED_BIT) + MMAP_FOOT_PAD); assert(is_mmapped(p)); assert(use_mmap(m)); assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); assert(ok_address(m, p)); assert(!is_small(sz)); assert((len & (mparams.page_size-SIZE_T_ONE)) == 0); assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD); assert(chunk_plus_offset(p, sz+SIZE_T_SIZE)->head == 0); } /* Check properties of inuse chunks */ static void do_check_inuse_chunk(mstate m, mchunkptr p) { do_check_any_chunk(m, p); assert(cinuse(p)); assert(next_pinuse(p)); /* If not pinuse and not mmapped, previous chunk has OK offset */ assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p); if (is_mmapped(p)) do_check_mmapped_chunk(m, p); } /* Check properties of free chunks */ static void do_check_free_chunk(mstate m, mchunkptr p) { size_t sz = p->head & ~(PINUSE_BIT|CINUSE_BIT); mchunkptr next = chunk_plus_offset(p, sz); do_check_any_chunk(m, p); assert(!cinuse(p)); assert(!next_pinuse(p)); assert (!is_mmapped(p)); if (p != m->dv && p != m->top) { if (sz >= MIN_CHUNK_SIZE) { assert((sz & CHUNK_ALIGN_MASK) == 0); assert(is_aligned(chunk2mem(p))); assert(next->prev_foot == sz); assert(pinuse(p)); assert (next == m->top || cinuse(next)); assert(p->fd->bk == p); assert(p->bk->fd == p); } else /* markers are always of size SIZE_T_SIZE */ assert(sz == SIZE_T_SIZE); } } /* Check properties of malloced chunks at the point they are malloced */ static void do_check_malloced_chunk(mstate m, void* mem, size_t s) { if (mem != 0) { mchunkptr p = mem2chunk(mem); size_t sz = p->head & ~(PINUSE_BIT|CINUSE_BIT); do_check_inuse_chunk(m, p); assert((sz & CHUNK_ALIGN_MASK) == 0); assert(sz >= MIN_CHUNK_SIZE); assert(sz >= s); /* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */ assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE)); } } /* Check a tree and its subtrees. */ static void do_check_tree(mstate m, tchunkptr t) { tchunkptr head = 0; tchunkptr u = t; bindex_t tindex = t->index; size_t tsize = chunksize(t); bindex_t idx; compute_tree_index(tsize, idx); assert(tindex == idx); assert(tsize >= MIN_LARGE_SIZE); assert(tsize >= minsize_for_tree_index(idx)); assert((idx == NTREEBINS-1) || (tsize < minsize_for_tree_index((idx+1)))); do { /* traverse through chain of same-sized nodes */ do_check_any_chunk(m, ((mchunkptr)u)); assert(u->index == tindex); assert(chunksize(u) == tsize); assert(!cinuse(u)); assert(!next_pinuse(u)); assert(u->fd->bk == u); assert(u->bk->fd == u); if (u->parent == 0) { assert(u->child[0] == 0); assert(u->child[1] == 0); } else { assert(head == 0); /* only one node on chain has parent */ head = u; assert(u->parent != u); assert (u->parent->child[0] == u || u->parent->child[1] == u || *((tbinptr*)(u->parent)) == u); if (u->child[0] != 0) { assert(u->child[0]->parent == u); assert(u->child[0] != u); do_check_tree(m, u->child[0]); } if (u->child[1] != 0) { assert(u->child[1]->parent == u); assert(u->child[1] != u); do_check_tree(m, u->child[1]); } if (u->child[0] != 0 && u->child[1] != 0) { assert(chunksize(u->child[0]) < chunksize(u->child[1])); } } u = u->fd; } while (u != t); assert(head != 0); } /* Check all the chunks in a treebin. */ static void do_check_treebin(mstate m, bindex_t i) { tbinptr* tb = treebin_at(m, i); tchunkptr t = *tb; int empty = (m->treemap & (1U << i)) == 0; if (t == 0) assert(empty); if (!empty) do_check_tree(m, t); } /* Check all the chunks in a smallbin. */ static void do_check_smallbin(mstate m, bindex_t i) { sbinptr b = smallbin_at(m, i); mchunkptr p = b->bk; unsigned int empty = (m->smallmap & (1U << i)) == 0; if (p == b) assert(empty); if (!empty) { for (; p != b; p = p->bk) { size_t size = chunksize(p); mchunkptr q; /* each chunk claims to be free */ do_check_free_chunk(m, p); /* chunk belongs in bin */ assert(small_index(size) == i); assert(p->bk == b || chunksize(p->bk) == chunksize(p)); /* chunk is followed by an inuse chunk */ q = next_chunk(p); if (q->head != FENCEPOST_HEAD) do_check_inuse_chunk(m, q); } } } /* Find x in a bin. Used in other check functions. */ static int bin_find(mstate m, mchunkptr x) { size_t size = chunksize(x); if (is_small(size)) { bindex_t sidx = small_index(size); sbinptr b = smallbin_at(m, sidx); if (smallmap_is_marked(m, sidx)) { mchunkptr p = b; do { if (p == x) return 1; } while ((p = p->fd) != b); } } else { bindex_t tidx; compute_tree_index(size, tidx); if (treemap_is_marked(m, tidx)) { tchunkptr t = *treebin_at(m, tidx); size_t sizebits = size << leftshift_for_tree_index(tidx); while (t != 0 && chunksize(t) != size) { t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; sizebits <<= 1; } if (t != 0) { tchunkptr u = t; do { if (u == (tchunkptr)x) return 1; } while ((u = u->fd) != t); } } } return 0; } /* Traverse each chunk and check it; return total */ static size_t traverse_and_check(mstate m) { size_t sum = 0; if (is_initialized(m)) { msegmentptr s = &m->seg; sum += m->topsize + TOP_FOOT_SIZE; while (s != 0) { mchunkptr q = align_as_chunk(s->base); mchunkptr lastq = 0; assert(pinuse(q)); while (segment_holds(s, q) && q != m->top && q->head != FENCEPOST_HEAD) { sum += chunksize(q); if (cinuse(q)) { assert(!bin_find(m, q)); do_check_inuse_chunk(m, q); } else { assert(q == m->dv || bin_find(m, q)); assert(lastq == 0 || cinuse(lastq)); /* Not 2 consecutive free */ do_check_free_chunk(m, q); } lastq = q; q = next_chunk(q); } s = s->next; } } return sum; } /* Check all properties of malloc_state. */ static void do_check_malloc_state(mstate m) { bindex_t i; size_t total; /* check bins */ for (i = 0; i < NSMALLBINS; ++i) do_check_smallbin(m, i); for (i = 0; i < NTREEBINS; ++i) do_check_treebin(m, i); if (m->dvsize != 0) { /* check dv chunk */ do_check_any_chunk(m, m->dv); assert(m->dvsize == chunksize(m->dv)); assert(m->dvsize >= MIN_CHUNK_SIZE); assert(bin_find(m, m->dv) == 0); } if (m->top != 0) { /* check top chunk */ do_check_top_chunk(m, m->top); assert(m->topsize == chunksize(m->top)); assert(m->topsize > 0); assert(bin_find(m, m->top) == 0); } total = traverse_and_check(m); assert(total <= m->footprint); assert(m->footprint <= m->max_footprint); } #endif /* DEBUG */ /* ----------------------------- statistics ------------------------------ */ #if !NO_MALLINFO static struct mallinfo internal_mallinfo(mstate m) { struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; if (!PREACTION(m)) { check_malloc_state(m); if (is_initialized(m)) { size_t nfree = SIZE_T_ONE; /* top always free */ size_t mfree = m->topsize + TOP_FOOT_SIZE; size_t sum = mfree; msegmentptr s = &m->seg; while (s != 0) { mchunkptr q = align_as_chunk(s->base); while (segment_holds(s, q) && q != m->top && q->head != FENCEPOST_HEAD) { size_t sz = chunksize(q); sum += sz; if (!cinuse(q)) { mfree += sz; ++nfree; } q = next_chunk(q); } s = s->next; } nm.arena = sum; nm.ordblks = nfree; nm.hblkhd = m->footprint - sum; nm.usmblks = m->max_footprint; nm.uordblks = m->footprint - mfree; nm.fordblks = mfree; nm.keepcost = m->topsize; } POSTACTION(m); } return nm; } #endif /* !NO_MALLINFO */ static void internal_malloc_stats(mstate m) { if (!PREACTION(m)) { size_t maxfp = 0; size_t fp = 0; size_t used = 0; check_malloc_state(m); if (is_initialized(m)) { msegmentptr s = &m->seg; maxfp = m->max_footprint; fp = m->footprint; used = fp - (m->topsize + TOP_FOOT_SIZE); while (s != 0) { mchunkptr q = align_as_chunk(s->base); while (segment_holds(s, q) && q != m->top && q->head != FENCEPOST_HEAD) { if (!cinuse(q)) used -= chunksize(q); q = next_chunk(q); } s = s->next; } } fprintf(stderr, "max system bytes = %10lu\n", (unsigned long)(maxfp)); fprintf(stderr, "system bytes = %10lu\n", (unsigned long)(fp)); fprintf(stderr, "in use bytes = %10lu\n", (unsigned long)(used)); POSTACTION(m); } } /* ----------------------- Operations on smallbins ----------------------- */ /* Various forms of linking and unlinking are defined as macros. Even the ones for trees, which are very long but have very short typical paths. This is ugly but reduces reliance on inlining support of compilers. */ /* Link a free chunk into a smallbin */ #define insert_small_chunk(M, P, S) {\ bindex_t I = small_index(S);\ mchunkptr B = smallbin_at(M, I);\ mchunkptr F = B;\ assert(S >= MIN_CHUNK_SIZE);\ if (!smallmap_is_marked(M, I))\ mark_smallmap(M, I);\ else if (RTCHECK(ok_address(M, B->fd)))\ F = B->fd;\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ B->fd = P;\ F->bk = P;\ P->fd = F;\ P->bk = B;\ } /* Unlink a chunk from a smallbin */ #define unlink_small_chunk(M, P, S) {\ mchunkptr F = P->fd;\ mchunkptr B = P->bk;\ bindex_t I = small_index(S);\ assert(P != B);\ assert(P != F);\ assert(chunksize(P) == small_index2size(I));\ if (F == B)\ clear_smallmap(M, I);\ else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&\ (B == smallbin_at(M,I) || ok_address(M, B)))) {\ F->bk = B;\ B->fd = F;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ } /* Unlink the first chunk from a smallbin */ #define unlink_first_small_chunk(M, B, P, I) {\ mchunkptr F = P->fd;\ assert(P != B);\ assert(P != F);\ assert(chunksize(P) == small_index2size(I));\ if (B == F)\ clear_smallmap(M, I);\ else if (RTCHECK(ok_address(M, F))) {\ B->fd = F;\ F->bk = B;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ } /* Replace dv node, binning the old one */ /* Used only when dvsize known to be small */ #define replace_dv(M, P, S) {\ size_t DVS = M->dvsize;\ if (DVS != 0) {\ mchunkptr DV = M->dv;\ assert(is_small(DVS));\ insert_small_chunk(M, DV, DVS);\ }\ M->dvsize = S;\ M->dv = P;\ } /* ------------------------- Operations on trees ------------------------- */ /* Insert chunk into tree */ #define insert_large_chunk(M, X, S) {\ tbinptr* H;\ bindex_t I;\ compute_tree_index(S, I);\ H = treebin_at(M, I);\ X->index = I;\ X->child[0] = X->child[1] = 0;\ if (!treemap_is_marked(M, I)) {\ mark_treemap(M, I);\ *H = X;\ X->parent = (tchunkptr)H;\ X->fd = X->bk = X;\ }\ else {\ tchunkptr T = *H;\ size_t K = S << leftshift_for_tree_index(I);\ for (;;) {\ if (chunksize(T) != S) {\ tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\ K <<= 1;\ if (*C != 0)\ T = *C;\ else if (RTCHECK(ok_address(M, C))) {\ *C = X;\ X->parent = T;\ X->fd = X->bk = X;\ break;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ break;\ }\ }\ else {\ tchunkptr F = T->fd;\ if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\ T->fd = F->bk = X;\ X->fd = F;\ X->bk = T;\ X->parent = 0;\ break;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ break;\ }\ }\ }\ }\ } /* Unlink steps: 1. If x is a chained node, unlink it from its same-sized fd/bk links and choose its bk node as its replacement. 2. If x was the last node of its size, but not a leaf node, it must be replaced with a leaf node (not merely one with an open left or right), to make sure that lefts and rights of descendents correspond properly to bit masks. We use the rightmost descendent of x. We could use any other leaf, but this is easy to locate and tends to counteract removal of leftmosts elsewhere, and so keeps paths shorter than minimally guaranteed. This doesn't loop much because on average a node in a tree is near the bottom. 3. If x is the base of a chain (i.e., has parent links) relink x's parent and children to x's replacement (or null if none). */ #define unlink_large_chunk(M, X) {\ tchunkptr XP = X->parent;\ tchunkptr R;\ if (X->bk != X) {\ tchunkptr F = X->fd;\ R = X->bk;\ if (RTCHECK(ok_address(M, F))) {\ F->bk = R;\ R->fd = F;\ }\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ else {\ tchunkptr* RP;\ if (((R = *(RP = &(X->child[1]))) != 0) ||\ ((R = *(RP = &(X->child[0]))) != 0)) {\ tchunkptr* CP;\ while ((*(CP = &(R->child[1])) != 0) ||\ (*(CP = &(R->child[0])) != 0)) {\ R = *(RP = CP);\ }\ if (RTCHECK(ok_address(M, RP)))\ *RP = 0;\ else {\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ }\ if (XP != 0) {\ tbinptr* H = treebin_at(M, X->index);\ if (X == *H) {\ if ((*H = R) == 0) \ clear_treemap(M, X->index);\ }\ else if (RTCHECK(ok_address(M, XP))) {\ if (XP->child[0] == X) \ XP->child[0] = R;\ else \ XP->child[1] = R;\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ if (R != 0) {\ if (RTCHECK(ok_address(M, R))) {\ tchunkptr C0, C1;\ R->parent = XP;\ if ((C0 = X->child[0]) != 0) {\ if (RTCHECK(ok_address(M, C0))) {\ R->child[0] = C0;\ C0->parent = R;\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ }\ if ((C1 = X->child[1]) != 0) {\ if (RTCHECK(ok_address(M, C1))) {\ R->child[1] = C1;\ C1->parent = R;\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ else\ CORRUPTION_ERROR_ACTION(M);\ }\ }\ } /* Relays to large vs small bin operations */ #define insert_chunk(M, P, S)\ if (is_small(S)) insert_small_chunk(M, P, S)\ else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); } #define unlink_chunk(M, P, S)\ if (is_small(S)) unlink_small_chunk(M, P, S)\ else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); } /* Relays to internal calls to malloc/free from realloc, memalign etc */ #if ONLY_MSPACES #define internal_malloc(m, b) mspace_malloc(m, b) #define internal_free(m, mem) mspace_free(m,mem); #else /* ONLY_MSPACES */ #if MSPACES #define internal_malloc(m, b)\ (m == gm)? dlmalloc(b) : mspace_malloc(m, b) #define internal_free(m, mem)\ if (m == gm) dlfree(mem); else mspace_free(m,mem); #else /* MSPACES */ #define internal_malloc(m, b) dlmalloc(b) #define internal_free(m, mem) dlfree(mem) #endif /* MSPACES */ #endif /* ONLY_MSPACES */ /* ----------------------- Direct-mmapping chunks ----------------------- */ /* Directly mmapped chunks are set up with an offset to the start of the mmapped region stored in the prev_foot field of the chunk. This allows reconstruction of the required argument to MUNMAP when freed, and also allows adjustment of the returned chunk to meet alignment requirements (especially in memalign). There is also enough space allocated to hold a fake next chunk of size SIZE_T_SIZE to maintain the PINUSE bit so frees can be checked. */ /* Malloc using mmap */ static void* mmap_alloc(mstate m, size_t nb) { size_t mmsize = granularity_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); if (mmsize > nb) { /* Check for wrap around 0 */ char* mm = (char*)(DIRECT_MMAP(mmsize)); if (mm != CMFAIL) { size_t offset = align_offset(chunk2mem(mm)); size_t psize = mmsize - offset - MMAP_FOOT_PAD; mchunkptr p = (mchunkptr)(mm + offset); p->prev_foot = offset | IS_MMAPPED_BIT; (p)->head = (psize|CINUSE_BIT); mark_inuse_foot(m, p, psize); chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD; chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0; if (mm < m->least_addr) m->least_addr = mm; if ((m->footprint += mmsize) > m->max_footprint) m->max_footprint = m->footprint; assert(is_aligned(chunk2mem(p))); check_mmapped_chunk(m, p); return chunk2mem(p); } } return 0; } /* Realloc using mmap */ static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb) { size_t oldsize = chunksize(oldp); if (is_small(nb)) /* Can't shrink mmap regions below small size */ return 0; /* Keep old chunk if big enough but not too big */ if (oldsize >= nb + SIZE_T_SIZE && (oldsize - nb) <= (mparams.granularity << 1)) return oldp; else { size_t offset = oldp->prev_foot & ~IS_MMAPPED_BIT; size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD; size_t newmmsize = granularity_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); char* cp = (char*)CALL_MREMAP((char*)oldp - offset, oldmmsize, newmmsize, 1); if (cp != CMFAIL) { mchunkptr newp = (mchunkptr)(cp + offset); size_t psize = newmmsize - offset - MMAP_FOOT_PAD; newp->head = (psize|CINUSE_BIT); mark_inuse_foot(m, newp, psize); chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD; chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0; if (cp < m->least_addr) m->least_addr = cp; if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint) m->max_footprint = m->footprint; check_mmapped_chunk(m, newp); return newp; } } return 0; } /* -------------------------- mspace management -------------------------- */ /* Initialize top chunk and its size */ static void init_top(mstate m, mchunkptr p, size_t psize) { /* Ensure alignment */ size_t offset = align_offset(chunk2mem(p)); p = (mchunkptr)((char*)p + offset); psize -= offset; m->top = p; m->topsize = psize; p->head = psize | PINUSE_BIT; /* set size of fake trailing chunk holding overhead space only once */ chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE; m->trim_check = mparams.trim_threshold; /* reset on each update */ } /* Initialize bins for a new mstate that is otherwise zeroed out */ static void init_bins(mstate m) { /* Establish circular links for smallbins */ bindex_t i; for (i = 0; i < NSMALLBINS; ++i) { sbinptr bin = smallbin_at(m,i); bin->fd = bin->bk = bin; } } #if PROCEED_ON_ERROR /* default corruption action */ static void reset_on_error(mstate m) { int i; ++malloc_corruption_error_count; /* Reinitialize fields to forget about all memory */ m->smallbins = m->treebins = 0; m->dvsize = m->topsize = 0; m->seg.base = 0; m->seg.size = 0; m->seg.next = 0; m->top = m->dv = 0; for (i = 0; i < NTREEBINS; ++i) *treebin_at(m, i) = 0; init_bins(m); } #endif /* PROCEED_ON_ERROR */ /* Allocate chunk and prepend remainder with chunk in successor base. */ static void* prepend_alloc(mstate m, char* newbase, char* oldbase, size_t nb) { mchunkptr p = align_as_chunk(newbase); mchunkptr oldfirst = align_as_chunk(oldbase); size_t psize = (char*)oldfirst - (char*)p; mchunkptr q = chunk_plus_offset(p, nb); size_t qsize = psize - nb; set_size_and_pinuse_of_inuse_chunk(m, p, nb); assert((char*)oldfirst > (char*)q); assert(pinuse(oldfirst)); assert(qsize >= MIN_CHUNK_SIZE); /* consolidate remainder with first chunk of old base */ if (oldfirst == m->top) { size_t tsize = m->topsize += qsize; m->top = q; q->head = tsize | PINUSE_BIT; check_top_chunk(m, q); } else if (oldfirst == m->dv) { size_t dsize = m->dvsize += qsize; m->dv = q; set_size_and_pinuse_of_free_chunk(q, dsize); } else { if (!cinuse(oldfirst)) { size_t nsize = chunksize(oldfirst); unlink_chunk(m, oldfirst, nsize); oldfirst = chunk_plus_offset(oldfirst, nsize); qsize += nsize; } set_free_with_pinuse(q, qsize, oldfirst); insert_chunk(m, q, qsize); check_free_chunk(m, q); } check_malloced_chunk(m, chunk2mem(p), nb); return chunk2mem(p); } /* Add a segment to hold a new noncontiguous region */ static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) { /* Determine locations and sizes of segment, fenceposts, old top */ char* old_top = (char*)m->top; msegmentptr oldsp = segment_holding(m, old_top); char* old_end = oldsp->base + oldsp->size; size_t ssize = pad_request(sizeof(struct malloc_segment)); char* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK); size_t offset = align_offset(chunk2mem(rawsp)); char* asp = rawsp + offset; char* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp; mchunkptr sp = (mchunkptr)csp; msegmentptr ss = (msegmentptr)(chunk2mem(sp)); mchunkptr tnext = chunk_plus_offset(sp, ssize); mchunkptr p = tnext; int nfences = 0; /* reset top to new space */ init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); /* Set up segment record */ assert(is_aligned(ss)); set_size_and_pinuse_of_inuse_chunk(m, sp, ssize); *ss = m->seg; /* Push current record */ m->seg.base = tbase; m->seg.size = tsize; set_segment_flags(&m->seg, mmapped); m->seg.next = ss; /* Insert trailing fenceposts */ for (;;) { mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE); p->head = FENCEPOST_HEAD; ++nfences; if ((char*)(&(nextp->head)) < old_end) p = nextp; else break; } assert(nfences >= 2); /* Insert the rest of old top into a bin as an ordinary free chunk */ if (csp != old_top) { mchunkptr q = (mchunkptr)old_top; size_t psize = csp - old_top; mchunkptr tn = chunk_plus_offset(q, psize); set_free_with_pinuse(q, psize, tn); insert_chunk(m, q, psize); } check_top_chunk(m, m->top); } /* -------------------------- System allocation -------------------------- */ /* Get memory from system using MORECORE or MMAP */ static void* sys_alloc(mstate m, size_t nb) { char* tbase = CMFAIL; size_t tsize = 0; flag_t mmap_flag = 0; init_mparams(); /* Directly map large chunks */ if (use_mmap(m) && nb >= mparams.mmap_threshold) { void* mem = mmap_alloc(m, nb); if (mem != 0) return mem; } /* Try getting memory in any of three ways (in most-preferred to least-preferred order): 1. A call to MORECORE that can normally contiguously extend memory. (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or or main space is mmapped or a previous contiguous call failed) 2. A call to MMAP new space (disabled if not HAVE_MMAP). Note that under the default settings, if MORECORE is unable to fulfill a request, and HAVE_MMAP is true, then mmap is used as a noncontiguous system allocator. This is a useful backup strategy for systems with holes in address spaces -- in this case sbrk cannot contiguously expand the heap, but mmap may be able to find space. 3. A call to MORECORE that cannot usually contiguously extend memory. (disabled if not HAVE_MORECORE) */ if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) { char* br = CMFAIL; msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (char*)m->top); size_t asize = 0; ACQUIRE_MORECORE_LOCK(); if (ss == 0) { /* First time through or recovery */ char* base = (char*)CALL_MORECORE(0); if (base != CMFAIL) { asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE); /* Adjust to end on a page boundary */ if (!is_page_aligned(base)) asize += (page_align((size_t)base) - (size_t)base); /* Can't call MORECORE if size is negative when treated as signed */ if (asize < HALF_MAX_SIZE_T && (br = (char*)(CALL_MORECORE(asize))) == base) { tbase = base; tsize = asize; } } } else { /* Subtract out existing available top space from MORECORE request. */ asize = granularity_align(nb - m->topsize + TOP_FOOT_SIZE + SIZE_T_ONE); /* Use mem here only if it did continuously extend old space */ if (asize < HALF_MAX_SIZE_T && (br = (char*)(CALL_MORECORE(asize))) == ss->base+ss->size) { tbase = br; tsize = asize; } } if (tbase == CMFAIL) { /* Cope with partial failure */ if (br != CMFAIL) { /* Try to use/extend the space we did get */ if (asize < HALF_MAX_SIZE_T && asize < nb + TOP_FOOT_SIZE + SIZE_T_ONE) { size_t esize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE - asize); if (esize < HALF_MAX_SIZE_T) { char* end = (char*)CALL_MORECORE(esize); if (end != CMFAIL) asize += esize; else { /* Can't use; try to release */ (void)CALL_MORECORE(-asize); br = CMFAIL; } } } } if (br != CMFAIL) { /* Use the space we did get */ tbase = br; tsize = asize; } else disable_contiguous(m); /* Don't try contiguous path in the future */ } RELEASE_MORECORE_LOCK(); } if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */ size_t req = nb + TOP_FOOT_SIZE + SIZE_T_ONE; size_t rsize = granularity_align(req); if (rsize > nb) { /* Fail if wraps around zero */ char* mp = (char*)(CALL_MMAP(rsize)); if (mp != CMFAIL) { tbase = mp; tsize = rsize; mmap_flag = IS_MMAPPED_BIT; } } } if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */ size_t asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE); if (asize < HALF_MAX_SIZE_T) { char* br = CMFAIL; char* end = CMFAIL; ACQUIRE_MORECORE_LOCK(); br = (char*)(CALL_MORECORE(asize)); end = (char*)(CALL_MORECORE(0)); RELEASE_MORECORE_LOCK(); if (br != CMFAIL && end != CMFAIL && br < end) { size_t ssize = end - br; if (ssize > nb + TOP_FOOT_SIZE) { tbase = br; tsize = ssize; } } } } if (tbase != CMFAIL) { if ((m->footprint += tsize) > m->max_footprint) m->max_footprint = m->footprint; if (!is_initialized(m)) { /* first-time initialization */ m->seg.base = m->least_addr = tbase; m->seg.size = tsize; set_segment_flags(&m->seg, mmap_flag); m->magic = mparams.magic; init_bins(m); if (is_global(m)) init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); else { /* Offset top by embedded malloc_state */ mchunkptr mn = next_chunk(mem2chunk(m)); init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) -TOP_FOOT_SIZE); } } else { /* Try to merge with an existing segment */ msegmentptr sp = &m->seg; while (sp != 0 && tbase != sp->base + sp->size) sp = sp->next; if (sp != 0 && !is_extern_segment(sp) && check_segment_merge(sp, tbase, tsize) && (get_segment_flags(sp) & IS_MMAPPED_BIT) == mmap_flag && segment_holds(sp, m->top)) { /* append */ sp->size += tsize; init_top(m, m->top, m->topsize + tsize); } else { if (tbase < m->least_addr) m->least_addr = tbase; sp = &m->seg; while (sp != 0 && sp->base != tbase + tsize) sp = sp->next; if (sp != 0 && !is_extern_segment(sp) && check_segment_merge(sp, tbase, tsize) && (get_segment_flags(sp) & IS_MMAPPED_BIT) == mmap_flag) { char* oldbase = sp->base; sp->base = tbase; sp->size += tsize; return prepend_alloc(m, tbase, oldbase, nb); } else add_segment(m, tbase, tsize, mmap_flag); } } if (nb < m->topsize) { /* Allocate from new or extended top space */ size_t rsize = m->topsize -= nb; mchunkptr p = m->top; mchunkptr r = m->top = chunk_plus_offset(p, nb); r->head = rsize | PINUSE_BIT; set_size_and_pinuse_of_inuse_chunk(m, p, nb); check_top_chunk(m, m->top); check_malloced_chunk(m, chunk2mem(p), nb); return chunk2mem(p); } } MALLOC_FAILURE_ACTION; return 0; } /* ----------------------- system deallocation -------------------------- */ /* Unmap and unlink any mmapped segments that don't contain used chunks */ static size_t release_unused_segments(mstate m) { size_t released = 0; msegmentptr pred = &m->seg; msegmentptr sp = pred->next; while (sp != 0) { char* base = sp->base; size_t size = sp->size; msegmentptr next = sp->next; if (is_mmapped_segment(sp) && !is_extern_segment(sp)) { mchunkptr p = align_as_chunk(base); size_t psize = chunksize(p); /* Can unmap if first chunk holds entire segment and not pinned */ if (!cinuse(p) && (char*)p + psize >= base + size - TOP_FOOT_SIZE) { tchunkptr tp = (tchunkptr)p; assert(segment_holds(sp, (char*)sp)); if (p == m->dv) { m->dv = 0; m->dvsize = 0; } else { unlink_large_chunk(m, tp); } if (CALL_MUNMAP(base, size) == 0) { released += size; m->footprint -= size; /* unlink obsoleted record */ sp = pred; sp->next = next; } else { /* back out if cannot unmap */ insert_large_chunk(m, tp, psize); } } } pred = sp; sp = next; } return released; } static int sys_trim(mstate m, size_t pad) { size_t released = 0; if (pad < MAX_REQUEST && is_initialized(m)) { pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */ if (m->topsize > pad) { /* Shrink top space in granularity-size units, keeping at least one */ size_t unit = mparams.granularity; size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit - SIZE_T_ONE) * unit; msegmentptr sp = segment_holding(m, (char*)m->top); if (!is_extern_segment(sp)) { if (is_mmapped_segment(sp)) { if (HAVE_MMAP && sp->size >= extra && !has_segment_link(m, sp)) { /* can't shrink if pinned */ size_t newsize = sp->size - extra; /* Prefer mremap, fall back to munmap */ if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) || (CALL_MUNMAP(sp->base + newsize, extra) == 0)) { released = extra; } } } else if (HAVE_MORECORE) { if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */ extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit; ACQUIRE_MORECORE_LOCK(); { /* Make sure end of memory is where we last set it. */ char* old_br = (char*)(CALL_MORECORE(0)); if (old_br == sp->base + sp->size) { char* rel_br = (char*)(CALL_MORECORE(-extra)); char* new_br = (char*)(CALL_MORECORE(0)); if (rel_br != CMFAIL && new_br < old_br) released = old_br - new_br; } } RELEASE_MORECORE_LOCK(); } } if (released != 0) { sp->size -= released; m->footprint -= released; init_top(m, m->top, m->topsize - released); check_top_chunk(m, m->top); } } /* Unmap any unused mmapped segments */ if (HAVE_MMAP) released += release_unused_segments(m); /* On failure, disable autotrim to avoid repeated failed future calls */ if (released == 0) m->trim_check = MAX_SIZE_T; } return (released != 0)? 1 : 0; } /* ---------------------------- malloc support --------------------------- */ /* allocate a large request from the best fitting chunk in a treebin */ static void* tmalloc_large(mstate m, size_t nb) { tchunkptr v = 0; size_t rsize = -nb; /* Unsigned negation */ tchunkptr t; bindex_t idx; compute_tree_index(nb, idx); if ((t = *treebin_at(m, idx)) != 0) { /* Traverse tree for this bin looking for node with size == nb */ size_t sizebits = nb << leftshift_for_tree_index(idx); tchunkptr rst = 0; /* The deepest untaken right subtree */ for (;;) { tchunkptr rt; size_t trem = chunksize(t) - nb; if (trem < rsize) { v = t; if ((rsize = trem) == 0) break; } rt = t->child[1]; t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; if (rt != 0 && rt != t) rst = rt; if (t == 0) { t = rst; /* set t to least subtree holding sizes > nb */ break; } sizebits <<= 1; } } if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */ binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap; if (leftbits != 0) { bindex_t i; binmap_t leastbit = least_bit(leftbits); compute_bit2idx(leastbit, i); t = *treebin_at(m, i); } } while (t != 0) { /* find smallest of tree or subtree */ size_t trem = chunksize(t) - nb; if (trem < rsize) { rsize = trem; v = t; } t = leftmost_child(t); } /* If dv is a better fit, return 0 so malloc will use it */ if (v != 0 && rsize < (size_t)(m->dvsize - nb)) { if (RTCHECK(ok_address(m, v))) { /* split */ mchunkptr r = chunk_plus_offset(v, nb); assert(chunksize(v) == rsize + nb); if (RTCHECK(ok_next(v, r))) { unlink_large_chunk(m, v); if (rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(m, v, (rsize + nb)); else { set_size_and_pinuse_of_inuse_chunk(m, v, nb); set_size_and_pinuse_of_free_chunk(r, rsize); insert_chunk(m, r, rsize); } return chunk2mem(v); } } CORRUPTION_ERROR_ACTION(m); } return 0; } /* allocate a small request from the best fitting chunk in a treebin */ static void* tmalloc_small(mstate m, size_t nb) { tchunkptr t, v; size_t rsize; bindex_t i; binmap_t leastbit = least_bit(m->treemap); compute_bit2idx(leastbit, i); v = t = *treebin_at(m, i); rsize = chunksize(t) - nb; while ((t = leftmost_child(t)) != 0) { size_t trem = chunksize(t) - nb; if (trem < rsize) { rsize = trem; v = t; } } if (RTCHECK(ok_address(m, v))) { mchunkptr r = chunk_plus_offset(v, nb); assert(chunksize(v) == rsize + nb); if (RTCHECK(ok_next(v, r))) { unlink_large_chunk(m, v); if (rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(m, v, (rsize + nb)); else { set_size_and_pinuse_of_inuse_chunk(m, v, nb); set_size_and_pinuse_of_free_chunk(r, rsize); replace_dv(m, r, rsize); } return chunk2mem(v); } } CORRUPTION_ERROR_ACTION(m); return 0; } /* --------------------------- realloc support --------------------------- */ static void* internal_realloc(mstate m, void* oldmem, size_t bytes) { if (bytes >= MAX_REQUEST) { MALLOC_FAILURE_ACTION; return 0; } if (!PREACTION(m)) { mchunkptr oldp = mem2chunk(oldmem); size_t oldsize = chunksize(oldp); mchunkptr next = chunk_plus_offset(oldp, oldsize); mchunkptr newp = 0; void* extra = 0; /* Try to either shrink or extend into top. Else malloc-copy-free */ if (RTCHECK(ok_address(m, oldp) && ok_cinuse(oldp) && ok_next(oldp, next) && ok_pinuse(next))) { size_t nb = request2size(bytes); if (is_mmapped(oldp)) newp = mmap_resize(m, oldp, nb); else if (oldsize >= nb) { /* already big enough */ size_t rsize = oldsize - nb; newp = oldp; if (rsize >= MIN_CHUNK_SIZE) { mchunkptr remainder = chunk_plus_offset(newp, nb); set_inuse(m, newp, nb); set_inuse(m, remainder, rsize); extra = chunk2mem(remainder); } } else if (next == m->top && oldsize + m->topsize > nb) { /* Expand into top */ size_t newsize = oldsize + m->topsize; size_t newtopsize = newsize - nb; mchunkptr newtop = chunk_plus_offset(oldp, nb); set_inuse(m, oldp, nb); newtop->head = newtopsize |PINUSE_BIT; m->top = newtop; m->topsize = newtopsize; newp = oldp; } } else { USAGE_ERROR_ACTION(m, oldmem); POSTACTION(m); return 0; } POSTACTION(m); if (newp != 0) { if (extra != 0) { internal_free(m, extra); } check_inuse_chunk(m, newp); return chunk2mem(newp); } else { void* newmem = internal_malloc(m, bytes); if (newmem != 0) { size_t oc = oldsize - overhead_for(oldp); memcpy(newmem, oldmem, (oc < bytes)? oc : bytes); internal_free(m, oldmem); } return newmem; } } return 0; } /* --------------------------- memalign support -------------------------- */ static void* internal_memalign(mstate m, size_t alignment, size_t bytes) { if (alignment <= MALLOC_ALIGNMENT) /* Can just use malloc */ return internal_malloc(m, bytes); if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */ alignment = MIN_CHUNK_SIZE; if ((alignment & (alignment-SIZE_T_ONE)) != 0) {/* Ensure a power of 2 */ size_t a = MALLOC_ALIGNMENT << 1; while (a < alignment) a <<= 1; alignment = a; } if (bytes >= MAX_REQUEST - alignment) { if (m != 0) { /* Test isn't needed but avoids compiler warning */ MALLOC_FAILURE_ACTION; } } else { size_t nb = request2size(bytes); size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD; char* mem = (char*)internal_malloc(m, req); if (mem != 0) { void* leader = 0; void* trailer = 0; mchunkptr p = mem2chunk(mem); if (PREACTION(m)) return 0; if ((((size_t)(mem)) % alignment) != 0) { /* misaligned */ /* Find an aligned spot inside chunk. Since we need to give back leading space in a chunk of at least MIN_CHUNK_SIZE, if the first calculation places us at a spot with less than MIN_CHUNK_SIZE leader, we can move to the next aligned spot. We've allocated enough total room so that this is always possible. */ char* br = (char*)mem2chunk((size_t)(((size_t)(mem + alignment - SIZE_T_ONE)) & -alignment)); char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE)? br : br+alignment; mchunkptr newp = (mchunkptr)pos; size_t leadsize = pos - (char*)(p); size_t newsize = chunksize(p) - leadsize; if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */ newp->prev_foot = p->prev_foot + leadsize; newp->head = (newsize|CINUSE_BIT); } else { /* Otherwise, give back leader, use the rest */ set_inuse(m, newp, newsize); set_inuse(m, p, leadsize); leader = chunk2mem(p); } p = newp; } /* Give back spare room at the end */ if (!is_mmapped(p)) { size_t size = chunksize(p); if (size > nb + MIN_CHUNK_SIZE) { size_t remainder_size = size - nb; mchunkptr remainder = chunk_plus_offset(p, nb); set_inuse(m, p, nb); set_inuse(m, remainder, remainder_size); trailer = chunk2mem(remainder); } } assert (chunksize(p) >= nb); assert((((size_t)(chunk2mem(p))) % alignment) == 0); check_inuse_chunk(m, p); POSTACTION(m); if (leader != 0) { internal_free(m, leader); } if (trailer != 0) { internal_free(m, trailer); } return chunk2mem(p); } } return 0; } /* ------------------------ comalloc/coalloc support --------------------- */ static void** ialloc(mstate m, size_t n_elements, size_t* sizes, int opts, void* chunks[]) { /* This provides common support for independent_X routines, handling all of the combinations that can result. The opts arg has: bit 0 set if all elements are same size (using sizes[0]) bit 1 set if elements should be zeroed */ size_t element_size; /* chunksize of each element, if all same */ size_t contents_size; /* total size of elements */ size_t array_size; /* request size of pointer array */ void* mem; /* malloced aggregate space */ mchunkptr p; /* corresponding chunk */ size_t remainder_size; /* remaining bytes while splitting */ void** marray; /* either "chunks" or malloced ptr array */ mchunkptr array_chunk; /* chunk for malloced ptr array */ flag_t was_enabled; /* to disable mmap */ size_t size; size_t i; /* compute array length, if needed */ if (chunks != 0) { if (n_elements == 0) return chunks; /* nothing to do */ marray = chunks; array_size = 0; } else { /* if empty req, must still return chunk representing empty array */ if (n_elements == 0) return (void**)internal_malloc(m, 0); marray = 0; array_size = request2size(n_elements * (sizeof(void*))); } /* compute total element size */ if (opts & 0x1) { /* all-same-size */ element_size = request2size(*sizes); contents_size = n_elements * element_size; } else { /* add up all the sizes */ element_size = 0; contents_size = 0; for (i = 0; i != n_elements; ++i) contents_size += request2size(sizes[i]); } size = contents_size + array_size; /* Allocate the aggregate chunk. First disable direct-mmapping so malloc won't use it, since we would not be able to later free/realloc space internal to a segregated mmap region. */ was_enabled = use_mmap(m); disable_mmap(m); mem = internal_malloc(m, size - CHUNK_OVERHEAD); if (was_enabled) enable_mmap(m); if (mem == 0) return 0; if (PREACTION(m)) return 0; p = mem2chunk(mem); remainder_size = chunksize(p); assert(!is_mmapped(p)); if (opts & 0x2) { /* optionally clear the elements */ memset((size_t*)mem, 0, remainder_size - SIZE_T_SIZE - array_size); } /* If not provided, allocate the pointer array as final part of chunk */ if (marray == 0) { size_t array_chunk_size; array_chunk = chunk_plus_offset(p, contents_size); array_chunk_size = remainder_size - contents_size; marray = (void**) (chunk2mem(array_chunk)); set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size); remainder_size = contents_size; } /* split out elements */ for (i = 0; ; ++i) { marray[i] = chunk2mem(p); if (i != n_elements-1) { if (element_size != 0) size = element_size; else size = request2size(sizes[i]); remainder_size -= size; set_size_and_pinuse_of_inuse_chunk(m, p, size); p = chunk_plus_offset(p, size); } else { /* the final element absorbs any overallocation slop */ set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size); break; } } #if DEBUG if (marray != chunks) { /* final element must have exactly exhausted chunk */ if (element_size != 0) { assert(remainder_size == element_size); } else { assert(remainder_size == request2size(sizes[i])); } check_inuse_chunk(m, mem2chunk(marray)); } for (i = 0; i != n_elements; ++i) check_inuse_chunk(m, mem2chunk(marray[i])); #endif /* DEBUG */ POSTACTION(m); return marray; } /* -------------------------- public routines ---------------------------- */ #if !ONLY_MSPACES void* dlmalloc(size_t bytes) { /* Basic algorithm: If a small request (< 256 bytes minus per-chunk overhead): 1. If one exists, use a remainderless chunk in associated smallbin. (Remainderless means that there are too few excess bytes to represent as a chunk.) 2. If it is big enough, use the dv chunk, which is normally the chunk adjacent to the one used for the most recent small request. 3. If one exists, split the smallest available chunk in a bin, saving remainder in dv. 4. If it is big enough, use the top chunk. 5. If available, get memory from system and use it Otherwise, for a large request: 1. Find the smallest available binned chunk that fits, and use it if it is better fitting than dv chunk, splitting if necessary. 2. If better fitting than any binned chunk, use the dv chunk. 3. If it is big enough, use the top chunk. 4. If request size >= mmap threshold, try to directly mmap this chunk. 5. If available, get memory from system and use it The ugly goto's here ensure that postaction occurs along all paths. */ if (!PREACTION(gm)) { void* mem; size_t nb; if (bytes <= MAX_SMALL_REQUEST) { bindex_t idx; binmap_t smallbits; nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); idx = small_index(nb); smallbits = gm->smallmap >> idx; if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ mchunkptr b, p; idx += ~smallbits & 1; /* Uses next bin if idx empty */ b = smallbin_at(gm, idx); p = b->fd; assert(chunksize(p) == small_index2size(idx)); unlink_first_small_chunk(gm, b, p, idx); set_inuse_and_pinuse(gm, p, small_index2size(idx)); mem = chunk2mem(p); check_malloced_chunk(gm, mem, nb); goto postaction; } else if (nb > gm->dvsize) { if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ mchunkptr b, p, r; size_t rsize; bindex_t i; binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); binmap_t leastbit = least_bit(leftbits); compute_bit2idx(leastbit, i); b = smallbin_at(gm, i); p = b->fd; assert(chunksize(p) == small_index2size(i)); unlink_first_small_chunk(gm, b, p, i); rsize = small_index2size(i) - nb; /* Fit here cannot be remainderless if 4byte sizes */ if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(gm, p, small_index2size(i)); else { set_size_and_pinuse_of_inuse_chunk(gm, p, nb); r = chunk_plus_offset(p, nb); set_size_and_pinuse_of_free_chunk(r, rsize); replace_dv(gm, r, rsize); } mem = chunk2mem(p); check_malloced_chunk(gm, mem, nb); goto postaction; } else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) { check_malloced_chunk(gm, mem, nb); goto postaction; } } } else if (bytes >= MAX_REQUEST) nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ else { nb = pad_request(bytes); if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) { check_malloced_chunk(gm, mem, nb); goto postaction; } } if (nb <= gm->dvsize) { size_t rsize = gm->dvsize - nb; mchunkptr p = gm->dv; if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ mchunkptr r = gm->dv = chunk_plus_offset(p, nb); gm->dvsize = rsize; set_size_and_pinuse_of_free_chunk(r, rsize); set_size_and_pinuse_of_inuse_chunk(gm, p, nb); } else { /* exhaust dv */ size_t dvs = gm->dvsize; gm->dvsize = 0; gm->dv = 0; set_inuse_and_pinuse(gm, p, dvs); } mem = chunk2mem(p); check_malloced_chunk(gm, mem, nb); goto postaction; } else if (nb < gm->topsize) { /* Split top */ size_t rsize = gm->topsize -= nb; mchunkptr p = gm->top; mchunkptr r = gm->top = chunk_plus_offset(p, nb); r->head = rsize | PINUSE_BIT; set_size_and_pinuse_of_inuse_chunk(gm, p, nb); mem = chunk2mem(p); check_top_chunk(gm, gm->top); check_malloced_chunk(gm, mem, nb); goto postaction; } mem = sys_alloc(gm, nb); postaction: POSTACTION(gm); return mem; } return 0; } void dlfree(void* mem) { /* Consolidate freed chunks with preceding or succeeding bordering free chunks, if they exist, and then place in a bin. Intermixed with special cases for top, dv, mmapped chunks, and usage errors. */ if (mem != 0) { mchunkptr p = mem2chunk(mem); #if FOOTERS mstate fm = get_mstate_for(p); if (!ok_magic(fm)) { USAGE_ERROR_ACTION(fm, p); return; } #else /* FOOTERS */ #define fm gm #endif /* FOOTERS */ if (!PREACTION(fm)) { check_inuse_chunk(fm, p); if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) { size_t psize = chunksize(p); mchunkptr next = chunk_plus_offset(p, psize); if (!pinuse(p)) { size_t prevsize = p->prev_foot; if ((prevsize & IS_MMAPPED_BIT) != 0) { prevsize &= ~IS_MMAPPED_BIT; psize += prevsize + MMAP_FOOT_PAD; if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) fm->footprint -= psize; goto postaction; } else { mchunkptr prev = chunk_minus_offset(p, prevsize); psize += prevsize; p = prev; if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ if (p != fm->dv) { unlink_chunk(fm, p, prevsize); } else if ((next->head & INUSE_BITS) == INUSE_BITS) { fm->dvsize = psize; set_free_with_pinuse(p, psize, next); goto postaction; } } else goto erroraction; } } if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { if (!cinuse(next)) { /* consolidate forward */ if (next == fm->top) { size_t tsize = fm->topsize += psize; fm->top = p; p->head = tsize | PINUSE_BIT; if (p == fm->dv) { fm->dv = 0; fm->dvsize = 0; } if (should_trim(fm, tsize)) sys_trim(fm, 0); goto postaction; } else if (next == fm->dv) { size_t dsize = fm->dvsize += psize; fm->dv = p; set_size_and_pinuse_of_free_chunk(p, dsize); goto postaction; } else { size_t nsize = chunksize(next); psize += nsize; unlink_chunk(fm, next, nsize); set_size_and_pinuse_of_free_chunk(p, psize); if (p == fm->dv) { fm->dvsize = psize; goto postaction; } } } else set_free_with_pinuse(p, psize, next); insert_chunk(fm, p, psize); check_free_chunk(fm, p); goto postaction; } } erroraction: USAGE_ERROR_ACTION(fm, p); postaction: POSTACTION(fm); } } #if !FOOTERS #undef fm #endif /* FOOTERS */ } void* dlcalloc(size_t n_elements, size_t elem_size) { void* mem; size_t req = 0; if (n_elements != 0) { req = n_elements * elem_size; if (((n_elements | elem_size) & ~(size_t)0xffff) && (req / n_elements != elem_size)) req = MAX_SIZE_T; /* force downstream failure on overflow */ } mem = dlmalloc(req); if (mem != 0 && calloc_must_clear(mem2chunk(mem))) memset(mem, 0, req); return mem; } void* dlrealloc(void* oldmem, size_t bytes) { if (oldmem == 0) return dlmalloc(bytes); #ifdef REALLOC_ZERO_BYTES_FREES if (bytes == 0) { dlfree(oldmem); return 0; } #endif /* REALLOC_ZERO_BYTES_FREES */ else { #if ! FOOTERS mstate m = gm; #else /* FOOTERS */ mstate m = get_mstate_for(mem2chunk(oldmem)); if (!ok_magic(m)) { USAGE_ERROR_ACTION(m, oldmem); return 0; } #endif /* FOOTERS */ return internal_realloc(m, oldmem, bytes); } } void* dlmemalign(size_t alignment, size_t bytes) { return internal_memalign(gm, alignment, bytes); } void** dlindependent_calloc(size_t n_elements, size_t elem_size, void* chunks[]) { size_t sz = elem_size; /* serves as 1-element array */ return ialloc(gm, n_elements, &sz, 3, chunks); } void** dlindependent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]) { return ialloc(gm, n_elements, sizes, 0, chunks); } void* dlvalloc(size_t bytes) { size_t pagesz; init_mparams(); pagesz = mparams.page_size; return dlmemalign(pagesz, bytes); } void* dlpvalloc(size_t bytes) { size_t pagesz; init_mparams(); pagesz = mparams.page_size; return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE)); } int dlmalloc_trim(size_t pad) { int result = 0; if (!PREACTION(gm)) { result = sys_trim(gm, pad); POSTACTION(gm); } return result; } size_t dlmalloc_footprint(void) { return gm->footprint; } size_t dlmalloc_max_footprint(void) { return gm->max_footprint; } #if !NO_MALLINFO struct mallinfo dlmallinfo(void) { return internal_mallinfo(gm); } #endif /* NO_MALLINFO */ void dlmalloc_stats() { internal_malloc_stats(gm); } size_t dlmalloc_usable_size(void* mem) { if (mem != 0) { mchunkptr p = mem2chunk(mem); if (cinuse(p)) return chunksize(p) - overhead_for(p); } return 0; } int dlmallopt(int param_number, int value) { return change_mparam(param_number, value); } #endif /* !ONLY_MSPACES */ /* ----------------------------- user mspaces ---------------------------- */ #if MSPACES static mstate init_user_mstate(char* tbase, size_t tsize) { size_t msize = pad_request(sizeof(struct malloc_state)); mchunkptr mn; mchunkptr msp = align_as_chunk(tbase); mstate m = (mstate)(chunk2mem(msp)); memset(m, 0, msize); INITIAL_LOCK(&m->mutex); msp->head = (msize|PINUSE_BIT|CINUSE_BIT); m->seg.base = m->least_addr = tbase; m->seg.size = m->footprint = m->max_footprint = tsize; m->magic = mparams.magic; m->mflags = mparams.default_mflags; disable_contiguous(m); init_bins(m); mn = next_chunk(mem2chunk(m)); init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE); check_top_chunk(m, m->top); return m; } mspace create_mspace(size_t capacity, int locked) { mstate m = 0; size_t msize = pad_request(sizeof(struct malloc_state)); init_mparams(); /* Ensure pagesize etc initialized */ if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { size_t rs = ((capacity == 0)? mparams.granularity : (capacity + TOP_FOOT_SIZE + msize)); size_t tsize = granularity_align(rs); char* tbase = (char*)(CALL_MMAP(tsize)); if (tbase != CMFAIL) { m = init_user_mstate(tbase, tsize); set_segment_flags(&m->seg, IS_MMAPPED_BIT); set_lock(m, locked); } } return (mspace)m; } mspace create_mspace_with_base(void* base, size_t capacity, int locked) { mstate m = 0; size_t msize = pad_request(sizeof(struct malloc_state)); init_mparams(); /* Ensure pagesize etc initialized */ if (capacity > msize + TOP_FOOT_SIZE && capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { m = init_user_mstate((char*)base, capacity); set_segment_flags(&m->seg, EXTERN_BIT); set_lock(m, locked); } return (mspace)m; } size_t destroy_mspace(mspace msp) { size_t freed = 0; mstate ms = (mstate)msp; if (ok_magic(ms)) { msegmentptr sp = &ms->seg; while (sp != 0) { char* base = sp->base; size_t size = sp->size; flag_t flag = get_segment_flags(sp); sp = sp->next; if ((flag & IS_MMAPPED_BIT) && !(flag & EXTERN_BIT) && CALL_MUNMAP(base, size) == 0) freed += size; } } else { USAGE_ERROR_ACTION(ms,ms); } return freed; } /* mspace versions of routines are near-clones of the global versions. This is not so nice but better than the alternatives. */ void* mspace_malloc(mspace msp, size_t bytes) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } if (!PREACTION(ms)) { void* mem; size_t nb; if (bytes <= MAX_SMALL_REQUEST) { bindex_t idx; binmap_t smallbits; nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); idx = small_index(nb); smallbits = ms->smallmap >> idx; if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ mchunkptr b, p; idx += ~smallbits & 1; /* Uses next bin if idx empty */ b = smallbin_at(ms, idx); p = b->fd; assert(chunksize(p) == small_index2size(idx)); unlink_first_small_chunk(ms, b, p, idx); set_inuse_and_pinuse(ms, p, small_index2size(idx)); mem = chunk2mem(p); check_malloced_chunk(ms, mem, nb); goto postaction; } else if (nb > ms->dvsize) { if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ mchunkptr b, p, r; size_t rsize; bindex_t i; binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); binmap_t leastbit = least_bit(leftbits); compute_bit2idx(leastbit, i); b = smallbin_at(ms, i); p = b->fd; assert(chunksize(p) == small_index2size(i)); unlink_first_small_chunk(ms, b, p, i); rsize = small_index2size(i) - nb; /* Fit here cannot be remainderless if 4byte sizes */ if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) set_inuse_and_pinuse(ms, p, small_index2size(i)); else { set_size_and_pinuse_of_inuse_chunk(ms, p, nb); r = chunk_plus_offset(p, nb); set_size_and_pinuse_of_free_chunk(r, rsize); replace_dv(ms, r, rsize); } mem = chunk2mem(p); check_malloced_chunk(ms, mem, nb); goto postaction; } else if (ms->treemap != 0 && (mem = tmalloc_small(ms, nb)) != 0) { check_malloced_chunk(ms, mem, nb); goto postaction; } } } else if (bytes >= MAX_REQUEST) nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ else { nb = pad_request(bytes); if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) { check_malloced_chunk(ms, mem, nb); goto postaction; } } if (nb <= ms->dvsize) { size_t rsize = ms->dvsize - nb; mchunkptr p = ms->dv; if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ mchunkptr r = ms->dv = chunk_plus_offset(p, nb); ms->dvsize = rsize; set_size_and_pinuse_of_free_chunk(r, rsize); set_size_and_pinuse_of_inuse_chunk(ms, p, nb); } else { /* exhaust dv */ size_t dvs = ms->dvsize; ms->dvsize = 0; ms->dv = 0; set_inuse_and_pinuse(ms, p, dvs); } mem = chunk2mem(p); check_malloced_chunk(ms, mem, nb); goto postaction; } else if (nb < ms->topsize) { /* Split top */ size_t rsize = ms->topsize -= nb; mchunkptr p = ms->top; mchunkptr r = ms->top = chunk_plus_offset(p, nb); r->head = rsize | PINUSE_BIT; set_size_and_pinuse_of_inuse_chunk(ms, p, nb); mem = chunk2mem(p); check_top_chunk(ms, ms->top); check_malloced_chunk(ms, mem, nb); goto postaction; } mem = sys_alloc(ms, nb); postaction: POSTACTION(ms); return mem; } return 0; } void mspace_free(mspace msp, void* mem) { if (mem != 0) { mchunkptr p = mem2chunk(mem); #if FOOTERS mstate fm = get_mstate_for(p); #else /* FOOTERS */ mstate fm = (mstate)msp; #endif /* FOOTERS */ if (!ok_magic(fm)) { USAGE_ERROR_ACTION(fm, p); return; } if (!PREACTION(fm)) { check_inuse_chunk(fm, p); if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) { size_t psize = chunksize(p); mchunkptr next = chunk_plus_offset(p, psize); if (!pinuse(p)) { size_t prevsize = p->prev_foot; if ((prevsize & IS_MMAPPED_BIT) != 0) { prevsize &= ~IS_MMAPPED_BIT; psize += prevsize + MMAP_FOOT_PAD; if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) fm->footprint -= psize; goto postaction; } else { mchunkptr prev = chunk_minus_offset(p, prevsize); psize += prevsize; p = prev; if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ if (p != fm->dv) { unlink_chunk(fm, p, prevsize); } else if ((next->head & INUSE_BITS) == INUSE_BITS) { fm->dvsize = psize; set_free_with_pinuse(p, psize, next); goto postaction; } } else goto erroraction; } } if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { if (!cinuse(next)) { /* consolidate forward */ if (next == fm->top) { size_t tsize = fm->topsize += psize; fm->top = p; p->head = tsize | PINUSE_BIT; if (p == fm->dv) { fm->dv = 0; fm->dvsize = 0; } if (should_trim(fm, tsize)) sys_trim(fm, 0); goto postaction; } else if (next == fm->dv) { size_t dsize = fm->dvsize += psize; fm->dv = p; set_size_and_pinuse_of_free_chunk(p, dsize); goto postaction; } else { size_t nsize = chunksize(next); psize += nsize; unlink_chunk(fm, next, nsize); set_size_and_pinuse_of_free_chunk(p, psize); if (p == fm->dv) { fm->dvsize = psize; goto postaction; } } } else set_free_with_pinuse(p, psize, next); insert_chunk(fm, p, psize); check_free_chunk(fm, p); goto postaction; } } erroraction: USAGE_ERROR_ACTION(fm, p); postaction: POSTACTION(fm); } } } void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size) { void* mem; size_t req = 0; mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } if (n_elements != 0) { req = n_elements * elem_size; if (((n_elements | elem_size) & ~(size_t)0xffff) && (req / n_elements != elem_size)) req = MAX_SIZE_T; /* force downstream failure on overflow */ } mem = internal_malloc(ms, req); if (mem != 0 && calloc_must_clear(mem2chunk(mem))) memset(mem, 0, req); return mem; } void* mspace_realloc(mspace msp, void* oldmem, size_t bytes) { if (oldmem == 0) return mspace_malloc(msp, bytes); #ifdef REALLOC_ZERO_BYTES_FREES if (bytes == 0) { mspace_free(msp, oldmem); return 0; } #endif /* REALLOC_ZERO_BYTES_FREES */ else { #if FOOTERS mchunkptr p = mem2chunk(oldmem); mstate ms = get_mstate_for(p); #else /* FOOTERS */ mstate ms = (mstate)msp; #endif /* FOOTERS */ if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return internal_realloc(ms, oldmem, bytes); } } void* mspace_memalign(mspace msp, size_t alignment, size_t bytes) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return internal_memalign(ms, alignment, bytes); } void** mspace_independent_calloc(mspace msp, size_t n_elements, size_t elem_size, void* chunks[]) { size_t sz = elem_size; /* serves as 1-element array */ mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return ialloc(ms, n_elements, &sz, 3, chunks); } void** mspace_independent_comalloc(mspace msp, size_t n_elements, size_t sizes[], void* chunks[]) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); return 0; } return ialloc(ms, n_elements, sizes, 0, chunks); } int mspace_trim(mspace msp, size_t pad) { int result = 0; mstate ms = (mstate)msp; if (ok_magic(ms)) { if (!PREACTION(ms)) { result = sys_trim(ms, pad); POSTACTION(ms); } } else { USAGE_ERROR_ACTION(ms,ms); } return result; } void mspace_malloc_stats(mspace msp) { mstate ms = (mstate)msp; if (ok_magic(ms)) { internal_malloc_stats(ms); } else { USAGE_ERROR_ACTION(ms,ms); } } size_t mspace_footprint(mspace msp) { size_t result; mstate ms = (mstate)msp; if (ok_magic(ms)) { result = ms->footprint; } USAGE_ERROR_ACTION(ms,ms); return result; } size_t mspace_max_footprint(mspace msp) { size_t result; mstate ms = (mstate)msp; if (ok_magic(ms)) { result = ms->max_footprint; } USAGE_ERROR_ACTION(ms,ms); return result; } #if !NO_MALLINFO struct mallinfo mspace_mallinfo(mspace msp) { mstate ms = (mstate)msp; if (!ok_magic(ms)) { USAGE_ERROR_ACTION(ms,ms); } return internal_mallinfo(ms); } #endif /* NO_MALLINFO */ int mspace_mallopt(int param_number, int value) { return change_mparam(param_number, value); } #endif /* MSPACES */ /* -------------------- Alternative MORECORE functions ------------------- */ /* Guidelines for creating a custom version of MORECORE: * For best performance, MORECORE should allocate in multiples of pagesize. * MORECORE may allocate more memory than requested. (Or even less, but this will usually result in a malloc failure.) * MORECORE must not allocate memory when given argument zero, but instead return one past the end address of memory from previous nonzero call. * For best performance, consecutive calls to MORECORE with positive arguments should return increasing addresses, indicating that space has been contiguously extended. * Even though consecutive calls to MORECORE need not return contiguous addresses, it must be OK for malloc'ed chunks to span multiple regions in those cases where they do happen to be contiguous. * MORECORE need not handle negative arguments -- it may instead just return MFAIL when given negative arguments. Negative arguments are always multiples of pagesize. MORECORE must not misinterpret negative args as large positive unsigned args. You can suppress all such calls from even occurring by defining MORECORE_CANNOT_TRIM, As an example alternative MORECORE, here is a custom allocator kindly contributed for pre-OSX macOS. It uses virtually but not necessarily physically contiguous non-paged memory (locked in, present and won't get swapped out). You can use it by uncommenting this section, adding some #includes, and setting up the appropriate defines above: #define MORECORE osMoreCore There is also a shutdown routine that should somehow be called for cleanup upon program exit. #define MAX_POOL_ENTRIES 100 #define MINIMUM_MORECORE_SIZE (64 * 1024U) static int next_os_pool; void *our_os_pools[MAX_POOL_ENTRIES]; void *osMoreCore(int size) { void *ptr = 0; static void *sbrk_top = 0; if (size > 0) { if (size < MINIMUM_MORECORE_SIZE) size = MINIMUM_MORECORE_SIZE; if (CurrentExecutionLevel() == kTaskLevel) ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0); if (ptr == 0) { return (void *) MFAIL; } // save ptrs so they can be freed during cleanup our_os_pools[next_os_pool] = ptr; next_os_pool++; ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK); sbrk_top = (char *) ptr + size; return ptr; } else if (size < 0) { // we don't currently support shrink behavior return (void *) MFAIL; } else { return sbrk_top; } } // cleanup any allocated memory pools // called as last thing before shutting down driver void osCleanupMem(void) { void **ptr; for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++) if (*ptr) { PoolDeallocate(*ptr); *ptr = 0; } } */ /* ----------------------------------------------------------------------- History: V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee) * Add max_footprint functions * Ensure all appropriate literals are size_t * Fix conditional compilation problem for some #define settings * Avoid concatenating segments with the one provided in create_mspace_with_base * Rename some variables to avoid compiler shadowing warnings * Use explicit lock initialization. * Better handling of sbrk interference. * Simplify and fix segment insertion, trimming and mspace_destroy * Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x * Thanks especially to Dennis Flanagan for help on these. V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee) * Fix memalign brace error. V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee) * Fix improper #endif nesting in C++ * Add explicit casts needed for C++ V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee) * Use trees for large bins * Support mspaces * Use segments to unify sbrk-based and mmap-based system allocation, removing need for emulation on most platforms without sbrk. * Default safety checks * Optional footer checks. Thanks to William Robertson for the idea. * Internal code refactoring * Incorporate suggestions and platform-specific changes. Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas, Aaron Bachmann, Emery Berger, and others. * Speed up non-fastbin processing enough to remove fastbins. * Remove useless cfree() to avoid conflicts with other apps. * Remove internal memcpy, memset. Compilers handle builtins better. * Remove some options that no one ever used and rename others. V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee) * Fix malloc_state bitmap array misdeclaration V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee) * Allow tuning of FIRST_SORTED_BIN_SIZE * Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte. * Better detection and support for non-contiguousness of MORECORE. Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger * Bypass most of malloc if no frees. Thanks To Emery Berger. * Fix freeing of old top non-contiguous chunk im sysmalloc. * Raised default trim and map thresholds to 256K. * Fix mmap-related #defines. Thanks to Lubos Lunak. * Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield. * Branch-free bin calculation * Default trim and mmap thresholds now 256K. V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) * Introduce independent_comalloc and independent_calloc. Thanks to Michael Pachos for motivation and help. * Make optional .h file available * Allow > 2GB requests on 32bit systems. * new WIN32 sbrk, mmap, munmap, lock code from . Thanks also to Andreas Mueller , and Anonymous. * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for helping test this.) * memalign: check alignment arg * realloc: don't try to shift chunks backwards, since this leads to more fragmentation in some programs and doesn't seem to help in any others. * Collect all cases in malloc requiring system memory into sysmalloc * Use mmap as backup to sbrk * Place all internal state in malloc_state * Introduce fastbins (although similar to 2.5.1) * Many minor tunings and cosmetic improvements * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS Thanks to Tony E. Bennett and others. * Include errno.h to support default failure action. V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee) * return null for negative arguments * Added Several WIN32 cleanups from Martin C. Fong * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h' (e.g. WIN32 platforms) * Cleanup header file inclusion for WIN32 platforms * Cleanup code to avoid Microsoft Visual C++ compiler complaints * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing memory allocation routines * Set 'malloc_getpagesize' for WIN32 platforms (needs more work) * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to usage of 'assert' in non-WIN32 code * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to avoid infinite loop * Always call 'fREe()' rather than 'free()' V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee) * Fixed ordering problem with boundary-stamping V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) * Added pvalloc, as recommended by H.J. Liu * Added 64bit pointer support mainly from Wolfram Gloger * Added anonymously donated WIN32 sbrk emulation * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen * malloc_extend_top: fix mask error that caused wastage after foreign sbrks * Add linux mremap support code from HJ Liu V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) * Integrated most documentation with the code. * Add support for mmap, with help from Wolfram Gloger (Gloger@lrz.uni-muenchen.de). * Use last_remainder in more cases. * Pack bins using idea from colin@nyx10.cs.du.edu * Use ordered bins instead of best-fit threshhold * Eliminate block-local decls to simplify tracing and debugging. * Support another case of realloc via move into top * Fix error occuring when initial sbrk_base not word-aligned. * Rely on page size for units instead of SBRK_UNIT to avoid surprises about sbrk alignment conventions. * Add mallinfo, mallopt. Thanks to Raymond Nijssen (raymond@es.ele.tue.nl) for the suggestion. * Add `pad' argument to malloc_trim and top_pad mallopt parameter. * More precautions for cases where other routines call sbrk, courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). * Added macros etc., allowing use in linux libc from H.J. Lu (hjl@gnu.ai.mit.edu) * Inverted this history list V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee) * Re-tuned and fixed to behave more nicely with V2.6.0 changes. * Removed all preallocation code since under current scheme the work required to undo bad preallocations exceeds the work saved in good cases for most test programs. * No longer use return list or unconsolidated bins since no scheme using them consistently outperforms those that don't given above changes. * Use best fit for very large chunks to prevent some worst-cases. * Added some support for debugging V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee) * Removed footers when chunks are in use. Thanks to Paul Wilson (wilson@cs.texas.edu) for the suggestion. V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) * Added malloc_trim, with help from Wolfram Gloger (wmglo@Dent.MED.Uni-Muenchen.DE). V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g) * realloc: try to expand in both directions * malloc: swap order of clean-bin strategy; * realloc: only conditionally expand backwards * Try not to scavenge used bins * Use bin counts as a guide to preallocation * Occasionally bin return list chunks in first scan * Add a few optimizations from colin@nyx10.cs.du.edu V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g) * faster bin computation & slightly different binning * merged all consolidations to one part of malloc proper (eliminating old malloc_find_space & malloc_clean_bin) * Scan 2 returns chunks (not just 1) * Propagate failure in realloc if malloc returns 0 * Add stuff to allow compilation on non-ANSI compilers from kpv@research.att.com V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) * removed potential for odd address access in prev_chunk * removed dependency on getpagesize.h * misc cosmetics and a bit more internal documentation * anticosmetics: mangled names in macros to evade debugger strangeness * tested on sparc, hp-700, dec-mips, rs6000 with gcc & native cc (hp, dec only) allowing Detlefs & Zorn comparison study (in SIGPLAN Notices.) Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) * Based loosely on libg++-1.2X malloc. (It retains some of the overall structure of old version, but most details differ.) */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/java_raw_api.c0000644000175000017500000002043111545150464022412 0ustar chr1schr1s/* ----------------------------------------------------------------------- java_raw_api.c - Copyright (c) 1999, 2007, 2008 Red Hat, Inc. Cloned from raw_api.c Raw_api.c author: Kresten Krab Thorup Java_raw_api.c author: Hans-J. Boehm $Id $ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /* This defines a Java- and 64-bit specific variant of the raw API. */ /* It assumes that "raw" argument blocks look like Java stacks on a */ /* 64-bit machine. Arguments that can be stored in a single stack */ /* stack slots (longs, doubles) occupy 128 bits, but only the first */ /* 64 bits are actually used. */ #include #include #include #if !defined(NO_JAVA_RAW_API) && !defined(FFI_NO_RAW_API) size_t ffi_java_raw_size (ffi_cif *cif) { size_t result = 0; int i; ffi_type **at = cif->arg_types; for (i = cif->nargs-1; i >= 0; i--, at++) { switch((*at) -> type) { case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_DOUBLE: result += 2 * FFI_SIZEOF_JAVA_RAW; break; case FFI_TYPE_STRUCT: /* No structure parameters in Java. */ abort(); default: result += FFI_SIZEOF_JAVA_RAW; } } return result; } void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args) { unsigned i; ffi_type **tp = cif->arg_types; #if WORDS_BIGENDIAN for (i = 0; i < cif->nargs; i++, tp++, args++) { switch ((*tp)->type) { case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: *args = (void*) ((char*)(raw++) + 3); break; case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: *args = (void*) ((char*)(raw++) + 2); break; #if FFI_SIZEOF_JAVA_RAW == 8 case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_DOUBLE: *args = (void *)raw; raw += 2; break; #endif case FFI_TYPE_POINTER: *args = (void*) &(raw++)->ptr; break; default: *args = raw; raw += ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); } } #else /* WORDS_BIGENDIAN */ #if !PDP /* then assume little endian */ for (i = 0; i < cif->nargs; i++, tp++, args++) { #if FFI_SIZEOF_JAVA_RAW == 8 switch((*tp)->type) { case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_DOUBLE: *args = (void*) raw; raw += 2; break; default: *args = (void*) raw++; } #else /* FFI_SIZEOF_JAVA_RAW != 8 */ *args = (void*) raw; raw += ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); #endif /* FFI_SIZEOF_JAVA_RAW == 8 */ } #else #error "pdp endian not supported" #endif /* ! PDP */ #endif /* WORDS_BIGENDIAN */ } void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) { unsigned i; ffi_type **tp = cif->arg_types; for (i = 0; i < cif->nargs; i++, tp++, args++) { switch ((*tp)->type) { case FFI_TYPE_UINT8: #if WORDS_BIGENDIAN *(UINT32*)(raw++) = *(UINT8*) (*args); #else (raw++)->uint = *(UINT8*) (*args); #endif break; case FFI_TYPE_SINT8: #if WORDS_BIGENDIAN *(SINT32*)(raw++) = *(SINT8*) (*args); #else (raw++)->sint = *(SINT8*) (*args); #endif break; case FFI_TYPE_UINT16: #if WORDS_BIGENDIAN *(UINT32*)(raw++) = *(UINT16*) (*args); #else (raw++)->uint = *(UINT16*) (*args); #endif break; case FFI_TYPE_SINT16: #if WORDS_BIGENDIAN *(SINT32*)(raw++) = *(SINT16*) (*args); #else (raw++)->sint = *(SINT16*) (*args); #endif break; case FFI_TYPE_UINT32: #if WORDS_BIGENDIAN *(UINT32*)(raw++) = *(UINT32*) (*args); #else (raw++)->uint = *(UINT32*) (*args); #endif break; case FFI_TYPE_SINT32: #if WORDS_BIGENDIAN *(SINT32*)(raw++) = *(SINT32*) (*args); #else (raw++)->sint = *(SINT32*) (*args); #endif break; case FFI_TYPE_FLOAT: (raw++)->flt = *(FLOAT32*) (*args); break; #if FFI_SIZEOF_JAVA_RAW == 8 case FFI_TYPE_UINT64: case FFI_TYPE_SINT64: case FFI_TYPE_DOUBLE: raw->uint = *(UINT64*) (*args); raw += 2; break; #endif case FFI_TYPE_POINTER: (raw++)->ptr = **(void***) args; break; default: #if FFI_SIZEOF_JAVA_RAW == 8 FFI_ASSERT(0); /* Should have covered all cases */ #else memcpy ((void*) raw->data, (void*)*args, (*tp)->size); raw += ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); #endif } } } #if !FFI_NATIVE_RAW_API static void ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue) { #if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8 switch (cif->rtype->type) { case FFI_TYPE_UINT8: case FFI_TYPE_UINT16: case FFI_TYPE_UINT32: *(UINT64 *)rvalue <<= 32; break; case FFI_TYPE_SINT8: case FFI_TYPE_SINT16: case FFI_TYPE_SINT32: case FFI_TYPE_INT: #if FFI_SIZEOF_JAVA_RAW == 4 case FFI_TYPE_POINTER: #endif *(SINT64 *)rvalue <<= 32; break; default: break; } #endif } static void ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue) { #if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8 switch (cif->rtype->type) { case FFI_TYPE_UINT8: case FFI_TYPE_UINT16: case FFI_TYPE_UINT32: *(UINT64 *)rvalue >>= 32; break; case FFI_TYPE_SINT8: case FFI_TYPE_SINT16: case FFI_TYPE_SINT32: case FFI_TYPE_INT: *(SINT64 *)rvalue >>= 32; break; default: break; } #endif } /* This is a generic definition of ffi_raw_call, to be used if the * native system does not provide a machine-specific implementation. * Having this, allows code to be written for the raw API, without * the need for system-specific code to handle input in that format; * these following couple of functions will handle the translation forth * and back automatically. */ void ffi_java_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_java_raw *raw) { void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); ffi_java_raw_to_ptrarray (cif, raw, avalue); ffi_call (cif, fn, rvalue, avalue); ffi_java_rvalue_to_raw (cif, rvalue); } #if FFI_CLOSURES /* base system provides closures */ static void ffi_java_translate_args (ffi_cif *cif, void *rvalue, void **avalue, void *user_data) { ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif)); ffi_raw_closure *cl = (ffi_raw_closure*)user_data; ffi_java_ptrarray_to_raw (cif, avalue, raw); (*cl->fun) (cif, rvalue, raw, cl->user_data); ffi_java_raw_to_rvalue (cif, rvalue); } ffi_status ffi_prep_java_raw_closure_loc (ffi_java_raw_closure* cl, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), void *user_data, void *codeloc) { ffi_status status; status = ffi_prep_closure_loc ((ffi_closure*) cl, cif, &ffi_java_translate_args, codeloc, codeloc); if (status == FFI_OK) { cl->fun = fun; cl->user_data = user_data; } return status; } /* Again, here is the generic version of ffi_prep_raw_closure, which * will install an intermediate "hub" for translation of arguments from * the pointer-array format, to the raw format */ ffi_status ffi_prep_java_raw_closure (ffi_java_raw_closure* cl, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), void *user_data) { return ffi_prep_java_raw_closure_loc (cl, cif, fun, user_data, cl); } #endif /* FFI_CLOSURES */ #endif /* !FFI_NATIVE_RAW_API */ #endif /* !FFI_NO_RAW_API */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/prep_cif.c0000644000175000017500000001220311545150464021554 0ustar chr1schr1s/* ----------------------------------------------------------------------- prep_cif.c - Copyright (c) 1996, 1998, 2007 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ #include #include #include /* Round up to FFI_SIZEOF_ARG. */ #define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) /* Perform machine independent initialization of aggregate type specifications. */ static ffi_status initialize_aggregate(ffi_type *arg) { ffi_type **ptr; FFI_ASSERT(arg != NULL); FFI_ASSERT(arg->elements != NULL); FFI_ASSERT(arg->size == 0); FFI_ASSERT(arg->alignment == 0); ptr = &(arg->elements[0]); while ((*ptr) != NULL) { if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; /* Perform a sanity check on the argument type */ FFI_ASSERT_VALID_TYPE(*ptr); arg->size = ALIGN(arg->size, (*ptr)->alignment); arg->size += (*ptr)->size; arg->alignment = (arg->alignment > (*ptr)->alignment) ? arg->alignment : (*ptr)->alignment; ptr++; } /* Structure size includes tail padding. This is important for structures that fit in one register on ABIs like the PowerPC64 Linux ABI that right justify small structs in a register. It's also needed for nested structure layout, for example struct A { long a; char b; }; struct B { struct A x; char y; }; should find y at an offset of 2*sizeof(long) and result in a total size of 3*sizeof(long). */ arg->size = ALIGN (arg->size, arg->alignment); if (arg->size == 0) return FFI_BAD_TYPEDEF; else return FFI_OK; } #ifndef __CRIS__ /* The CRIS ABI specifies structure elements to have byte alignment only, so it completely overrides this functions, which assumes "natural" alignment and padding. */ /* Perform machine independent ffi_cif preparation, then call machine dependent routine. */ ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, ffi_type *rtype, ffi_type **atypes) { unsigned bytes = 0; unsigned int i; ffi_type **ptr; FFI_ASSERT(cif != NULL); FFI_ASSERT(abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI); cif->abi = abi; cif->arg_types = atypes; cif->nargs = nargs; cif->rtype = rtype; cif->flags = 0; /* Initialize the return type if necessary */ if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) return FFI_BAD_TYPEDEF; /* Perform a sanity check on the return type */ FFI_ASSERT_VALID_TYPE(cif->rtype); /* x86, x86-64 and s390 stack space allocation is handled in prep_machdep. */ #if !defined M68K && !defined X86_ANY && !defined S390 && !defined PA /* Make space for the return structure pointer */ if (cif->rtype->type == FFI_TYPE_STRUCT #ifdef SPARC && (cif->abi != FFI_V9 || cif->rtype->size > 32) #endif ) bytes = STACK_ARG_SIZE(sizeof(void*)); #endif for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) { /* Initialize any uninitialized aggregate type definitions */ if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) return FFI_BAD_TYPEDEF; /* Perform a sanity check on the argument type, do this check after the initialization. */ FFI_ASSERT_VALID_TYPE(*ptr); #if !defined X86_ANY && !defined S390 && !defined PA #ifdef SPARC if (((*ptr)->type == FFI_TYPE_STRUCT && ((*ptr)->size > 16 || cif->abi != FFI_V9)) || ((*ptr)->type == FFI_TYPE_LONGDOUBLE && cif->abi != FFI_V9)) bytes += sizeof(void*); else #endif { /* Add any padding if necessary */ if (((*ptr)->alignment - 1) & bytes) bytes = ALIGN(bytes, (*ptr)->alignment); bytes += STACK_ARG_SIZE((*ptr)->size); } #endif } cif->bytes = bytes; /* Perform machine dependent cif processing */ return ffi_prep_cif_machdep(cif); } #endif /* not __CRIS__ */ #if FFI_CLOSURES ffi_status ffi_prep_closure (ffi_closure* closure, ffi_cif* cif, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data) { return ffi_prep_closure_loc (closure, cif, fun, user_data, closure); } #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/raw_api.c0000644000175000017500000001366311545150464021422 0ustar chr1schr1s/* ----------------------------------------------------------------------- raw_api.c - Copyright (c) 1999, 2008 Red Hat, Inc. Author: Kresten Krab Thorup Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /* This file defines generic functions for use with the raw api. */ #include #include #if !FFI_NO_RAW_API size_t ffi_raw_size (ffi_cif *cif) { size_t result = 0; int i; ffi_type **at = cif->arg_types; for (i = cif->nargs-1; i >= 0; i--, at++) { #if !FFI_NO_STRUCTS if ((*at)->type == FFI_TYPE_STRUCT) result += ALIGN (sizeof (void*), FFI_SIZEOF_ARG); else #endif result += ALIGN ((*at)->size, FFI_SIZEOF_ARG); } return result; } void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) { unsigned i; ffi_type **tp = cif->arg_types; #if WORDS_BIGENDIAN for (i = 0; i < cif->nargs; i++, tp++, args++) { switch ((*tp)->type) { case FFI_TYPE_UINT8: case FFI_TYPE_SINT8: *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 1); break; case FFI_TYPE_UINT16: case FFI_TYPE_SINT16: *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 2); break; #if FFI_SIZEOF_ARG >= 4 case FFI_TYPE_UINT32: case FFI_TYPE_SINT32: *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 4); break; #endif #if !FFI_NO_STRUCTS case FFI_TYPE_STRUCT: *args = (raw++)->ptr; break; #endif case FFI_TYPE_POINTER: *args = (void*) &(raw++)->ptr; break; default: *args = raw; raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; } } #else /* WORDS_BIGENDIAN */ #if !PDP /* then assume little endian */ for (i = 0; i < cif->nargs; i++, tp++, args++) { #if !FFI_NO_STRUCTS if ((*tp)->type == FFI_TYPE_STRUCT) { *args = (raw++)->ptr; } else #endif { *args = (void*) raw; raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*); } } #else #error "pdp endian not supported" #endif /* ! PDP */ #endif /* WORDS_BIGENDIAN */ } void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) { unsigned i; ffi_type **tp = cif->arg_types; for (i = 0; i < cif->nargs; i++, tp++, args++) { switch ((*tp)->type) { case FFI_TYPE_UINT8: (raw++)->uint = *(UINT8*) (*args); break; case FFI_TYPE_SINT8: (raw++)->sint = *(SINT8*) (*args); break; case FFI_TYPE_UINT16: (raw++)->uint = *(UINT16*) (*args); break; case FFI_TYPE_SINT16: (raw++)->sint = *(SINT16*) (*args); break; #if FFI_SIZEOF_ARG >= 4 case FFI_TYPE_UINT32: (raw++)->uint = *(UINT32*) (*args); break; case FFI_TYPE_SINT32: (raw++)->sint = *(SINT32*) (*args); break; #endif #if !FFI_NO_STRUCTS case FFI_TYPE_STRUCT: (raw++)->ptr = *args; break; #endif case FFI_TYPE_POINTER: (raw++)->ptr = **(void***) args; break; default: memcpy ((void*) raw->data, (void*)*args, (*tp)->size); raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; } } } #if !FFI_NATIVE_RAW_API /* This is a generic definition of ffi_raw_call, to be used if the * native system does not provide a machine-specific implementation. * Having this, allows code to be written for the raw API, without * the need for system-specific code to handle input in that format; * these following couple of functions will handle the translation forth * and back automatically. */ void ffi_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *raw) { void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); ffi_raw_to_ptrarray (cif, raw, avalue); ffi_call (cif, fn, rvalue, avalue); } #if FFI_CLOSURES /* base system provides closures */ static void ffi_translate_args (ffi_cif *cif, void *rvalue, void **avalue, void *user_data) { ffi_raw *raw = (ffi_raw*)alloca (ffi_raw_size (cif)); ffi_raw_closure *cl = (ffi_raw_closure*)user_data; ffi_ptrarray_to_raw (cif, avalue, raw); (*cl->fun) (cif, rvalue, raw, cl->user_data); } ffi_status ffi_prep_raw_closure_loc (ffi_raw_closure* cl, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data, void *codeloc) { ffi_status status; status = ffi_prep_closure_loc ((ffi_closure*) cl, cif, &ffi_translate_args, codeloc, codeloc); if (status == FFI_OK) { cl->fun = fun; cl->user_data = user_data; } return status; } #endif /* FFI_CLOSURES */ #endif /* !FFI_NATIVE_RAW_API */ #if FFI_CLOSURES /* Again, here is the generic version of ffi_prep_raw_closure, which * will install an intermediate "hub" for translation of arguments from * the pointer-array format, to the raw format */ ffi_status ffi_prep_raw_closure (ffi_raw_closure* cl, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data) { return ffi_prep_raw_closure_loc (cl, cif, fun, user_data, cl); } #endif /* FFI_CLOSURES */ #endif /* !FFI_NO_RAW_API */ mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/src/types.c0000644000175000017500000000553011545150464021136 0ustar chr1schr1s/* ----------------------------------------------------------------------- types.c - Copyright (c) 1996, 1998 Red Hat, Inc. Predefined ffi_types needed by libffi. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /* Hide the basic type definitions from the header file, so that we can redefine them here as "const". */ #define LIBFFI_HIDE_BASIC_TYPES #include #include /* Type definitions */ #define FFI_TYPEDEF(name, type, id) \ struct struct_align_##name { \ char c; \ type x; \ }; \ const ffi_type ffi_type_##name = { \ sizeof(type), \ offsetof(struct struct_align_##name, x), \ id, NULL \ } /* Size and alignment are fake here. They must not be 0. */ const ffi_type ffi_type_void = { 1, 1, FFI_TYPE_VOID, NULL }; FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8); FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8); FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16); FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16); FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32); FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32); FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64); FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64); FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER); FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT); FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE); #ifdef __alpha__ /* Even if we're not configured to default to 128-bit long double, maintain binary compatibility, as -mlong-double-128 can be used at any time. */ /* Validate the hard-coded number below. */ # if defined(__LONG_DOUBLE_128__) && FFI_TYPE_LONGDOUBLE != 4 # error FFI_TYPE_LONGDOUBLE out of date # endif const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; #elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE); #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/Makefile.am0000644000175000017500000000774611545150464023137 0ustar chr1schr1s## Process this file with automake to produce Makefile.in. AUTOMAKE_OPTIONS = foreign dejagnu # Setup the testing framework, if you have one EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \ echo $(top_builddir)/../expect/expect ; \ else echo expect ; fi` RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` AM_RUNTESTFLAGS = CLEANFILES = *.exe core* *.log *.sum EXTRA_DIST = libffi.special/special.exp \ libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \ libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \ lib/libffi-dg.exp lib/wrapper.exp libffi.call/float.c \ libffi.call/cls_multi_schar.c libffi.call/float3.c \ libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \ libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \ libffi.call/promotion.c libffi.call/cls_dbls_struct.c \ libffi.call/nested_struct.c libffi.call/closure_fn1.c \ libffi.call/cls_4_1byte.c libffi.call/cls_float.c \ libffi.call/cls_2byte.c libffi.call/closure_fn4.c \ libffi.call/return_fl2.c libffi.call/nested_struct7.c \ libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \ libffi.call/float1.c libffi.call/cls_19byte.c \ libffi.call/nested_struct1.c libffi.call/cls_4byte.c \ libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \ libffi.call/nested_struct4.c libffi.call/nested_struct3.c \ libffi.call/struct7.c libffi.call/nested_struct9.c \ libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \ libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \ libffi.call/testclosure.c libffi.call/cls_3byte1.c \ libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \ libffi.call/cls_ushort.c libffi.call/stret_medium2.c \ libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \ libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \ libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \ libffi.call/return_ll.c libffi.call/cls_pointer.c \ libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \ libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \ libffi.call/return_sl.c libffi.call/cls_1_1byte.c \ libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \ libffi.call/cls_double.c libffi.call/many_win32.c \ libffi.call/cls_16byte.c libffi.call/cls_align_double.c \ libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \ libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \ libffi.call/closure_stdcall.c libffi.call/return_fl.c \ libffi.call/strlen_win32.c libffi.call/return_ldl.c \ libffi.call/cls_align_float.c libffi.call/struct3.c \ libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \ libffi.call/cls_align_longdouble_split.c \ libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \ libffi.call/stret_large.c libffi.call/cls_align_sint16.c \ libffi.call/nested_struct6.c libffi.call/cls_5byte.c \ libffi.call/return_dbl.c libffi.call/cls_20byte.c \ libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \ libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \ libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \ libffi.call/cls_18byte.c libffi.call/closure_fn3.c \ libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \ libffi.call/struct2.c libffi.call/cls_3byte2.c \ libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \ libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \ libffi.call/problem1.c libffi.call/float4.c \ libffi.call/cls_align_uint64.c libffi.call/struct9.c \ libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \ libffi.call/closure_fn0.c libffi.call/closure_fn6.c \ libffi.call/struct4.c libffi.call/nested_struct2.c \ libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \ libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \ libffi.call/cls_12byte.c libffi.call/cls_double_va.c \ libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \ libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ libffi.call/huge_struct.c mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/testsuite/Makefile.in0000644000175000017500000003626111545150464023142 0ustar chr1schr1s# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = testsuite DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/fficonfig.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = DEJATOOL = $(PACKAGE) RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TARGET = @TARGET@ TARGETDIR = @TARGETDIR@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ toolexecdir = @toolexecdir@ toolexeclibdir = @toolexeclibdir@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign dejagnu # Setup the testing framework, if you have one EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \ echo $(top_builddir)/../expect/expect ; \ else echo expect ; fi` RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ echo $(top_srcdir)/../dejagnu/runtest ; \ else echo runtest; fi` CLEANFILES = *.exe core* *.log *.sum EXTRA_DIST = libffi.special/special.exp \ libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \ libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \ lib/libffi-dg.exp lib/wrapper.exp libffi.call/float.c \ libffi.call/cls_multi_schar.c libffi.call/float3.c \ libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \ libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \ libffi.call/promotion.c libffi.call/cls_dbls_struct.c \ libffi.call/nested_struct.c libffi.call/closure_fn1.c \ libffi.call/cls_4_1byte.c libffi.call/cls_float.c \ libffi.call/cls_2byte.c libffi.call/closure_fn4.c \ libffi.call/return_fl2.c libffi.call/nested_struct7.c \ libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \ libffi.call/float1.c libffi.call/cls_19byte.c \ libffi.call/nested_struct1.c libffi.call/cls_4byte.c \ libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \ libffi.call/nested_struct4.c libffi.call/nested_struct3.c \ libffi.call/struct7.c libffi.call/nested_struct9.c \ libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \ libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \ libffi.call/testclosure.c libffi.call/cls_3byte1.c \ libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \ libffi.call/cls_ushort.c libffi.call/stret_medium2.c \ libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \ libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \ libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \ libffi.call/return_ll.c libffi.call/cls_pointer.c \ libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \ libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \ libffi.call/return_sl.c libffi.call/cls_1_1byte.c \ libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \ libffi.call/cls_double.c libffi.call/many_win32.c \ libffi.call/cls_16byte.c libffi.call/cls_align_double.c \ libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \ libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \ libffi.call/closure_stdcall.c libffi.call/return_fl.c \ libffi.call/strlen_win32.c libffi.call/return_ldl.c \ libffi.call/cls_align_float.c libffi.call/struct3.c \ libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \ libffi.call/cls_align_longdouble_split.c \ libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \ libffi.call/stret_large.c libffi.call/cls_align_sint16.c \ libffi.call/nested_struct6.c libffi.call/cls_5byte.c \ libffi.call/return_dbl.c libffi.call/cls_20byte.c \ libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \ libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \ libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \ libffi.call/cls_18byte.c libffi.call/closure_fn3.c \ libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \ libffi.call/struct2.c libffi.call/cls_3byte2.c \ libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \ libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \ libffi.call/problem1.c libffi.call/float4.c \ libffi.call/cls_align_uint64.c libffi.call/struct9.c \ libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \ libffi.call/closure_fn0.c libffi.call/closure_fn6.c \ libffi.call/struct4.c libffi.call/nested_struct2.c \ libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \ libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \ libffi.call/cls_12byte.c libffi.call/cls_double_va.c \ libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \ libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ libffi.call/huge_struct.c all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign testsuite/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags: TAGS TAGS: ctags: CTAGS CTAGS: check-DEJAGNU: site.exp srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ EXPECT=$(EXPECT); export EXPECT; \ runtest=$(RUNTEST); \ if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \ if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ then :; else exit_status=1; fi; \ done; \ else echo "WARNING: could not find \`runtest'" 1>&2; :;\ fi; \ exit $$exit_status site.exp: Makefile @echo 'Making a new site.exp file...' @echo '## these variables are automatically generated by make ##' >site.tmp @echo '# Do not edit here. If you wish to override these values' >>site.tmp @echo '# edit the last section' >>site.tmp @echo 'set srcdir $(srcdir)' >>site.tmp @echo "set objdir `pwd`" >>site.tmp @echo 'set build_alias "$(build_alias)"' >>site.tmp @echo 'set build_triplet $(build_triplet)' >>site.tmp @echo 'set host_alias "$(host_alias)"' >>site.tmp @echo 'set host_triplet $(host_triplet)' >>site.tmp @echo 'set target_alias "$(target_alias)"' >>site.tmp @echo 'set target_triplet $(target_triplet)' >>site.tmp @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp @test ! -f site.exp || \ sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp @-rm -f site.bak @test ! -f site.exp || mv site.exp site.bak @mv site.tmp site.exp distclean-DEJAGNU: -rm -f site.exp site.bak -l='$(DEJATOOL)'; for tool in $$l; do \ rm -f $$tool.sum $$tool.log; \ done distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-DEJAGNU distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: check-am install-am install-strip .PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \ clean-libtool distclean distclean-DEJAGNU distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/doc/libffi.texi0000644000175000017500000004103411545150464021731 0ustar chr1schr1s\input texinfo @c -*-texinfo-*- @c %**start of header @setfilename libffi.info @settitle libffi @setchapternewpage off @c %**end of header @c Merge the standard indexes into a single one. @syncodeindex fn cp @syncodeindex vr cp @syncodeindex ky cp @syncodeindex pg cp @syncodeindex tp cp @include version.texi @copying This manual is for Libffi, a portable foreign-function interface library. Copyright @copyright{} 2008, 2010 Red Hat, Inc. @quotation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. A copy of the license is included in the section entitled ``GNU General Public License''. @end quotation @end copying @dircategory Development @direntry * libffi: (libffi). Portable foreign-function interface library. @end direntry @titlepage @title Libffi @page @vskip 0pt plus 1filll @insertcopying @end titlepage @ifnottex @node Top @top libffi @insertcopying @menu * Introduction:: What is libffi? * Using libffi:: How to use libffi. * Missing Features:: Things libffi can't do. * Index:: Index. @end menu @end ifnottex @node Introduction @chapter What is libffi? Compilers for high level languages generate code that follow certain conventions. These conventions are necessary, in part, for separate compilation to work. One such convention is the @dfn{calling convention}. The calling convention is a set of assumptions made by the compiler about where function arguments will be found on entry to a function. A calling convention also specifies where the return value for a function is found. The calling convention is also sometimes called the @dfn{ABI} or @dfn{Application Binary Interface}. @cindex calling convention @cindex ABI @cindex Application Binary Interface Some programs may not know at the time of compilation what arguments are to be passed to a function. For instance, an interpreter may be told at run-time about the number and types of arguments used to call a given function. @samp{Libffi} can be used in such programs to provide a bridge from the interpreter program to compiled code. The @samp{libffi} library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run time. @acronym{FFI} stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language. The @samp{libffi} library really only provides the lowest, machine dependent layer of a fully featured foreign function interface. A layer must exist above @samp{libffi} that handles type conversions for values passed between the two languages. @cindex FFI @cindex Foreign Function Interface @node Using libffi @chapter Using libffi @menu * The Basics:: The basic libffi API. * Simple Example:: A simple example. * Types:: libffi type descriptions. * Multiple ABIs:: Different passing styles on one platform. * The Closure API:: Writing a generic function. * Closure Example:: A closure example. @end menu @node The Basics @section The Basics @samp{Libffi} assumes that you have a pointer to the function you wish to call and that you know the number and types of arguments to pass it, as well as the return type of the function. The first thing you must do is create an @code{ffi_cif} object that matches the signature of the function you wish to call. This is a separate step because it is common to make multiple calls using a single @code{ffi_cif}. The @dfn{cif} in @code{ffi_cif} stands for Call InterFace. To prepare a call interface object, use the function @code{ffi_prep_cif}. @cindex cif @findex ffi_prep_cif @defun ffi_status ffi_prep_cif (ffi_cif *@var{cif}, ffi_abi @var{abi}, unsigned int @var{nargs}, ffi_type *@var{rtype}, ffi_type **@var{argtypes}) This initializes @var{cif} according to the given parameters. @var{abi} is the ABI to use; normally @code{FFI_DEFAULT_ABI} is what you want. @ref{Multiple ABIs} for more information. @var{nargs} is the number of arguments that this function accepts. @samp{libffi} does not yet handle varargs functions; see @ref{Missing Features} for more information. @var{rtype} is a pointer to an @code{ffi_type} structure that describes the return type of the function. @xref{Types}. @var{argtypes} is a vector of @code{ffi_type} pointers. @var{argtypes} must have @var{nargs} elements. If @var{nargs} is 0, this argument is ignored. @code{ffi_prep_cif} returns a @code{libffi} status code, of type @code{ffi_status}. This will be either @code{FFI_OK} if everything worked properly; @code{FFI_BAD_TYPEDEF} if one of the @code{ffi_type} objects is incorrect; or @code{FFI_BAD_ABI} if the @var{abi} parameter is invalid. @end defun To call a function using an initialized @code{ffi_cif}, use the @code{ffi_call} function: @findex ffi_call @defun void ffi_call (ffi_cif *@var{cif}, void *@var{fn}, void *@var{rvalue}, void **@var{avalues}) This calls the function @var{fn} according to the description given in @var{cif}. @var{cif} must have already been prepared using @code{ffi_prep_cif}. @var{rvalue} is a pointer to a chunk of memory that will hold the result of the function call. This must be large enough to hold the result and must be suitably aligned; it is the caller's responsibility to ensure this. If @var{cif} declares that the function returns @code{void} (using @code{ffi_type_void}), then @var{rvalue} is ignored. If @var{rvalue} is @samp{NULL}, then the return value is discarded. @var{avalues} is a vector of @code{void *} pointers that point to the memory locations holding the argument values for a call. If @var{cif} declares that the function has no arguments (i.e., @var{nargs} was 0), then @var{avalues} is ignored. Note that argument values may be modified by the callee (for instance, structs passed by value); the burden of copying pass-by-value arguments is placed on the caller. @end defun @node Simple Example @section Simple Example Here is a trivial example that calls @code{puts} a few times. @example #include #include int main() @{ ffi_cif cif; ffi_type *args[1]; void *values[1]; char *s; int rc; /* Initialize the argument info vectors */ args[0] = &ffi_type_pointer; values[0] = &s; /* Initialize the cif */ if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, args) == FFI_OK) @{ s = "Hello World!"; ffi_call(&cif, puts, &rc, values); /* rc now holds the result of the call to puts */ /* values holds a pointer to the function's arg, so to call puts() again all we need to do is change the value of s */ s = "This is cool!"; ffi_call(&cif, puts, &rc, values); @} return 0; @} @end example @node Types @section Types @menu * Primitive Types:: Built-in types. * Structures:: Structure types. * Type Example:: Structure type example. @end menu @node Primitive Types @subsection Primitive Types @code{Libffi} provides a number of built-in type descriptors that can be used to describe argument and return types: @table @code @item ffi_type_void @tindex ffi_type_void The type @code{void}. This cannot be used for argument types, only for return values. @item ffi_type_uint8 @tindex ffi_type_uint8 An unsigned, 8-bit integer type. @item ffi_type_sint8 @tindex ffi_type_sint8 A signed, 8-bit integer type. @item ffi_type_uint16 @tindex ffi_type_uint16 An unsigned, 16-bit integer type. @item ffi_type_sint16 @tindex ffi_type_sint16 A signed, 16-bit integer type. @item ffi_type_uint32 @tindex ffi_type_uint32 An unsigned, 32-bit integer type. @item ffi_type_sint32 @tindex ffi_type_sint32 A signed, 32-bit integer type. @item ffi_type_uint64 @tindex ffi_type_uint64 An unsigned, 64-bit integer type. @item ffi_type_sint64 @tindex ffi_type_sint64 A signed, 64-bit integer type. @item ffi_type_float @tindex ffi_type_float The C @code{float} type. @item ffi_type_double @tindex ffi_type_double The C @code{double} type. @item ffi_type_uchar @tindex ffi_type_uchar The C @code{unsigned char} type. @item ffi_type_schar @tindex ffi_type_schar The C @code{signed char} type. (Note that there is not an exact equivalent to the C @code{char} type in @code{libffi}; ordinarily you should either use @code{ffi_type_schar} or @code{ffi_type_uchar} depending on whether @code{char} is signed.) @item ffi_type_ushort @tindex ffi_type_ushort The C @code{unsigned short} type. @item ffi_type_sshort @tindex ffi_type_sshort The C @code{short} type. @item ffi_type_uint @tindex ffi_type_uint The C @code{unsigned int} type. @item ffi_type_sint @tindex ffi_type_sint The C @code{int} type. @item ffi_type_ulong @tindex ffi_type_ulong The C @code{unsigned long} type. @item ffi_type_slong @tindex ffi_type_slong The C @code{long} type. @item ffi_type_longdouble @tindex ffi_type_longdouble On platforms that have a C @code{long double} type, this is defined. On other platforms, it is not. @item ffi_type_pointer @tindex ffi_type_pointer A generic @code{void *} pointer. You should use this for all pointers, regardless of their real type. @end table Each of these is of type @code{ffi_type}, so you must take the address when passing to @code{ffi_prep_cif}. @node Structures @subsection Structures Although @samp{libffi} has no special support for unions or bit-fields, it is perfectly happy passing structures back and forth. You must first describe the structure to @samp{libffi} by creating a new @code{ffi_type} object for it. @tindex ffi_type @deftp ffi_type The @code{ffi_type} has the following members: @table @code @item size_t size This is set by @code{libffi}; you should initialize it to zero. @item unsigned short alignment This is set by @code{libffi}; you should initialize it to zero. @item unsigned short type For a structure, this should be set to @code{FFI_TYPE_STRUCT}. @item ffi_type **elements This is a @samp{NULL}-terminated array of pointers to @code{ffi_type} objects. There is one element per field of the struct. @end table @end deftp @node Type Example @subsection Type Example The following example initializes a @code{ffi_type} object representing the @code{tm} struct from Linux's @file{time.h}. Here is how the struct is defined: @example struct tm @{ int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; /* Those are for future use. */ long int __tm_gmtoff__; __const char *__tm_zone__; @}; @end example Here is the corresponding code to describe this struct to @code{libffi}: @example @{ ffi_type tm_type; ffi_type *tm_type_elements[12]; int i; tm_type.size = tm_type.alignment = 0; tm_type.elements = &tm_type_elements; for (i = 0; i < 9; i++) tm_type_elements[i] = &ffi_type_sint; tm_type_elements[9] = &ffi_type_slong; tm_type_elements[10] = &ffi_type_pointer; tm_type_elements[11] = NULL; /* tm_type can now be used to represent tm argument types and return types for ffi_prep_cif() */ @} @end example @node Multiple ABIs @section Multiple ABIs A given platform may provide multiple different ABIs at once. For instance, the x86 platform has both @samp{stdcall} and @samp{fastcall} functions. @code{libffi} provides some support for this. However, this is necessarily platform-specific. @c FIXME: document the platforms @node The Closure API @section The Closure API @code{libffi} also provides a way to write a generic function -- a function that can accept and decode any combination of arguments. This can be useful when writing an interpreter, or to provide wrappers for arbitrary functions. This facility is called the @dfn{closure API}. Closures are not supported on all platforms; you can check the @code{FFI_CLOSURES} define to determine whether they are supported on the current platform. @cindex closures @cindex closure API @findex FFI_CLOSURES Because closures work by assembling a tiny function at runtime, they require special allocation on platforms that have a non-executable heap. Memory management for closures is handled by a pair of functions: @findex ffi_closure_alloc @defun void *ffi_closure_alloc (size_t @var{size}, void **@var{code}) Allocate a chunk of memory holding @var{size} bytes. This returns a pointer to the writable address, and sets *@var{code} to the corresponding executable address. @var{size} should be sufficient to hold a @code{ffi_closure} object. @end defun @findex ffi_closure_free @defun void ffi_closure_free (void *@var{writable}) Free memory allocated using @code{ffi_closure_alloc}. The argument is the writable address that was returned. @end defun Once you have allocated the memory for a closure, you must construct a @code{ffi_cif} describing the function call. Finally you can prepare the closure function: @findex ffi_prep_closure_loc @defun ffi_status ffi_prep_closure_loc (ffi_closure *@var{closure}, ffi_cif *@var{cif}, void (*@var{fun}) (ffi_cif *@var{cif}, void *@var{ret}, void **@var{args}, void *@var{user_data}), void *@var{user_data}, void *@var{codeloc}) Prepare a closure function. @var{closure} is the address of a @code{ffi_closure} object; this is the writable address returned by @code{ffi_closure_alloc}. @var{cif} is the @code{ffi_cif} describing the function parameters. @var{user_data} is an arbitrary datum that is passed, uninterpreted, to your closure function. @var{codeloc} is the executable address returned by @code{ffi_closure_alloc}. @var{fun} is the function which will be called when the closure is invoked. It is called with the arguments: @table @var @item cif The @code{ffi_cif} passed to @code{ffi_prep_closure_loc}. @item ret A pointer to the memory used for the function's return value. @var{fun} must fill this, unless the function is declared as returning @code{void}. @c FIXME: is this NULL for void-returning functions? @item args A vector of pointers to memory holding the arguments to the function. @item user_data The same @var{user_data} that was passed to @code{ffi_prep_closure_loc}. @end table @code{ffi_prep_closure_loc} will return @code{FFI_OK} if everything went ok, and something else on error. @c FIXME: what? After calling @code{ffi_prep_closure_loc}, you can cast @var{codeloc} to the appropriate pointer-to-function type. @end defun You may see old code referring to @code{ffi_prep_closure}. This function is deprecated, as it cannot handle the need for separate writable and executable addresses. @node Closure Example @section Closure Example A trivial example that creates a new @code{puts} by binding @code{fputs} with @code{stdin}. @example #include #include /* Acts like puts with the file given at time of enclosure. */ void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], FILE *stream) @{ *ret = fputs(*(char **)args[0], stream); @} int main() @{ ffi_cif cif; ffi_type *args[1]; ffi_closure *closure; int (*bound_puts)(char *); int rc; /* Allocate closure and bound_puts */ closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts); if (closure) @{ /* Initialize the argument info vectors */ args[0] = &ffi_type_pointer; /* Initialize the cif */ if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_uint, args) == FFI_OK) @{ /* Initialize the closure, setting stream to stdout */ if (ffi_prep_closure_loc(closure, &cif, puts_binding, stdout, bound_puts) == FFI_OK) @{ rc = bound_puts("Hello World!"); /* rc now holds the result of the call to fputs */ @} @} @} /* Deallocate both closure, and bound_puts */ ffi_closure_free(closure); return 0; @} @end example @node Missing Features @chapter Missing Features @code{libffi} is missing a few features. We welcome patches to add support for these. @itemize @bullet @item There is no support for calling varargs functions. This may work on some platforms, depending on how the ABI is defined, but it is not reliable. @item There is no support for bit fields in structures. @item The closure API is @c FIXME: ... @item The ``raw'' API is undocumented. @c argument promotion? @c unions? @c anything else? @end itemize @node Index @unnumbered Index @printindex cp @bye mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/doc/stamp-vti0000644000175000017500000000014511545150464021450 0ustar chr1schr1s@set UPDATED 14 February 2008 @set UPDATED-MONTH February 2008 @set EDITION 3.0.8 @set VERSION 3.0.8 mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/doc/version.texi0000644000175000017500000000014511545150464022161 0ustar chr1schr1s@set UPDATED 14 February 2008 @set UPDATED-MONTH February 2008 @set EDITION 3.0.8 @set VERSION 3.0.8 mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/include/ffi.h.in0000644000175000017500000002600511545150464022004 0ustar chr1schr1s/* -----------------------------------------------------------------*-C-*- libffi @VERSION@ - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------- */ /* ------------------------------------------------------------------- The basic API is described in the README file. The raw API is designed to bypass some of the argument packing and unpacking on architectures for which it can be avoided. The closure API allows interpreted functions to be packaged up inside a C function pointer, so that they can be called as C functions, with no understanding on the client side that they are interpreted. It can also be used in other cases in which it is necessary to package up a user specified parameter and a function pointer as a single function pointer. The closure API must be implemented in order to get its functionality, e.g. for use by gij. Routines are provided to emulate the raw API if the underlying platform doesn't allow faster implementation. More details on the raw and cloure API can be found in: http://gcc.gnu.org/ml/java/1999-q3/msg00138.html and http://gcc.gnu.org/ml/java/1999-q3/msg00174.html -------------------------------------------------------------------- */ #ifndef LIBFFI_H #define LIBFFI_H #ifdef __cplusplus extern "C" { #endif /* Specify which architecture libffi is configured for. */ #ifndef @TARGET@ #define @TARGET@ #endif /* ---- System configuration information --------------------------------- */ #include #ifndef LIBFFI_ASM #ifdef _MSC_VER #define __attribute__(X) #endif #include #include /* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). But we can find it either under the correct ANSI name, or under GNU C's internal name. */ #define FFI_64_BIT_MAX 9223372036854775807 #ifdef LONG_LONG_MAX # define FFI_LONG_LONG_MAX LONG_LONG_MAX #else # ifdef LLONG_MAX # define FFI_LONG_LONG_MAX LLONG_MAX # else # ifdef __GNUC__ # define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ # endif # ifdef _AIX # ifndef __PPC64__ # if defined (__IBMC__) || defined (__IBMCPP__) # define FFI_LONG_LONG_MAX LONGLONG_MAX # endif # endif /* __PPC64__ */ # undef FFI_64_BIT_MAX # define FFI_64_BIT_MAX 9223372036854775807LL # endif # endif #endif /* The closure code assumes that this works on pointers, i.e. a size_t */ /* can hold a pointer. */ typedef struct _ffi_type { size_t size; unsigned short alignment; unsigned short type; struct _ffi_type **elements; } ffi_type; #ifndef LIBFFI_HIDE_BASIC_TYPES #if SCHAR_MAX == 127 # define ffi_type_uchar ffi_type_uint8 # define ffi_type_schar ffi_type_sint8 #else #error "char size not supported" #endif #if SHRT_MAX == 32767 # define ffi_type_ushort ffi_type_uint16 # define ffi_type_sshort ffi_type_sint16 #elif SHRT_MAX == 2147483647 # define ffi_type_ushort ffi_type_uint32 # define ffi_type_sshort ffi_type_sint32 #else #error "short size not supported" #endif #if INT_MAX == 32767 # define ffi_type_uint ffi_type_uint16 # define ffi_type_sint ffi_type_sint16 #elif INT_MAX == 2147483647 # define ffi_type_uint ffi_type_uint32 # define ffi_type_sint ffi_type_sint32 #elif INT_MAX == 9223372036854775807 # define ffi_type_uint ffi_type_uint64 # define ffi_type_sint ffi_type_sint64 #else #error "int size not supported" #endif #if LONG_MAX == 2147483647 # if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX #error "no 64-bit data type supported" # endif #elif LONG_MAX != FFI_64_BIT_MAX #error "long size not supported" #endif #if LONG_MAX == 2147483647 # define ffi_type_ulong ffi_type_uint32 # define ffi_type_slong ffi_type_sint32 #elif LONG_MAX == FFI_64_BIT_MAX # define ffi_type_ulong ffi_type_uint64 # define ffi_type_slong ffi_type_sint64 #else #error "long size not supported" #endif /* These are defined in types.c */ extern ffi_type ffi_type_void; extern ffi_type ffi_type_uint8; extern ffi_type ffi_type_sint8; extern ffi_type ffi_type_uint16; extern ffi_type ffi_type_sint16; extern ffi_type ffi_type_uint32; extern ffi_type ffi_type_sint32; extern ffi_type ffi_type_uint64; extern ffi_type ffi_type_sint64; extern ffi_type ffi_type_float; extern ffi_type ffi_type_double; extern ffi_type ffi_type_pointer; #if @HAVE_LONG_DOUBLE@ extern ffi_type ffi_type_longdouble; #else #define ffi_type_longdouble ffi_type_double #endif #endif /* LIBFFI_HIDE_BASIC_TYPES */ typedef enum { FFI_OK = 0, FFI_BAD_TYPEDEF, FFI_BAD_ABI } ffi_status; typedef unsigned FFI_TYPE; typedef struct { ffi_abi abi; unsigned nargs; ffi_type **arg_types; ffi_type *rtype; unsigned bytes; unsigned flags; #ifdef FFI_EXTRA_CIF_FIELDS FFI_EXTRA_CIF_FIELDS; #endif } ffi_cif; /* ---- Definitions for the raw API -------------------------------------- */ #ifndef FFI_SIZEOF_ARG # if LONG_MAX == 2147483647 # define FFI_SIZEOF_ARG 4 # elif LONG_MAX == FFI_64_BIT_MAX # define FFI_SIZEOF_ARG 8 # endif #endif #ifndef FFI_SIZEOF_JAVA_RAW # define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG #endif typedef union { ffi_sarg sint; ffi_arg uint; float flt; char data[FFI_SIZEOF_ARG]; void* ptr; } ffi_raw; #if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 /* This is a special case for mips64/n32 ABI (and perhaps others) where sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ typedef union { signed int sint; unsigned int uint; float flt; char data[FFI_SIZEOF_JAVA_RAW]; void* ptr; } ffi_java_raw; #else typedef ffi_raw ffi_java_raw; #endif void ffi_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *avalue); void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); size_t ffi_raw_size (ffi_cif *cif); /* This is analogous to the raw API, except it uses Java parameter */ /* packing, even on 64-bit machines. I.e. on 64-bit machines */ /* longs and doubles are followed by an empty 64-bit word. */ void ffi_java_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_java_raw *avalue); void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); size_t ffi_java_raw_size (ffi_cif *cif); /* ---- Definitions for closures ----------------------------------------- */ #if FFI_CLOSURES #ifdef _MSC_VER __declspec(align(8)) #endif typedef struct { char tramp[FFI_TRAMPOLINE_SIZE]; ffi_cif *cif; void (*fun)(ffi_cif*,void*,void**,void*); void *user_data; #ifdef __GNUC__ } ffi_closure __attribute__((aligned (8))); #else } ffi_closure; #endif void *ffi_closure_alloc (size_t size, void **code); void ffi_closure_free (void *); ffi_status ffi_prep_closure (ffi_closure*, ffi_cif *, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data); ffi_status ffi_prep_closure_loc (ffi_closure*, ffi_cif *, void (*fun)(ffi_cif*,void*,void**,void*), void *user_data, void*codeloc); typedef struct { char tramp[FFI_TRAMPOLINE_SIZE]; ffi_cif *cif; #if !FFI_NATIVE_RAW_API /* if this is enabled, then a raw closure has the same layout as a regular closure. We use this to install an intermediate handler to do the transaltion, void** -> ffi_raw*. */ void (*translate_args)(ffi_cif*,void*,void**,void*); void *this_closure; #endif void (*fun)(ffi_cif*,void*,ffi_raw*,void*); void *user_data; } ffi_raw_closure; typedef struct { char tramp[FFI_TRAMPOLINE_SIZE]; ffi_cif *cif; #if !FFI_NATIVE_RAW_API /* if this is enabled, then a raw closure has the same layout as a regular closure. We use this to install an intermediate handler to do the transaltion, void** -> ffi_raw*. */ void (*translate_args)(ffi_cif*,void*,void**,void*); void *this_closure; #endif void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); void *user_data; } ffi_java_raw_closure; ffi_status ffi_prep_raw_closure (ffi_raw_closure*, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data); ffi_status ffi_prep_raw_closure_loc (ffi_raw_closure*, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_raw*,void*), void *user_data, void *codeloc); ffi_status ffi_prep_java_raw_closure (ffi_java_raw_closure*, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), void *user_data); ffi_status ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, ffi_cif *cif, void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), void *user_data, void *codeloc); #endif /* FFI_CLOSURES */ /* ---- Public interface definition -------------------------------------- */ ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, ffi_type *rtype, ffi_type **atypes); void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue); /* Useful for eliminating compiler warnings */ #define FFI_FN(f) ((void (*)(void))f) /* ---- Definitions shared with assembly code ---------------------------- */ #endif /* If these change, update src/mips/ffitarget.h. */ #define FFI_TYPE_VOID 0 #define FFI_TYPE_INT 1 #define FFI_TYPE_FLOAT 2 #define FFI_TYPE_DOUBLE 3 #if @HAVE_LONG_DOUBLE@ #define FFI_TYPE_LONGDOUBLE 4 #else #define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE #endif #define FFI_TYPE_UINT8 5 #define FFI_TYPE_SINT8 6 #define FFI_TYPE_UINT16 7 #define FFI_TYPE_SINT16 8 #define FFI_TYPE_UINT32 9 #define FFI_TYPE_SINT32 10 #define FFI_TYPE_UINT64 11 #define FFI_TYPE_SINT64 12 #define FFI_TYPE_STRUCT 13 #define FFI_TYPE_POINTER 14 /* This should always refer to the last type code (for sanity checks) */ #define FFI_TYPE_LAST FFI_TYPE_POINTER #ifdef __cplusplus } #endif #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/include/ffi_common.h0000644000175000017500000000573111545150464022752 0ustar chr1schr1s/* ----------------------------------------------------------------------- ffi_common.h - Copyright (c) 1996 Red Hat, Inc. Copyright (C) 2007 Free Software Foundation, Inc Common internal definitions and macros. Only necessary for building libffi. ----------------------------------------------------------------------- */ #ifndef FFI_COMMON_H #define FFI_COMMON_H #ifdef __cplusplus extern "C" { #endif #include /* Do not move this. Some versions of AIX are very picky about where this is positioned. */ #ifdef __GNUC__ /* mingw64 defines this already in malloc.h. */ #ifndef alloca # define alloca __builtin_alloca #endif # define MAYBE_UNUSED __attribute__((__unused__)) #else # define MAYBE_UNUSED # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ # ifdef _MSC_VER # define alloca _alloca # else char *alloca (); # endif # endif # endif # endif #endif /* Check for the existence of memcpy. */ #if STDC_HEADERS # include #else # ifndef HAVE_MEMCPY # define memcpy(d, s, n) bcopy ((s), (d), (n)) # endif #endif #if defined(FFI_DEBUG) #include #endif #ifdef FFI_DEBUG void ffi_assert(char *expr, char *file, int line); void ffi_stop_here(void); void ffi_type_test(ffi_type *a, char *file, int line); #define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) #define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) #define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) #else #define FFI_ASSERT(x) #define FFI_ASSERT_AT(x, f, l) #define FFI_ASSERT_VALID_TYPE(x) #endif #define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) #define ALIGN_DOWN(v, a) (((size_t) (v)) & -a) /* Perform machine dependent cif processing */ ffi_status ffi_prep_cif_machdep(ffi_cif *cif); /* Extended cif, used in callback from assembly routine */ typedef struct { ffi_cif *cif; void *rvalue; void **avalue; } extended_cif; /* Terse sized type definitions. */ #if defined(_MSC_VER) || defined(__sgi) typedef unsigned char UINT8; typedef signed char SINT8; typedef unsigned short UINT16; typedef signed short SINT16; typedef unsigned int UINT32; typedef signed int SINT32; # ifdef _MSC_VER typedef unsigned __int64 UINT64; typedef signed __int64 SINT64; # else # include typedef uint64_t UINT64; typedef int64_t SINT64; # endif #else typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); typedef signed int SINT8 __attribute__((__mode__(__QI__))); typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); typedef signed int SINT16 __attribute__((__mode__(__HI__))); typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); typedef signed int SINT32 __attribute__((__mode__(__SI__))); typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); typedef signed int SINT64 __attribute__((__mode__(__DI__))); #endif typedef float FLOAT32; #ifdef __cplusplus } #endif #endif mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/include/Makefile.am0000644000175000017500000000037111545150464022514 0ustar chr1schr1s## Process this with automake to create Makefile.in AUTOMAKE_OPTIONS=foreign DISTCLEANFILES=ffitarget.h EXTRA_DIST=ffi.h.in ffi_common.h includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include nodist_includes_HEADERS = ffi.h ffitarget.h mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/include/Makefile.in0000644000175000017500000003347511545150464022540 0ustar chr1schr1s# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = include DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/ffi.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/fficonfig.h CONFIG_CLEAN_FILES = ffi.h ffitarget.h CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(includesdir)" HEADERS = $(nodist_includes_HEADERS) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TARGET = @TARGET@ TARGETDIR = @TARGETDIR@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ toolexecdir = @toolexecdir@ toolexeclibdir = @toolexeclibdir@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign DISTCLEANFILES = ffitarget.h EXTRA_DIST = ffi.h.in ffi_common.h includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include nodist_includes_HEADERS = ffi.h ffitarget.h all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign include/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): ffi.h: $(top_builddir)/config.status $(srcdir)/ffi.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-nodist_includesHEADERS: $(nodist_includes_HEADERS) @$(NORMAL_INSTALL) test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ done uninstall-nodist_includesHEADERS: @$(NORMAL_UNINSTALL) @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(includesdir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(HEADERS) installdirs: for dir in "$(DESTDIR)$(includesdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-nodist_includesHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-nodist_includesHEADERS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool ctags distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-nodist_includesHEADERS \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-nodist_includesHEADERS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/m4/libtool.m40000644000175000017500000077341111545150464021277 0ustar chr1schr1s# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 56 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl _LT_PROG_ECHO_BACKSLASH case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld="$lt_cv_prog_gnu_ld" old_CC="$CC" old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN ## ------------------------------------- ## ## Accumulate code for creating libtool. ## ## ------------------------------------- ## # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the `libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) ## ------------------------ ## ## FIXME: Eliminate VARNAME ## ## ------------------------ ## # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to `config.status' so that its # declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "X$" | $Xsed -e "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags="_LT_TAGS"dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into `config.status', and then the shell code to quote escape them in # for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Fix-up fallback echo if it was mangled by the above quoting rules. case \$lt_ECHO in *'\\\[$]0 --fallback-echo"')dnl " lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\` ;; esac _LT_OUTPUT_LIBTOOL_INIT ]) # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) cat >"$CONFIG_LT" <<_LTEOF #! $SHELL # Generated by $as_me. # Run this file to recreate a libtool stub with the current configuration. lt_cl_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ \`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2008 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test $[#] != 0 do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try \`$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. if test "$no_create" != yes; then lt_cl_success=: test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) fi ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_XSI_SHELLFNS sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; 10.[[012]]*) _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES # -------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(whole_archive_flag_spec, $1)='' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=echo _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], [ if test "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX # ----------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl AC_LINK_IFELSE(AC_LANG_PROGRAM,[ lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/ p } }' aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], [AC_DIVERT_PUSH(NOTICE)]) $1 AC_DIVERT_POP ])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Add some code to the start of the generated configure script which # will find an echo command which doesn't interpret backslashes. m4_defun([_LT_PROG_ECHO_BACKSLASH], [_LT_SHELL_INIT([ # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} case X$lt_ECHO in X*--fallback-echo) # Remove one level of quotation (which was required for Make). ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` ;; esac ECHO=${lt_ECHO-echo} if test "X[$]1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X[$]1" = X--fallback-echo; then # Avoid inline document here, it may be left over : elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then # Yippee, $ECHO works! : else # Restart under the correct shell. exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} fi if test "X[$]1" = X--fallback-echo; then # used as fallback echo shift cat <<_LT_EOF [$]* _LT_EOF exit 0 fi # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test -z "$lt_ECHO"; then if test "X${echo_test_string+set}" != Xset; then # find a string as large as possible, as long as the shell can cope with it for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... if { echo_test_string=`eval $cmd`; } 2>/dev/null && { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null then break fi done fi if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then : else # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # # So, first we look for a working echo in the user's PATH. lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for dir in $PATH /usr/ucb; do IFS="$lt_save_ifs" if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$dir/echo" break fi done IFS="$lt_save_ifs" if test "X$ECHO" = Xecho; then # We didn't find a better echo, so look for alternatives. if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # This shell has a builtin print -r that does the trick. ECHO='print -r' elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } && test "X$CONFIG_SHELL" != X/bin/ksh; then # If we have ksh, try running configure again with it. ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} export ORIGINAL_CONFIG_SHELL CONFIG_SHELL=/bin/ksh export CONFIG_SHELL exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} else # Try using printf. ECHO='printf %s\n' if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' && echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then # Cool, printf works : elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL export CONFIG_SHELL SHELL="$CONFIG_SHELL" export SHELL ECHO="$CONFIG_SHELL [$]0 --fallback-echo" elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && test "X$echo_testing_string" = 'X\t' && echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && test "X$echo_testing_string" = "X$echo_test_string"; then ECHO="$CONFIG_SHELL [$]0 --fallback-echo" else # maybe with a smaller string... prev=: for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null then break fi prev="$cmd" done if test "$prev" != 'sed 50q "[$]0"'; then echo_test_string=`eval $prev` export echo_test_string exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} else # Oops. We lost completely, so just stick with echo. ECHO=echo fi fi fi fi fi fi # Copy echo and quote the copy suitably for passing to libtool from # the Makefile, instead of quoting the original, which is used later. lt_ECHO=$ECHO if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" fi AC_SUBST(lt_ECHO) ]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that does not interpret backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line __oline__ "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) LD="${LD-ld} -m elf64_sparc" ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [AC_CHECK_TOOL(AR, ar, false) test -z "$AR" && AR=ar test -z "$AR_FLAGS" && AR_FLAGS=cru _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1]) AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS="$save_LDFLAGS" ]) if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \ = "XX$teststring$teststring"; } >/dev/null 2>&1 && test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line __oline__ "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif void fnord() { int i=42;} int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links="nottested" if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'` else lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` sys_lib_search_path_spec=`$ECHO $lt_search_path_spec` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) version_type=linux need_lib_prefix=no need_version=no hardcode_into_libs=yes if test "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=".dll" need_version=no need_lib_prefix=no case $GCC,$host_os in yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \${file}`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH printed by # mingw gcc, but we are running on Cygwin. Gcc prints its search # path with ; separators, and with drive letters. We can handle the # drive letters (cygwin fileutils understands them), so leave them, # especially as we might pass files found there to a mingw objdump, # which wouldn't understand a cygwinified path. Ahh. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac ;; *) library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' ;; esac dynamic_linker='Win32 ld.exe' # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd1*) dynamic_linker=no ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[123]]*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555. postinstall_cmds='chmod 555 $lib' ;; interix[[3-9]]*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; # This must be Linux ELF. linux* | k*bsd*-gnu) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Add ABI-specific directories to the system library path. sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib" # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec ;then version_type=linux library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([], [sys_lib_dlsearch_path_spec], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be Linux ELF. linux* | k*bsd*-gnu) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method == "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM="$NM" else lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. tmp_nm="$ac_dir/$lt_tmp_nm" if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :) AC_SUBST([DUMPBIN]) if test "$DUMPBIN" != ":"; then NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ const struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_save_LIBS="$LIBS" lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" CFLAGS="$lt_save_CFLAGS" else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= AC_MSG_CHECKING([for $compiler option to produce PIC]) m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC*) # IBM XL 8.0 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; pgcc* | pgf77* | pgf90* | pgf95*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl*) # IBM XL C 8.0/Fortran 10.1 on PPC _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Sun\ F*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ` (' and `)$', so one must not match beginning or # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes if test "$with_gnu_ld" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.9.1, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to modify your PATH *** so that a non-GNU linker is found, and then restart. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag= tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; freebsd1*) _LT_TAGVAR(ld_shlibs, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test "$GCC" = yes -a "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac fi if test "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE(int foo(void) {}, _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' ) LDFLAGS="$save_LDFLAGS" else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test "$GCC" = yes; then wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='${wl}' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_MSG_CHECKING([whether -lc should be explicitly linked in]) $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then _LT_TAGVAR(archive_cmds_need_lc, $1)=no else _LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)]) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], [[If ld is used when linking, flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [fix_srcfile_path], [1], [Fix the shell variable $srcfile for the compiler]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_PROG_CXX # ------------ # Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++ # compiler, we have our own version here. m4_defun([_LT_PROG_CXX], [ pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes]) AC_PROG_CXX if test -n "$CXX" && ( test "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_CXX dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_CXX], []) # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [AC_REQUIRE([_LT_PROG_CXX])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' _LT_TAGVAR(archive_cmds_need_lc, $1)=yes # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd[[12]]*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; gnu*) ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test "$GXX" = yes; then if test "$with_gnu_ld" = no; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 will use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; xl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=echo else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed' ;; *) if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='echo' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' else # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ]) dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test $p = "-L" || test $p = "-R"; then prev=$p continue else prev= fi if test "$pre_test_object_deps_done" = no; then case $p in -L* | -R*) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)="${prev}${p}" else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi ;; *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_PROG_F77 # ------------ # Since AC_PROG_F77 is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_F77], [ pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes]) AC_PROG_F77 if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_F77 dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_F77], []) # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_REQUIRE([_LT_PROG_F77])dnl AC_LANG_PUSH(Fortran 77) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${F77-"f77"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_PROG_FC # ----------- # Since AC_PROG_FC is broken, in that it returns the empty string # if there is no fortran compiler, we have our own version here. m4_defun([_LT_PROG_FC], [ pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes]) AC_PROG_FC if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi popdef([AC_MSG_ERROR]) ])# _LT_PROG_FC dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([_LT_PROG_FC], []) # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_REQUIRE([_LT_PROG_FC])dnl AC_LANG_PUSH(Fortran) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC CC=${FC-"f95"} compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC="$lt_save_CC" ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC GCC= CC=${RC-"windres"} compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC="$lt_save_CC" ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ ############################################################ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # ############################################################ m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_XSI_SHELLFNS # --------------------- # Bourne and XSI compatible variants of some useful shell functions. m4_defun([_LT_PROG_XSI_SHELLFNS], [case $xsi_shell in yes) cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac } # func_basename file func_basename () { func_basename_result="${1##*/}" } # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}" } # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). func_stripname () { # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"} } # func_opt_split func_opt_split () { func_opt_split_opt=${1%%=*} func_opt_split_arg=${1#*=} } # func_lo2o object func_lo2o () { case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac } # func_xform libobj-or-source func_xform () { func_xform_result=${1%.*}.lo } # func_arith arithmetic-term... func_arith () { func_arith_result=$(( $[*] )) } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=${#1} } _LT_EOF ;; *) # Bourne compatible functions. cat << \_LT_EOF >> "$cfgfile" # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_basename file func_basename () { func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"` } dnl func_dirname_and_basename dnl A portable version of this function is already defined in general.m4sh dnl so there is no need for it here. # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "X${3}" \ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;; esac } # sed scripts: my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' my_sed_long_arg='1s/^-[[^=]]*=//' # func_opt_split func_opt_split () { func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"` func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"` } # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"` } # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'` } # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "$[@]"` } # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` } _LT_EOF esac case $lt_shell_append in yes) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]+=\$[2]" } _LT_EOF ;; *) cat << \_LT_EOF >> "$cfgfile" # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "$[1]=\$$[1]\$[2]" } _LT_EOF ;; esac ]) mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/m4/ltoptions.m40000644000175000017500000002724211545150464021660 0ustar chr1schr1s# Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS ## --------------------------------- ## ## Macros to handle LT_INIT options. ## ## --------------------------------- ## # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [0], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the `shared' and # `disable-shared' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the `static' and # `disable-static' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the `fast-install' # and `disable-fast-install' LT_INIT options. # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. # MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [pic_mode="$withval"], [pic_mode=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) ## ----------------- ## ## LTDL_INIT Options ## ## ----------------- ## m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/m4/ltsugar.m40000644000175000017500000001042411545150464021300 0ustar chr1schr1s# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/m4/ltversion.m40000644000175000017500000000127711545150464021652 0ustar chr1schr1s# ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # Generated from ltversion.in. # serial 3017 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.2.6b]) m4_define([LT_PACKAGE_REVISION], [1.3017]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.2.6b' macro_revision='1.3017' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/m4/lt~obsolete.m40000644000175000017500000001311311545150464022167 0ustar chr1schr1s# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 4 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/man/ffi.30000644000175000017500000000121011545150464020431 0ustar chr1schr1s.Dd February 15, 2008 .Dt FFI 3 .Sh NAME .Nm FFI .Nd Foreign Function Interface .Sh LIBRARY libffi, -lffi .Sh SYNOPSIS .In ffi.h .Ft ffi_status .Fo ffi_prep_cif .Fa "ffi_cif *cif" .Fa "ffi_abi abi" .Fa "unsigned int nargs" .Fa "ffi_type *rtype" .Fa "ffi_type **atypes" .Fc .Ft void .Fo ffi_call .Fa "ffi_cif *cif" .Fa "void (*fn)(void)" .Fa "void *rvalue" .Fa "void **avalue" .Fc .Sh DESCRIPTION The foreign function interface provides a mechanism by which a function can generate a call to another function at runtime without requiring knowledge of the called function's interface at compile time. .Sh SEE ALSO .Xr ffi_prep_cif 3 , .Xr ffi_call 3 mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/man/ffi_call.30000644000175000017500000000443511545150464021440 0ustar chr1schr1s.Dd February 15, 2008 .Dt ffi_call 3 .Sh NAME .Nm ffi_call .Nd Invoke a foreign function. .Sh SYNOPSIS .In ffi.h .Ft void .Fo ffi_call .Fa "ffi_cif *cif" .Fa "void (*fn)(void)" .Fa "void *rvalue" .Fa "void **avalue" .Fc .Sh DESCRIPTION The .Nm ffi_call function provides a simple mechanism for invoking a function without requiring knowledge of the function's interface at compile time. .Fa fn is called with the values retrieved from the pointers in the .Fa avalue array. The return value from .Fa fn is placed in storage pointed to by .Fa rvalue . .Fa cif contains information describing the data types, sizes and alignments of the arguments to and return value from .Fa fn , and must be initialized with .Nm ffi_prep_cif before it is used with .Nm ffi_call . .Pp .Fa rvalue must point to storage that is sizeof(ffi_arg) or larger for non-floating point types. For smaller-sized return value types, the .Nm ffi_arg or .Nm ffi_sarg integral type must be used to hold the return value. .Sh EXAMPLES .Bd -literal #include #include unsigned char foo(unsigned int, float); int main(int argc, const char **argv) { ffi_cif cif; ffi_type *arg_types[2]; void *arg_values[2]; ffi_status status; // Because the return value from foo() is smaller than sizeof(long), it // must be passed as ffi_arg or ffi_sarg. ffi_arg result; // Specify the data type of each argument. Available types are defined // in . arg_types[0] = &ffi_type_uint; arg_types[1] = &ffi_type_float; // Prepare the ffi_cif structure. if ((status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_uint8, arg_types)) != FFI_OK) { // Handle the ffi_status error. } // Specify the values of each argument. unsigned int arg1 = 42; float arg2 = 5.1; arg_values[0] = &arg1; arg_values[1] = &arg2; // Invoke the function. ffi_call(&cif, FFI_FN(foo), &result, arg_values); // The ffi_arg 'result' now contains the unsigned char returned from foo(), // which can be accessed by a typecast. printf("result is %hhu", (unsigned char)result); return 0; } // The target function. unsigned char foo(unsigned int x, float y) { unsigned char result = x - y; return result; } .Ed .Sh SEE ALSO .Xr ffi 3 , .Xr ffi_prep_cif 3 mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/man/ffi_prep_cif.30000644000175000017500000000203511545150464022306 0ustar chr1schr1s.Dd February 15, 2008 .Dt ffi_prep_cif 3 .Sh NAME .Nm ffi_prep_cif .Nd Prepare a .Nm ffi_cif structure for use with .Nm ffi_call . .Sh SYNOPSIS .In ffi.h .Ft ffi_status .Fo ffi_prep_cif .Fa "ffi_cif *cif" .Fa "ffi_abi abi" .Fa "unsigned int nargs" .Fa "ffi_type *rtype" .Fa "ffi_type **atypes" .Fc .Sh DESCRIPTION The .Nm ffi_prep_cif function prepares a .Nm ffi_cif structure for use with .Nm ffi_call . .Fa abi specifies a set of calling conventions to use. .Fa atypes is an array of .Fa nargs pointers to .Nm ffi_type structs that describe the data type, size and alignment of each argument. .Fa rtype points to an .Nm ffi_type that describes the data type, size and alignment of the return value. .Sh RETURN VALUES Upon successful completion, .Nm ffi_prep_cif returns .Nm FFI_OK . It will return .Nm FFI_BAD_TYPEDEF if .Fa cif is .Nm NULL or .Fa atypes or .Fa rtype is malformed. If .Fa abi does not refer to a valid ABI, .Nm FFI_BAD_ABI will be returned. Available ABIs are defined in .Nm . .Sh SEE ALSO .Xr ffi 3 , .Xr ffi_call 3 mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/man/Makefile.am0000644000175000017500000000025111545150464021641 0ustar chr1schr1s## Process this with automake to create Makefile.in AUTOMAKE_OPTIONS=foreign EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 mozjs-1.8.5-1.0.0+dfsg/js/src/ctypes/libffi/man/Makefile.in0000644000175000017500000003220611545150464021657 0ustar chr1schr1s# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = man DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/fficonfig.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man3dir = $(mandir)/man3 am__installdirs = "$(DESTDIR)$(man3dir)" NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ ALLOCA = @ALLOCA@ AMTAR = @AMTAR@ AM_LTLDFLAGS = @AM_LTLDFLAGS@ AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCAS = @CCAS@ CCASDEPMODE = @CCASDEPMODE@ CCASFLAGS = @CCASFLAGS@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ TARGET = @TARGET@ TARGETDIR = @TARGETDIR@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ target_os = @target_os@ target_vendor = @target_vendor@ toolexecdir = @toolexecdir@ toolexeclibdir = @toolexeclibdir@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = foreign EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign man/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man3: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" @list=''; test -n "$(man3dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ done; } uninstall-man3: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man3dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.3[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man3dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man3 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man3 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man3 \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ uninstall uninstall-am uninstall-man uninstall-man3 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug585391.js0000644000175000017500000000020611545150464022244 0ustar chr1schr1svar x = (function () { return [, , ] }()); (function () { while (x > 7 & 0) { return } }()) /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug585408-2.js0000644000175000017500000000007111545150464022402 0ustar chr1schr1sfor (let c in []) { c << c++ } /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug585408-3.js0000644000175000017500000000010511545150464022401 0ustar chr1schr1s(function() { function a() {} a > a-- })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug585408.js0000644000175000017500000000010711545150464022243 0ustar chr1schr1s(function() { function a() {} a.e = a++ })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug585540.js0000644000175000017500000000033111545150464022237 0ustar chr1schr1stry { (function () { gczeal(2)() })() } catch (e) {} (function () { for (y in [/x/, Boolean, Boolean, 0, Boolean]) { [Math.floor(this)].some(function () {}) } })() /* Don't crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug587431.js0000644000175000017500000000112611545150464022243 0ustar chr1schr1sfunction g() { var UPPER_MASK = 2147483648 var mt = new Array function f1(n1) { return n1 < 0 ? (n1 ^ UPPER_MASK) + UPPER_MASK: n1 } function f2(n1, n2) { return f1(n1 + n2 & 4294967295) } function f3(n1, n2) { var sum for (var i = 0; i < 32; ++i) { sum = f2(sum, f1(n2 << i)) } return sum } this.init_genrand = function(s) { mt[0] = f1(s & 96295) for (mti = 1; mti < 6; mti++) { mt[mti] = f2(f3(3, f1(mt[mti - 1] ^ mt[1] > 0)), mti) } } } (function() { var fuzzMT = new g; fuzzMT.init_genrand(54) } ()) /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug588338.js0000644000175000017500000000041611545150464022253 0ustar chr1schr1s// |jit-test| error: is not a function function f() { (e) } (x = Proxy.createFunction((function(x) { return { get: function(r, b) { return x[b] } } })(/x/), wrap)) for (z = 0; z < 100; x.unwatch(), z++) for (e in [0]) { gczeal(2) } ( )("") mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug588362-1.js0000644000175000017500000000015611545150464022407 0ustar chr1schr1sfor (a = 0; a < HOTLOOP + 5; a++) { (function e() { yield eval() }()) } /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug588362-2.js0000644000175000017500000000016711545150464022412 0ustar chr1schr1sfor (a = 0; a < HOTLOOP + 5; a++) { (function n() { with({}) { yield } } ()) } /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug588362-3.js0000644000175000017500000000022311545150464022404 0ustar chr1schr1sfor (a = 0; a < HOTLOOP + 5; a++) { (function n() { { function s() {} } yield[]; }()); } /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug588363-1.js0000644000175000017500000000015611545150464022410 0ustar chr1schr1s({eval} = Object.defineProperty(evalcx("lazy"), "", {})) eval("eval(/x/)", []) /* Don't assert or crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug588363-2.js0000644000175000017500000000017211545150464022407 0ustar chr1schr1swith(evalcx('')) { delete eval; eval("x", this.__defineGetter__("x", Function)); } /* Don't assert or crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug589108.js0000644000175000017500000000022511545150464022245 0ustar chr1schr1stry { var x for (x in >) gczeal(2) new NaN } catch(e) {} (function() { for (a in [Boolean(), x.t]) {} } (function() {})) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug589115.js0000644000175000017500000000011511545150464022241 0ustar chr1schr1sfor each(y in ['', 0, '']) { y.lastIndexOf-- } /* Don't assert/crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug589461.js0000644000175000017500000000017611545150464022254 0ustar chr1schr1sfunction f(h, i, Q) { var L = Q; var H = h; return h[i] * L ^ L * 0x1010100; } assertEq(f([6], 0, 12345), 1768429654); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug590083.js0000644000175000017500000000017411545150464022242 0ustar chr1schr1seval("\ (function(){\ for(var w in [0]) {\ function w(){}\ print(w)\ }\ })\ ")() /* Don't crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug591602.js0000644000175000017500000000132511545150464022237 0ustar chr1schr1stry { for (x in ['']) { gczeal(2) } } catch(e) {} try { var x, e p() } catch(e) {} try { (function() { let(x)((function() { let(y)((function() { try { let(c) o } finally { (f, *::*) } })) })) })() } catch(e) {} try { (function() { if (x.w("", (function() { t })())) {} })() } catch(e) {} try { gczeal() } catch(e) {} try { (function() { for (let w in [0, 0]) let(b)((function() { let(x = w = [])((function() { for (let a in []); })) })()) })() } catch(e) {} /* Don't assert with -m only. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug591606.js0000644000175000017500000000006111545150464022237 0ustar chr1schr1svar c = [] function c() {} /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug592973-1.js0000644000175000017500000000025311545150464022410 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function f(x) { if (x) { let y; y = 12; (function () { assertEq(y, 12); })(); } } f(1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug592973-2.js0000644000175000017500000000014211545150464022406 0ustar chr1schr1sfunction f(a) { function a() { } } /* Don't assert on JOF_NAME test in BindNameToSlot(). */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug592973-3.js0000644000175000017500000000025711545150464022416 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function f([a, b, c, d]) { a = b; return function () { return a + b + c + d; }; } var F = f(["a", "b", "c", "d"]); assertEq(F(), "bbcd"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug593554.js0000644000175000017500000000023011545150464022241 0ustar chr1schr1s/* Don't assert. */ var b = 7; var a = []; for (var j = 0; j < 7; ++j) { var d = {}; a.push(b >> d); } assertEq(a.toString(), '7,7,7,7,7,7,7'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug595917.js0000644000175000017500000000014111545150464022247 0ustar chr1schr1sif (!this.parseInt) { var parseInt = function () { return 5; } } assertEq(parseInt(10), 10); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug595921.js0000644000175000017500000000017011545150464022244 0ustar chr1schr1s/* Don't assert. */ x = function f(aaa) { aaa.e = x } for each(let c in [x, x, x]) { f(c) } assertEq(0,0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug597378.js0000644000175000017500000000027411545150464022261 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function f(a, b) { var o = a; var q = b; var p; do { } while (0); p = o; q = p + 1 < q ? p + 1 : 0; assertEq(q, 0); } f(3, 4); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug597871.js0000644000175000017500000000024011545150464022250 0ustar chr1schr1sfor (a in [0, 0, 0, 0, 0, 0, 0, 0, 0]) { try { (function() { for each(l in [false, 0, 0, 0]) {} h })() } catch(e) {} } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug598696.js0000644000175000017500000000010111545150464022252 0ustar chr1schr1sfunction f() { eval(); var i = 0; assertEq(++i, 1); } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug599488.js0000644000175000017500000000023411545150464022261 0ustar chr1schr1s/* Don't crash. */ function foo(y) { var x = y; if (x != x) return true; return false; } assertEq(foo("three"), false); assertEq(foo(NaN), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug600139.js0000644000175000017500000000036611545150464022237 0ustar chr1schr1s// |jit-test| error: ReferenceError // vim: set ts=4 sw=4 tw=99 et: function f(a, b, c) { if (!a.__SSi) { throw Components.returnCode = Cr.NS_ERROR_INVALID_ARG; } this.restoreWindow(a, b, c); eval(); } dis(f); f(1, 2, 3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug600419.js0000644000175000017500000000012511545150464022231 0ustar chr1schr1s/* Don't assert. */ (function() { var x; [1].map(function(){}, x << x); })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug600424.js0000644000175000017500000000034011545150464022224 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function f(a) { var x = { g: function () { return this.a; } }; x.g.prototype.a = a; assertEq(x.g.prototype.a, a); return x; } f(1); f(2); f(3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug601400.js0000644000175000017500000000015011545150464022216 0ustar chr1schr1s// |jit-test| error: TypeError eval("\ function NaN() {}\ for(w in s) {}\ ") // Don't assert. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug601982.js0000644000175000017500000000074211545150464022244 0ustar chr1schr1s/* vim: set ts=4 sw=4 tw=99 et: */ function J(i) { /* Cause a branch to build. */ if (i % 3) } function h(i) { J(i); /* Generate a safe point in the method JIT. */ if (1 == 14) { eval(); } return J(i); } function g(i) { /* Method JIT will try to remove this frame. */ if (i == 14) { } return h(i); } function f() { for (var i = 0; i < RUNLOOP * 2; i++) { g(i); } } f(); /* Don't crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug604381.js0000644000175000017500000000026611545150464022241 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function F() { var T = { }; try { throw 12; } catch (e) { T.x = 5; return T; } } assertEq((new F()).x, 5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug604427.js0000644000175000017500000000013611545150464022236 0ustar chr1schr1s function testInt(x) { var a = x|0; return (a !== a); } assertEq(testInt(10), false); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug606662-1.js0000644000175000017500000000006211545150464022375 0ustar chr1schr1s// don't assert new(function() { #1# }) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug606662-2.js0000644000175000017500000000023711545150464022402 0ustar chr1schr1s// don't crash try{a()}catch(e){} try{for(e in((JSON.e)(x=/x/)))throw []}catch(e){} try{(function(){c()})()}catch(e){} try{new function(){#1#}}catch(e){} mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug606829.js0000644000175000017500000000012411545150464022243 0ustar chr1schr1s/* Don't assert. */ function f(x) { if ("hi" == (x & 3)) { return 1; } } f(12); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug610652.js0000644000175000017500000000013011545150464022225 0ustar chr1schr1sfunction a1(a2) { return 10 - a2; } a3 = a1(-2147483648); assertEq(a3, 2147483658); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug615440.js0000644000175000017500000000013311545150464022230 0ustar chr1schr1sArray.prototype.__proto__ = null; for (var r = 0; r < 3; ++r) [][0] = 1; // Don't crash. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug616508.js0000644000175000017500000000031111545150464022234 0ustar chr1schr1s// |jit-test| error: ReferenceError // vim: set ts=4 sw=4 tw=99 et: try { (function () { __proto__ = Uint32Array() }()) } catch (e) {}(function () { length, ([eval()] ? x : 7) })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug618007.js0000644000175000017500000000123011545150464022231 0ustar chr1schr1svar appendToActual = function(s) { actual += s + ','; } for(var z=0; z < 3; z++) { function ff() { } ff(); // jit-test/tests/closures/setname-closure.js actual = ''; expected = '2,4,8,16,32,undefined,64,128,256,512,1024,undefined,2048,4096,8192,16384,32768,undefined,65536,131072,262144,524288,1048576,undefined,2097152,4194304,8388608,16777216,33554432,undefined,'; var f = function() { var p = 1; function g() { for (var i = 0; i < 5; ++i) { p = p * 2; appendToActual(p); } } return g; } var g = f(); for (var i = 0; i < 5; ++i) { g(); appendToActual(); } assertEq(actual, expected); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug620643.js0000644000175000017500000000004611545150464022234 0ustar chr1schr1svar a = new Int32Array(); +(a[0]={}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug623474.js0000644000175000017500000000026311545150464022242 0ustar chr1schr1sfor (var j=0;j<2;++j) { (function(o){o.length})(String.prototype); } for each(let y in [Number, Number]) { try { "".length() } catch(e) {} } /* Don't crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug624100.js0000644000175000017500000000012611545150464022223 0ustar chr1schr1s// |jit-test| error: ReferenceError eval("'use strict'; for(let j=0;j<9;++j) {} x;"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug624483.js0000644000175000017500000000016711545150464022246 0ustar chr1schr1svar arr = new Uint8ClampedArray(16); for (var i = 0; i < 16; i++) { arr[i] = "Infinity"; } assertEq(arr[14], 255); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug625157.js0000644000175000017500000000047011545150464022242 0ustar chr1schr1sfunction f() { { function g() { var a = []; for (var i = 0; i < 10; i++) a.push({}); for (var i = 0; i < 10; i++) a[i].m = function() { return 0; } assertEq(a[8].m !== a[9].m, true); } g(); } } f() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug625377.js0000644000175000017500000000040311545150464022242 0ustar chr1schr1sx = [] for(var i=0; i<3; i++) { var obj = { first: "first", second: "second" }; var count = 0; for (var elem in obj) { delete obj.second; count++; } x.push(count); } assertEq(x[0], 1); assertEq(x[1], 1); assertEq(x[2], 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug625438.js0000644000175000017500000000023211545150464022240 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: var count = 0; this.watch("x", function() { count++; }); for(var i=0; i<10; i++) { x = 2; } assertEq(count, 10); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug625718-1.js0000644000175000017500000000027511545150464022406 0ustar chr1schr1sfunction f3() { return 2; }; function f4(o) { o.g4 = function() {}; }; var f = function() {}; f.x = undefined; f4(new String("x")); f3(); f4(f); for(var i=0; i<20; i++) { f4(Math); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug625718-2.js0000644000175000017500000000037311545150464022406 0ustar chr1schr1svar o3 = new String("foobarbaz"); var o10 = Math; var o11 = function() {}; function f3(o) { return o; }; function f4(o) { o.g4 = function() {}; }; for(var i=0; i<20; i++) { o11[3] = undefined; f4(o3); f3(o3); f4(o11); f4(o10); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug625718-3.js0000644000175000017500000000175111545150464022410 0ustar chr1schr1svar o0 = []; var o1 = new String("foobarbaz"); var o2 = {}; var o3 = new String("foobarbaz"); var o4 = {}; var o5 = Math; var o6 = {}; var o7 = new String("foobarbaz"); var o8 = new String("foobarbaz"); var o9 = Math; var o10 = Math; var o11 = function() {}; var o12 = {}; var o13 = new String("foobarbaz"); var o14 = {}; function f1(o) { return o.length;}; function f2(o) { o.g2 = function() {};}; function f3(o) { return o.g10;}; function f4(o) { o.g4 = function() {};}; function f5(o) { return o == o14;}; function f6(o) { o[3] = o;}; function f7(o) { o[3] = undefined;}; function f8(o) { o[3] = undefined;}; function f9(o) { return o.length;}; function f10(o) { return o.__proto__; }; for(var i=0; i<20; i++) { f9(o11); f6(o0); f2(o1); f2(o6); f7(o6); f8(o11); f2(o5); f7(o9); f7(o12); f6(o4); f5(o1); f4(o1); f8(o8); f6(o5); f2(o0); f10(o7); f3(o3); f4(o1); f9(o3); f4(o11); f4(o0); f2(o4); f4(o10); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug625757.js0000644000175000017500000000010311545150464022241 0ustar chr1schr1sfor(var i=0; i<20; i++) { var x = 5e-324; } /* Don't crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug627486.js0000644000175000017500000000040711545150464022251 0ustar chr1schr1s// |jit-test| error: TypeError // vim: set ts=4 sw=4 tw=99 et: g = undefined; function L() { } function h() { with (h) { } for (var i = 0; i < 10; i++) g(); } function f(x) { g = x; } f(L); h(); f(L); f(2); h(); /* Don't assert/crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug630366.js0000644000175000017500000000016311545150464022237 0ustar chr1schr1svar o = {}; for(var i=0; i<5; i++) { o.p = 2; o.watch("p", function() { }); o.p = 2; delete o.p; } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/compare-wrong-1.js0000644000175000017500000000012411545150464023705 0ustar chr1schr1sfunction f(a) { return a; } assertEq(print < f, false); assertEq(print > f, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/crash-on-compare.js0000644000175000017500000000006511545150464024131 0ustar chr1schr1sassertEq(Infinity >= Infinity ? true : false, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/deepBailAfterRunTracer.js0000644000175000017500000000051011545150464025303 0ustar chr1schr1svar o = { }; for (var i = 0; i <= 50; i++) o[i] = i; Object.defineProperty(o, "51", { get: assertEq }); var threw = 0; function g(o, i) { try { assertEq(o[i], i); } catch (e) { threw++; } } function f() { for (var i = 0; i <= 51; i++) g(o, i); } f(); f(); f(); assertEq(threw, 3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/floatTypedArrays.js0000644000175000017500000000256111545150464024273 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function testFloat32Array(L) { var f = new Float32Array(8); assertEq(f[0], 0); assertEq(f[L], 0); assertEq(f[L+8], undefined); assertEq(f[8], undefined); f[0] = 12; f[L+1] = 13.5; f[2] = f[1]; f[L+3] = 4294967295; f[L+4] = true; f[L+5] = L; assertEq(f[0], 12); assertEq(f[1], 13.5); assertEq(f[2], 13.5); assertEq(f[3], 4294967296); assertEq(f[4], 1); assertEq(f[5], 0); } function testFloat64Array(L) { var f = new Float64Array(8); assertEq(f[0], 0); assertEq(f[L], 0); assertEq(f[L+8], undefined); assertEq(f[8], undefined); f[0] = 12; f[L+1] = 13.5; f[2] = f[1]; f[L+3] = 4294967295; f[L+4] = true; f[L+5] = L; assertEq(f[0], 12); assertEq(f[1], 13.5); assertEq(f[2], 13.5); assertEq(f[3], 4294967295); assertEq(f[4], 1); assertEq(f[5], 0); } function testNaNCanonicalization() { var buf = new ArrayBuffer(128); var u8 = new Uint8Array(buf); for (var i = 0; i < 128; i++) u8[i] = 0xFF; var dblarr = new Float64Array(buf); var asstr = dblarr[0] + ""; var asnum = dblarr[0] + 0.0; assertEq(asstr, "NaN"); assertEq(asnum, NaN); } for (var i = 0; i < 10; i++) { //testFloat32Array(0); //testFloat64Array(0); testNaNCanonicalization(); if (i == 5) gc(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/fused-eq-ifeq.js0000644000175000017500000000022011545150464023417 0ustar chr1schr1sfunction ack(m,n){ if (m==0) { return n+1; } if (n==0) { return ack(m-1,1); } return ack(m-1, ack(m,n-1) ); } assertEq(ack(3, 3), 61); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/getelem-sanity-1.js0000644000175000017500000000025211545150464024056 0ustar chr1schr1svar obj = {attr: 'value'}; (function() { var name = 'attr'; for (var i = 0; i < 10; ++i) assertEq(obj[name], 'value'); })(); /* Look up a string id. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/getelem-sanity-2.js0000644000175000017500000000102511545150464024056 0ustar chr1schr1svar obj = {firstAttr: 'value', secondAttr: 'another value'}; (function() { for (var i = 0; i < 12; ++i) { var name; if (i < 4) name = 'firstAttr'; else if (i < 8) name = 'secondAttr'; else name = 'firstAttr'; var result = obj[name]; switch (name) { case 'firstAttr': assertEq(result, 'value'); break; case 'secondAttr': assertEq(result, 'another value'); break; } } })(); /* Toggle lookup between two ids. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/getelem-sanity-3.js0000644000175000017500000000123311545150464024060 0ustar chr1schr1svar obj = {firstAttr: 'value', secondAttr: 'another value', thirdAttr: 'the last value'}; (function() { for (var i = 0; i < 64; ++i) { var name; switch (~~(i / 4) % 3) { case 0: name = 'firstAttr'; break; case 1: name = 'secondAttr'; break; case 2: name = 'thirdAttr'; break; } var result = obj[name]; switch (name) { case 'firstAttr': assertEq(result, 'value'); break; case 'secondAttr': assertEq(result, 'another value'); break; case 'thirdAttr': assertEq(result, 'the last value'); break; } } })(); /* Rotate lookup between three ids. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/getelem-sanity-4.js0000644000175000017500000000276711545150464024076 0ustar chr1schr1svar obj = { attr0: 'val0', attr1: 'val1', attr2: 'val2', attr3: 'val3', attr4: 'val4', attr5: 'val5', attr6: 'val6', attr7: 'val7', attr8: 'val8', attr9: 'val9', attr10: 'val10', attr11: 'val11', attr12: 'val12', attr13: 'val13', attr14: 'val14', attr15: 'val15', attr16: 'val16', attr17: 'val17', } var baseName = 'attr'; (function() { for (var i = 0; i < 128; ++i) { var name = baseName + (i % 18); var result = obj[name]; switch (i) { case 0: assertEq('val0', result); break; case 1: assertEq('val1', result); break; case 2: assertEq('val2', result); break; case 3: assertEq('val3', result); break; case 4: assertEq('val4', result); break; case 5: assertEq('val5', result); break; case 6: assertEq('val6', result); break; case 7: assertEq('val7', result); break; case 8: assertEq('val8', result); break; case 9: assertEq('val9', result); break; case 10: assertEq('val10', result); break; case 11: assertEq('val11', result); break; case 12: assertEq('val12', result); break; case 13: assertEq('val13', result); break; case 14: assertEq('val14', result); break; case 15: assertEq('val15', result); break; case 16: assertEq('val16', result); break; case 17: assertEq('val17', result); break; } } })(); /* Megamorphic index atom. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/getelem-sanity-5.js0000644000175000017500000000012311545150464024057 0ustar chr1schr1svar x = { 0: 5, 1: 5 }; assertEq(x[0] + x[1], 10); /* int32 getelem on object. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/getelem-sanity-6.js0000644000175000017500000000014311545150464024062 0ustar chr1schr1svar x = {1: 2, 3: 4}; assertEq(x[1], 2); /* getelem with non-dense array and known type int32. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/getelem-sanity-7.js0000644000175000017500000000030011545150464024056 0ustar chr1schr1svar obj = {count: 24}; var key = 'count'; for (var i = 0; i < 1024; ++i) { var result = obj[key]; if (i === 2) obj.newAttr = 42; } /* Perform getelem across shape change. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/getelem-sanity-int-1.js0000644000175000017500000000027711545150464024655 0ustar chr1schr1svar arr = ['this', 'works', 'for', 'me']; assertEq('this', arr[0]); assertEq('works', arr[1]); assertEq('for', arr[2]); assertEq('me', arr[3]); /* Multiple int32 getelem for dense array. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/getelem-sanity-int-2.js0000644000175000017500000000054311545150464024652 0ustar chr1schr1svar arr = ['this', 'works', 'for', 'me']; for (var i = 0; i < arr.length; ++i) { var result = arr[i]; switch (i) { case 0: assertEq('this', result); break; case 1: assertEq('works', result); break; case 2: assertEq('for', result); break; case 3: assertEq('me', result); break; } } /* int32 getelem for dense array. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/getelem-sanity-int-3.js0000644000175000017500000000070311545150464024651 0ustar chr1schr1svar a = [1, 2]; a[3.1415926535] = 'value'; for (var i = 0; i < 3; i++) { var attr; switch (i) { case 0: attr = 0; break; case 1: attr = 1; break; case 2: attr = 3.1415926535; break; } var result = a[attr]; switch (i) { case 0: assertEq(result, 1); break; case 1: assertEq(result, 2); break; case 2: assertEq(result, 'value'); break; } } /* int32 and string getelem for non-dense array. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/globalOptimize-1.js0000644000175000017500000000014611545150464024112 0ustar chr1schr1s/* Test that NaN does not trigger js_InitMathClass & constants while parsing. */ var NaN var x = 2; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/instanceOfWithKnownTypes.js0000644000175000017500000000035111545150464025760 0ustar chr1schr1s// |jit-test| error: TypeError // Verify that the compiler doesn't assert. function f() { var o = {}, p = {}; z = o instanceof p; z = 3 instanceof p; z = p instanceof 3; z = 3 instanceof 4; } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/invokeSessionGuard.js0000644000175000017500000000026711545150464024621 0ustar chr1schr1s// |jit-test| mjitalways;debug [1,2,3,4,5,6,7,8].forEach( function(x) { // evalInFrame means lightweight gets call obj assertEq(evalInFrame(0, "x"), x); } ); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/modConstDoubles.js0000644000175000017500000000013311545150464024073 0ustar chr1schr1s function f() { var x = 2.6; var y = 2.1; return x % y; } assertEq(f(), 0.5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/modConstInt.js0000644000175000017500000000016411545150464023234 0ustar chr1schr1s function f() { var i = 1000; var rest = i % 3; var div = (i - rest) / 3; assertEq(div, 333); } f();mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/modConstZeroRhs.js0000644000175000017500000000012711545150464024075 0ustar chr1schr1s function f() { var x = 5; var y = 0; return x % y; } assertEq(f(), NaN); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/modWithConstLhs.js0000644000175000017500000000005411545150464024062 0ustar chr1schr1s// |jit-test| error: ReferenceError; 7%s; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/mulNegZero.js0000644000175000017500000000144511545150464023065 0ustar chr1schr1s function mul(x, y) { return x * y; }; function mulConst0(x) { return x * 0; }; function mulConst1(x) { return -5 * x; }; function mulConst2(x) { return x * -5; }; function f() { assertEq(mulConst0(7), 0); assertEq(mulConst0(-5), -0); assertEq(mulConst0(0), 0); assertEq(mulConst0(-0), -0); assertEq(mulConst1(7), -35); assertEq(mulConst1(-8), 40); assertEq(mulConst1(0), -0); assertEq(mulConst1(-0), 0); assertEq(mulConst2(7), -35); assertEq(mulConst2(-8), 40); assertEq(mulConst2(0), -0); assertEq(mulConst2(-0), 0); assertEq(mul(55, 2), 110); assertEq(mul(0, -10), -0); assertEq(mul(-5, 0), -0); assertEq(mul(-0, 0), -0); assertEq(mul(0, -0), -0); assertEq(mul(0, 0), 0); assertEq(mul(-0, -0), 0); } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/negation.js0000644000175000017500000000006111545150464022573 0ustar chr1schr1svar n = -2147483648; assertEq(-n, 2147483648); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/normalIntTypedArrays.js0000644000175000017500000000175411545150464025134 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function testInt32Array(L) { var f = new Int32Array(8); assertEq(f[0], 0); assertEq(f[L], 0); assertEq(f[L+8], undefined); assertEq(f[8], undefined); f[0] = 12; f[L+1] = 13; f[2] = f[1]; f[L+3] = 4294967295; f[L+4] = true; f[L+5] = L; assertEq(f[0], 12); assertEq(f[1], 13); assertEq(f[2], 13); assertEq(f[3], -1); assertEq(f[4], 1); assertEq(f[5], 0); } function testUint32Array(L) { var f = new Uint32Array(8); assertEq(f[0], 0); assertEq(f[L], 0); assertEq(f[L+8], undefined); assertEq(f[8], undefined); f[0] = 12; f[L+1] = 13; f[2] = f[1]; f[L+3] = 4294967295; f[L+4] = true; f[L+5] = L; assertEq(f[0], 12); assertEq(f[1], 13); assertEq(f[2], 13); assertEq(f[3], 4294967295); assertEq(f[4], 1); assertEq(f[5], 0); } for (var i = 0; i < 10; i++) { //testInt32Array(0); testUint32Array(0); if (i == 5) gc(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/optimize-globals-1.js0000644000175000017500000000024511545150464024412 0ustar chr1schr1s function testLocalNames() { var NaN = 4; var undefined = 5; var Infinity = 6; return NaN + undefined + Infinity; } assertEq(testLocalNames(), 15); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/optimize-globals-2.js0000644000175000017500000000065511545150464024420 0ustar chr1schr1s function testNaN(x) { var x = NaN; assertEq(isNaN(x), true); } testNaN(); function testInfinity(x) { return (x === Infinity); } assertEq(testInfinity(Infinity), true); assertEq(testInfinity(6), false); assertEq(testInfinity(-Infinity), false); function testUndefined(x) { return (x === undefined); } assertEq(testUndefined(undefined), true); assertEq(testUndefined(), true); assertEq(testUndefined(5), false); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/optimize-globals-3.js0000644000175000017500000000020511545150464024410 0ustar chr1schr1s NaN = 4; undefined = 5; Infinity = 6; assertEq(isNaN(NaN), true); assertEq(Infinity > 100, true); assertEq(undefined != 5, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/regalloc-1.js0000644000175000017500000000055611545150464022726 0ustar chr1schr1s// |jit-test| error: TypeError x = 2; function tryItOut(c) { return eval("(function(){" + c + "})"); } function doit() { var f = tryItOut("((( \"\" \n for each (eval in [null, this, null, this, (1/0), new String('q'), new String('q'), null, null, null, new String('q'), new String('q'), new String('q'), null]) if (this)).eval(x = x)));"); f(); } doit(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/regress-bug625701.js0000644000175000017500000000023111545150464023700 0ustar chr1schr1sgczeal(2); for(var i=0; i<20; i++) { function f() { for (var j = 0; j < 3; j++) { (function() {})(); } } f(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/rsh-sanity-1.js0000644000175000017500000000055311545150464023234 0ustar chr1schr1s/* Unknown types. */ function rsh(lhs, rhs) { return lhs >> rhs; } assertEq(rsh(1024, 2), 256) assertEq(rsh(1024.5, 2), 256) assertEq(rsh(1024.5, 2.0), 256) /* Constant rhs. */ var lhs = 1024; assertEq(lhs >> 2, 256); lhs = 1024.5; assertEq(lhs >> 2, 256); /* Constant lhs. */ var rhs = 2; assertEq(256, 1024 >> rhs); var rhs = 2.0; assertEq(256, 1024 >> rhs); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/scriptedICs-1.js0000644000175000017500000000076111545150464023350 0ustar chr1schr1sT = 12; function arity2(q, w, r, t, y) { var Q1; var Q2; var Q3; var Q4; var Q5; var Q6; var Q7; var Q8; var Q9; T; return arguments; } function arity(q, w, r) { var Q1; var Q2; var Q3; var Q4; var Q5; var Q6; var Q7; var Q8; var Q9; T; return Q9; } for (var i = 0; i < 10; i++) { arity(); if (i == 6) arity = arity2; } /* Don't assert - stubs::CompileFunction must correct |regs.sp| */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/smallIntTypedArrays.js0000644000175000017500000000443511545150464024753 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function testInt8Array(L) { var f = new Int8Array(8); assertEq(f[0], 0); assertEq(f[L], 0); assertEq(f[L+8], undefined); assertEq(f[8], undefined); f[0] = 12; f[L+1] = 13; f[2] = f[1]; f[L+3] = 500; f[L+4] = true; f[L+5] = L; assertEq(f[0], 12); assertEq(f[1], 13); assertEq(f[2], 13); assertEq(f[3], -12); assertEq(f[4], 1); assertEq(f[5], 0); } function testUint8Array(L) { var f = new Uint8Array(8); assertEq(f[0], 0); assertEq(f[L], 0); assertEq(f[L+8], undefined); assertEq(f[8], undefined); f[0] = 12; f[L+1] = 13; f[2] = f[1]; f[L+3] = 500; f[L+4] = true; f[L+5] = L; assertEq(f[0], 12); assertEq(f[1], 13); assertEq(f[2], 13); assertEq(f[3], 244); assertEq(f[4], 1); assertEq(f[5], 0); } function testUint8ClampedArray(L) { var f = new Uint8ClampedArray(8); assertEq(f[0], 0); assertEq(f[L], 0); assertEq(f[L+8], undefined); assertEq(f[8], undefined); f[0] = 12; f[L+1] = 13; f[2] = f[1]; f[L+3] = 500; f[L+4] = true; f[L+5] = L; assertEq(f[0], 12); assertEq(f[1], 13); assertEq(f[2], 13); assertEq(f[3], 255); assertEq(f[4], 1); assertEq(f[5], 0); } function testInt16Array(L) { var f = new Int16Array(8); assertEq(f[0], 0); assertEq(f[L], 0); assertEq(f[L+8], undefined); assertEq(f[8], undefined); f[0] = 12; f[L+1] = 13; f[2] = f[1]; f[L+3] = 190000; f[L+4] = true; f[L+5] = L; assertEq(f[0], 12); assertEq(f[1], 13); assertEq(f[2], 13); assertEq(f[3], -6608); assertEq(f[4], 1); assertEq(f[5], 0); } function testUint16Array(L) { var f = new Uint16Array(8); assertEq(f[0], 0); assertEq(f[L], 0); assertEq(f[L+8], undefined); assertEq(f[8], undefined); f[0] = 12; f[L+1] = 13; f[2] = f[1]; f[L+3] = 190000; f[L+4] = true; f[L+5] = L; assertEq(f[0], 12); assertEq(f[1], 13); assertEq(f[2], 13); assertEq(f[3], 58928); assertEq(f[4], 1); assertEq(f[5], 0); } for (var i = 0; i < 10; i++) { testInt8Array(0); testUint8Array(0); testUint8ClampedArray(0); testInt16Array(0); testUint16Array(0); if (i == 5) gc(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/strictModeSetUndefinedVar.js0000644000175000017500000000013411545150464026054 0ustar chr1schr1s// |jit-test| error: ReferenceError; function f() { "use strict"; foo = 1; } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/subCommutativity.js0000644000175000017500000000016211545150464024361 0ustar chr1schr1sassertEq(6 - ((void 0) ^ 0x80000005), 2147483649); var x = ((void 0) ^ 0x80000005); assertEq(6 - x, 2147483649); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/tableSwitchConst.js0000644000175000017500000000043011545150464024247 0ustar chr1schr1sfunction f() { switch(2) { case 1: return 1; case 2: return 2; default: return -1; } } assertEq(f(), 2); function g() { switch(3.14) { case 3: return 3; case 4: return 4; default: return -1; } } assertEq(g(), -1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/tableSwitchDouble.js0000644000175000017500000000030111545150464024370 0ustar chr1schr1s function f(a) { switch(a) { case 3: return 3; case 4: return 4; default: return -1; } } assertEq(f(-0.0), -1); assertEq(f(3.14), -1); assertEq(f(12.34), -1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/tableSwitchEmpty.js0000644000175000017500000000025211545150464024261 0ustar chr1schr1s function f(a) { switch(a) { } switch(a) { default: return 0; } assertEq(0, 1); } assertEq(f(), 0); assertEq(f(0), 0); assertEq(f(1.1), 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/tableSwitchFloat.js0000644000175000017500000000043011545150464024226 0ustar chr1schr1sfunction f() { switch(2) { case 1: return 1; case 2: return 2; default: return -1; } } assertEq(f(), 2); function g() { switch(3.14) { case 3: return 3; case 4: return 4; default: return -1; } } assertEq(g(), -1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/tableSwitchNeg.js0000644000175000017500000000073211545150464023677 0ustar chr1schr1s function f(a) { switch(a) { case -1: return 1; case -2: return 2; case -5: return 5; default: return 10; } } assertEq(f(-1), 1); assertEq(f(-2), 2); assertEq(f(-5), 5); assertEq(f(-3), 10); assertEq(f(-6), 10); assertEq(f(0), 10); assertEq(f(1), 10); assertEq(f(-2147483647), 10); assertEq(f(-2147483648), 10); assertEq(f(-2147483649), 10); assertEq(f(2147483647), 10); assertEq(f(2147483648), 10); assertEq(f(2147483649), 10); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testAddStringObject.js0000644000175000017500000000044511545150464024703 0ustar chr1schr1sString.prototype.m = function(s) { return this.indexOf('a'); }; var g = function(s) { return (s + 'asdf').m(); }; var h = function(s) { return ('asdf' + s).m(); }; var ix = g(new String('abc')); assertEq(ix, 0); var ix = h(new String('abc')); assertEq(ix, 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testBug550743.js0000644000175000017500000000054411545150464023102 0ustar chr1schr1sexpected = ''; function g(code) { f = Function(code); gen = f(); gen.next(); try { gen.next(); } catch (ex) { expected = ex.toString() } } g("\ yield this.__defineGetter__('x', function(){ return z }); \ let z = new String('hi'); \ "); eval(); gc(); str = x; assertEq(expected, "[object StopIteration]"); assertEq(str.toString(), "hi"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testCallElemAfterGC.js0000644000175000017500000000043311545150464024544 0ustar chr1schr1s// vim: ts=4 sw=4 tw=99 et: function A() { this.x = 12; this.y = function () { return this.x; }; this[1] = function () { return this.x; }; } function f(obj, key){ assertEq(obj[key](), 12); } a = new A(); f(a, "y"); f(a, "y"); f(a, 1); gc(); f(a, "y"); f(a, "y"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testDenseCallElem.js0000644000175000017500000000431311545150464024330 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function fillDense(a) { } function testDenseUKeyUArray(a, key) { a.push(function () { return this[3]; }); a.push(function () { return this[4]; }); a.push(function() { return this[5]; }); a.push(20); a.push("hi"); a.push(500); assertEq(a[key](), 20); assertEq(a[key + 1](), "hi"); assertEq(a[key + 2](), 500); } function testDenseVKeyUArray(a) { a.push(function () { return this[3]; }); a.push(function () { return this[4]; }); a.push(function() { return this[5]; }); a.push(20); a.push("hi"); a.push(500); var key = a.length & 1; assertEq(a[key](), 20); assertEq(a[(key + 1) & 3](), "hi"); assertEq(a[(key + 2) & 3](), 500); } function testDenseKKeyUArray(a, key) { a.push(function () { return this[3]; }); a.push(function () { return this[4]; }); a.push(function() { return this[5]; }); a.push(20); a.push("hi"); a.push(500); assertEq(a[0](), 20); assertEq(a[1](), "hi"); assertEq(a[2](), 500); } function testDenseUKeyVArray(key) { var a = [function () { return this[3]; }, function () { return this[4]; }, function() { return this[5]; }, 20, "hi", 500]; assertEq(a[key](), 20); assertEq(a[key + 1](), "hi"); assertEq(a[key + 2](), 500); } function testDenseVKeyVArray() { var a = [function () { return this[3]; }, function () { return this[4]; }, function() { return this[5]; }, 20, "hi", 500]; var key = a.length & 1; assertEq(a[key](), 20); assertEq(a[(key + 1) & 3](), "hi"); assertEq(a[(key + 2) & 3](), 500); } function testDenseKKeyVArray() { var a = [function () { return this[3]; }, function () { return this[4]; }, function() { return this[5]; }, 20, "hi", 500]; assertEq(a[0](), 20); assertEq(a[1](), "hi"); assertEq(a[2](), 500); } for (var i = 0; i < 5; i++) { testDenseUKeyUArray([], 0); testDenseVKeyUArray([]); testDenseKKeyUArray([]); testDenseUKeyVArray(0); testDenseVKeyVArray(); testDenseKKeyVArray(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testForOps.js0000644000175000017500000000260011545150464023100 0ustar chr1schr1s// |jit-test| mjitalways // vim: set ts=4 sw=4 tw=99 et: function assertObjectsEqual(obj1, obj2) { assertEq(obj1.a, obj2.a); assertEq(obj1.b, obj2.b); assertEq(obj1.c, obj2.c); assertEq(obj1.d, obj2.d); assertEq(obj2.a, 1); assertEq(obj2.b, "bee"); assertEq(obj2.c, "crab"); assertEq(obj2.d, 12); } function forName(obj) { assertJit(); eval(''); var r = { }; for (x in obj) r[x] = obj[x]; return r; } function forGlobalName(obj) { assertJit(); var r = { }; for (x in obj) r[x] = obj[x]; return r; } function forProp(obj) { assertJit(); var r = { }; var c = { }; for (c.x in obj) r[c.x] = obj[c.x]; return r; } function forElem(obj, x) { assertJit(); var r = { }; var c = { }; for (c[x] in obj) r[c[x]] = obj[c[x]]; return r; } function forLocal(obj) { assertJit(); var r = { }; for (var x in obj) r[x] = obj[x]; return r; } function forArg(obj, x) { assertJit(); var r = { }; for (x in obj) r[x] = obj[x]; return r; } var obj = { a: 1, b: "bee", c: "crab", d: 12 }; assertObjectsEqual(obj, forName(obj)); assertObjectsEqual(obj, forGlobalName(obj)); assertObjectsEqual(obj, forProp(obj)); assertObjectsEqual(obj, forElem(obj, "v")); assertObjectsEqual(obj, forLocal(obj)); assertObjectsEqual(obj, forArg(obj)); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testPropCallElem.js0000644000175000017500000000440311545150464024212 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function testUKeyUObject(a, key1, key2, key3) { a.a = function () { return this.d; } a.b = function () { return this.e; } a.c = function() { return this.f; } a.d = 20; a.e = "hi"; a.f = 500; assertEq(a[key1](), 20); assertEq(a[key2](), "hi"); assertEq(a[key3](), 500); } function testVKeyUObject(a, key1, key2, key3) { a.a = function () { return this.d; } a.b = function () { return this.e; } a.c = function() { return this.f; } a.d = 20; a.e = "hi"; a.f = 500; assertEq(a["" + key1](), 20); assertEq(a["" + key2](), "hi"); assertEq(a["" + key3](), 500); } function testKKeyUObject(a) { a.a = function () { return this.d; } a.b = function () { return this.e; } a.c = function() { return this.f; } a.d = 20; a.e = "hi"; a.f = 500; var key1 = "a"; var key2 = "b"; var key3 = "c"; assertEq(a[key1](), 20); assertEq(a[key2](), "hi"); assertEq(a[key3](), 500); } function testUKeyVObject(key1, key2, key3) { a = { a: function () { return this.d; }, b: function () { return this.e; }, c: function () { return this.f; }, d: 20, e: "hi", f: 500 }; assertEq(a[key1](), 20); assertEq(a[key2](), "hi"); assertEq(a[key3](), 500); } function testVKeyVObject(key1, key2, key3) { a = { a: function () { return this.d; }, b: function () { return this.e; }, c: function () { return this.f; }, d: 20, e: "hi", f: 500 }; assertEq(a["" + key1](), 20); assertEq(a["" + key2](), "hi"); assertEq(a["" + key3](), 500); } function testKKeyVObject(a) { a = { a: function () { return this.d; }, b: function () { return this.e; }, c: function () { return this.f; }, d: 20, e: "hi", f: 500 }; var key1 = "a"; var key2 = "b"; var key3 = "c"; assertEq(a[key1](), 20); assertEq(a[key2](), "hi"); assertEq(a[key3](), 500); } for (var i = 0; i < 5; i++) { testUKeyUObject({}, "a", "b", "c"); testVKeyUObject({}, "a", "b", "c"); testKKeyUObject({}); testUKeyVObject("a", "b", "c"); testVKeyVObject("a", "b", "c"); testKKeyVObject(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testPropCallElem2.js0000644000175000017500000000102111545150464024265 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function testUKeyUObject(a, key1, key2, key3) { a.a = function () { return this.d; } a.b = function () { return this.e; } a.c = function() { return this.f; } a.d = 20; a.e = "hi"; a.f = 500; delete a["b"]; Object.defineProperty(a, "b", { get: function () { return function () { return this.e; } } }); assertEq(a[key1](), 20); assertEq(a[key2](), "hi"); assertEq(a[key3](), 500); } for (var i = 0; i < 5; i++) testUKeyUObject({}, "a", "b", "c"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testSetElem-Easy.js0000644000175000017500000000136511545150464024134 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function testBadSetElems(obj, key) { obj[key] = 5; obj[-1] = 5; var L = obj; L[L] = L; obj = []; obj.K = 5; obj[2] = 5; var T = "a"; obj[T] = 12; obj = []; obj[Object] = key; } function testDenseSets(L) { var obj = [,,,,,,,,,,]; obj[2] = 2; assertEq(obj[2], 2); var T = L; assertEq(obj[T], 2); assertEq(obj.length, 10); obj[10] = T; assertEq(obj[10], T); assertEq(obj.length, 11); var K = T + 9; obj[K] = K; assertEq(obj[K], K); assertEq(obj.length, 12); obj[K + 1] = obj; assertEq(obj[K + 1], obj); assertEq(obj.length, 13); } for (var i = 0; i < 10; i++) { testBadSetElems([], -1); testDenseSets(2); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testSetElem-Indexed.js0000644000175000017500000000126211545150464024607 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function f() { return [[], [], [], []]; } function setelem(obj, key, val) { obj[key] = val; } // Generate IC setelem([], 0, "hi"); setelem([], 0, "hi"); // Get some arrays pre-indexing. var arrays = f(); // Do bad stuff. Object.defineProperty(Object.prototype, "1", { set: function (v) { this.kettle = v; } }); var k = arrays[0]; setelem(k, 1, 13); assertEq(k.kettle, 13); assertEq(k.hasOwnProperty("1"), false); Object.defineProperty(Array.prototype, "2", { set: function (v) { this.pot = v; } }); k = arrays[1]; setelem(k, 2, "yam"); assertEq(k.pot, "yam"); gc(); // make sure this reset okay. setelem([], 0, "hi"); setelem([], 0, "hi"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testSetElem-NewProto.js0000644000175000017500000000063011545150464025002 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function f() { return [[], [], [], []]; } function setelem(obj, key, val) { obj[key] = val; } // Generate IC setelem([], 0, "hi"); setelem([], 0, "hi"); var arrays = f(); var evil = { }; Object.defineProperty(evil, "1", { set: function (v) { this.ham = v; } }); Array.prototype.__proto__ = evil; var k = arrays[0]; setelem(k, 1, "yam"); assertEq(k.ham, "yam"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testSetTypedFloatArray.js0000644000175000017500000000276011545150464025425 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function testSetTypedFloat32Array(k) { var ar = new Float32Array(8); ar[k+5] = { }; ar[k+6] = ar; ar[k+4] = (k + 800) * 897 * 800 * 800 * 810 * 1923437; var t = k + 555; var L = ar[k+7] = t & 5; ar[0] = 12.3; ar[8] = 500; ar[k+8] = 1200; ar[k+1] = 500; ar[k+2] = "3" + k; ar[k+3] = true; assertEq(ar[0] - 12.3 >= 0 && ar[0] - 12.3 <= 0.0001, true); assertEq(ar[1], 500); assertEq(ar[2], 30); assertEq(ar[3], 1); assertEq(ar[4], 715525927453369300000); assertEq(ar[5], NaN); assertEq(ar[6], NaN); assertEq(ar[7], 1); assertEq(ar[8], undefined); assertEq(ar[k+8], undefined); } function testSetTypedFloat64Array(k) { var ar = new Float64Array(8); ar[k+5] = { }; ar[k+6] = ar; ar[k+4] = (k + 800) * 897 * 800 * 800 * 810 * 1923437; var t = k + 555; var L = ar[k+7] = t & 5; ar[0] = 12.3; ar[8] = 500; ar[k+8] = 1200; ar[k+1] = 500; ar[k+2] = "3" + k; ar[k+3] = true; assertEq(ar[0] - 12.3 >= 0 && ar[0] - 12.3 <= 0.0001, true); assertEq(ar[1], 500); assertEq(ar[2], 30); assertEq(ar[3], 1); assertEq(ar[4], 715525949998080000000); assertEq(ar[5], NaN); assertEq(ar[6], NaN); assertEq(ar[7], 1); assertEq(ar[8], undefined); assertEq(ar[k+8], undefined); } for (var i = 0; i <= 10; i++) { testSetTypedFloat32Array(0); testSetTypedFloat64Array(0); if (i == 5) gc(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testSetTypedIntArray.js0000644000175000017500000001046011545150464025106 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function testSetTypedInt8Array(k) { var ar = new Int8Array(8); ar[k+5] = { }; ar[k+6] = ar; ar[k+4] = k + 800; var t = k + 555; var t = ar[k+7] = t & 5; ar[0] = 12; ar[8] = 500; ar[k+8] = 1200; ar[k+1] = 500; ar[k+2] = "3"; ar[k+3] = true; assertEq(ar[0], 12); assertEq(ar[1], -12); assertEq(ar[2], 3); assertEq(ar[3], 1); assertEq(ar[4], 32); assertEq(ar[5], 0); assertEq(ar[6], 0); assertEq(ar[7], 1); assertEq(ar[8], undefined); assertEq(ar[k+8], undefined); } function testSetTypedUint8ClampedArray(k) { var ar = new Uint8ClampedArray(8); ar[k+5] = { }; ar[k+6] = ar; ar[k+4] = k + 800; var t = k + 555; var L = ar[k+7] = t & 5; var Q = ar[k+7] = t + 5; ar[0] = 12; ar[8] = 500; ar[k+8] = 1200; ar[k+1] = -500; ar[k+2] = "3"; ar[k+3] = true; assertEq(ar[0], 12); assertEq(ar[1], 0); assertEq(ar[2], 3); assertEq(ar[3], 1); assertEq(ar[4], 255); assertEq(ar[5], 0); assertEq(ar[6], 0); assertEq(ar[7], 255); assertEq(ar[8], undefined); assertEq(ar[k+8], undefined); } function testSetTypedUint8Array(k) { var ar = new Uint8Array(8); ar[k+5] = { }; ar[k+6] = ar; ar[k+4] = k + 800; var t = k + 555; var L = ar[k+7] = t + 5; ar[0] = 12.3; ar[8] = 500; ar[k+8] = 1200; ar[k+1] = 500; ar[k+2] = "3"; ar[k+3] = true; assertEq(ar[0], 12); assertEq(ar[1], 244); assertEq(ar[2], 3); assertEq(ar[3], 1); assertEq(ar[4], 32); assertEq(ar[5], 0); assertEq(ar[6], 0); assertEq(ar[7], 48); assertEq(ar[8], undefined); assertEq(ar[k+8], undefined); } function testSetTypedInt16Array(k) { var ar = new Int16Array(8); ar[k+5] = { }; ar[k+6] = ar; ar[k+4] = (k + 800) * 800 * 800 * 913; var t = k + 555; var L = ar[k+7] = t + 5; ar[0] = 12.3; ar[8] = 500; ar[k+8] = 1200; ar[k+1] = 500000; ar[k+2] = "3"; ar[k+3] = true; assertEq(ar[0], 12); assertEq(ar[1], -24288); assertEq(ar[2], 3); assertEq(ar[3], 1); assertEq(ar[4], -32768); assertEq(ar[5], 0); assertEq(ar[6], 0); assertEq(ar[7], 560); assertEq(ar[8], undefined); assertEq(ar[k+8], undefined); } function testSetTypedUint16Array(k) { var ar = new Uint16Array(8); ar[k+5] = { }; ar[k+6] = ar; ar[k+4] = (k + 800) * 800 * 800 * 913; var t = k + 555; var L = ar[k+7] = t + 5; ar[0] = 12.3; ar[8] = 500; ar[k+8] = 1200; ar[k+1] = 500000; ar[k+2] = "3"; ar[k+3] = true; assertEq(ar[0], 12); assertEq(ar[1], 41248); assertEq(ar[2], 3); assertEq(ar[3], 1); assertEq(ar[4], 32768); assertEq(ar[5], 0); assertEq(ar[6], 0); assertEq(ar[7], 560); assertEq(ar[8], undefined); assertEq(ar[k+8], undefined); } function testSetTypedInt32Array(k) { var ar = new Int32Array(8); ar[k+5] = { }; ar[k+6] = ar; ar[k+4] = (k + 800) * 800 * 800 * 800 * 800; var t = k + 555; var L = ar[k+7] = t + 5; ar[0] = 12.3; ar[8] = 500; ar[k+8] = 1200; ar[k+1] = 500; ar[k+2] = "3"; ar[k+3] = true; assertEq(ar[0], 12); assertEq(ar[1], 500); assertEq(ar[2], 3); assertEq(ar[3], 1); assertEq(ar[4], -234881024); assertEq(ar[5], 0); assertEq(ar[6], 0); assertEq(ar[7], 560); assertEq(ar[8], undefined); assertEq(ar[k+8], undefined); } function testSetTypedUint32Array(k) { var ar = new Uint32Array(8); ar[k+5] = { }; ar[k+6] = ar; ar[k+4] = (k + 800) * 800 * 800 * 800 * 800; var t = k + 555; var L = ar[k+7] = t + 5; ar[0] = 12.3; ar[8] = 500; ar[k+8] = 1200; ar[k+1] = 500; ar[k+2] = "3"; ar[k+3] = true; assertEq(ar[0], 12); assertEq(ar[1], 500); assertEq(ar[2], 3); assertEq(ar[3], 1); assertEq(ar[4], 4060086272); assertEq(ar[5], 0); assertEq(ar[6], 0); assertEq(ar[7], 560); assertEq(ar[8], undefined); assertEq(ar[k+8], undefined); } for (var i = 0; i <= 10; i++) { testSetTypedInt8Array(0); testSetTypedUint8Array(0); testSetTypedUint8ClampedArray(0); testSetTypedInt16Array(0); testSetTypedUint16Array(0); testSetTypedInt32Array(0); testSetTypedUint32Array(0); if (i == 5) gc(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/testShiftSameBacking.js0000644000175000017500000000023611545150464025035 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function f(a) { var x = a; var y = x; assertEq((x << y), (a << a)); assertEq((y << x), (a << a)); } f(2); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/unsignedShiftZero.js0000644000175000017500000000023511545150464024444 0ustar chr1schr1s function f(a) { return a >>> 0; }; assertEq(f(-2147483647), 2147483649); assertEq(f(-2147483648), 2147483648); assertEq(f(-2147483649), 2147483647); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/xor-sanity.js0000644000175000017500000000002611545150464023105 0ustar chr1schr1sassertEq(-2^31, -31); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug549393-1.js0000644000175000017500000000162511545150464022412 0ustar chr1schr1s// |jit-test| error: TypeError function start() { MAX_TOTAL_TIME = startTime = new Date do { if (rnd(0)) return (a[rnd()])() lastTime = new Date } while ( lastTime - startTime < MAX_TOTAL_TIME ) } function MersenneTwister19937() { this.init_genrand = function() { for (mti = 1; mti < 4; mti++) { Array[mti] = 1 } }; this.genrand_int32 = function() { if (mti > 4) { mti = 0 } return Array[mti++]; } } (function() { fuzzMT = new MersenneTwister19937; fuzzMT.init_genrand() rnd = function() { return Math.floor(fuzzMT.genrand_int32()) } } ()) function weighted(wa) { a = [] for (i = 0; i < wa.length; ++i) { for (var j = 0; j < 8; ++j) { a.push(wa[i].fun) } } } statementMakers = weighted([{ fun: function makeMixedTypeArray() { [[, , , , , , , , , , , , , , , , , , , , , , , , ""][(a[rnd()])()]]} }]) start() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug549393-2.js0000644000175000017500000000034311545150464022407 0ustar chr1schr1s(function () { for (var q = 0; q < 6; ++q) { x: (function () { var m = (function () {})() })([0, , 0, 0, 0, , 0, 0, 0, , 0, 0, 0, , 0, 0, 0, 0, 0, 0, Number(1)]) } })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug549396.js0000644000175000017500000000007511545150464022255 0ustar chr1schr1sx = this.__defineSetter__("x", function(z) function() { z }) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug549398.js0000644000175000017500000000020311545150464022250 0ustar chr1schr1s(function () { eval("\ for(var z = 0 ; z < 2 ; ++z) {\ this\ }\ ", ()) })() /* Don't crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug549521.js0000644000175000017500000000016111545150464022237 0ustar chr1schr1sfunction f(y) { if (y) return; let(x) { for (;;) {} } } /* Don't assert. */ f(1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug549602.js0000644000175000017500000000121011545150464022233 0ustar chr1schr1sversion(180) function f1(code) { var c var t = code.replace(/s/, "") var f = new Function(code) var o e = v = f2(f, c) } function f2(f, e) { try { a = f() } catch(r) { var r = g() } } g1 = [{ text: "(function sum_slicing(array){return array==0?0:a+sum_slicing(array.slice(1))})", test: function (f) { f([, 2]) == "" } }]; (function () { for (var i = 0; i < g1.length; ++i) { var a = g1[i] var text = a.text var f = eval(text.replace(/@/, "")) if (a.test(f)) {} } }()) f1("for(let a=0;a<6;a++){print([\"\"].some(function(){false>\"\"}))}") mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug549603.js0000644000175000017500000000006511545150464022243 0ustar chr1schr1s// |jit-test| error: ReferenceError x ? o : [] && x mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug550490.js0000644000175000017500000000024611545150464022240 0ustar chr1schr1s function a() { function f() {} this.d = function() { f } } (function() { var a2, x a2 = new a; d = (function(){x * 1})(); })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug550665.js0000644000175000017500000000027011545150464022241 0ustar chr1schr1s(function () { var a; eval("for(w in ((function(x,y){b:0})())) ;"); })(); this.__defineSetter__("l", function() { gc() }); this.watch("l", function(x) { yield #1={} }); l = true; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug551603.js0000644000175000017500000000012711545150464022233 0ustar chr1schr1s(function() { ((function f(a) { if (a > 0) { f(a - 1) } })(6)) })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug552644.js0000644000175000017500000000013411545150464022237 0ustar chr1schr1s(function() { for (e in ((function() { yield })())) return })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug553781-2.js0000644000175000017500000000021011545150464022374 0ustar chr1schr1s(function() { do { try { return } catch(x if (c)) { return } (x) } while (x) })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug553781.js0000644000175000017500000000020111545150464022235 0ustar chr1schr1s(function () { try { return } catch (x if i) { return } for (z in []); })() /* Don't assert */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug553784.js0000644000175000017500000000047611545150464022256 0ustar chr1schr1s// |jit-test| allow-oom (function(){ (x)=> })() try{ (function(){ ((function a(aaaaaa,bbbbbb){ if(aaaaaa.length==bbbbbb){ return eval%bbbbbb.valueOf() } cccccc=a(aaaaaa,bbbbbb+1) return cccccc._=x })([,,,,,,,,,,,,,,,,,,0],0)) })() }catch(e){} /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug554580-1.js0000644000175000017500000000015311545150464022377 0ustar chr1schr1s// |jit-test| error: TypeError for (var a = 0; a < 7; ++a) { if (a == 1) { Iterator() } } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug554580-2.js0000644000175000017500000000022511545150464022400 0ustar chr1schr1s// |jit-test| error: RangeError (function() { for each(let a in [function() {}, Infinity]) { new Array(a) } })() /* Don't assert/crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug554580-3.js0000644000175000017500000000030311545150464022376 0ustar chr1schr1s// |jit-test| error: SyntaxError Function("\n\ for (a = 0; a < 3; a++) {\n\ if (a == 0) {} else {\n\ this.__defineSetter__(\"\",1)\n\ }\n\ }\n\ ")() /* Don't crash/assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug554580-4.js0000644000175000017500000000045511545150464022407 0ustar chr1schr1s(function() { try { (eval("\ function() {\ for each(let y in [0]) {\ for (var a = 0; a < 9; ++a) {\ if (a) {\ this.__defineGetter__(\"\",this)\ }\ }\ }\ }\ "))() } catch(e) {} })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug554580-5.js0000644000175000017500000000042711545150464022407 0ustar chr1schr1s(function() { (function g(m, n) { if (m = n) { return eval("x=this") } g(m, 1)[[]] })() })() Function("\ for (let b in [0]) {\ for (var k = 0; k < 6; ++k) {\ if (k == 1) {\ print(x)\ }\ }\ }\ ")() /* Don't crash/assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug554651.js0000644000175000017500000000052011545150464022236 0ustar chr1schr1s// |jit-test| error: InternalError (function() { try { (Function("this.__defineGetter__(\"x\",(Function(\"for(z=0;z<6;z++)(x)\")))"))() } catch(e) {} })() ((function f(d, aaaaaa) { if (bbbbbb = aaaaaa) { x } f(bbbbbb, aaaaaa + 1) })([], 0)) /* Don't assert (32-bit mac only, relies on very specific stack usage). */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug554675-1.js0000644000175000017500000000013211545150464022401 0ustar chr1schr1s(function() { for (e in [0, 0]) { if (/x/ < this) {} } })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug554675-2.js0000644000175000017500000000030211545150464022401 0ustar chr1schr1sfunction a(code) { var f = new Function("for each(let x in[false,'',/x/,'',{}]){if(x; this.x = x; } function f() { var a = new K(1); var b = new K(2); return (a == b); } assertEq(f(), false); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug577580.js0000644000175000017500000000013511545150464022246 0ustar chr1schr1s// |jit-test| error: ReferenceError (function() { for (; i;) { eval(/@/, "") } })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug577646.js0000644000175000017500000000006011545150464022246 0ustar chr1schr1stry { [](); } catch(e) {} /* Don't crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug577705.js0000644000175000017500000000220411545150464022244 0ustar chr1schr1s// |jit-test| error: ReferenceError function f1() { N = 62; mt = Array function g1(n1) { return n1 < 0 ? (1 ^ 21) + 21: n1 } function g2(n1, n2) { return g1(n1 + n2 & 4294967295); } function g3(n1, n2) { sum = 0; for (var i = 0; i < 32; ++i) { if (n1 >> i) { sum = g2(sum, g1(n2)) } } return sum } this.h1 = function() { for (mti = 1; mti < N; mti++) { mt[mti] = g2(g3(3, g1(mt[mti - 1] ^ 0)), mti) } }; this.i2 = function() { if (mti > N) { mti = 0; } y = mt[mti++]; return y }; this.i1 = function() { return (this.i2() + 5) * 2e-10 }; } (function() { fuzzMT = new f1; fuzzMT.h1(9); rnd = function(n) { return Math.floor(fuzzMT.i1() * n) }; } ()); function f5(a) { return a[rnd(a.length)] } function f2(d, b) { f3(d, b); return "" + f2(2, b) + ""; } function f3(d, b) { if (rnd(4) == 1) { f5(f4)(d, b) } } var f4 = [function() { ["", f6(), ""] }]; function f6(db) { return f5(foo)(); } var foo = [function() { t(["", "", "", "", "", "", "", "", "", "", "", "" + h.I, ""]); }]; f2() /* Don't assert or crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug577996.js0000644000175000017500000000021111545150464022254 0ustar chr1schr1sFunction("\n\ for each(y in[0,0,0]) {\n\ for(x in[0,0,0,0,0,0,0,0,0,new Boolean(true),0,0,0,new Boolean(true)]) {}\n\ }\n\ ")() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug580703.js0000644000175000017500000000007711545150464022242 0ustar chr1schr1s let(w)(function () { w }) let(e)(function () { e }) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug580712.js0000644000175000017500000000001611545150464022233 0ustar chr1schr1s--''.trimLeft mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug580883.js0000644000175000017500000000012411545150464022244 0ustar chr1schr1s// |jit-test| error: invalid sharp variable use #1# [] = #1# with(7) { var c } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug580884-2.js0000644000175000017500000000132511545150464022410 0ustar chr1schr1sassertEq( (function () { eval(); var arr = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 ]; for (var i = 0; i < 4; ++i) { var src = i * 8; var dst = i * 8 + 7; for (var j = 0; j < 4; ++j) { [arr[dst--], arr[src++]] = [arr[src], arr[dst]]; } } return arr; })().toSource(), "[7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8, 23, 22, 21, 20, 19, 18, 17, 16, 31, 30, 29, 28, 27, 26, 25, 24, 32]"); checkStats({ recorderStarted: 2, traceCompleted: 2, sideExitIntoInterpreter: 3, traceTriggered: 3 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug580884-3.js0000644000175000017500000000035111545150464022407 0ustar chr1schr1sfunction testDestructuring() { eval(); var t = 0; for (var i = 0; i < HOTLOOP + 1; ++i) { var [r, g, b] = [1, 1, 1]; t += r + g + b; } return t } assertEq(testDestructuring(), (HOTLOOP + 1) * 3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug580884.js0000644000175000017500000000015111545150464022245 0ustar chr1schr1s// |jit-test| error: ReferenceError for (let a in [0]) a = e for (let a in [0]) (function () { a }) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug580931-2.js0000644000175000017500000000011111545150464022371 0ustar chr1schr1s// |jit-test| error: TypeError x = 0 'a'.replace(/a/, x.toLocaleString) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug581871.js0000644000175000017500000000031411545150464022243 0ustar chr1schr1sfunction test(p) { var alwaysFalse = p && !p; var k = []; var g; if (!alwaysFalse) { k[0] = g = alwaysFalse ? "failure" : "success"; return g; } } assertEq(test("anything"), "success"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug581936.js0000644000175000017500000000027111545150464022247 0ustar chr1schr1sfunction returnZero() { return 0; } function test() { var a = "a"; var b = "b"; if (returnZero()) { return a + b; } else { return b + a; } } assertEq(test(), "ba"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug582185.js0000644000175000017500000000005411545150464022243 0ustar chr1schr1slet c = (this != 4.2); /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug582286.js0000644000175000017500000000005211545150464022243 0ustar chr1schr1sevalcx("function s(){}",evalcx('lazy')) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug582392.js0000644000175000017500000000017511545150464022247 0ustar chr1schr1sfunction cmp(x, y) { if (x < y) return -1; if (x > y) return 1; return 0; } assertEq(cmp('true', 'false'), 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug582880.js0000644000175000017500000000020011545150464022236 0ustar chr1schr1sx = default xml namespace = []; (function () { function a() {} a([7].some(gc)) }()) /* Don't crash or assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug582882.js0000644000175000017500000000027211545150464022251 0ustar chr1schr1s// |jit-test| error: ReferenceError function f1(code) { f = Function(code) f2() } function f2() { f() } f1("d=this.__defineGetter__(\"x\",gc)") f1("b(x&=w);function b(){}") mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug582884.js0000644000175000017500000000010011545150464022241 0ustar chr1schr1s(function () { x ^ x++ var x })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug582894.js0000644000175000017500000000010511545150464022247 0ustar chr1schr1sfor each(let e in [0x40000000]) { (0)[e] } /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug582897.js0000644000175000017500000000005511545150464022256 0ustar chr1schr1slet(x) { x + x-- } /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug582898.js0000644000175000017500000000010311545150464022251 0ustar chr1schr1slet(x = "") { x++ assertEq(x, 1); } /* Test no assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug582900.js0000644000175000017500000000006411545150464022237 0ustar chr1schr1s// |jit-test| error: ReferenceError [].x >>= a | 0 mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug583158.js0000644000175000017500000000020111545150464022236 0ustar chr1schr1s// |jit-test| error: ReferenceError function g() { var rv = (function() { this << 1 })() if (a) (function() {}) } g() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug583160.js0000644000175000017500000000024711545150464022241 0ustar chr1schr1s(function() { for (a in []) { (function() {}) ([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, h.I]) } })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug583672.js0000644000175000017500000000066011545150464022250 0ustar chr1schr1s(function () { function f() { this.y = w this.y = (void 0) Object } for (a in [0, 0, 0, 0]) { new f } let w = {} })() /* Make sure that MICs don't have the same bug. */ x = Object(); (function () { function f() { x = w x = (void 0) Object } for (a in [0, 0, 0, 0]) { new f } let w = {} })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug583684.js0000644000175000017500000000016411545150464022252 0ustar chr1schr1s// |jit-test| error: TypeError (function () { var b = e for (var [e] = b in w) c })() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug583688.js0000644000175000017500000000026011545150464022253 0ustar chr1schr1s// |jit-test| error: ReferenceError this.__defineSetter__("x", function () {}) try { this.__defineGetter__("d", (Function("x"))) } catch (e) {} d print(delete x) throw d mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug583689.js0000644000175000017500000000011611545150464022254 0ustar chr1schr1sfunction f() { if (-[]) delete y } for (c in [0, 0, 0, 0]) { new f } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug584644-2.js0000644000175000017500000000023711545150464022407 0ustar chr1schr1sthis.__defineSetter__("x",/a/) Function("\ for each(w in[0,0,0]) {\ for each(y in[0,0,0,0,0,0,0,0,x,0,0,0,0,0,0,0,0,0,x,0,0,0,0,0,0,0,x]) {}\ }\ ")() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug584646.js0000644000175000017500000000011311545150464022243 0ustar chr1schr1sswitch (0) { case 2: k; case (-1): case 2: } /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug584647.js0000644000175000017500000000010411545150464022244 0ustar chr1schr1s(function(){for(j=0;j<3;++j)NaN=42})(); assertEq(NaN != NaN, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug585310.js0000644000175000017500000000054611545150464022242 0ustar chr1schr1sgczeal(2) try { (function () { for each(l in [0, 0, 0]) { print(''.replace(function () {})) } })() } catch (e) {} x = gczeal(2) try { (function () { for each(d in [x, x, x]) { 'a'.replace(/a/, function () {}) } })() } catch (e) {} /* Don't assert or segfault. Tests PIC resetting. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/jaeger/bug585341.js0000644000175000017500000000014011545150464022234 0ustar chr1schr1sthis.__defineGetter__("x", Float64Array) Function("\ with(this) {\ eval(\"x\")\ }\ ")() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-createontrace.js0000644000175000017500000000045111545150464025313 0ustar chr1schr1sactual = ''; expected = '5,4,3,2,1,X,5,4,3,2,1,Y,5,4,3,2,1,'; function f() { for (var i = 0; i < 5; ++i) { var args = arguments; appendToActual(args[i]); } } f(5, 4, 3, 2, 1); appendToActual("X"); f(5, 4, 3, 2, 1); appendToActual("Y"); f(5, 4, 3, 2, 1); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-mochi-2.js0000644000175000017500000000057611545150464023742 0ustar chr1schr1sactual = ''; expected = 'true,'; var isNotEmpty = function (args, i) { var o = args[i]; if (!(o && o.length)) { return false; } return true; }; var f = function(obj) { for (var i = 0; i < arguments.length; i++) { if (!isNotEmpty(arguments, i)) return false; } return true; } appendToActual(f([1], [1], [1], "asdf", [1])); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-mochi-2a.js0000644000175000017500000000056111545150464024075 0ustar chr1schr1sactual = ''; expected = 'true,'; function isNotEmpty(args, i) { var o = args[i]; if (!(o && o.length)) { return false; } return true; }; function f(obj) { for (var i = 0; i < arguments.length; i++) { if (!isNotEmpty(arguments, i)) return false; } return true; } appendToActual(f([1], [1], [1], "asdf", [1])); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-mochi.js0000644000175000017500000000045711545150464023601 0ustar chr1schr1sactual = ''; expected = 'true,'; var isNotEmpty = function (obj) { for (var i = 0; i < arguments.length; i++) { var o = arguments[i]; if (!(o && o.length)) { return false; } } return true; }; appendToActual(isNotEmpty([1], [1], [1], "asdf", [1])); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-mutate-length-1.js0000644000175000017500000000031511545150464025407 0ustar chr1schr1sactual = ''; expected = '0,0,0,'; function f() { arguments.length--; for (var i = 0; i < arguments.length; ++i) { appendToActual(i); } } f(1, 2); f(1, 2); f(2, 2); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-mutate-length-2.js0000644000175000017500000000027511545150464025415 0ustar chr1schr1sactual = ''; expected = '0,1,0,1,0,1,'; function f() { for (var i = 0; i < arguments.length; ++i) { appendToActual(i); } } f(1, 2); f(1, 2); f(2, 2); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-range-2.js0000644000175000017500000000152711545150464023734 0ustar chr1schr1sactual = ''; expected = "undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,"; var index; function h() { for (var i = 0; i < 5; ++i) { var a = arguments; appendToActual(a[index]); } } index = 0; h(); index = -1; h(); index = 1; h(); index = -9999999; h(1, 2, 3); index = -1; h(1, 2, 3); index = 0; h(1, 2, 3); index = 1; h(1, 2, 3); index = 2; h(1, 2, 3); index = 3; h(1, 2, 3); index = 4; h(1, 2, 3); index = 9999999; h(1, 2, 3); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-range-const.js0000644000175000017500000000033211545150464024712 0ustar chr1schr1sactual = ''; expected = 'undefined,undefined,undefined,undefined,undefined,'; function h() { for (var i = 0; i < 5; ++i) { var a = arguments; appendToActual(a[100]); } } h(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-range.js0000644000175000017500000000060111545150464023565 0ustar chr1schr1sactual = ''; expected = '0,0,0,0,0,88,88,88,88,88,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,'; function h(k) { for (var i = 0; i < 5; ++i) { var a = arguments; appendToActual(a[k]); } } h(0); h(2, 99, 88, 77); h(-5); h(46); h('adf'); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-redefine-length-1.js0000644000175000017500000000022511545150464025671 0ustar chr1schr1sfunction t() { Object.defineProperty(arguments, "length", { value: 17 }); for (var i = 0; i < 5; i++) assertEq(arguments.length, 17); } t(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-redefine-length-2.js0000644000175000017500000000023211545150464025670 0ustar chr1schr1sfunction t() { var a = arguments; Object.defineProperty(a, "length", { value: 17 }); for (var i = 0; i < 5; i++) assertEq(a.length, 17); } t(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-sum.js0000644000175000017500000000034311545150464023300 0ustar chr1schr1sactual = ''; expected = '666,'; function h() { var ans = 0; for (var i = 0; i < arguments.length; ++i) { ans += arguments[i]; } return ans; } var q = h(600, 60, 6); appendToActual(q); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args-vargc.js0000644000175000017500000000052211545150464023575 0ustar chr1schr1sactual = ''; expected = '1 2,1 2,1 2,1 2,1 2,1 2,1 2,1 2,1 undefined,1 undefined,1 undefined,1 undefined,1 undefined,1 undefined,1 undefined,1 undefined,'; function g(a, b) { appendToActual(a + ' ' + b); } function f() { for (var i = 0; i < 8; ++i) { g.apply(this, arguments); } } f(1, 2); f(1); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args1.js0000644000175000017500000000023611545150464022560 0ustar chr1schr1sactual = ''; expected = 'a,'; function f() { arguments; } for (var i = 0; i < 1000; ++i) { f(1, 2); } appendToActual('a') assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args10.js0000644000175000017500000000045511545150464022643 0ustar chr1schr1sactual = ''; expected = 'function h(x, y) {\n return arguments;\n},2,4,8,'; function h(x, y) { return arguments; } var p; for (var i = 0; i < 5; ++i) { p = h(i, i*2); } appendToActual(p.callee); appendToActual(p.length); appendToActual(p[0]); appendToActual(p[1]); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args11.js0000644000175000017500000000030711545150464022640 0ustar chr1schr1sactual = ''; expected = 'true,true,true,true,true,'; function h() { var a = arguments; for (var i = 0; i < 5; ++i) { appendToActual(a == arguments); } } h(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args2.js0000644000175000017500000000034011545150464022555 0ustar chr1schr1sactual = ''; expected = '151,'; var g = 0; function add(a, b) { g = a + b; } function f() { add.apply(this, arguments); } for (var i = 0; i < 5; ++i) { f(100, 51); } appendToActual(g); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args2a.js0000644000175000017500000000030211545150464022714 0ustar chr1schr1sactual = ''; expected = 'g,g,g,g,g,'; function g() { appendToActual('g'); } function f() { g.apply(this, arguments); } for (var i = 0; i < 5; ++i) { f(); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args2b.js0000644000175000017500000000032311545150464022720 0ustar chr1schr1sactual = ''; expected = 'g 0,g 1,g 2,g 3,g 4,'; function g(x) { appendToActual('g ' + x); } function f() { g.apply(this, arguments); } for (var i = 0; i < 5; ++i) { f(i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args2c.js0000644000175000017500000000046511545150464022730 0ustar chr1schr1sactual = ''; expected = 'g 0 0,g 1 2,g 2 4,g 3 6,g 4 8,'; function g(x, y) { appendToActual('g ' + x + ' ' + y); //appendToActual('g ' + x + ' ' + y); //appendToActual('g ' + y); } function f() { g.apply(this, arguments); } for (var i = 0; i < 5; ++i) { f(i, i*2); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args2d.js0000644000175000017500000000041411545150464022723 0ustar chr1schr1sactual = ''; expected = 'g 0 0 0,g 1 2 1,g 2 4 4,g 3 6 9,g 4 8 16,'; function g(x, y, z) { appendToActual('g ' + x + ' ' + y + ' ' + z); } function f() { g.apply(this, arguments); } for (var i = 0; i < 5; ++i) { f(i, i*2, i*i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args3.js0000644000175000017500000000033111545150464022556 0ustar chr1schr1sactual = ''; expected = '51,'; var g = 0; function add(a, b) { g = a + b; } function f() { g = arguments[1]; } for (var i = 0; i < 10000; ++i) { f(100, 51); } appendToActual(g); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args4.js0000644000175000017500000000032611545150464022563 0ustar chr1schr1sactual = ''; expected = '51,'; var g = 0; function h(args) { g = args[1]; } function f() { h(arguments); } for (var i = 0; i < 10000; ++i) { f(100, 51); } appendToActual(g); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args5.js0000644000175000017500000000044011545150464022561 0ustar chr1schr1sactual = ''; expected = '150,'; var g = 0; function h(args) { var ans = 0; for (var i = 0; i < 5; ++i) { ans += args[i]; } g = ans; } function f() { h(arguments); } for (var i = 0; i < 5; ++i) { f(10, 20, 30, 40, 50); } appendToActual(g); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args6.js0000644000175000017500000000036611545150464022571 0ustar chr1schr1sactual = ''; expected = '6,'; // tracing length var g = 0; function h(args) { g = args.length; } function f() { h(arguments); } for (var i = 0; i < 5; ++i) { f(10, 20, 30, 40, 50, 60); } appendToActual(g); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args6a.js0000644000175000017500000000042211545150464022723 0ustar chr1schr1sactual = ''; expected = '5,'; // tracing length var g = 0; function h(args) { for (var i = 0; i < 6; ++i) g = args.length; } function f() { h(arguments); } for (var i = 0; i < 5; ++i) { f(10, 20, 30, 40, 50); } appendToActual(g); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args7.js0000644000175000017500000000033011545150464022561 0ustar chr1schr1sactual = ''; expected = '5,4,3,2,1,'; function f() { while (arguments.length > 0) { appendToActual(arguments[arguments.length-1]); arguments.length--; } } f(1, 2, 3, 4, 5); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args8.js0000644000175000017500000000041111545150464022562 0ustar chr1schr1sactual = ''; expected = '[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],'; function h() { return arguments; } for (var i = 0; i < 5; ++i) { var p = h(i, i*2); appendToActual(p); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/args9.js0000644000175000017500000000031511545150464022566 0ustar chr1schr1sactual = ''; expected = '10,20,'; function h() { var p; for (var i = 0; i < 5; ++i) { p = arguments; } appendToActual(p[0]); appendToActual(p[1]); } h(10, 20); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/argsub.js0000644000175000017500000000031311545150464023022 0ustar chr1schr1sactual = ''; expected = 'undefined,undefined,undefined,undefined,undefined,'; function h() { for (var i = 0; i < 5; ++i) { appendToActual(arguments[100]); } } h(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/argsx-1.js0000644000175000017500000001603711545150464023033 0ustar chr1schr1sactual = ''; expected = 'function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,1,2,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,1,2,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,1,2,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,1,2,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,1,2,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,1,2,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,1,2,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,1,2,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,1,2,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,1,2,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,[object Object],a,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,[object Object],a,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,[object Object],a,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,[object Object],a,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,[object Object],a,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,[object Object],a,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,[object Object],a,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,[object Object],a,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,[object Object],a,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,[object Object],a,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,abc,def,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,abc,def,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,abc,def,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,abc,def,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,abc,def,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,abc,def,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,abc,def,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,abc,def,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,abc,def,function f() {\n var a = arguments;\n for (var i = 0; i < 10; ++i) {\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},2,abc,def,'; // args object created by interpreter function f() { var a = arguments; for (var i = 0; i < 10; ++i) { appendToActual(a.callee); appendToActual(a.length); appendToActual(a[0]); appendToActual(a[1]); } } f(1, 2, 3); f({}, 'a'); f('abc', 'def'); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/argsx-2.js0000644000175000017500000001253711545150464023035 0ustar chr1schr1sactual = ''; expected = 'function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},3,1,2,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},3,1,2,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},3,1,2,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},3,1,2,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},3,1,2,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},3,1,2,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},3,1,2,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},3,1,2,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},3,1,2,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},3,1,2,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,[object Object],a,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,[object Object],a,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,[object Object],a,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,[object Object],a,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,[object Object],a,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,[object Object],a,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,[object Object],a,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,[object Object],a,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,[object Object],a,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,[object Object],a,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,abc,def,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,abc,def,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,abc,def,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,abc,def,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,abc,def,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,abc,def,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,abc,def,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,abc,def,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,abc,def,function f() {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n},2,abc,def,'; // args object created on trace function f() { var a = arguments; appendToActual(a.callee); appendToActual(a.length); appendToActual(a[0]); appendToActual(a[1]); } for (var i = 0; i < 10; ++i) f(1, 2, 3); for (var i = 0; i < 10; ++i) f({}, 'a'); for (var i = 0; i < 10; ++i) f('abc', 'def'); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/argsx-3.js0000644000175000017500000003147211545150464023035 0ustar chr1schr1sactual = ''; expected = 'true,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,false,abc,'; // args object created by interpreter at record time, but not always at run time. function f(t) { if (t) { var b = arguments; appendToActual(b[0]); } for (var i = 0; i < 10; ++i) { var a = arguments; appendToActual(a.callee); appendToActual(a.length); appendToActual(a[0]); appendToActual(a[1]); } } f(true, 1, 2, 3); f(false, 1, 2, 3); f(false, {}, 'a'); f(false, 'abc', 'def'); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/argsx-3a.js0000644000175000017500000003145411545150464023176 0ustar chr1schr1sactual = ''; expected = 'function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,false,1,true,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},4,true,1,true,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,[object Object],function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,[object Object],true,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,abc,function f(t) {\n if (t) {\n var b = arguments;\n appendToActual(b[0]);\n }\n for (var i = 0; i < 10; ++i) {\n var a = arguments;\n appendToActual(a.callee);\n appendToActual(a.length);\n appendToActual(a[0]);\n appendToActual(a[1]);\n }\n},3,true,abc,'; // args object not created by interpreter at record time, but maybe at run time function f(t) { if (t) { var b = arguments; appendToActual(b[0]); } for (var i = 0; i < 10; ++i) { var a = arguments; appendToActual(a.callee); appendToActual(a.length); appendToActual(a[0]); appendToActual(a[1]); } } f(false, 1, 2, 3); f(true, 1, 2, 3); f(true, {}, 'a'); f(true, 'abc', 'def'); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/argsx-4.js0000644000175000017500000000051411545150464023027 0ustar chr1schr1sactual = ''; expected = '[object Arguments] undefined undefined,[object Arguments] undefined undefined,'; function f() { g(arguments); } function g(a, b, c) { h(arguments); a = 1; b = 2; c = 3; h(arguments); } function h(a, b, c) { appendToActual(a + ' ' + b + ' ' + c); } f(4, 5, 6); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/bug503772.js0000644000175000017500000000037711545150464023016 0ustar chr1schr1sfunction f(a) { // Create arguments on trace var z = arguments; // Make f need a call object if (false) { var p = function() { ++a; } } } function g() { for (var i = 0; i < 5; ++i) { f(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); } } g(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/bug508178.js0000644000175000017500000000057011545150464023016 0ustar chr1schr1sactual = ''; expected = 'g,g,g,g,f,'; function test() { var testargs = arguments; var f = function (name, which) { var args = [testargs, arguments]; return args[which][0]; }; var arr = [0, 0, 0, 0, 1]; for (var i = 0; i < arr.length; i++) arr[i] = f("f", arr[i]); appendToActual(arr); } test('g'); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/bug554670-1.js0000644000175000017500000000016011545150464023145 0ustar chr1schr1sx = true; (function() { for each(let c in [0, x]) { (arguments)[4] *= c } })() // don't assert mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/bug554670-2.js0000644000175000017500000000015111545150464023146 0ustar chr1schr1svar c; (function() { for each(e in [0, 0]) { (arguments)[1] *= c } })() // don't assert mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/bug633020.js0000644000175000017500000000033011545150464022771 0ustar chr1schr1svar N = HOTLOOP + 2; function f(b) { var a = []; for (var i = 0; i < N; i++) a[i] = {}; a[N-1] = arguments; for (var i = 0; i < N; i++) a[i][0] = i; assertEq(b, N - 1); } f(null); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/nonstrict-args.js0000644000175000017500000000075511545150464024526 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function args(a) { return arguments; } var a1, a2, a3, a4; for (var i = 0; i < 5; i++) { a1 = args(); a2 = args(1); a3 = args(1, obj); a4 = args("foopy"); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [1]), true); assertEq(arraysEqual(a3, [1, obj]), true); assertEq(arraysEqual(a4, ["foopy"]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/nonstrict-assign-element-get-parameter.js0000644000175000017500000000041011545150464031224 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function assignElementGetParameter(a) { arguments[0] = 17; return a; } for (var i = 0; i < 5; i++) assertEq(assignElementGetParameter(42), 17); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/nonstrict-assign-parameter-get-element.js0000644000175000017500000000041011545150464031224 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function assignParameterGetElement(a) { a = 17; return arguments[0]; } for (var i = 0; i < 5; i++) assertEq(assignParameterGetElement(42), 17); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/nonstrict-assign.js0000644000175000017500000000045011545150464025046 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); function assign(a) { a = 17; return arguments; } var a1; for (var i = 0; i < 5; i++) a1 = assign(1); assertEq(arraysEqual(a1, [17]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/nonstrict-later-assign.js0000644000175000017500000000051111545150464026151 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); function getLaterAssign(a) { var o = arguments; a = 17; return o; } var a1, a2; for (var i = 0; i < 5; i++) a1 = getLaterAssign(1); assertEq(arraysEqual(a1, [17]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/nonstrict-noargs.js0000644000175000017500000000066311545150464025061 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function noargs() { return arguments; } var a1, a2, a3; for (var i = 0; i < 5; i++) { a1 = noargs(); a2 = noargs(1); a3 = noargs(2, obj, 8); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [1]), true); assertEq(arraysEqual(a3, [2, obj, 8]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-args-flushstack.js0000644000175000017500000000105011545150464026145 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var args; function test() { "use strict"; eval("args = arguments;"); var a = []; for (var i = 0; i < RUNLOOP; i++) a.push(arguments); return a; } var a = test(); assertEq(Array.isArray(a), true); assertEq(a.length, RUNLOOP); var count = 0; a.forEach(function(v, i) { count++; assertEq(v, args); }); assertEq(count, RUNLOOP); assertEq(Object.prototype.toString.call(args), "[object Arguments]"); assertEq(args.length, 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-args-generator-flushstack.js0000644000175000017500000000067211545150464030142 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var args; function upToTen() { "use strict"; eval("args = arguments;"); for (var i = 0; i < RUNLOOP; i++) yield i; } var gen = upToTen(); var i = 0; for (var v in gen) { assertEq(v, i); i++; } assertEq(i, RUNLOOP); assertEq(Object.prototype.toString.call(args), "[object Arguments]"); assertEq(args.length, 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-args.js0000644000175000017500000000073011545150464024004 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictArgs(a) { "use strict"; return arguments; } var a1, a2, a3; for (var i = 0; i < HOTLOOP+1; i++) { a1 = strictArgs(); a2 = strictArgs(1); a3 = strictArgs(1, obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [1]), true); assertEq(arraysEqual(a3, [1, obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-assign-after.js0000644000175000017500000000101611545150464025431 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; var upper; function strictAssignAfter(a) { "use strict"; upper = arguments; a = 42; return upper; } var a1, a2, a3; for (var i = 0; i < 5; i++) { a1 = strictAssignAfter(); a2 = strictAssignAfter(17); a3 = strictAssignAfter(obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [17]), true); assertEq(arraysEqual(a3, [obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-assign-arguments-element.js0000644000175000017500000000067711545150464030000 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictAssignArgumentsElement(a) { "use strict"; arguments[0] = 42; return a; } for (var i = 0; i < 5; i++) { assertEq(strictAssignArgumentsElement(), undefined); assertEq(strictAssignArgumentsElement(obj), obj); assertEq(strictAssignArgumentsElement(17), 17); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-assign-outer-param-psych.js0000644000175000017500000000107311545150464027713 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictAssignOuterParamPSYCH(p) { "use strict"; function inner(p) { p = 17; } inner(); return arguments; } var a1, a2, a3; for (var i = 0; i < 5; i++) { a1 = strictAssignOuterParamPSYCH(); a2 = strictAssignOuterParamPSYCH(17); a3 = strictAssignOuterParamPSYCH(obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [17]), true); assertEq(arraysEqual(a3, [obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-assign-outer-param.js0000644000175000017500000000104611545150464026567 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictAssignOuterParam(p) { "use strict"; function inner() { p = 17; } inner(); return arguments; } var a1, a2, a3; for (var i = 0; i < 5; i++) { a1 = strictAssignOuterParam(); a2 = strictAssignOuterParam(42); a3 = strictAssignOuterParam(obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [42]), true); assertEq(arraysEqual(a3, [obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-assign-parameter-get-element.js0000644000175000017500000000044411545150464030520 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function strictAssignParameterGetElement(a) { "use strict"; a = 17; return arguments[0]; } for (var i = 0; i < 5; i++) assertEq(strictAssignParameterGetElement(42), 42); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-assign.js0000644000175000017500000000074211545150464024337 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictAssign(a) { "use strict"; a = 17; return arguments; } var a1, a2, a3; for (var i = 0; i < 5; i++) { a1 = strictAssign(); a2 = strictAssign(1); a3 = strictAssign(1, obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [1]), true); assertEq(arraysEqual(a3, [1, obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-eval-mutation.js0000644000175000017500000000110211545150464025627 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictEvalMutation(code) { "use strict"; return eval(code); } var a1, a2; for (var i = 0; i < 5; i++) { a1 = strictEvalMutation("code = 17; arguments"); a2 = strictEvalMutation("arguments[0] = 17; arguments"); assertEq(strictEvalMutation("arguments[0] = 17; code"), "arguments[0] = 17; code"); } assertEq(arraysEqual(a1, ["code = 17; arguments"]), true); assertEq(arraysEqual(a2, [17]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-eval.js0000644000175000017500000000137111545150464024001 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); function strictEval(code, p) { "use strict"; eval(code); return arguments; } var a1, a2, a3, a4, a5, a6; for (var i = 0; i < 5; i++) { a1 = strictEval("1", 2); a2 = strictEval("arguments"); a3 = strictEval("p = 2"); a4 = strictEval("p = 2", 17); a5 = strictEval("arguments[0] = 17"); a6 = strictEval("arguments[0] = 17", 42); } assertEq(arraysEqual(a1, ["1", 2]), true); assertEq(arraysEqual(a2, ["arguments"]), true); assertEq(arraysEqual(a3, ["p = 2"]), true); assertEq(arraysEqual(a4, ["p = 2", 17]), true); assertEq(arraysEqual(a5, [17]), true); assertEq(arraysEqual(a6, [17, 42]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-maybe-assign-outer.js0000644000175000017500000000105711545150464026566 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictMaybeAssignOuterParam(p) { "use strict"; function inner() { p = 17; } return arguments; } var a1, a2, a3; for (var i = 0; i < 5; i++) { a1 = strictMaybeAssignOuterParam(); a2 = strictMaybeAssignOuterParam(17); a3 = strictMaybeAssignOuterParam(obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [17]), true); assertEq(arraysEqual(a3, [obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-maybe-nested-eval.js0000644000175000017500000000122711545150464026354 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); function strictMaybeNestedEval(code, p) { "use strict"; function inner() { eval(code); } return arguments; } var a1, a2, a3, a4; for (var i = 0; i < 5; i++) { a1 = strictMaybeNestedEval("1", 2); a2 = strictMaybeNestedEval("arguments"); a3 = strictMaybeNestedEval("p = 2"); a4 = strictMaybeNestedEval("p = 2", 17); } assertEq(arraysEqual(a1, ["1", 2]), true); assertEq(arraysEqual(a2, ["arguments"]), true); assertEq(arraysEqual(a3, ["p = 2"]), true); assertEq(arraysEqual(a4, ["p = 2", 17]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-nested-assign-shadow-function-call.js0000644000175000017500000000133111545150464031631 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictNestedAssignShadowFunctionCall(p) { "use strict"; function inner() { function p() { } p = 1776; } inner(); return arguments; } var a1, a2, a3, a4; for (var i = 0; i < 5; i++) { a1 = strictNestedAssignShadowFunctionCall(); a2 = strictNestedAssignShadowFunctionCall(99); a3 = strictNestedAssignShadowFunctionCall(""); a4 = strictNestedAssignShadowFunctionCall(obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [99]), true); assertEq(arraysEqual(a3, [""]), true); assertEq(arraysEqual(a4, [obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-nested-assign-shadow-function-name.js0000644000175000017500000000134211545150464031640 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictNestedAssignShadowFunctionName(p) { "use strict"; function inner() { function p() { p = 1776; } p(); } inner(); return arguments; } var a1, a2, a3, a4, a5; for (var i = 0; i < 5; i++) { a1 = strictNestedAssignShadowFunctionName(); a2 = strictNestedAssignShadowFunctionName(99); a3 = strictNestedAssignShadowFunctionName(""); a4 = strictNestedAssignShadowFunctionName(obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [99]), true); assertEq(arraysEqual(a3, [""]), true); assertEq(arraysEqual(a4, [obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-nested-assign-shadow-function.js0000644000175000017500000000127211545150464030724 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictNestedAssignShadowFunction(p) { "use strict"; function inner() { function p() { } p = 1776; } return arguments; } var a1, a2, a3, a4; for (var i = 0; i < 5; i++) { a1 = strictNestedAssignShadowFunction(); a2 = strictNestedAssignShadowFunction(99); a3 = strictNestedAssignShadowFunction(""); a4 = strictNestedAssignShadowFunction(obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [99]), true); assertEq(arraysEqual(a3, [""]), true); assertEq(arraysEqual(a4, [obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-nested-assign-shadowed-catch-call.js0000644000175000017500000000143511545150464031404 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictNestedAssignShadowCatchCall(p) { "use strict"; function inner() { try { } catch (p) { var f = function innermost() { p = 1776; return 12; }; f(); } } inner(); return arguments; } var a1, a2, a3, a4; for (var i = 0; i < 5; i++) { a1 = strictNestedAssignShadowCatchCall(); a2 = strictNestedAssignShadowCatchCall(99); a3 = strictNestedAssignShadowCatchCall(""); a4 = strictNestedAssignShadowCatchCall(obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [99]), true); assertEq(arraysEqual(a3, [""]), true); assertEq(arraysEqual(a4, [obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-nested-assign-shadowed-catch.js0000644000175000017500000000137711545150464030500 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictNestedAssignShadowCatch(p) { "use strict"; function inner() { try { } catch (p) { var f = function innermost() { p = 1776; return 12; }; f(); } } return arguments; } var a1, a2, a3, a4; for (var i = 0; i < 5; i++) { a1 = strictNestedAssignShadowCatch(); a2 = strictNestedAssignShadowCatch(99); a3 = strictNestedAssignShadowCatch(""); a4 = strictNestedAssignShadowCatch(obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [99]), true); assertEq(arraysEqual(a3, [""]), true); assertEq(arraysEqual(a4, [obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-nested-assign-shadowed-var.js0000644000175000017500000000127411545150464030202 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; /******************** * STRICT ARGUMENTS * ********************/ function strictNestedAssignShadowVar(p) { "use strict"; function inner() { var p = 12; function innermost() { p = 1776; return 12; } return innermost(); } return arguments; } assertEq(arraysEqual(strictNestedAssignShadowVar(), []), true); assertEq(arraysEqual(strictNestedAssignShadowVar(99), [99]), true); assertEq(arraysEqual(strictNestedAssignShadowVar(""), [""]), true); assertEq(arraysEqual(strictNestedAssignShadowVar(obj), [obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-nested-eval.js0000644000175000017500000000154511545150464025264 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); function strictNestedEval(code, p) { "use strict"; function inner() { eval(code); } inner(); return arguments; } var a1, a2, a3, a4, a5, a6; for (var i = 0; i < 5; i++) { a1 = strictNestedEval("1", 2); a2 = strictNestedEval("arguments"); a3 = strictNestedEval("p = 2"); a4 = strictNestedEval("p = 2", 17); a5 = strictNestedEval("arguments[0] = 17"); a6 = strictNestedEval("arguments[0] = 17", 42); } assertEq(arraysEqual(a1, ["1", 2]), true); assertEq(arraysEqual(a2, ["arguments"]), true); assertEq(arraysEqual(a3, ["p = 2"]), true); assertEq(arraysEqual(a4, ["p = 2", 17]), true); assertEq(arraysEqual(a5, ["arguments[0] = 17"]), true); assertEq(arraysEqual(a6, ["arguments[0] = 17", 42]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-nested-shadow-eval.js0000644000175000017500000000160511545150464026544 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); function strictNestedShadowEval(code, p) { "use strict"; function inner(p) { eval(code); } return arguments; } var a1, a2, a3, a4, a5, a6; for (var i = 0; i < 5; i++) { a1 = strictNestedShadowEval("1", 2); a2 = strictNestedShadowEval("arguments"); a3 = strictNestedShadowEval("p = 2"); a4 = strictNestedShadowEval("p = 2", 17); a5 = strictNestedShadowEval("arguments[0] = 17"); a6 = strictNestedShadowEval("arguments[0] = 17", 42); } assertEq(arraysEqual(a1, ["1", 2]), true); assertEq(arraysEqual(a2, ["arguments"]), true); assertEq(arraysEqual(a3, ["p = 2"]), true); assertEq(arraysEqual(a4, ["p = 2", 17]), true); assertEq(arraysEqual(a5, ["arguments[0] = 17"]), true); assertEq(arraysEqual(a6, ["arguments[0] = 17", 42]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-nested-shadow-maybe-eval.js0000644000175000017500000000165011545150464027637 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); function strictNestedShadowMaybeEval(code, p) { "use strict"; function inner(p) { eval(code); } return arguments; } var a1, a2, a3, a4, a5, a6; for (var i = 0; i < 5; i++) { a1 = strictNestedShadowMaybeEval("1", 2); a2 = strictNestedShadowMaybeEval("arguments"); a3 = strictNestedShadowMaybeEval("p = 2"); a4 = strictNestedShadowMaybeEval("p = 2", 17); a5 = strictNestedShadowMaybeEval("arguments[0] = 17"); a6 = strictNestedShadowMaybeEval("arguments[0] = 17", 42); } assertEq(arraysEqual(a1, ["1", 2]), true); assertEq(arraysEqual(a2, ["arguments"]), true); assertEq(arraysEqual(a3, ["p = 2"]), true); assertEq(arraysEqual(a4, ["p = 2", 17]), true); assertEq(arraysEqual(a5, ["arguments[0] = 17"]), true); assertEq(arraysEqual(a6, ["arguments[0] = 17", 42]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/strict-noargs.js0000644000175000017500000000072711545150464024347 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ load(libdir + 'array-compare.js'); var obj = {}; function strictNoargs() { "use strict"; return arguments; } var a1, a2, a3; for (var i = 0; i < 5; i++) { a1 = strictNoargs(); a2 = strictNoargs(1); a3 = strictNoargs(1, obj); } assertEq(arraysEqual(a1, []), true); assertEq(arraysEqual(a2, [1]), true); assertEq(arraysEqual(a3, [1, obj]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/testDelArg1.js0000644000175000017500000000036211545150464023662 0ustar chr1schr1sfunction f(x,y,z) { z = 9; delete arguments[2]; assertEq(arguments[2], undefined); o = arguments; assertEq(o[2], undefined); assertEq(o[2] == undefined, true); } for (var i = 0; i < HOTLOOP+2; ++i) { print(i); f(1,2,3) } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/arguments/testDelArg2.js0000644000175000017500000000037011545150464023662 0ustar chr1schr1sfunction f(del) { o = arguments; if (del) delete o[2]; for (var i = 0; i < HOTLOOP+2; ++i) assertEq(o[2] == undefined, del); } // record without arg deleted f(false, 1,2,3,4); // run with arg deleted f(true, 1,2,3,4); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug465902.js0000644000175000017500000000035611545150464022071 0ustar chr1schr1svar a = []; for (let j = 0; j < 6; ++j) { e = 3; for each (let c in [10, 20, 30]) { a.push(e); e = c; } } for (let j = 0; j < 6; ++j) { assertEq(a[j*3 + 0], 3); assertEq(a[j*3 + 1], 10); assertEq(a[j*3 + 2], 20); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug489098.js0000644000175000017500000000036011545150464022100 0ustar chr1schr1s// Check that the loop is trace-compiled even though it's run in an eval. code = "\ j = 0;\ for (i = 0; i < 10; i++)\ {\ j += 5;\ }\ "; eval(code); print (j); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug504587-1.js0000644000175000017500000000065411545150464022233 0ustar chr1schr1s// This test case failed a WIP patch. See https://bugzilla.mozilla.org/show_bug.cgi?id=504587#c68 function B() {} B.prototype.x = 1; var d = new B; var names = ['z', 'z', 'z', 'z', 'z', 'z', 'z', 'x']; for (var i = 0; i < names.length; i++) { x = d.x; // guard on shapeOf(d) d[names[i]] = 2; // unpredicted shape change y = d.x; // guard here is elided } assertEq(y, 2); // Assertion failed: got 1, expected 2 mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug507180.js0000644000175000017500000000323511545150464022063 0ustar chr1schr1svar o = { valueOf : function() { return { toString : function() { return "fail" } } }, toString : function() { return "good" } }; var p = { valueOf : function() { return { toString : function() { return "0" } } }, toString : function() { return "7" } }; var q = { toString : function() { return { valueOf : function() { return "0" } } }, valueOf : function() { return "7" } }; function assert(b, s) { if (b) return; assertEq("imacro produces incorrect result for " + s, "fail"); } function run() { for (var i = 0; i < 5; ++i) { // equality / inequality assert(!(o == "fail"), "obj == any"); assert(!("fail" == o), "any == obj"); assert(!(o != "good"), "obj != any"); assert(!("good" != o), "any != obj"); // binary assert(!((p | 3) != 7), "obj | any"); assert(!((3 | p) != 7), "any | obj"); assert(!((p | p) != 7), "obj | obj"); assert(!((p & 3) != 3), "obj & any"); assert(!((3 & p) != 3), "any & obj"); assert(!((p & p) != 7), "obj & obj"); assert(!((p * 3) != 21), "obj * any"); assert(!((3 * p) != 21), "any * obj"); assert(!((p * p) != 49), "obj * obj"); // addition assert(!(o + "" != "good"), "obj + any"); assert(!("" + o != "good"), "any + obj"); assert(!(o + o != "goodgood"), "any + any"); // sign assert(!(-p != -7), "-obj"); assert(!(+p != 7), "+obj"); // String assert(!(String(q) != "7"), "String(obj)"); assert(!(new String(q) != "7"), "new String(obj)"); } return true; } run(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug509639.js0000644000175000017500000000011111545150464022064 0ustar chr1schr1s// don't crash (function(){ var c; eval("for(c in [1,2,3,4]) {}") })(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug509982.js0000644000175000017500000000031511545150464022073 0ustar chr1schr1sfunction g() { const e = 0; return function () { switch (7) { case e: } }; } for (var i = 0; i < 2; i++) { let f = g; f(); } // Just test that we don't crash. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug510434.js0000644000175000017500000000012711545150464022054 0ustar chr1schr1svar f = function(){ var arguments = 3; for (var j=0;j<4;++j) print(arguments); }; f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug510437-2.js0000644000175000017500000000026211545150464022216 0ustar chr1schr1sfunction f() { eval("g=function() { \ for (let x=0; x < 2; ++x) { \ d=x \ } \ }") g(); eval("var d") g(); } f(); assertEq(d, 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug510437.js0000644000175000017500000000027211545150464022060 0ustar chr1schr1s// Don't crash or assert. this.watch("d", eval); (function () { (eval("\ (function () {\ for (let x = 0; x < 2; ++x) {\ d = x\ }\ })\ "))() })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug510642.js0000644000175000017500000000037111545150464022056 0ustar chr1schr1s// Don't crash or assert. (function () { var x; (eval("\ (function () {\ for (y in [0, 0]) let(a)((function () {\ for (w in [0, 0])\ x = 0\ })());\ with({}) {}\ })\ "))() })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug510655.js0000644000175000017500000000047411545150464022066 0ustar chr1schr1s// This should not crash (or assert in debug builds). (function () { for (b in [0, 0]) { (eval("\ [this\ for (b in [\ [undefined],\ arguments,\ [undefined]\ ])\ ]\ ")) } })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug511214.js0000644000175000017500000000044311545150464022052 0ustar chr1schr1seval(1); // avoid global shape change when we call eval below function q() { var x = 1; function f() { function g() { var t=0; for (var i=0; i<3; i++) x = i; }; g(); eval("var x = 3"); g(); assertEq(x, 2); } f(); assertEq(x, 2); } q(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug511241.js0000644000175000017500000000041511545150464022051 0ustar chr1schr1svar d = 1; function heavy(x) { eval(x); return function lite() { var s = 0; for (var i = 0; i < 9; i++) s += d; return s; }; } var f1 = heavy("1"); var f2 = heavy("var d = 100;"); assertEq(f1(), 9); assertEq(f2(), 900); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug513038.js0000644000175000017500000000040011545150464022051 0ustar chr1schr1s// Just don't assert or crash. function f() { let c try { (eval("\ (function(){\ with(\ this.__defineGetter__(\"x\", function(){for(a = 0; a < 3; a++){c=a}})\ ){}\ })\ "))() } catch(e) {} } f() print(x) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug513898-regexp.js0000644000175000017500000000301011545150464023357 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: haytjes */ /* Check the undefined pattern is equivalent to empty string. */ assertEq(RegExp(undefined).source, ''); assertEq(RegExp(undefined).global, false); assertEq("test".replace(RegExp(undefined), "*"), '*test'); assertEq(new RegExp(undefined).source, ''); assertEq(new RegExp(undefined).global, false); assertEq('test'.replace(new RegExp(undefined), "*"), '*test'); /* Global flags. */ assertEq(new RegExp(undefined, "g").global, true); assertEq("test".replace(new RegExp(undefined, "g"), "*"), "*t*e*s*t*"); assertEq(RegExp(undefined, "g").global, true); assertEq("test".replace(RegExp(undefined, "g"), "*"), "*t*e*s*t*"); /* Undefined flags. */ var re = new RegExp(undefined, undefined); assertEq(re.multiline, false); assertEq(re.global, false); assertEq(re.ignoreCase, false); var re = new RegExp("test", undefined); assertEq(re.multiline, false); assertEq(re.global, false); assertEq(re.ignoreCase, false); /* Flags argument that requires toString. */ function Flags() {}; Flags.prototype.toString = function dogToString() { return ""; } var re = new RegExp(undefined, new Flags()); assertEq(re.multiline, false); assertEq(re.global, false); assertEq(re.ignoreCase, false); Flags.prototype.toString = function dogToString() { return "gim"; } var re = new RegExp(undefined, new Flags()); assertEq(re.multiline, true); assertEq(re.global, true); assertEq(re.ignoreCase, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug516009.js0000644000175000017500000000051211545150464022056 0ustar chr1schr1svar gFutureCalls = []; function add_future_call(index, func) { if (!(index in gFutureCalls)) { gFutureCalls[index] = []; } } function check_reset_test(time) { } check_reset_test(0); for (var i = 1; i <= 8; ++i) { (function(j) { add_future_call(j, function() { check_reset_test(j); }); })(i); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug517721.js0000644000175000017500000000016611545150464022065 0ustar chr1schr1stry { for (var j = 0; j < 2; ++j) { if (j == 1) { ++(null[2]); } } } catch(e) { } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug519129.js0000644000175000017500000000005511545150464022066 0ustar chr1schr1s(function(){eval("for(l in[0,0,0]){}",0)})() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug520498.js0000644000175000017500000000021611545150464022066 0ustar chr1schr1svar Q = 0; try { (function f(i) { Q = i; if (i == 100000) return; f(i+1); })(1) } catch (e) { } if (Q == 100000) assertEq(Q, "fail"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug522136.js0000644000175000017500000000033611545150464022060 0ustar chr1schr1svar Q = 0; try { (function f(i) { Q = i; if (i == 100000) return; f(i+1); })(1) } catch (e) { } // Exact behavior of recursion check depends on which JIT we use. var ok = (Q == 3000 || Q == 3001); assertEq(ok, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug522817.js0000644000175000017500000000071011545150464022062 0ustar chr1schr1s// This test should not assert in a debug build. var q1={}; var $native = function () { for (var i = 0, l = arguments.length; i < l; i++) { arguments[i].extend = function (props) {}; } }; $native(q1, Array, String, Number); Array.extend({}); Number.extend({}); Object.Native = function () { for (var i = 0; i < arguments.length; i++) { arguments[i].eeeeee = (function(){}); } }; new Object.Native(q1, Array, String, Number); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug524826-2.js0000644000175000017500000000034511545150464022227 0ustar chr1schr1svar x = 42; function f() { var a = [{}, {}, {}, {}, {}]; for (var i = 0; i < 5; i++) a[i].m = function () {return x}; for (i = 0; i < 4; i++) if (a[i].m == a[i+1].m) throw "FAIL!"; } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug524826.js0000644000175000017500000000040211545150464022062 0ustar chr1schr1svar x = 42; function f() { var a = [new Date, new Date, new Date, new Date, new Date]; for (var i = 0; i < 5; i++) a[i].m = function () {return x}; for (i = 0; i < 4; i++) if (a[i].m == a[i+1].m) throw "FAIL!"; } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug525028.js0000644000175000017500000000044011545150464022057 0ustar chr1schr1s// don't crash function f() { var _L1 = arguments; for (var i = 0; i < _L1.length; i++) { if (typeof _L1[i] == "string") _L1[i] = new Object(); } print(arguments[2]); } f(1, 2, "3", 4, 5); f(1, 2, "3", 4, 5); f(1, 2, "3", 4, 5); f(1, 2, "3", 4, 5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug527288.js0000644000175000017500000000017111545150464022072 0ustar chr1schr1s(function () { for (a = 0; a < 3; a++) { for each(b in [0, -0]) {} } })() // Just test we don't assert. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug528116.js0000644000175000017500000000027111545150464022062 0ustar chr1schr1s(function() { var x = [null, [], null]; for (var i = 0; i != x.length; ++i) { eval("for (var b = 0; b < 2; ++b);", x[i]); } })(); // Just test that we don't crash. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug528644.js0000644000175000017500000000033711545150464022073 0ustar chr1schr1s// Don't crash function g(foo) { for (a in foo) { } } var makegen = eval("\n\ (function(b) {\n\ var h = \n\ eval(\"new function() { yield print(b) }\" ); \n\ return h\n\ })\n\ "); g(makegen()); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug529130.js0000644000175000017500000000035411545150464022061 0ustar chr1schr1s// don't crash var q = 30; function var_iter(v) { q--; yield v; if (q > 0) { for each (let ret in var_iter(v)) { var_iter(v); yield ret; } } } for (x in var_iter([1, 2, 3, 4, 5, 6, 7, 8, 9])) print(x); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug532568-2.js0000644000175000017500000000044611545150464022233 0ustar chr1schr1svar before = ''; var after = ''; function g(b) { for (var i = 0; i < 10; ++i) { } } function f(xa_arg) { var xa = xa_arg; for (var i = 0; i < 5; ++i) { var j = i + xa[i]; before += j + ','; g(); after += j + ','; } } f([ 0, 1, 2, 3, 4 ]); assertEq(before, after); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug532568.js0000644000175000017500000000043711545150464022074 0ustar chr1schr1svar actual = ""; function f() { var x = 10; var g = function(p) { for (var i = 0; i < 10; ++i) x = p + i; } for (var i = 0; i < 10; ++i) { g(100 * i + x); actual += x + ','; } } f(); assertEq(actual, "19,128,337,646,1055,1564,2173,2882,3691,4600,"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug532823.js0000644000175000017500000000045411545150464022065 0ustar chr1schr1sfunction loop(f) { var p; for (var i = 0; i < 10; ++i) { p = f(); } return p; } function f(j, k) { var g = function() { return k; } var ans = ''; for (k = 0; k < 5; ++k) { ans += loop(g); } return ans; } var t0 = new Date; var actual = f(1); assertEq(actual, '01234'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug535474.js0000644000175000017500000000106011545150464022064 0ustar chr1schr1sfunction f() { var _76 = {}; for (var i = 0; i < arguments.length; i++) { var typ = arguments[i]; _76[typ] = typ; } return function () { for (var i = 0; i < arguments.length; i++) { if (!(typeof (arguments[i]) in _76)) { return false; } } return true; } } g = f("number", "boolean", "object"); g("a", "b", "c", "d", "e", "f", 2); g(2, "a", "b", "c", "d", "e", "f", 2); /* * Don't assert -- * Assertion failed: frame entry -4 wasn't freed * : _activation.entry[i] == 0 (../nanojit/Assembler.cpp:786) */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug535760.js0000644000175000017500000000035711545150464022072 0ustar chr1schr1s/* vim: set ts=4 sw=4 tw=99 et: */ function foundit(items, n) { for (var i = 0; i < 10; i++) arguments[2](items, this); } function dostuff() { print(this); } foundit('crab', 'crab', dostuff); /* Don't crash or assert */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug535930.js0000644000175000017500000000054111545150464022064 0ustar chr1schr1s(function () { p = function () { Set() }; var Set = function () {}; for (var x = 0; x < 5; x++) { Set = function (z) { return function () { [z] } } (x) } })() /* * bug 535930, mistakenly generated code to GetUpvar and crashed inside the call. * so don't crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug536445.js0000644000175000017500000000034411545150464022067 0ustar chr1schr1svar x; var str = "a"; assertEq(str.charCodeAt(Infinity) | 0, 0); for (var i = 0; i < 10; ++i) x = str.charCodeAt(Infinity) | 0; assertEq(x, 0); for (var i = 0; i < 10; ++i) x = str.charCodeAt(Infinity); assertEq(x | 0, 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug536748.js0000644000175000017500000000015311545150464022073 0ustar chr1schr1s// Do not assert. var s = "a"; var b = 32767; for (var i = 0; i < 10; ++i) { b = b & s.charCodeAt(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug539379.js0000644000175000017500000000027311545150464022101 0ustar chr1schr1stry { // On X64 this was crashing rather than causing a "too much recursion" exception. x = /x/; (function f() { x.r = x; return f() })(); } catch (e) {} mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug539553-2.js0000644000175000017500000000020511545150464022225 0ustar chr1schr1sfunction f() { var x = arguments; arguments.length = {}; for (var i = 0; i < 9; i++) x.length.toSource(); } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug539553-3.js0000644000175000017500000000025011545150464022226 0ustar chr1schr1sfunction g(x) { assertEq(arguments.length, 1); assertEq(x.length, 4); } function f() { for (var i = 0; i < 9; i++) g(arguments); } f(1, 2, 3, 4); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug539553.js0000644000175000017500000000022511545150464022070 0ustar chr1schr1sfunction g(x) { assertEq(x.length, 1); } function f() { arguments.length = 1; for (var i = 0; i < 9; i++) g(arguments); } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug541191-1.js0000644000175000017500000000063711545150464022224 0ustar chr1schr1s/* vim: set ts=4 sw=4 tw=99 et: */ function g(a, b, c, d) { return "" + a + b + c + d; } var x = 1; function f(a, b, c) { arguments[1] = 2; arguments[2] = 3; arguments[3] = 4; if (!x) arguments.length = 4; var k; for (var i = 0; i < 10; i++) k = g.apply(this, arguments); return k; } assertEq(f(1), "1undefinedundefinedundefined"); x = 0; assertEq(f(1), "1234"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug541191-2.js0000644000175000017500000000064311545150464022222 0ustar chr1schr1s/* vim: set ts=4 sw=4 tw=99 et: */ function g(a, b, c, d) { return "" + a + b + c + d; } var x = 1; function f(a, b, c) { arguments[1] = 2; arguments[2] = 3; arguments[3] = 4; if (x) arguments.length = 4; var k; for (var i = 0; i < RUNLOOP; i++) k = g.apply(this, arguments); return k; } assertEq(f(1), "1234"); x = 0; assertEq(f(1), "1undefinedundefinedundefined"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug541191-3.js0000644000175000017500000000066611545150464022230 0ustar chr1schr1s/* vim: set ts=4 sw=4 tw=99 et: */ function g(a, b, c, d) { return "" + a + b + c + d; } var x = 1; function f(a, b, c) { arguments[1] = 2; arguments[2] = 3; arguments[3] = 4; if (x) arguments.length = 1; var k; for (var i = 0; i < 10; i++) k = g.apply(this, arguments); return k; } assertEq(f(1), "1undefinedundefinedundefined"); x = 0; assertEq(f(1), "1undefinedundefinedundefined"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug541191-4.js0000644000175000017500000000106111545150464022217 0ustar chr1schr1s/* vim: set ts=4 sw=4 tw=99 et: */ function g(a, b, c, d) { return "" + a + b + c + d; } var x = 1; function f(a, b, c) { arguments[1] = 2; arguments[2] = 3; arguments[3] = 4; if (x) { arguments.length = 1; delete arguments.length; arguments.__defineGetter__('length', function () { return eval('1'); }); } var k; for (var i = 0; i < 10; i++) k = g.apply(this, arguments); return k; } assertEq(f(1), "1undefinedundefinedundefined"); x = 0; assertEq(f(1), "1undefinedundefinedundefined"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug541191-5.js0000644000175000017500000000066711545150464022233 0ustar chr1schr1s/* vim: set ts=4 sw=4 tw=99 et: */ function g(a, b, c, d) { return "" + a + b + c + d; } var x = 1; function f(a, b, c) { arguments[1] = 2; arguments[2] = 3; arguments[3] = 4; if (x) arguments.length = 1; var k; for (var i = 0; i < 10; i++) k = g.apply(this, arguments); return k; } assertEq(f(1), "1undefinedundefinedundefined"); x = 0; assertEq(f(1), "1undefinedundefinedundefined"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug547911-1.js0000644000175000017500000000025111545150464022222 0ustar chr1schr1sa = b = c = d = 0; this.__defineGetter__("e", function () { throw StopIteration; }) try { for each(f in this) {} } catch (exc) { assertEq(exc, StopIteration); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug547911-2.js0000644000175000017500000000024511545150464022226 0ustar chr1schr1svar obj = {a: 0, b: 0, c: 0, d: 0, get e() { throw StopIteration; }}; try { for each (x in obj) {} FAIL; } catch (exc) { assertEq(exc, StopIteration); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug551705.js0000644000175000017500000000105611545150464022064 0ustar chr1schr1s(Function("\ for each(let x in [\n\ true,\n\ (1),\n\ (1),\n\ (1),\n\ (1),\n\ true,\n\ true,\n\ true,\n\ (1),\n\ true,\n\ true,\n\ (1),\n\ true,\n\ true,\n\ (1),\n\ (1),\n\ true,\n\ true,\n\ true,\n\ true\n\ ]) { \n\ ((function f(aaaaaa) {\n\ return aaaaaa.length == 0 ? 0 : aaaaaa[0] + f(aaaaaa.slice(1))\n\ })([\n\ x,\n\ Math.I,\n\ '',\n\ null,\n\ Math.I,\n\ null,\n\ new String(),\n\ new String()\n\ ]))\n\ }"))() /* Don't assert/crash. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug552196.js0000644000175000017500000000023411545150464022066 0ustar chr1schr1s(Function("\ for (a = 0; a < 5; a++)\n\ (function f(b) {\n\ if (b > 0) {\n\ f(b - 1)\n\ }\n\ })\n\ (3)\n\ "))() /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug557168-1.js0000644000175000017500000000023711545150464022233 0ustar chr1schr1sx = try { Function("\ (function f() {\ ({x:{b}}=x);\ f()\ })()\ ")() } catch (e) { assertEq(e.message, "too much recursion"); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug557168-2.js0000644000175000017500000000023311545150464022230 0ustar chr1schr1sx = try { Function("\ (function f() {\ ({x}=x);\ f()\ })()\ ")() } catch (e) { assertEq(e.message, "too much recursion"); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug557168-3.js0000644000175000017500000000023511545150464022233 0ustar chr1schr1sx = try { Function("\ for(var a = 0; a < 6; a++) {\ Number(x.u)\ }\ ")() } catch (e) { assertEq(e.message, "too much recursion"); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug557168.js0000644000175000017500000000007011545150464022070 0ustar chr1schr1sx = for (var z = 0; z < 4; z++) { print(x.z) } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug557841.js0000644000175000017500000000005311545150464022067 0ustar chr1schr1seval("for(a = 0; a < 4; a++) x = 1;", []); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug558530.js0000644000175000017500000000032611545150464022066 0ustar chr1schr1s// There's no assertEq() here; the test is just that it doesn't crash. (function () { new function () {} }()); [function () {}] gc() for (z = 0; z < 6; ++z) { x = [] } for (w in [0]) { x._ = w } gc() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug558814.js0000644000175000017500000000031311545150464022067 0ustar chr1schr1sfunction f() { var a = []; a.length = 10; for (var i = 0; i < 100; i++) { var y = a[a.length]; } } f(); // No assertEq() call, the test is just that it shouldn't assert or crash. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug559912.js0000644000175000017500000000036011545150464022071 0ustar chr1schr1s function s(f) { this._m = f; } function C() { Object.defineProperty(this, "m", {set: s}); this.m = function () {}; } var last = {}; for (var i = 0; i < 20; i++) { var a = new C; assertEq(a._m === last._m, false); last = a; } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug560234.js0000644000175000017500000000043311545150464022057 0ustar chr1schr1sfunction test() { var a = ['x', '', '', '', '', '', '', 'x']; var b = ''; for (var i = 0; i < a.length; i++) { (function() { a[i].replace(/x/, function() { return b; }); }()); } } test(); // should NOT get a ReferenceError for b on trace mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug560234b.js0000644000175000017500000000032311545150464022217 0ustar chr1schr1sfunction f(a) { function g() { yield function () a; } if (a == 8) return g(); a = 3; } var x; for (var i = 0; i < 9; i++) x = f(i); x.next()(); // ReferenceError: a is not defined. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug561279.js0000644000175000017500000000010311545150464022063 0ustar chr1schr1s{ let y; eval('eval("for (z = 0; z < 6; z++) a = z;")'); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug563125.js0000644000175000017500000000015711545150464022064 0ustar chr1schr1svar array = new Array(4294967295); for (var j = 0; j < RUNLOOP; ++j) { '' + array.length; } // Don't assert. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug566637.js0000644000175000017500000000013011545150464022066 0ustar chr1schr1sfor (var j = 0; j < 9; j++) { var a = j; var b = this.a; } assertEq(b, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug568276.js0000644000175000017500000000010211545150464022066 0ustar chr1schr1sfunction outer(a) { var b, c, d, e, f, g, h, i; function a() {} } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug569651.js0000644000175000017500000000010611545150464022070 0ustar chr1schr1s// don't crash or assert +Function("switch(\"\"){case 1:case 8:}");mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug569843.js0000644000175000017500000000007211545150464022075 0ustar chr1schr1sx = ; for each(l in [0, 0, 0, 0]) { delete x.d; } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug569849.js0000644000175000017500000000021611545150464022103 0ustar chr1schr1sfunction g() { function f(a) { delete a.x; } for each(let w in [Infinity, String()]) { let i = f(w); } } g(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug570385-1.js0000644000175000017500000000017511545150464022230 0ustar chr1schr1svar actual = ''; var a = [0, 1]; for (var i in a) { appendToActual(i); a.pop(); } assertEq(actual, "0,"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug570385-2.js0000644000175000017500000000020111545150464022217 0ustar chr1schr1svar actual = ''; var a = [0, 1]; for (var i in a) { appendToActual(i); delete a[1]; } assertEq(actual, "0,"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug570385-3.js0000644000175000017500000000022511545150464022226 0ustar chr1schr1svar actual = ''; var a = [0, 1]; a.x = 10; delete a.x; for (var i in a) { appendToActual(i); a.pop(); } assertEq(actual, "0,"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug570663-1.js0000644000175000017500000000010111545150464022214 0ustar chr1schr1s// don't crash for (var a = 0; a < 4; a++) { switch (NaN) {} } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug570663-2.js0000644000175000017500000000020711545150464022224 0ustar chr1schr1sfunction f() { var x; for (var a = 0; a < 4; a++) { switch (NaN) { default: x = a; } } assertEq(x, 3); } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug572229.js0000644000175000017500000000030211545150464022061 0ustar chr1schr1s// Don't crash function f(o, s) { var k = s.substr(0, 1); var c; for (var i = 0; i < 10; ++i) { c = k in o; } return c; } assertEq(f({ a: 66 }, 'abc'), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug574280.js0000644000175000017500000000006211545150464022063 0ustar chr1schr1sfor (p = 0; p < 4; p++) { a = 0 new XMLList } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug576823-regexp.js0000644000175000017500000000011711545150464023361 0ustar chr1schr1s// Sticky should work across disjunctions. assertEq(/A|B/y.exec("CB"), null); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug576837-regexp.js0000644000175000017500000000322711545150464023373 0ustar chr1schr1s/* * Check that builtin character classes within ranges produce syntax * errors. * * Note that, per the extension in bug 351463, SpiderMonkey permits hyphens * adjacent to character class escapes in character classes, treating them as a * hyphen pattern character. Therefore /[\d-\s]/ is okay * * Note: /\b/ is the backspace escape, which is a single pattern character, * though it looks deceptively like a character class. */ function isRegExpSyntaxError(pattern) { try { var re = new RegExp(pattern); } catch (e) { if (e instanceof SyntaxError) return true; } return false; } assertEq(isRegExpSyntaxError('[C-\\s]'), true); assertEq(isRegExpSyntaxError('[C-\\d]'), true); assertEq(isRegExpSyntaxError('[C-\\W]'), true); assertEq(isRegExpSyntaxError('[C-]'), false); assertEq(isRegExpSyntaxError('[-C]'), false); assertEq(isRegExpSyntaxError('[C-C]'), false); assertEq(isRegExpSyntaxError('[C-C]'), false); assertEq(isRegExpSyntaxError('[\\b-\\b]'), false); assertEq(isRegExpSyntaxError('[\\B-\\B]'), false); assertEq(isRegExpSyntaxError('[\\b-\\B]'), false); assertEq(isRegExpSyntaxError('[\\B-\\b]'), true); assertEq(isRegExpSyntaxError('[\\b-\\w]'), true); assertEq(isRegExpSyntaxError('[\\B-\\w]'), true); /* Extension. */ assertEq(isRegExpSyntaxError('[\\s-\\s]'), false); assertEq(isRegExpSyntaxError('[\\W-\\s]'), false); assertEq(isRegExpSyntaxError('[\\s-\\W]'), false); assertEq(isRegExpSyntaxError('[\\W-C]'), false); assertEq(isRegExpSyntaxError('[\\d-C]'), false); assertEq(isRegExpSyntaxError('[\\s-C]'), false); assertEq(isRegExpSyntaxError('[\\w-\\b]'), false); assertEq(isRegExpSyntaxError('[\\w-\\B]'), false); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug578041.js0000644000175000017500000000007411545150464022065 0ustar chr1schr1sthis.__defineGetter__('x', Float32Array); with(this) x; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug579740.js0000644000175000017500000000011311545150464022066 0ustar chr1schr1s for (a = 0; a < 4; a++) { new Math.round(0).t } /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug582161.js0000644000175000017500000000017711545150464022067 0ustar chr1schr1s// |jit-test| error: RangeError; var vs = [1, 1, 1, 1, 3.5, 1]; for (var i = 0, sz = vs.length; i < sz; i++) new Array(vs[i]); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug582479.js0000644000175000017500000000007011545150464022073 0ustar chr1schr1sfor (b = 0; b < 2; b++) { / / (function(){}) } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug583615.js0000644000175000017500000000034011545150464022064 0ustar chr1schr1s// |jit-test| slow; try { x = x += /x / } catch (e) {} for each(a in [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) { x += x; } default xml namespace = x; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug583757.js0000644000175000017500000000054711545150464022104 0ustar chr1schr1svar arr = []; function f() {} function g(n, h) { var a = f; if (n <= 0) return f; var t = g(n - 1, h); var r = function(x) { if (x) return a; return a(h(function() { return t(); })); }; arr.push(r); return r; } g(80, f); g(80, f); g(80, f); for (var i = 0; i < arr.length; i++) assertEq(arr[i](1), f); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug584499-1.js0000644000175000017500000000014411545150464022237 0ustar chr1schr1s// |jit-test| error: TypeError var s = "12345"; for(var i=0; i<7; i++) { print(s[i].length); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug584499-2.js0000644000175000017500000000026111545150464022240 0ustar chr1schr1sfunction f(x) { var s = "a"; var last = ""; for (var i = 0; i < HOTLOOP + 2; i++) { last = s[x]; } return last; } f(0); assertEq(f(1), undefined); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug584565.js0000644000175000017500000000036711545150464022102 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ // Contributor: Luke Wagner var x, f; for (var i = 0; i < 100; i++) { f = function() {}; f.foo; x = f.length; } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug584603.js0000644000175000017500000000027011545150464022064 0ustar chr1schr1svar f = 99; function g(a) { if (a) { var e = 55; function f() { print("f"); } assertEq(f == 99, false); } } g(true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug585542.js0000644000175000017500000000021211545150464022063 0ustar chr1schr1sfunction f() { return 2; } function g(o) { with (o) { var f = function() { return 4; } } return f(); } assertEq(g({}), 4); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug586499-regexp.js0000644000175000017500000000005411545150464023373 0ustar chr1schr1s// Don't crash. var re = /^(?:\s*.){0,16}/; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug586917.js0000644000175000017500000014415111545150464022105 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* The tracer should properly parse JSOP_TABLESWITCHX instructions. */ var x = 1; for (i = 0; i < HOTLOOP; i++) { switch (x) { case 2: try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} try {} catch (e) {} } } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug587346-regexp-01.js0000644000175000017500000000002611545150464023600 0ustar chr1schr1svar re = /(?:){1,60}/ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug587366.js0000644000175000017500000000023011545150464022071 0ustar chr1schr1s// Test flat string replacement, per ECMAScriptv5 15.5.4.11. assertEq("1+2".replace("1+2", "$&+3"), "1+2+3"); assertEq(")".replace(")","*$&*"), "*)*"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug589318.js0000644000175000017500000000023511545150464022075 0ustar chr1schr1s// Use arguments in an eval. code = " \ function f(a) { var x = a; } \ for (var i = 0; i < 10; i++) { f(5); } \ "; eval(code); // Test it doesn't assert. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug590006.js0000644000175000017500000000035011545150464022055 0ustar chr1schr1sfunction f() { var ret; for (var i = 0; i < 10; ++i) { let (local = 3) { ret = function() { print(local++); } } } return ret; } f()(); // test.js:5: ReferenceError: local is not defined mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug592927.js0000644000175000017500000000067511545150464022105 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function f(x, y) { x(f); assertEq(y, "hello"); } function g(x) { assertEq(x.arguments[1], "hello"); x.arguments[1] = "bye"; assertEq(x.arguments[1], "hello"); } function f2(x, y) { arguments; x(f2); assertEq(y, "bye"); } function g2(x) { assertEq(x.arguments[1], "hello"); x.arguments[1] = "bye"; assertEq(x.arguments[1], "bye"); } f(g, "hello"); f2(g2, "hello"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug593663-regexp.js0000644000175000017500000000644111545150464023370 0ustar chr1schr1s/* * Ensure that flat matches with metachars in them don't have their metachars * interpreted as special. */ function isPatternSyntaxError(pattern) { try { new RegExp(pattern); return false; } catch (e if e instanceof SyntaxError) { return true; } } // Bug example. assertEq("1+2".replace("1+2", "$&+3", "g"), "1+2+3"); assertEq("1112".replace("1+2", "", "g"), "1112"); // ^ assertEq("leading text^my hat".replace("^my hat", "", "g"), "leading text"); assertEq("my hat".replace("^my hat", "", "g"), "my hat"); // $ assertEq("leading text$my money".replace("leading text$", "", "g"), "my money"); assertEq("leading text".replace("leading text$", "", "g"), "leading text"); // \ var BSL = '\\'; assertEq(("dir C:" + BSL + "Windoze").replace("C:" + BSL, "", "g"), "dir Windoze"); assertEq(isPatternSyntaxError("C:" + BSL), true); // . assertEq("This is a sentence. It has words.".replace(".", "!", "g"), "This is a sentence! It has words!"); assertEq("This is an unterminated sentence".replace(".", "", "g"), "This is an unterminated sentence"); // * assertEq("Video killed the radio *".replace(" *", "", "g"), "Video killed the radio"); assertEq("aaa".replace("a*", "", "g"), "aaa"); // + assertEq("On the + side".replace(" +", "", "g"), "On the side"); assertEq("1111111111111".replace("1+", "", "g"), "1111111111111"); // \+ assertEq(("Inverse cone head: " + BSL + "++/").replace(BSL + "+", "", "g"), "Inverse cone head: +/"); assertEq((BSL + BSL + BSL).replace(BSL + "+", "", "g"), BSL + BSL + BSL); // \\+ assertEq((BSL + BSL + "+").replace(BSL + BSL + "+", "", "g"), ""); assertEq((BSL + BSL + BSL).replace(BSL + BSL + "+", "", "g"), (BSL + BSL + BSL)); // \\\ assertEq((BSL + BSL + BSL + BSL).replace(BSL + BSL + BSL, "", "g"), BSL); assertEq(isPatternSyntaxError(BSL + BSL + BSL), true); // \\\\ assertEq((BSL + BSL + BSL + BSL).replace(BSL + BSL + BSL + BSL, "", "i"), ""); assertEq((BSL + BSL).replace(BSL + BSL + BSL + BSL, "", "g"), BSL + BSL); // ? assertEq("Pressing question?".replace("?", ".", "g"), "Pressing question."); assertEq("a".replace("a?", "", "g"), "a"); // ( assertEq("(a".replace("(", "", "g"), "a"); // ) assertEq("a)".replace(")", "", "g"), "a"); // ( and ) assertEq("(foo)".replace("(foo)", "", "g"), ""); assertEq("a".replace("(a)", "", "g"), "a"); // [ assertEq("[a".replace("[", "", "g"), "a"); // ] assertEq("a]".replace("]", "", "g"), "a"); // [ and ] assertEq("a".replace("[a-z]", "", "g"), "a"); assertEq("You would write your regexp as [a-z]".replace("[a-z]", "", "g"), "You would write your regexp as "); // { assertEq("Numbers may be specified in the interval {1,100}".replace("{1,", "", "g"), "Numbers may be specified in the interval 100}"); // } assertEq("Numbers may be specified in the interval {1,100}".replace(",100}", "", "g"), "Numbers may be specified in the interval {1"); // { and } assertEq("Numbers may be specified in the interval {1,100}".replace(" {1,100}", "", "g"), "Numbers may be specified in the interval"); assertEq("aaa".replace("a{1,10}", "", "g"), "aaa"); // | assertEq("Mr. Gorbachev|Tear down this wall!".replace("|Tear down this wall!", "", "g"), "Mr. Gorbachev"); assertEq("foobar".replace("foo|bar", "", "g"), "foobar"); print("PASS"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug594108.js0000644000175000017500000000025511545150464022070 0ustar chr1schr1svar res; for (var i = 0; i < 10; i++) { var re = /a(b)c/; var b = (re.exec(""), v = re.exec("abc")) !== null; assertEq(v[0], "abc"); assertEq(v[1], "b"); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug594205.js0000644000175000017500000000072611545150464022071 0ustar chr1schr1svar re = /a(b)c/; for (var i = 0; i < 10; i++) { // These two are of a form where we can convert exec() to test(). if (!re.exec("abc")) print("huh?"); re.exec("abc"); } RegExp.prototype.test = 1; for (var i = 0; i < 10; i++) { // These two are the same form, but we've replaced test(), so we must // not convert. if (!re.exec("abc")) print("huh?"); // don't crash/assert re.exec("abc"); // don't crash/assert } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug595963-1.js0000644000175000017500000000041511545150464022236 0ustar chr1schr1sfunction remove(k, L) { for (var i in k) { if (i == L) k.splice(L, 1); } } function f(k) { var L = 0; for (var i in k) { if (L == 1) remove(k, L); L++; assertEq(k[i], 3); } assertEq(L, 6); } var a = [3, 3, 3, 3, 3, 3, 3]; f(a); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug595963-2.js0000644000175000017500000000041511545150464022237 0ustar chr1schr1sfunction remove(k, L) { for (var i in k) { if (i == L) k.splice(L, 3); } } function f(k) { var L = 0; for (var i in k) { if (L == 1) remove(k, L); L++; assertEq(k[i], 3); } assertEq(L, 4); } var a = [3, 3, 3, 3, 3, 3, 3]; f(a); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug596502-version.js0000644000175000017500000000077311545150464023560 0ustar chr1schr1s/* All versions >= 1.6. */ function syntaxErrorFromXML() { try { var f = new Function('var text = .toString();'); return false; } catch (e if e instanceof SyntaxError) { return true; } } version(150); assertEq(syntaxErrorFromXML(), true); revertVersion(); for (vno in {160: null, 170: null, 180: null}) { print('Setting version to: ' + vno); version(vno); assertEq(syntaxErrorFromXML(), false); revertVersion(); } print('PASS!') mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug599854.js0000644000175000017500000000067311545150464022111 0ustar chr1schr1sload(libdir + 'eqArrayHelper.js'); assertEqArray(/(?:(?:(")(c)")?)*/.exec('"c"'), [ '"c"', '"', "c" ]); assertEqArray(/(?:(?:a*?(")(c)")?)*/.exec('"c"'), [ '"c"', '"', "c" ]); assertEqArray(/]*type=['"]?(?:dojo\/|text\/html\b))(?:[^>]*?(?:src=(['"]?)([^>]*?)\1[^>]*)?)*>([\s\S]*?)<\/script>/gi.exec(''), ['', '"', "...", ""]); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug601046.js0000644000175000017500000000052511545150464022056 0ustar chr1schr1s// don't assert var f = function(){}; for (var p in f); Object.defineProperty(f, "j", ({configurable: true, value: "a"})); Object.defineProperty(f, "k", ({configurable: true, value: "b"})); Object.defineProperty(f, "j", ({configurable: true, get: function() {}})); delete f.k; Object.defineProperty(f, "j", ({configurable: false})); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug601395.js0000644000175000017500000000007311545150464022063 0ustar chr1schr1s// |jit-test| error: SyntaxError; let(y = let(d = []) u, x mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug601398.js0000644000175000017500000000013611545150464022066 0ustar chr1schr1s(function () { try {} finally { let(z) { return; } } })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug601401.js0000644000175000017500000000011611545150464022045 0ustar chr1schr1slet(e) { with({}) try {} catch (x) {} finally { let(y) {} } } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug601402.js0000644000175000017500000000011611545150464022046 0ustar chr1schr1s// |jit-test| error: SyntaxError; for (let d in [(0)]) let(b = (let(e) {}), d mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug601428.js0000644000175000017500000000007611545150464022063 0ustar chr1schr1s// |jit-test| error: SyntaxError; let({}=[c for(x in[])]){let mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug602088.js0000644000175000017500000000023511545150464022063 0ustar chr1schr1s// |jit-test| error: TypeError /* vim: set ts=4 sw=4 tw=99 et: */ var p = Proxy.createFunction({}, function(x, y) { undefined.x(); }); print(new p(1, 2)); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug605015.js0000644000175000017500000000025311545150464022054 0ustar chr1schr1s// |jit-test| error: TypeError // don't assert print(this.watch("x", function() { Object.defineProperty(this, "x", ({ get: (Int8Array) })) }))(x = /x/) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug605754-regexp.js0000644000175000017500000000012111545150464023350 0ustar chr1schr1svar result = "foobarbaz".replace(/foo(bar)?bar/, "$1"); assertEq(result, "baz"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug606083.js0000644000175000017500000000044111545150464022061 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: function f(L) { do { L: for (var i = 0; i < L; i++) { break L; } } while (0); } f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); f(1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug606882-1.js0000644000175000017500000000010411545150464022222 0ustar chr1schr1s// don't crash "ABC".match("A+(?:X?(?:|(?:))(?:(?:B)?C+w?w?)?)*"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug606882-2.js0000644000175000017500000000063411545150464022233 0ustar chr1schr1s// don't crash var book = 'Ps'; var pattern = "(?:" + "(?:" + "(?:" + "(?:-|)" + "\\s?" + ")" + "|" + ")" + " ?" + "\\d+" + "\\w?" + ")*"; var re = new RegExp(pattern); '8:5-8'.match(re); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug608313.js0000644000175000017500000000023711545150464022062 0ustar chr1schr1s function testInt8Array(L) { var f = new Int8Array(8); f[0] = 0; // Don't assert. } for (var i = 0; i < 10; i++) { testInt8Array(0); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug608980.js0000644000175000017500000000014511545150464022072 0ustar chr1schr1s /* Don't trip bogus assert. */ function foo() { var x; while (x = 0) { x = 1; } } foo(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug609502-1.js0000644000175000017500000000022411545150464022215 0ustar chr1schr1sfor(var i = 0; i < RUNLOOP; i++) { x = ''.charCodeAt(NaN); } for(var i = 0; i < RUNLOOP; i++) { x = ''.charAt(NaN); } // Don't assert mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug609502-2.js0000644000175000017500000000012111545150464022212 0ustar chr1schr1sfor (var i = 0; i < RUNLOOP; i++) { Math.abs(-2147483648) } // Don't assert mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug609502-3.js0000644000175000017500000000025711545150464022225 0ustar chr1schr1s{ function a() {} } Math.floor(Math.d) function c() {} c() for each(let b in [0, 0, 0, 0, 0, 0, 0, -2147483648]) { print(Math.abs(b)) } // Don't assert mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug610592.js0000644000175000017500000000075311545150464022067 0ustar chr1schr1s /* Don't confuse JIT code by making slow arrays that use inline slots inconsistently. */ function foo(a) { assertEq(a.x, 5); } function bar() { for (var i = 0; i < 50; i++) { var a = []; a[i] = 0; delete a[i]; a.x = 5; foo(a); } var b = [1,,2,,3,,4,,5]; assertEq(b.toString(), "1,,2,,3,,4,,5"); b.x = 0; assertEq(b.toString(), "1,,2,,3,,4,,5"); delete b.x; delete b[8]; delete b[6]; delete b[4]; assertEq(b.toString(), "1,,2,,,,,,"); } bar(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug613122.js0000644000175000017500000000012011545150464022043 0ustar chr1schr1svar a = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]; a.push(1); a.splice(0); a.d = ""; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug620532.js0000644000175000017500000000054511545150464022061 0ustar chr1schr1sfor (var i = 0; i < 20; i++) { m = Math.min(0xffffffff, 0); } assertEq(m == 0, true); var buffer = new ArrayBuffer(4); var int32View = new Int32Array(buffer); var uint32View = new Uint32Array(buffer); int32View[0] = -1; var m; for (var i = 0; i < 20; i++) { m = Math.min(uint32View[0], 0); // uint32View[0] == 0xffffffff } assertEq(m == 0, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug620838.js0000644000175000017500000000046011545150464022066 0ustar chr1schr1sfunction g() { return "global"; } function q(fun) { return fun(); } function f(x) { if (x) { function g() { return "local"; } var ans = q(function() { return g(); }); } g = null; return ans; } assertEq(f(true), "local"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug621022-1.js0000644000175000017500000000034211545150464022205 0ustar chr1schr1sfunction f(x) { delete arguments[0]; undefined != arguments[0]; undefined == arguments[0]; undefined != arguments[0]; undefined === arguments[0]; } for(var i=0; i<20; i++) { f(1); } // Don't assert. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug621022-2.js0000644000175000017500000000035111545150464022206 0ustar chr1schr1sfunction f(j) { var a = [[1],[1],[1],[1],[1],[1],[1],[1],[1],arguments]; var b; for (var i = 0; i < a.length; i++) { delete a[i][0]; b = arguments[0]; } assertEq(b === undefined, true); } f(1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug623859.js0000644000175000017500000000115311545150464022074 0ustar chr1schr1s// |jit-test| allow-oom (function() { Iterator((function() { switch ((7)) { default: return (Float32Array).call([], 4300018) case Proxy.create((function() { return { e: function() {} } })): } })()) })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug623863.js0000644000175000017500000000037611545150464022075 0ustar chr1schr1s// Contributor: Christian Holler if (typeof gczeal === 'function') gczeal(2); Function.prototype.prototype = function() { return 42; }; try { foo(Function); } catch (e) { } Function.prototype.prototype = function() { return 42; }; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug624041-1.js0000644000175000017500000000014711545150464022214 0ustar chr1schr1svar count = 0; var a = [0, 1]; for (var i in a) { assertEq(++count <= 1, true); a.shift(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug624041-2.js0000644000175000017500000000022411545150464022211 0ustar chr1schr1svar s = ''; var a = [, 0, 1]; for (var i in a) { a.reverse(); s += i + ','; } // Index of the element with value '0'. assertEq(s, '1,'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug625141-1.js0000644000175000017500000000044311545150464022215 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function f() { var arr = new Int32Array(10); x = function () { return arr.length; } for (var i = 0; i < arr.length; i++) { arr[i] = i; } assertEq(arr[5], 5); } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug625141-2.js0000644000175000017500000000044211545150464022215 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function f() { var arr = new Int8Array(10); x = function () { return arr.length; } for (var i = 0; i < arr.length; i++) { arr[i] = i; } assertEq(arr[5], 5); } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug625399.js0000644000175000017500000000017611545150464022101 0ustar chr1schr1sfunction a(bb) { "use strict"; return; this.d = function() { bb; }; } for (var i = 0; i <= RUNLOOP; i++) a(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug627609.js0000644000175000017500000000013511545150464022070 0ustar chr1schr1sload(libdir + 'eqArrayHelper.js'); assertEqArray(/((a|)+b)+/.exec('bb'), [ "bb", "b", "" ]); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug627692-1.js0000644000175000017500000000067511545150464022241 0ustar chr1schr1svar loop1 = '', loop2 = '', actual = ''; var obj = {}; for (var i = 0; i < HOTLOOP + 2; i++) { obj['a' + i] = i; loop1 += i; loop2 += 'a' + i; } Object.defineProperty(obj, 'z', {enumerable: true, get: function () { for (var y in obj) actual += y; }}); (function() { for each (var e in obj) actual += e; })(); assertEq(actual, loop1 + loop2 + "z" + "undefined"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug627692-2.js0000644000175000017500000000060611545150464022234 0ustar chr1schr1sN = 0; function n() {} s = n; function f(foo) { gc(); try { (Function(foo))(); } catch(r) {} delete this.Math; } function g() {} var c; function y() {} t = b = eval; f("\ __defineGetter__(\"\",\ function(p){\ for(var s in this) {}\ }\ )[\"\"]\ "); f("\ do;\ while(([\ \"\" for each(z in this)\ ])&0)\ "); f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug630377.js0000644000175000017500000000030311545150464022061 0ustar chr1schr1svar a = []; for (var i = 0; i < RUNLOOP; i++) a[i] = 0; var b = #1=[x === "0" && (#1#.slow = 1) for (x in a)]; assertEq(b[0], 1); for (var i = 1; i < RUNLOOP; i++) assertEq(b[i], false); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug630865-1.js0000644000175000017500000000037611545150464022233 0ustar chr1schr1sObject.defineProperty(Function.prototype, "prototype", {set:function(){}}); var x; for (var i = 0; i < HOTLOOP + 2; i++) x = new Function.prototype; assertEq(toString.call(x), "[object Object]"); assertEq(Object.getPrototypeOf(x), Object.prototype); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug630865-2.js0000644000175000017500000000035511545150464022231 0ustar chr1schr1sFunction.prototype.prototype = function () {}; var x; for (var i = 0; i < HOTLOOP + 2; i++) x = new Function.prototype; assertEq(toString.call(x), "[object Object]"); assertEq(Object.getPrototypeOf(x), Function.prototype.prototype); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug630865-3.js0000644000175000017500000000047611545150464022236 0ustar chr1schr1svar a = []; function next() { var x = {}; a.push(x); return x; } Object.defineProperty(Function.prototype, 'prototype', {get: next}); var b = []; for (var i = 0; i < HOTLOOP + 2; i++) b[i] = new Function.prototype; for (var i = 0; i < HOTLOOP + 2; i++) assertEq(Object.getPrototypeOf(b[i]), a[i]); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug630865-4.js0000644000175000017500000000045211545150464022231 0ustar chr1schr1sObject.defineProperty(Function.prototype, 'prototype', {get: function () { if (i == HOTLOOP + 1) throw "X"; }}); var x; try { for (var i = 0; i < HOTLOOP + 2; i++) x = new Function.prototype; } catch (exc) { assertEq(i, HOTLOOP + 1); assertEq(exc, "X"); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug630865-5.js0000644000175000017500000000055011545150464022231 0ustar chr1schr1sfunction C(a, b) { this.a = a; this.b = b; } var f = C.bind(null, 2); Object.defineProperty(f, "prototype", {get: function () { throw "FAIL"; }}); var x; for (var i = 0; i < HOTLOOP + 2; i++) x = new f(i); assertEq(toString.call(x), "[object Object]"); assertEq(Object.getPrototypeOf(x), C.prototype); assertEq(x.a, 2); assertEq(x.b, HOTLOOP + 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug630865-6.js0000644000175000017500000000047611545150464022241 0ustar chr1schr1svar a = []; var x, i; for (i = 0; i < HOTLOOP + 10; i++) { a[i] = function (b) { this.b = b; }; if (i != HOTLOOP + 9) x = a[i].prototype; } for (i = 0; i < HOTLOOP + 10; i++) x = new a[i]; assertEq(toString.call(x), "[object Object]"); assertEq(Object.getPrototypeOf(x), a[HOTLOOP + 9].prototype); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug631082.js0000644000175000017500000000030511545150464022055 0ustar chr1schr1svar t; (function () { t = (function() { yield k(); })(); function h() { } function k() { return function() { h(); }; } })(); t.next(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug631219.js0000644000175000017500000000021711545150464022061 0ustar chr1schr1s// don't assert or crash function g(o) { o.__proto__ = arguments; o.length = 123; } function f() { g(arguments); } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug631305.js0000644000175000017500000000027011545150464022054 0ustar chr1schr1svar n = 0; var a = []; for (var i = 0; i < 20; i++) a[i] = {}; a[18].watch("p", function () { n++; }); delete a[18].p; for (var i = 0; i < 20; i++) a[i].p = 0; assertEq(n, 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug631788.js0000644000175000017500000000010411545150464022067 0ustar chr1schr1sfor (var j = 1; j < 10; ++j) { switch(0/j) { } } // don't assert mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug632206.js0000644000175000017500000000010411545150464022051 0ustar chr1schr1s// don't crash x = for (a = 0; a < 9; a++) { x.elements() } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug632901.js0000644000175000017500000000020711545150464022057 0ustar chr1schr1s// don't crash when tracing function f(o) { var prop = "arguments"; f[prop] = f[prop]; } for(var i=0; i<10; i++) { f(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug632964-regexp.js0000644000175000017500000000057611545150464023371 0ustar chr1schr1s// |jit-test| error: InternalError: regular expression too complex var sText = "s"; for (var i = 0; i < 250000; ++i) sText += 'a\n'; sText += 'e'; var start = new Date(); var match = sText.match(/s(\s|.)*?e/gi); //var match = sText.match(/s([\s\S]*?)e/gi); //var match = sText.match(/s(?:[\s\S]*?)e/gi); var end = new Date(); print(end - start); assertEq(match.length, 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug633409-1.js0000644000175000017500000000032511545150464022222 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: x = { a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }; for (i in x) delete x.d; x = { a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }; y = []; for (i in x) y.push(i) assertEq(y[3], "d"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug633409-2.js0000644000175000017500000000033311545150464022222 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: var o1 = {p1: 1}; var o2 = {p1: 1, p2: 2}; for(var x in o1) { for(var y in o2) { delete o2.p2; } } /* Don't fail cx->enumerators == obj assert, see bug comment #31 */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug633752.js0000644000175000017500000000017211545150464022065 0ustar chr1schr1sfunction f(o) { var p = "arguments"; for(var i=0; i<10; i++) { f[p]; } } f({}); f({}); f({}); f({}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug633890.js0000644000175000017500000000041711545150464022072 0ustar chr1schr1s// |jit-test| error:Error var p = /./, x = resolver({}, p), y = resolver({lastIndex: 2}, p), v; var a = []; for (var i = 0; i < HOTLOOP; i++) a[i] = x; a[HOTLOOP] = y; for (i = 0; i < a.length; i++) v = a[i].lastIndex; assertEq(v, 2); // fails due to bug 458271 mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug634593.js0000644000175000017500000000017611545150464022075 0ustar chr1schr1sthis.__defineGetter__("x3", Function); parseInt = x3; parseInt.prototype = []; for (var z = 0; z < 10; ++z) { new parseInt() }mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug635417.js0000644000175000017500000000005411545150464022064 0ustar chr1schr1sassertEq(/^@(A*)x(B)*/.test("@xB"), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/call.js0000644000175000017500000000074711545150464021541 0ustar chr1schr1sfunction glob_f1() { return 1; } function glob_f2() { return glob_f1(); } function call() { var q1 = 0, q2 = 0, q3 = 0, q4 = 0, q5 = 0; var o = {}; function f1() { return 1; } function f2(f) { return f(); } o.f = f1; for (var i = 0; i < 100; ++i) { q1 += f1(); q2 += f2(f1); q3 += glob_f1(); q4 += o.f(); q5 += glob_f2(); } var ret = String([q1, q2, q3, q4, q5]); return ret; } assertEq(call(), "100,100,100,100,100"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/call2.js0000644000175000017500000000027511545150464021617 0ustar chr1schr1sfunction g(x) { if ((x & 1) == 1) return 1; return 2; } function f(n) { var q = 0; for (var i = 0; i < n; i++) q += g(i); return q; } assertEq(f(1000), 1500); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/createMandelSet.js0000644000175000017500000001465111545150464023665 0ustar chr1schr1s// |jit-test| slow; // XXXbz I would dearly like to wrap it up into a function to avoid polluting // the global scope, but the function ends up heavyweight, and then we lose on // the jit. load(libdir + "mandelbrot-results.js"); //function testMandelbrotAll() { // Configuration options that affect which codepaths we follow. var doImageData = true; var avoidSparseArray = true; // Control of iteration numbers and sizing. We'll do // scaler * colorNames.length iterations or so before deciding that we // don't escape. const scaler = 5; const numRows = 600; const numCols = 600; const colorNames = [ "black", "green", "blue", "red", "purple", "orange", "cyan", "yellow", "magenta", "brown", "pink", "chartreuse", "darkorange", "crimson", "gray", "deeppink", "firebrick", "lavender", "lawngreen", "lightsalmon", "lime", "goldenrod" ]; const threshold = (colorNames.length - 1) * scaler; // Now set up our colors var colors = []; // 3-part for loop (iterators buggy, we will add a separate test for them) for (var colorNameIdx = 0; colorNameIdx < colorNames.length; ++colorNameIdx) { //for (var colorNameIdx in colorNames) { colorNameIdx = parseInt(colorNameIdx); colors.push([colorNameIdx, colorNameIdx, colorNameIdx, 0]); } // Storage for our point data var points; var scratch = {}; var scratchZ = {}; function complexMult(a, b) { var newr = a.r * b.r - a.i * b.i; var newi = a.r * b.i + a.i * b.r; scratch.r = newr; scratch.i = newi; return scratch; } function complexAdd(a, b) { scratch.r = a.r + b.r; scratch.i = a.i + b.i; return scratch; } function abs(a) { return Math.sqrt(a.r * a.r + a.i * a.i); } function escapeAbsDiff(normZ, absC) { var absZ = Math.sqrt(normZ); return normZ > absZ + absC; } function escapeNorm2(normZ) { return normZ > 4; } function fuzzyColors(i) { return Math.floor(i / scaler) + 1; } function moddedColors(i) { return (i % (colorNames.length - 1)) + 1; } function computeEscapeSpeedObjects(real, imag) { var c = { r: real, i: imag } scratchZ.r = scratchZ.i = 0; var absC = abs(c); for (var i = 0; i < threshold; ++i) { scratchZ = complexAdd(c, complexMult(scratchZ, scratchZ)); if (escape(scratchZ.r * scratchZ.r + scratchZ.i * scratchZ.i, absC)) { return colorMap(i); } } return 0; } function computeEscapeSpeedOneObject(real, imag) { // fold in the fact that we start with 0 var r = real; var i = imag; var absC = abs({r: real, i: imag}); for (var j = 0; j < threshold; ++j) { var r2 = r * r; var i2 = i * i; if (escape(r2 + i2, absC)) { return colorMap(j); } i = 2 * r * i + imag; r = r2 - i2 + real; } return 0; } function computeEscapeSpeedDoubles(real, imag) { // fold in the fact that we start with 0 var r = real; var i = imag; var absC = Math.sqrt(real * real + imag * imag); for (var j = 0; j < threshold; ++j) { var r2 = r * r; var i2 = i * i; if (escape(r2 + i2, absC)) { return colorMap(j); } i = 2 * r * i + imag; r = r2 - i2 + real; } return 0; } var computeEscapeSpeed = computeEscapeSpeedDoubles; var escape = escapeNorm2; var colorMap = fuzzyColors; function addPointOrig(pointArray, n, i, j) { if (!points[n]) { points[n] = []; points[n].push([i, j, 1, 1]); } else { var point = points[n][points[n].length-1]; if (point[0] == i && point[1] == j - point[3]) { ++point[3]; } else { points[n].push([i, j, 1, 1]); } } } function addPointImagedata(pointArray, n, col, row) { var slotIdx = ((row * numCols) + col) * 4; pointArray[slotIdx] = colors[n][0]; pointArray[slotIdx+1] = colors[n][1]; pointArray[slotIdx+2] = colors[n][2]; pointArray[slotIdx+3] = colors[n][3]; } function createMandelSet() { var realRange = { min: -2.1, max: 1 }; var imagRange = { min: -1.5, max: 1.5 }; var addPoint; if (doImageData) { addPoint = addPointImagedata; points = new Array(4*numCols*numRows); if (avoidSparseArray) { for (var idx = 0; idx < 4*numCols*numRows; ++idx) { points[idx] = 0; } } } else { addPoint = addPointOrig; points = []; } var realStep = (realRange.max - realRange.min)/numCols; var imagStep = (imagRange.min - imagRange.max)/numRows; for (var i = 0, curReal = realRange.min; i < numCols; ++i, curReal += realStep) { for (var j = 0, curImag = imagRange.max; j < numRows; ++j, curImag += imagStep) { var n = computeEscapeSpeed(curReal, curImag); addPoint(points, n, i, j) } } var result; if (doImageData) { if (colorMap == fuzzyColors) { result = mandelbrotImageDataFuzzyResult; } else { result = mandelbrotImageDataModdedResult; } } else { result = mandelbrotNoImageDataResult; } return points.toSource() == result; } const escapeTests = [ escapeAbsDiff ]; const colorMaps = [ fuzzyColors, moddedColors ]; const escapeComputations = [ computeEscapeSpeedObjects, computeEscapeSpeedOneObject, computeEscapeSpeedDoubles ]; // Test all possible escape-speed generation codepaths, using the // imageData + sparse array avoidance storage. doImageData = true; avoidSparseArray = true; for (var escapeIdx in escapeTests) { escape = escapeTests[escapeIdx]; for (var colorMapIdx in colorMaps) { colorMap = colorMaps[colorMapIdx]; for (var escapeComputationIdx in escapeComputations) { computeEscapeSpeed = escapeComputations[escapeComputationIdx]; assertEq(createMandelSet(), true); } } } // Test all possible storage strategies. Note that we already tested // doImageData == true with avoidSparseArray == true. escape = escapeAbsDiff; colorMap = fuzzyColors; // This part doesn't really matter too much here computeEscapeSpeed = computeEscapeSpeedDoubles; doImageData = true; avoidSparseArray = false; assertEq(createMandelSet(), true); escape = escapeNorm2; doImageData = false; // avoidSparseArray doesn't matter here assertEq(createMandelSet(), true); //} //testMandelbrotAll(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/deep2.js0000644000175000017500000000027011545150464021614 0ustar chr1schr1sfunction deep1(x) { if (x > 90) return 1; return 2; } function deep2() { for (var i = 0; i < 100; ++i) deep1(i); return "ok"; } assertEq(deep2(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/deepForInLoop.js0000644000175000017500000000050511545150464023323 0ustar chr1schr1sfunction deepForInLoop() { // NB: the number of props set in C is arefully tuned to match HOTLOOP = 2. function C(){this.p = 1, this.q = 2} C.prototype = {p:1, q:2, r:3, s:4, t:5}; var o = new C; var j = 0; var a = []; for (var i in o) a[j++] = i; return a.join(""); } assertEq(deepForInLoop(), "pqrst"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/delete-array-elements.js0000644000175000017500000000041411545150464025005 0ustar chr1schr1svar a = [0,1,2,3,4,5,6,7,8,9,10]; for (var i = 0; i < 10; i++) delete a[9 - i]; assertEq(a.length, 11); for (i = 0; i < 10; i++) assertEq(a.hasOwnProperty(i), false); checkStats({ recorderAborted:0, traceCompleted:2, sideExitIntoInterpreter:2 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/delete-indexed-names.js0000644000175000017500000000040511545150464024576 0ustar chr1schr1svar a = ['p', 'q', 'r', 's', 't']; var o = {p:1, q:2, r:3, s:4, t:5}; for (var i in o) delete o[i]; for each (var i in a) assertEq(o.hasOwnProperty(i), false); checkStats({ recorderAborted:0, traceCompleted:2, sideExitIntoInterpreter:2 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/delete-integer-nonid.js0000644000175000017500000000066011545150464024622 0ustar chr1schr1svar JSID_INT_MIN = -(1 << 30); var JSID_INT_MAX = (1 << 30) - 1; var o = {}; for (var i = 0; i < 10; i++) delete o[JSID_INT_MIN - 1]; for (var i = 0; i < 10; i++) delete o[JSID_INT_MIN]; for (var i = 0; i < 10; i++) delete o[JSID_INT_MIN + 1]; for (var i = 0; i < 10; i++) delete o[JSID_INT_MAX - 1]; for (var i = 0; i < 10; i++) delete o[JSID_INT_MAX]; for (var i = 0; i < 10; i++) delete o[JSID_INT_MAX + 1]; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/delete-named-names.js0000644000175000017500000000051011545150464024237 0ustar chr1schr1svar a = ['p', 'q', 'r', 's', 't']; var o = {p:1, q:2, r:3, s:4, t:5}; for (var i in o) { delete o.p; delete o.q; delete o.r; delete o.s; delete o.t; } for each (var i in a) assertEq(o.hasOwnProperty(i), false); checkStats({ recorderAborted:0, traceCompleted:1, sideExitIntoInterpreter:1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/delete-non-config.js0000644000175000017500000000032311545150464024111 0ustar chr1schr1svar a = [0,1,2,3,4,5,6,7,8,9,10]; for (var i = 0; i < 10; i++) delete a.length; assertEq(delete a.length, false); checkStats({ recorderAborted:0, traceCompleted:1, sideExitIntoInterpreter:1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/dependentStrings.js0000644000175000017500000000041211545150464024133 0ustar chr1schr1sfunction dependentStrings() { var a = []; var t = "abcdefghijklmnopqrst"; for (var i = 0; i < 10; i++) { var s = t.substring(2*i, 2*i + 2); a[i] = s + s.length; } return a.join(""); } assertEq(dependentStrings(), "ab2cd2ef2gh2ij2kl2mn2op2qr2st2"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/doMath.js0000644000175000017500000000246711545150464022043 0ustar chr1schr1sfunction map_test(t, cases) { for (var i = 0; i < cases.length; i++) { function c() { return t(cases[i].input); } var expected = cases[i].expected; assertEq(c(), expected); } } function lsh_inner(n) { var r; for (var i = 0; i < 35; i++) r = 0x1 << n; return r; } map_test (lsh_inner, [{input: 15, expected: 32768}, {input: 55, expected: 8388608}, {input: 1, expected: 2}, {input: 0, expected: 1}]); function rsh_inner(n) { var r; for (var i = 0; i < 35; i++) r = 0x11010101 >> n; return r; } map_test (rsh_inner, [{input: 8, expected: 1114369}, {input: 5, expected: 8914952}, {input: 35, expected: 35659808}, {input: -1, expected: 0}]); function ursh_inner(n) { var r; for (var i = 0; i < 35; i++) r = -55 >>> n; return r; } map_test (ursh_inner, [{input: 8, expected: 16777215}, {input: 33, expected: 2147483620}, {input: 0, expected: 4294967241}, {input: 1, expected: 2147483620}]); function doMath_inner(cos) { var s = 0; var sin = Math.sin; for (var i = 0; i < 200; i++) s = -Math.pow(sin(i) + cos(i * 0.75), 4); return s; } function doMath() { return doMath_inner(Math.cos); } assertEq(doMath(), -0.5405549555611059); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/equalInt.js0000644000175000017500000000152011545150464022376 0ustar chr1schr1sfunction equalInt() { var i1 = 55, one = 1, zero = 0, undef; var o1 = { }, o2 = { }; var s = "5"; var hits = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; for (var i = 0; i < 5000; i++) { if (i1 == 55) hits[0]++; if (i1 != 56) hits[1]++; if (i1 < 56) hits[2]++; if (i1 > 50) hits[3]++; if (i1 <= 60) hits[4]++; if (i1 >= 30) hits[5]++; if (i1 == 7) hits[6]++; if (i1 != 55) hits[7]++; if (i1 < 30) hits[8]++; if (i1 > 90) hits[9]++; if (i1 <= 40) hits[10]++; if (i1 >= 70) hits[11]++; if (o1 == o2) hits[12]++; if (o2 != null) hits[13]++; if (s < 10) hits[14]++; if (true < zero) hits[15]++; if (undef > one) hits[16]++; if (undef < zero) hits[17]++; } return hits.toString(); } assertEq(equalInt(), "5000,5000,5000,5000,5000,5000,0,0,0,0,0,0,0,5000,5000,0,0,0"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/fannkuch.js0000644000175000017500000000056311545150464022417 0ustar chr1schr1sfunction fannkuch() { var count = Array(8); var r = 8; var done = 0; while (done < 40) { // write-out the first 30 permutations done += r; while (r != 1) { count[r - 1] = r; r--; } while (true) { count[r] = count[r] - 1; if (count[r] > 0) break; r++; } } return done; } assertEq(fannkuch(), 41); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/firstSlotConflict.js0000644000175000017500000000050711545150464024273 0ustar chr1schr1s(function(x) { function f1() { return 1; } function f2() { return 2; } function f3() { return 3; } function f4() { return 4; } var g = function () { return x; } var a = [f1, f2, f3, f4, g]; for each (var v in a) v.adhoc = 42; // Don't assertbotch in jsbuiltins.cpp setting g.adhoc })(33); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/forVarInWith.js0000644000175000017500000000043011545150464023175 0ustar chr1schr1sfunction forVarInWith() { function foo() ({notk:42}); function bar() ({p:1, q:2, r:3, s:4, t:5}); var o = foo(); var a = []; with (o) { for (var k in bar()) a[a.length] = k; } return a.join(""); } assertEq(forVarInWith(), "pqrst"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/FPQuadCmp.js0000644000175000017500000000016611545150464022401 0ustar chr1schr1sfunction FPQuadCmp() { for (let j = 0; j < 3; ++j) { true == 0; } return "ok"; } assertEq(FPQuadCmp(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/function-bind.js0000644000175000017500000000053511545150464023360 0ustar chr1schr1svar A = Array.bind(1, 1, 2); var a1; for (var i = 0; i < 5; i++) a1 = A(3, 4); assertEq(a1.length, 4); assertEq(a1[0], 1); assertEq(a1[1], 2); assertEq(a1[2], 3); assertEq(a1[3], 4); var a2; for (var i = 0; i < 5; i++) a2 = new A(3, 4); assertEq(a2.length, 4); assertEq(a2[0], 1); assertEq(a2[1], 2); assertEq(a2[2], 3); assertEq(a2[3], 4); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/getelem.js0000644000175000017500000000065511545150464022246 0ustar chr1schr1svar a; function setelem() { a = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; a = a.concat(a, a, a); var l = a.length; for (var i = 0; i < l; i++) { a[i] = i; } return a.toString(); } setelem(); function getelem_inner(a) { var accum = 0; var l = a.length; for (var i = 0; i < l; i++) { accum += a[i]; } return accum; } function getelem() { return getelem_inner(a); } assertEq(getelem(), 3486); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/getprop.js0000644000175000017500000000041311545150464022274 0ustar chr1schr1svar a = 2; function getprop_inner(o2) { var o = {a:5}; var t = this; var x = 0; for (var i = 0; i < 20; i++) { t = this; x += o.a + o2.a + this.a + t.a; } return x; } function getprop() { return getprop_inner({a:9}); } assertEq(getprop(), 360); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/globalGet.js0000644000175000017500000000021111545150464022510 0ustar chr1schr1sglobalName = 907; var globalInt = 0; for (var i = 0; i < 500; i++) globalInt = globalName + i; assertEq(globalInt, globalName + 499); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/globalOptimize-1.js0000644000175000017500000000014611545150464023736 0ustar chr1schr1s/* Test that NaN does not trigger js_InitMathClass & constants while parsing. */ var NaN var x = 2; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/globalSet.js0000644000175000017500000000011211545150464022524 0ustar chr1schr1sfor (var i = 0; i < 500; i++) globalInt = i; assertEq(globalInt, 499); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/ifInsideLoop.js0000644000175000017500000000033111545150464023177 0ustar chr1schr1sfunction ifInsideLoop() { var cond = true, intCond = 5, count = 0; for (var i = 0; i < 100; i++) { if (cond) count++; if (intCond) count++; } return count; } assertEq(ifInsideLoop(), 200); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/inArrayTest.js0000644000175000017500000000031311545150464023060 0ustar chr1schr1sfunction inArrayTest() { var a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; for (var i = 0; i < a.length; i++) { if (!(i in a)) break; } return i; } assertEq(inArrayTest(), 10); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/inner_double_outer_int.js0000644000175000017500000000036111545150464025353 0ustar chr1schr1sfunction inner_double_outer_int() { function f(i) { for (var m = 0; m < 20; ++m) for (var n = 0; n < 100; n += i) ; return n; } return f(.5); } assertEq(inner_double_outer_int(), 100); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/innerLoopIntOuterDouble.js0000644000175000017500000000043711545150464025414 0ustar chr1schr1sfunction innerLoopIntOuterDouble() { var n = 10000, i=0, j=0, count=0, limit=0; for (i = 1; i <= n; ++i) { limit = i * 1; for (j = 0; j < limit; ++j) { ++count; } } return "" + count; } assertEq(innerLoopIntOuterDouble(), "50005000"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/inObjectTest.js0000644000175000017500000000040311545150464023210 0ustar chr1schr1sfunction inObjectTest() { var o = {p: 1, q: 2, r: 3, s: 4, t: 5}; var r = 0; for (var i in o) { if (!(i in o)) break; if ((i + i) in o) break; ++r; } return r; } assertEq(inObjectTest(), 5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/jitstatsArchFlags.js0000644000175000017500000000064111545150464024237 0ustar chr1schr1s// Make sure the arch flags are valid on startup, even if nothing has // been traced yet. We don't know what arch the user is building on, // but presumably we want at least 1 flag to be set on all supported // platforms. if (HAVE_TM) { assertEq(jitstats.archIsIA32 || jitstats.archIs64BIT || jitstats.archIsARM || jitstats.archIsSPARC || jitstats.archIsPPC || jitstats.archIsAMD64, 1); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/joinTest.js0000644000175000017500000000066411545150464022423 0ustar chr1schr1sfunction joinTest() { var s = ""; var a = []; for (var i = 0; i < 8; i++) a[i] = [String.fromCharCode(97 + i)]; for (i = 0; i < 8; i++) { for (var j = 0; j < 8; j++) a[i][1 + j] = j; } for (i = 0; i < 8; i++) s += a[i].join(","); return s; } assertEq(joinTest(), "a,0,1,2,3,4,5,6,7b,0,1,2,3,4,5,6,7c,0,1,2,3,4,5,6,7d,0,1,2,3,4,5,6,7e,0,1,2,3,4,5,6,7f,0,1,2,3,4,5,6,7g,0,1,2,3,4,5,6,7h,0,1,2,3,4,5,6,7"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/matchInLoop.js0000644000175000017500000000026411545150464023035 0ustar chr1schr1sfunction matchInLoop() { var k = "hi"; for (var i = 0; i < 10; i++) { var result = k.match(/hi/) != null; } return result; } assertEq(matchInLoop(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/math-jit-tests.js0000644000175000017500000005505511545150464023505 0ustar chr1schr1s/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ // Apply FUNCNAME to ARGS, and check against EXPECTED. // Expect a loop containing such a call to be traced. // FUNCNAME and ARGS are both strings. // ARGS has the form of an argument list: a comma-separated list of expressions. // Certain Tracemonkey limitations require us to pass FUNCNAME as a string. // Passing ARGS as a string allows us to assign better test names: // expressions like Math.PI/4 haven't been evaluated to big hairy numbers. function testmath(funcname, args, expected) { var i, j; var arg_value_list = eval("[" + args + "]"); var arity = arg_value_list.length; // Build the string "a[i][0],...,a[i][ARITY-1]". var actuals = [] for (i = 0; i < arity; i++) actuals.push("a[i][" + i + "]"); actuals = actuals.join(","); // Create a function that maps FUNCNAME across an array of input values. // Unless we eval here, the call to funcname won't get traced. // FUNCNAME="Infinity/Math.abs" and cases like that happen to // parse, too, in a twisted way. var mapfunc = eval("(function(a) {\n" + " for (var i = 0; i < a.length; i++)\n" + " a[i] = " + funcname + "(" + actuals +");\n" + " })\n"); // To prevent the compiler from doing constant folding, produce an // array to pass to mapfunc that contains enough dummy // values at the front to get the loop body jitted, and then our // actual test value. var dummies_and_input = []; for (i = 0; i < RUNLOOP; i++) { var dummy_list = []; for (j = 0; j < arity; j++) dummy_list[j] = .0078125 * ((i + j) % 128); dummies_and_input[i] = dummy_list; } dummies_and_input[RUNLOOP] = arg_value_list; function testfunc() { // Map the function across the dummy values and the test input. mapfunc(dummies_and_input); return dummies_and_input[RUNLOOP]; } assertEq(close_enough(testfunc(), expected), true); } function close_enough(expected, actual) { if (typeof expected != typeof actual) return false; if (typeof expected != 'number') return actual == expected; // Distinguish NaN from other values. Using x != x comparisons here // works even if tests redefine isNaN. if (actual != actual) return expected != expected if (expected != expected) return false; // Tolerate a certain degree of error. if (actual != expected) return Math.abs(actual - expected) <= 1E-10; // Distinguish 0 and -0. if (actual == 0) return (1 / actual > 0) == (1 / expected > 0); return true; } testmath("Math.abs", "void 0", Number.NaN) testmath("Math.abs", "null", 0) testmath("Math.abs", "true", 1) testmath("Math.abs", "false", 0) testmath("Math.abs", "\"a string primitive\"", Number.NaN) testmath("Math.abs", "new String( 'a String object' )", Number.NaN) testmath("Math.abs", "Number.NaN", Number.NaN) testmath("Math.abs", "0", 0) testmath("Math.abs", "-0", 0) testmath("Infinity/Math.abs", "-0", Infinity) testmath("Math.abs", "Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.abs", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.abs", "- Number.MAX_VALUE", Number.MAX_VALUE) testmath("Math.abs", "-Number.MIN_VALUE", Number.MIN_VALUE) testmath("Math.abs", "Number.MAX_VALUE", Number.MAX_VALUE) testmath("Math.abs", "Number.MIN_VALUE", Number.MIN_VALUE) testmath("Math.abs", "-1", 1) testmath("Math.abs", "new Number(-1)", 1) testmath("Math.abs", "1", 1) testmath("Math.abs", "Math.PI", Math.PI) testmath("Math.abs", "-Math.PI", Math.PI) testmath("Math.abs", "-1/100000000", 1/100000000) testmath("Math.abs", "-Math.pow(2,32)", Math.pow(2,32)) testmath("Math.abs", "Math.pow(2,32)", Math.pow(2,32)) testmath("Math.abs", "-0xfff", 4095) testmath("Math.abs", "-0777", 511) testmath("Math.abs", "'-1e-1'", 0.1) testmath("Math.abs", "'0xff'", 255) testmath("Math.abs", "'077'", 77) testmath("Math.abs", "'Infinity'", Infinity) testmath("Math.abs", "'-Infinity'", Infinity) testmath("Math.acos", "void 0", Number.NaN) testmath("Math.acos", "null", Math.PI/2) testmath("Math.acos", "Number.NaN", Number.NaN) testmath("Math.acos", "\"a string\"", Number.NaN) testmath("Math.acos", "'0'", Math.PI/2) testmath("Math.acos", "'1'", 0) testmath("Math.acos", "'-1'", Math.PI) testmath("Math.acos", "1.00000001", Number.NaN) testmath("Math.acos", "-1.00000001", Number.NaN) testmath("Math.acos", "1", 0) testmath("Math.acos", "-1", Math.PI) testmath("Math.acos", "0", Math.PI/2) testmath("Math.acos", "-0", Math.PI/2) testmath("Math.acos", "Math.SQRT1_2", Math.PI/4) testmath("Math.acos", "-Math.SQRT1_2", Math.PI/4*3) testmath("Math.acos", "0.9999619230642", Math.PI/360) testmath("Math.acos", "-3.0", Number.NaN) testmath("Math.asin", "void 0", Number.NaN) testmath("Math.asin", "null", 0) testmath("Math.asin", "Number.NaN", Number.NaN) testmath("Math.asin", "\"string\"", Number.NaN) testmath("Math.asin", "\"0\"", 0) testmath("Math.asin", "\"1\"", Math.PI/2) testmath("Math.asin", "\"-1\"", -Math.PI/2) testmath("Math.asin", "Math.SQRT1_2+''", Math.PI/4) testmath("Math.asin", "-Math.SQRT1_2+''", -Math.PI/4) testmath("Math.asin", "1.000001", Number.NaN) testmath("Math.asin", "-1.000001", Number.NaN) testmath("Math.asin", "0", 0) testmath("Math.asin", "-0", -0) testmath("Infinity/Math.asin", "-0", -Infinity) testmath("Math.asin", "1", Math.PI/2) testmath("Math.asin", "-1", -Math.PI/2) testmath("Math.asin", "Math.SQRT1_2", Math.PI/4) testmath("Math.asin", "-Math.SQRT1_2", -Math.PI/4) testmath("Math.atan", "void 0", Number.NaN) testmath("Math.atan", "null", 0) testmath("Math.atan", "Number.NaN", Number.NaN) testmath("Math.atan", "\"a string\"", Number.NaN) testmath("Math.atan", "'0'", 0) testmath("Math.atan", "'1'", Math.PI/4) testmath("Math.atan", "'-1'", -Math.PI/4) testmath("Math.atan", "'Infinity'", Math.PI/2) testmath("Math.atan", "'-Infinity'", -Math.PI/2) testmath("Math.atan", "0", 0) testmath("Math.atan", "-0", -0) testmath("Infinity/Math.atan", "-0", -Infinity) testmath("Math.atan", "Number.POSITIVE_INFINITY", Math.PI/2) testmath("Math.atan", "Number.NEGATIVE_INFINITY", -Math.PI/2) testmath("Math.atan", "1", Math.PI/4) testmath("Math.atan", "-1", -Math.PI/4) testmath("Math.atan2", "Number.NaN,0", Number.NaN) testmath("Math.atan2", "null, null", 0) testmath("Math.atan2", "void 0, void 0", Number.NaN) testmath("Math.atan2", "0,Number.NaN", Number.NaN) testmath("Math.atan2", "1,0", Math.PI/2) testmath("Math.atan2", "1,-0", Math.PI/2) testmath("Math.atan2", "0,0.001", 0) testmath("Math.atan2", "0,0", 0) testmath("Math.atan2", "0,-0", Math.PI) testmath("Math.atan2", "0, -1", Math.PI) testmath("Math.atan2", "-0, 1", -0) testmath("Infinity/Math.atan2", "-0,1", -Infinity) testmath("Math.atan2", "-0,0", -0) testmath("Math.atan2", "-0, -0", -Math.PI) testmath("Math.atan2", "-0, -1", -Math.PI) testmath("Math.atan2", "-1, 0", -Math.PI/2) testmath("Math.atan2", "-1, -0", -Math.PI/2) testmath("Math.atan2", "1, Number.POSITIVE_INFINITY", 0) testmath("Math.atan2", "1, Number.NEGATIVE_INFINITY", Math.PI) testmath("Math.atan2", "-1,Number.POSITIVE_INFINITY", -0) testmath("Infinity/Math.atan2", "-1,Infinity", -Infinity) testmath("Math.atan2", "-1,Number.NEGATIVE_INFINITY", -Math.PI) testmath("Math.atan2", "Number.POSITIVE_INFINITY, 0", Math.PI/2) testmath("Math.atan2", "Number.POSITIVE_INFINITY, 1", Math.PI/2) testmath("Math.atan2", "Number.POSITIVE_INFINITY,-1", Math.PI/2) testmath("Math.atan2", "Number.POSITIVE_INFINITY,-0", Math.PI/2) testmath("Math.atan2", "Number.NEGATIVE_INFINITY, 0", -Math.PI/2) testmath("Math.atan2", "Number.NEGATIVE_INFINITY,-0", -Math.PI/2) testmath("Math.atan2", "Number.NEGATIVE_INFINITY, 1", -Math.PI/2) testmath("Math.atan2", "Number.NEGATIVE_INFINITY,-1", -Math.PI/2) testmath("Math.atan2", "Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY", Math.PI/4) testmath("Math.atan2", "Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY", 3*Math.PI/4) testmath("Math.atan2", "Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY", -Math.PI/4) testmath("Math.atan2", "Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY", -3*Math.PI/4) testmath("Math.atan2", "-1, 1", -Math.PI/4) testmath("Math.ceil", "Number.NaN", Number.NaN) testmath("Math.ceil", "null", 0) testmath("Math.ceil", "void 0", Number.NaN) testmath("Math.ceil", "'0'", 0) testmath("Math.ceil", "'-0'", -0) testmath("Infinity/Math.ceil", "'0'", Infinity) testmath("Infinity/Math.ceil", "'-0'", -Infinity) testmath("Math.ceil", "0", 0) testmath("Math.ceil", "-0", -0) testmath("Infinity/Math.ceil", "0", Infinity) testmath("Infinity/Math.ceil", "-0", -Infinity) testmath("Math.ceil", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.ceil", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY) testmath("Math.ceil", "-Number.MIN_VALUE", -0) testmath("Infinity/Math.ceil", "-Number.MIN_VALUE", -Infinity) testmath("Math.ceil", "1", 1) testmath("Math.ceil", "-1", -1) testmath("Math.ceil", "-0.9", -0) testmath("Infinity/Math.ceil", "-0.9", -Infinity) testmath("Math.ceil", "0.9", 1) testmath("Math.ceil", "-1.1", -1) testmath("Math.ceil", "1.1", 2) testmath("Math.ceil", "Number.POSITIVE_INFINITY", -Math.floor(-Infinity)) testmath("Math.ceil", "Number.NEGATIVE_INFINITY", -Math.floor(Infinity)) testmath("Math.ceil", "-Number.MIN_VALUE", -Math.floor(Number.MIN_VALUE)) testmath("Math.ceil", "1", -Math.floor(-1)) testmath("Math.ceil", "-1", -Math.floor(1)) testmath("Math.ceil", "-0.9", -Math.floor(0.9)) testmath("Math.ceil", "0.9", -Math.floor(-0.9)) testmath("Math.ceil", "-1.1", -Math.floor(1.1)) testmath("Math.ceil", "1.1", -Math.floor(-1.1)) testmath("Math.cos", "void 0", Number.NaN) testmath("Math.cos", "false", 1) testmath("Math.cos", "null", 1) testmath("Math.cos", "'0'", 1) testmath("Math.cos", "\"Infinity\"", Number.NaN) testmath("Math.cos", "'3.14159265359'", -1) testmath("Math.cos", "Number.NaN", Number.NaN) testmath("Math.cos", "0", 1) testmath("Math.cos", "-0", 1) testmath("Math.cos", "Number.POSITIVE_INFINITY", Number.NaN) testmath("Math.cos", "Number.NEGATIVE_INFINITY", Number.NaN) testmath("Math.cos", "0.7853981633974", 0.7071067811865) testmath("Math.cos", "1.570796326795", 0) testmath("Math.cos", "2.356194490192", -0.7071067811865) testmath("Math.cos", "3.14159265359", -1) testmath("Math.cos", "3.926990816987", -0.7071067811865) testmath("Math.cos", "4.712388980385", 0) testmath("Math.cos", "5.497787143782", 0.7071067811865) testmath("Math.cos", "Math.PI*2", 1) testmath("Math.cos", "Math.PI/4", Math.SQRT2/2) testmath("Math.cos", "Math.PI/2", 0) testmath("Math.cos", "3*Math.PI/4", -Math.SQRT2/2) testmath("Math.cos", "Math.PI", -1) testmath("Math.cos", "5*Math.PI/4", -Math.SQRT2/2) testmath("Math.cos", "3*Math.PI/2", 0) testmath("Math.cos", "7*Math.PI/4", Math.SQRT2/2) testmath("Math.cos", "2*Math.PI", 1) testmath("Math.cos", "-0.7853981633974", 0.7071067811865) testmath("Math.cos", "-1.570796326795", 0) testmath("Math.cos", "2.3561944901920", -.7071067811865) testmath("Math.cos", "3.14159265359", -1) testmath("Math.cos", "3.926990816987", -0.7071067811865) testmath("Math.cos", "4.712388980385", 0) testmath("Math.cos", "5.497787143782", 0.7071067811865) testmath("Math.cos", "6.28318530718", 1) testmath("Math.cos", "-Math.PI/4", Math.SQRT2/2) testmath("Math.cos", "-Math.PI/2", 0) testmath("Math.cos", "-3*Math.PI/4", -Math.SQRT2/2) testmath("Math.cos", "-Math.PI", -1) testmath("Math.cos", "-5*Math.PI/4", -Math.SQRT2/2) testmath("Math.cos", "-3*Math.PI/2", 0) testmath("Math.cos", "-7*Math.PI/4", Math.SQRT2/2) testmath("Math.cos", "-Math.PI*2", 1) testmath("Math.exp", "null", 1) testmath("Math.exp", "void 0", Number.NaN) testmath("Math.exp", "1", Math.E) testmath("Math.exp", "true", Math.E) testmath("Math.exp", "false", 1) testmath("Math.exp", "'1'", Math.E) testmath("Math.exp", "'0'", 1) testmath("Math.exp", "Number.NaN", Number.NaN) testmath("Math.exp", "0", 1) testmath("Math.exp", "-0", 1) testmath("Math.exp", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.exp", "Number.NEGATIVE_INFINITY", 0) testmath("Math.floor", "void 0", Number.NaN) testmath("Math.floor", "null", 0) testmath("Math.floor", "true", 1) testmath("Math.floor", "false", 0) testmath("Math.floor", "\"1.1\"", 1) testmath("Math.floor", "\"-1.1\"", -2) testmath("Math.floor", "\"0.1\"", 0) testmath("Math.floor", "\"-0.1\"", -1) testmath("Math.floor", "Number.NaN", Number.NaN) testmath("Math.floor(Number.NaN) == -Math.ceil", "-Number.NaN", false) testmath("Math.floor", "0", 0) testmath("Math.floor(0) == -Math.ceil", "-0", true) testmath("Math.floor", "-0", -0) testmath("Infinity/Math.floor", "-0", -Infinity) testmath("Math.floor(-0)== -Math.ceil", "0", true) testmath("Math.floor", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil", "Number.NEGATIVE_INFINITY", true) testmath("Math.floor", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY) testmath("Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil", "Number.POSITIVE_INFINITY", true) testmath("Math.floor", "0.0000001", 0) testmath("Math.floor(0.0000001)==-Math.ceil", "-0.0000001", true) testmath("Math.floor", "-0.0000001", -1) testmath("Math.floor(-0.0000001)==-Math.ceil", "0.0000001", true) testmath("Math.log", "void 0", Number.NaN) testmath("Math.log", "null", Number.NEGATIVE_INFINITY) testmath("Math.log", "true", 0) testmath("Math.log", "false", -Infinity) testmath("Math.log", "'0'", -Infinity) testmath("Math.log", "'1'", 0) testmath("Math.log", "\"Infinity\"", Infinity) testmath("Math.log", "Number.NaN", Number.NaN) testmath("Math.log", "-0.000001", Number.NaN) testmath("Math.log", "-1", Number.NaN) testmath("Math.log", "0", Number.NEGATIVE_INFINITY) testmath("Math.log", "-0", Number.NEGATIVE_INFINITY) testmath("Math.log", "1", 0) testmath("Math.log", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.log", "Number.NEGATIVE_INFINITY", Number.NaN) testmath("Math.max", "void 0, 1", Number.NaN) testmath("Math.max", "void 0, void 0", Number.NaN) testmath("Math.max", "null, 1", 1) testmath("Math.max", "-1, null", 0) testmath("Math.max", "true,false", 1) testmath("Math.max", "\"-99\",\"99\"", 99) testmath("Math.max", "Number.NaN,Number.POSITIVE_INFINITY", Number.NaN) testmath("Math.max", "Number.NaN, 0", Number.NaN) testmath("Math.max", "\"a string\", 0", Number.NaN) testmath("Math.max", "Number.NaN,1", Number.NaN) testmath("Math.max", "\"a string\", Number.POSITIVE_INFINITY", Number.NaN) testmath("Math.max", "Number.POSITIVE_INFINITY, Number.NaN", Number.NaN) testmath("Math.max", "Number.NaN, Number.NaN", Number.NaN) testmath("Math.max", "0,Number.NaN", Number.NaN) testmath("Math.max", "1, Number.NaN", Number.NaN) testmath("Math.max", "0,0", 0) testmath("Math.max", "0,-0", 0) testmath("Math.max", "-0,0", 0) testmath("Math.max", "-0,-0", -0) testmath("Infinity/Math.max", "-0,-0", -Infinity) testmath("Math.max", "Number.POSITIVE_INFINITY, Number.MAX_VALUE", Number.POSITIVE_INFINITY) testmath("Math.max", "Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.max", "Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY) testmath("Math.max", "1,.99999999999999", 1) testmath("Math.max", "-1,-.99999999999999", -.99999999999999) testmath("Math.min", "void 0, 1", Number.NaN) testmath("Math.min", "void 0, void 0", Number.NaN) testmath("Math.min", "null, 1", 0) testmath("Math.min", "-1, null", -1) testmath("Math.min", "true,false", 0) testmath("Math.min", "\"-99\",\"99\"", -99) testmath("Math.min", "Number.NaN,0", Number.NaN) testmath("Math.min", "Number.NaN,1", Number.NaN) testmath("Math.min", "Number.NaN,-1", Number.NaN) testmath("Math.min", "0,Number.NaN", Number.NaN) testmath("Math.min", "1,Number.NaN", Number.NaN) testmath("Math.min", "-1,Number.NaN", Number.NaN) testmath("Math.min", "Number.NaN,Number.NaN", Number.NaN) testmath("Math.min", "1,1.0000000001", 1) testmath("Math.min", "1.0000000001,1", 1) testmath("Math.min", "0,0", 0) testmath("Math.min", "0,-0", -0) testmath("Math.min", "-0,-0", -0) testmath("Infinity/Math.min", "0,-0", -Infinity) testmath("Infinity/Math.min", "-0,-0", -Infinity) testmath("Math.pow", "null,null", 1) testmath("Math.pow", "void 0, void 0", Number.NaN) testmath("Math.pow", "true, false", 1) testmath("Math.pow", "false,true", 0) testmath("Math.pow", "'2','32'", 4294967296) testmath("Math.pow", "1,Number.NaN", Number.NaN) testmath("Math.pow", "0,Number.NaN", Number.NaN) testmath("Math.pow", "Number.NaN,0", 1) testmath("Math.pow", "Number.NaN,-0", 1) testmath("Math.pow", "Number.NaN, 1", Number.NaN) testmath("Math.pow", "Number.NaN, .5", Number.NaN) testmath("Math.pow", "1.00000001, Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.pow", "1.00000001, Number.NEGATIVE_INFINITY", 0) testmath("Math.pow", "-1.00000001,Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.pow", "-1.00000001,Number.NEGATIVE_INFINITY", 0) testmath("Math.pow", "1, Number.POSITIVE_INFINITY", Number.NaN) testmath("Math.pow", "1, Number.NEGATIVE_INFINITY", Number.NaN) testmath("Math.pow", "-1, Number.POSITIVE_INFINITY", Number.NaN) testmath("Math.pow", "-1, Number.NEGATIVE_INFINITY", Number.NaN) testmath("Math.pow", ".0000000009, Number.POSITIVE_INFINITY", 0) testmath("Math.pow", "-.0000000009, Number.POSITIVE_INFINITY", 0) testmath("Math.pow", "-.0000000009, Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.pow", "Number.POSITIVE_INFINITY,.00000000001", Number.POSITIVE_INFINITY) testmath("Math.pow", "Number.POSITIVE_INFINITY, 1", Number.POSITIVE_INFINITY) testmath("Math.pow", "Number.POSITIVE_INFINITY, -.00000000001", 0) testmath("Math.pow", "Number.POSITIVE_INFINITY, -1", 0) testmath("Math.pow", "Number.NEGATIVE_INFINITY, 1", Number.NEGATIVE_INFINITY) testmath("Math.pow", "Number.NEGATIVE_INFINITY, 333", Number.NEGATIVE_INFINITY) testmath("Math.pow", "Number.POSITIVE_INFINITY, 2", Number.POSITIVE_INFINITY) testmath("Math.pow", "Number.NEGATIVE_INFINITY, 666", Number.POSITIVE_INFINITY) testmath("Math.pow", "Number.NEGATIVE_INFINITY, 0.5", Number.POSITIVE_INFINITY) testmath("Math.pow", "Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.pow", "Number.NEGATIVE_INFINITY, -1", -0) testmath("Infinity/Math.pow", "Number.NEGATIVE_INFINITY, -1", -Infinity) testmath("Math.pow", "Number.NEGATIVE_INFINITY, -3", -0) testmath("Math.pow", "Number.NEGATIVE_INFINITY, -2", 0) testmath("Math.pow", "Number.NEGATIVE_INFINITY,-0.5", 0) testmath("Math.pow", "Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY", 0) testmath("Math.pow", "0,1", 0) testmath("Math.pow", "0,0", 1) testmath("Math.pow", "1,0", 1) testmath("Math.pow", "-1,0", 1) testmath("Math.pow", "0,0.5", 0) testmath("Math.pow", "0,1000", 0) testmath("Math.pow", "0, Number.POSITIVE_INFINITY", 0) testmath("Math.pow", "0, -1", Number.POSITIVE_INFINITY) testmath("Math.pow", "0, -0.5", Number.POSITIVE_INFINITY) testmath("Math.pow", "0, -1000", Number.POSITIVE_INFINITY) testmath("Math.pow", "0, Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.pow", "-0, 1", -0) testmath("Math.pow", "-0,3", -0) testmath("Infinity/Math.pow", "-0, 1", -Infinity) testmath("Infinity/Math.pow", "-0,3", -Infinity) testmath("Math.pow", "-0,2", 0) testmath("Math.pow", "-0, Number.POSITIVE_INFINITY", 0) testmath("Math.pow", "-0, -1", Number.NEGATIVE_INFINITY) testmath("Math.pow", "-0, -10001", Number.NEGATIVE_INFINITY) testmath("Math.pow", "-0, -2", Number.POSITIVE_INFINITY) testmath("Math.pow", "-0, 0.5", 0) testmath("Math.pow", "-0, Number.POSITIVE_INFINITY", 0) testmath("Math.pow", "-1, 0.5", Number.NaN) testmath("Math.pow", "-1, Number.NaN", Number.NaN) testmath("Math.pow", "-1, -0.5", Number.NaN) testmath("Math.round", "0", 0) testmath("Math.round", "void 0", Number.NaN) testmath("Math.round", "true", 1) testmath("Math.round", "false", 0) testmath("Math.round", "'.99999'", 1) testmath("Math.round", "'12345e-2'", 123) testmath("Math.round", "Number.NaN", Number.NaN) testmath("Math.round", "0", 0) testmath("Math.round", "-0", -0) testmath("Infinity/Math.round", "-0", -Infinity) testmath("Math.round", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.round", "Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY) testmath("Math.round", "0.49", 0) testmath("Math.round", "0.5", 1) testmath("Math.round", "0.51", 1) testmath("Math.round", "-0.49", -0) testmath("Math.round", "-0.5", -0) testmath("Infinity/Math.round", "-0.49", -Infinity) testmath("Infinity/Math.round", "-0.5", -Infinity) testmath("Math.round", "-0.51", -1) testmath("Math.round", "3.5", 4) testmath("Math.round", "-3", -3) testmath("Math.sin", "null", 0) testmath("Math.sin", "void 0", Number.NaN) testmath("Math.sin", "false", 0) testmath("Math.sin", "'2.356194490192'", 0.7071067811865) testmath("Math.sin", "Number.NaN", Number.NaN) testmath("Math.sin", "0", 0) testmath("Math.sin", "-0", -0) testmath("Math.sin", "Number.POSITIVE_INFINITY", Number.NaN) testmath("Math.sin", "Number.NEGATIVE_INFINITY", Number.NaN) testmath("Math.sin", "0.7853981633974", 0.7071067811865) testmath("Math.sin", "1.570796326795", 1) testmath("Math.sin", "2.356194490192", 0.7071067811865) testmath("Math.sin", "3.14159265359", 0) testmath("Math.sqrt", "void 0", Number.NaN) testmath("Math.sqrt", "null", 0) testmath("Math.sqrt", "1", 1) testmath("Math.sqrt", "false", 0) testmath("Math.sqrt", "'225'", 15) testmath("Math.sqrt", "Number.NaN", Number.NaN) testmath("Math.sqrt", "Number.NEGATIVE_INFINITY", Number.NaN) testmath("Math.sqrt", "-1", Number.NaN) testmath("Math.sqrt", "-0.5", Number.NaN) testmath("Math.sqrt", "0", 0) testmath("Math.sqrt", "-0", -0) testmath("Infinity/Math.sqrt", "-0", -Infinity) testmath("Math.sqrt", "Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY) testmath("Math.sqrt", "1", 1) testmath("Math.sqrt", "2", Math.SQRT2) testmath("Math.sqrt", "0.5", Math.SQRT1_2) testmath("Math.sqrt", "4", 2) testmath("Math.sqrt", "9", 3) testmath("Math.sqrt", "16", 4) testmath("Math.sqrt", "25", 5) testmath("Math.sqrt", "36", 6) testmath("Math.sqrt", "49", 7) testmath("Math.sqrt", "64", 8) testmath("Math.sqrt", "256", 16) testmath("Math.sqrt", "10000", 100) testmath("Math.sqrt", "65536", 256) testmath("Math.sqrt", "0.09", 0.3) testmath("Math.sqrt", "0.01", 0.1) testmath("Math.sqrt", "0.00000001", 0.0001) testmath("Math.tan", "void 0", Number.NaN) testmath("Math.tan", "null", 0) testmath("Math.tan", "false", 0) testmath("Math.tan", "Number.NaN", Number.NaN) testmath("Math.tan", "0", 0) testmath("Math.tan", "-0", -0) testmath("Math.tan", "Number.POSITIVE_INFINITY", Number.NaN) testmath("Math.tan", "Number.NEGATIVE_INFINITY", Number.NaN) testmath("Math.tan", "Math.PI/4", 1) testmath("Math.tan", "3*Math.PI/4", -1) testmath("Math.tan", "Math.PI", -0) testmath("Math.tan", "5*Math.PI/4", 1) testmath("Math.tan", "7*Math.PI/4", -1) testmath("Infinity/Math.tan", "-0", -Infinity) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/merge_type_maps.js0000644000175000017500000000047111545150464024000 0ustar chr1schr1svar merge_type_maps_x = 0, merge_type_maps_y = 0; function merge_type_maps() { for (merge_type_maps_x = 0; merge_type_maps_x < 50; ++merge_type_maps_x) if ((merge_type_maps_x & 1) == 1) ++merge_type_maps_y; return [merge_type_maps_x,merge_type_maps_y].join(","); } merge_type_maps(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/missingArgTest.js0000644000175000017500000000030311545150464023555 0ustar chr1schr1sfunction arity1(x) { return (x == undefined) ? 1 : 0; } function missingArgTest() { var q; for (var i = 0; i < 10; i++) { q = arity1(); } return q; } assertEq(missingArgTest(), 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/missingArgTest2.js0000644000175000017500000000106311545150464023643 0ustar chr1schr1sJSON = function () { return { stringify: function stringify(value, whitelist) { switch (typeof(value)) { case "object": return value.constructor.name; } } }; }(); function missingArgTest2() { var testPairs = [ ["{}", {}], ["[]", []], ['{"foo":"bar"}', {"foo":"bar"}], ] var a = []; for (var i=0; i < testPairs.length; i++) { var s = JSON.stringify(testPairs[i][1]) a[i] = s; } return a.join(","); } assertEq(missingArgTest2(), "Object,Array,Object"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/mod.js0000644000175000017500000000044411545150464021377 0ustar chr1schr1sfunction mod() { var mods = [-1,-1,-1,-1]; var a = 9.5, b = -5, c = 42, d = (1/0); for (var i = 0; i < 20; i++) { mods[0] = a % b; mods[1] = b % 1; mods[2] = c % d; mods[3] = c % a; mods[4] = b % 0; } return mods.toString(); } assertEq(mod(), "4.5,0,42,4,NaN"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/name-inactive-del.js0000644000175000017500000000043211545150464024077 0ustar chr1schr1sfunction mp(g) { var ans = ''; for (var i = 0; i < 5; ++i) { ans += g(); } return ans; } function f() { var k = 5; function g() { return k; } ans = ''; k = 6; ans += mp(g); delete k; ans += mp(g); return ans; } assertEq(f(), '6666666666'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/name-inactive-eval-del.js0000644000175000017500000000034711545150464025031 0ustar chr1schr1sfunction mp(g) { ans = '' for (var i = 0; i < 5; ++i) { ans += g(); } return ans; } var f = eval("(function() { var k = 5; function g() { return k; } k = 6; mp(g); delete k; return mp(g); })"); assertEq(f(), "66666"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/name-inactive-inferflags.js0000644000175000017500000000044011545150464025452 0ustar chr1schr1sfunction addAccumulations(f) { var a = f(); var b = f(); return a() + b(); } function loopingAccumulator() { var x = 0; return function () { for (var i = 0; i < 10; ++i) { ++x; } return x; } } var x = addAccumulations(loopingAccumulator); assertEq(x, 20); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/name-inactive.js0000644000175000017500000000042011545150464023332 0ustar chr1schr1sfunction f(k) { function g(j) { return j + k; } return g; } g = f(10); var ans = ''; for (var i = 0; i < 5; ++i) { ans += g(i) + ','; } assertEq(ans, '10,11,12,13,14,'); checkStats({ recorderStarted: 1, recorderAborted: 0, traceTriggered: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/name.js0000644000175000017500000000021211545150464021531 0ustar chr1schr1sglobalName = 907; function name() { var a = 0; for (var i = 0; i < 100; i++) a = globalName; return a; } assertEq(name(), 907); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/nestedExit2.js0000644000175000017500000000046611545150464023022 0ustar chr1schr1sfunction bitsinbyte(b) { var m = 1, c = 0; while(m<0x100) { if(b & m) c++; m <<= 1; } return 1; } function TimeFunc(func) { var x,y; for(var y=0; y<256; y++) func(y); } function nestedExit2() { TimeFunc(bitsinbyte); return "ok"; } assertEq(nestedExit2(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/nestedExitLoop.js0000644000175000017500000000040411545150464023562 0ustar chr1schr1sfunction nestedExit(x) { var q = 0; for (var i = 0; i < 10; ++i) { if (x) ++q; } } function nestedExitLoop() { for (var j = 0; j < 10; ++j) nestedExit(j < 7); return "ok"; } assertEq(nestedExitLoop(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/new-bound-function.js0000644000175000017500000000130511545150464024336 0ustar chr1schr1svar funProto = Function.prototype; assertEq(Object.getOwnPropertyDescriptor(funProto, "prototype"), undefined); function Point(x, y) { this.x = x; this.y = y; } var YAxisPoint = Point.bind(null, 0); assertEq(YAxisPoint.prototype, undefined); var oldPoint; for (var i = 0, sz = RUNLOOP; i < sz; oldPoint = point, i++) { var point = new YAxisPoint(5); assertEq(point === oldPoint, false); assertEq(point.x, 0); assertEq(point.y, 5); assertEq(Object.getOwnPropertyDescriptor(funProto, "prototype"), undefined); assertEq(Object.getOwnPropertyDescriptor(YAxisPoint, "prototype"), undefined); } checkStats({ recorderStarted: 1, recorderAborted: 1, traceTriggered: 0, traceCompleted: 0, }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/new-Function-prototype.js0000644000175000017500000000122611545150464025236 0ustar chr1schr1svar funProto = Function.prototype; assertEq(Object.getOwnPropertyDescriptor(funProto, "prototype"), undefined); assertEq(parseInt.prototype, undefined); var oldObj; for (var i = 0, sz = RUNLOOP; i < sz; oldObj = obj, i++) { var obj = new funProto; assertEq(obj === oldObj, false); assertEq(Object.prototype.toString.call(obj), "[object Object]"); assertEq(Object.getOwnPropertyDescriptor(funProto, "prototype"), undefined); assertEq(Object.getOwnPropertyDescriptor(parseInt, "prototype"), undefined); assertEq(parseInt.prototype, undefined); } checkStats({ recorderStarted: 1, recorderAborted: 0, traceTriggered: 1, traceCompleted: 1, }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/newArrayTest.js0000644000175000017500000000030311545150464023242 0ustar chr1schr1sfunction newArrayTest() { var a = []; for (var i = 0; i < 10; i++) a[i] = new Array(); return a.map(function(x) x.length).toString(); } assertEq(newArrayTest(), "0,0,0,0,0,0,0,0,0,0"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/newTest.js0000644000175000017500000000041611545150464022250 0ustar chr1schr1sfunction MyConstructor(i) { this.i = i; } MyConstructor.prototype.toString = function() {return this.i + ""}; function newTest() { var a = []; for (var i = 0; i < 10; i++) a[i] = new MyConstructor(i); return a.join(""); } assertEq(newTest(), "0123456789"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/nonEmptyStack1.js0000644000175000017500000000043611545150464023501 0ustar chr1schr1sfunction nonEmptyStack1Helper(o, farble) { var a = []; var j = 0; for (var i in o) a[j++] = i; return a.join(""); } function nonEmptyStack1() { return nonEmptyStack1Helper({a:1,b:2,c:3,d:4,e:5,f:6,g:7,h:8}, "hi"); } assertEq(nonEmptyStack1(), "abcdefgh"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/nonEmptyStack2.js0000644000175000017500000000027011545150464023476 0ustar chr1schr1sfunction nonEmptyStack2() { var a = 0; for (var c in {a:1, b:2, c:3}) { for (var i = 0; i < 10; i++) a += i; } return String(a); } assertEq(nonEmptyStack2(), "135"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/orNaNTest1.js0000644000175000017500000000020211545150464022546 0ustar chr1schr1sload(libdir + 'orTestHelper.js'); var orNaNTest1 = new Function("return orTestHelper(NaN, NaN, 10);"); assertEq(orNaNTest1(), 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/orNaNTest2.js0000644000175000017500000000020111545150464022546 0ustar chr1schr1sload(libdir + 'orTestHelper.js'); var orNaNTest2 = new Function("return orTestHelper(NaN, 1, 10);"); assertEq(orNaNTest2(), 45); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/outerline.js0000644000175000017500000000037411545150464022630 0ustar chr1schr1sfunction outerline(){ var i=0; var j=0; for (i = 3; i<= 100000; i+=2) { for (j = 3; j < 1000; j+=2) { if ((i & 1) == 1) break; } } return "ok"; } assertEq(outerline(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/parseIntTests.js0000644000175000017500000000117311545150464023430 0ustar chr1schr1sfunction parseIntHelper(n) { var a; for (var i = 0; i < 5; i++) a = parseInt(n); return a; } function doParseIntTests() { var inputs = [0, -0, .1, -.1, .7, -.7, 1.3, -1.3]; var outputs = new Array(8); //avoid jit, unrolled outputs[0] = outputs[1] = outputs[2] = outputs[4] = 0; outputs[3] = outputs[5] = -0; outputs[6] = 1; outputs[7] = -1; for (var i = 0; i < 8; i++) { var testfn = new Function('return parseIntHelper(' + uneval(inputs[i]) + ');'); assertEq(testfn(), outputs[i]); } } doParseIntTests(); assertEq(parseInt("08"), 0); assertEq(parseInt("09"), 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/parsingNumbers.js0000644000175000017500000000074311545150464023621 0ustar chr1schr1sfunction parsingNumbers() { var s1 = "123"; var s1z = "123zzz"; var s2 = "123.456"; var s2z = "123.456zzz"; var e1 = 123; var e2 = 123.456; var r1, r1z, r2, r2z; for (var i = 0; i < 10; i++) { r1 = parseInt(s1); r1z = parseInt(s1z); r2 = parseFloat(s2); r2z = parseFloat(s2z); } if (r1 == e1 && r1z == e1 && r2 == e2 && r2z == e2) return "ok"; return "fail"; } assertEq(parsingNumbers(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/perf-smoketest.js0000644000175000017500000000207211545150464023567 0ustar chr1schr1sfunction spin_loop() { for (let i = 0; i < 10000; i++) ; } function check_timing(label, count) { if (count == -1) { print("TEST-UNEXPECTED-FAIL | TestPerf | " + label); throwError(); } else { print("TEST-PASS | TestPerf | " + label + " = " + count); } } var pm = new PerfMeasurement(PerfMeasurement.ALL); if (pm.eventsMeasured == 0) { print("TEST-KNOWN-FAIL | perf-smoketest | stub, skipping test"); } else { pm.start(); spin_loop(); pm.stop(); check_timing("cpu_cycles", pm.cpu_cycles); check_timing("instructions", pm.instructions); check_timing("cache_references", pm.cache_references); check_timing("cache_misses", pm.cache_misses); check_timing("branch_instructions", pm.branch_instructions); check_timing("branch_misses", pm.branch_misses); check_timing("bus_cycles", pm.bus_cycles); check_timing("page_faults", pm.page_faults); check_timing("major_page_faults", pm.major_page_faults); check_timing("context_switches", pm.context_switches); check_timing("cpu_migrations", pm.cpu_migrations); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/putargsNoReturn.js0000644000175000017500000000014211545150464023775 0ustar chr1schr1sfunction f(a) { x = arguments; } for (var i = 0; i < 9; i++) f(123); assertEq(x[0], 123); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/putargsReturn.js0000644000175000017500000000016111545150464023501 0ustar chr1schr1sfunction f(a) { x = arguments; return 99; } for (var i = 0; i < 9; i++) f(123); assertEq(x[0], 123); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/regexp-reset-input.js0000644000175000017500000000040411545150464024363 0ustar chr1schr1svar re = /(pattern)/g; var input = "patternpatternpattern"; re.exec(input) RegExp.input = "satturn"; assertEq(RegExp.$1, "pattern"); assertEq(RegExp.lastMatch, "pattern"); assertEq(RegExp.lastParen, "pattern"); assertEq(RegExp.rightContext, "patternpattern"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/regexp-sticky-undef-capture.js0000644000175000017500000000032411545150464026153 0ustar chr1schr1svar re = /abc(WHOO!)?def/y; var input = 'abcdefabcdefabcdef'; var count = 0; while ((match = re.exec(input)) !== null) { print(count++); assertEq(match[0], 'abcdef'); assertEq(match[1], undefined); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/regexpLastIndex.js0000644000175000017500000000044311545150464023725 0ustar chr1schr1sfunction regexpLastIndex() { var n = 0; var re = /hi/g; var ss = " hi hi hi hi hi hi hi hi hi hi"; for (var i = 0; i < 10; i++) { // re.exec(ss); n += (re.lastIndex > 0) ? 3 : 0; re.lastIndex = 0; } return n; } assertEq(regexpLastIndex(), 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/setArgumentsLength.js0000644000175000017500000000025011545150464024436 0ustar chr1schr1svar count = 0; function f() { arguments.length--; for (var i = 0; i < arguments.length; ++i) { ++count; } } f(1, 2); f(1, 2); f(2, 2); assertEq(count, 3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/setArgumentsLength2.js0000644000175000017500000000024011545150464024517 0ustar chr1schr1s// don't crash var q; function f() { while (arguments.length > 0) { q = arguments[arguments.length-1]; arguments.length--; } } f(1, 2, 3, 4, 5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/setCall.js0000644000175000017500000000043311545150464022205 0ustar chr1schr1sfunction f() { var x = 11; function g() { var y = 12; function h() { for (var i = 0; i < 5; ++i) { y = 4; x = i * 2; } } h(); assertEq(y, 4); } g(); assertEq(x, 8); } f(); checkStats({ recorderStarted: 1, recorderAborted: 0, }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/setCallEvalMiddle.js0000644000175000017500000000042111545150464024131 0ustar chr1schr1seval(1); // avoid global shape change when we call eval below function q() { var x = 1; function f() { function g() { var t=0; for (var i=0; i<3; i++) x = i; }; g(); eval("var x = 3"); g(); assertEq(x, 2); } f(); } q(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/setCallEvalMiddle2.js0000644000175000017500000000045111545150464024216 0ustar chr1schr1seval(1); // avoid global shape change when we call eval below function q() { var x = 1; function f() { function g() { var t=0; for (var i=0; i<3; i++) x = i; assertEq(x, 2); eval("var x = 3"); }; g(); g(); assertEq(x, 2); } f(); } q(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/setCallGlobal.js0000644000175000017500000000026311545150464023327 0ustar chr1schr1svar x = 1; function f() { function g() { var t=0; for (var i=0; i<3; i++) x = i; }; g(); eval("var x = 2"); g(); assertEq(x, 2); } f(); assertEq(x, 2); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/setelem.js0000644000175000017500000000072111545150464022254 0ustar chr1schr1svar a; function setelem() { a = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; a = a.concat(a, a, a); var l = a.length; for (var i = 0; i < l; i++) { a[i] = i; } return a.toString(); } assertEq(setelem(), "0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/setprop.js0000644000175000017500000000032511545150464022312 0ustar chr1schr1sfunction setprop() { var obj = { a:-1 }; var obj2 = { b:-1, a:-1 }; for (var i = 0; i < 20; i++) { obj2.b = obj.a = i; } return [obj.a, obj2.a, obj2.b].toString(); } assertEq(setprop(), "19,-1,19"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/shapelessCalleeTest.js0000644000175000017500000000312611545150464024555 0ustar chr1schr1s// The following functions use a delay line of length 2 to change the value // of the callee without exiting the traced loop. This is obviously tuned to // match the current HOTLOOP setting of 2. function shapelessArgCalleeLoop(f, g, h, a) { for (var i = 0; i < 10; i++) { f(i, a); f = g; g = h; } } function shapelessVarCalleeLoop(f0, g, h, a) { var f = f0; for (var i = 0; i < 10; i++) { f(i, a); f = g; g = h; } } function shapelessLetCalleeLoop(f0, g, h, a) { for (var i = 0; i < 10; i++) { let f = f0; f(i, a); f = g; g = h; } } function shapelessUnknownCalleeLoop(n, f, g, h, a) { for (var i = 0; i < 10; i++) { (n || f)(i, a); f = g; g = h; } } function shapelessCalleeTest() { var a = []; var helper = function (i, a) a[i] = i; shapelessArgCalleeLoop(helper, helper, function (i, a) a[i] = -i, a); helper = function (i, a) a[10 + i] = i; shapelessVarCalleeLoop(helper, helper, function (i, a) a[10 + i] = -i, a); helper = function (i, a) a[20 + i] = i; shapelessLetCalleeLoop(helper, helper, function (i, a) a[20 + i] = -i, a); helper = function (i, a) a[30 + i] = i; shapelessUnknownCalleeLoop(null, helper, helper, function (i, a) a[30 + i] = -i, a); try { helper = {hack: 42}; shapelessUnknownCalleeLoop(null, helper, helper, helper, a); } catch (e) { if (e + "" != "TypeError: f is not a function") print("shapelessUnknownCalleeLoop: unexpected exception " + e); } return a.join(""); } assertEq(shapelessCalleeTest(), "01-2-3-4-5-6-7-8-901-2-3-4-5-6-7-8-9012345678901-2-3-4-5-6-7-8-9"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/strict-eval-loop-error.js0000644000175000017500000000030711545150464025151 0ustar chr1schr1svar COUNT = RUNLOOP; eval("'use strict'; for (let j = 0; j < COUNT; j++); try { x; throw new Error(); } catch (e) { if (!(e instanceof ReferenceError)) throw e; }"); assertEq(typeof j, "undefined"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/strictParseIntOctal.js0000644000175000017500000000055411545150464024563 0ustar chr1schr1s"use strict"; assertEq(parseInt("08"), 0); assertEq(parseInt("09"), 0); assertEq(parseInt("014"), 12); assertEq(parseInt("0xA"), 10); assertEq(parseInt("00123"), 83); for (var i = 0; i < 5; i++) { assertEq(parseInt("08"), 0); assertEq(parseInt("09"), 0); assertEq(parseInt("014"), 12); assertEq(parseInt("0xA"), 10); assertEq(parseInt("00123"), 83); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/stringConvert.js0000644000175000017500000000056611545150464023474 0ustar chr1schr1sfunction stringConvert() { var a = []; var s1 = "F", s2 = "1.3", s3 = "5"; for (var i = 0; i < 10; i++) { a[0] = 1 >> s1; a[1] = 10 - s2; a[2] = 15 * s3; a[3] = s3 | 32; a[4] = s2 + 60; // a[5] = 9 + s3; // a[6] = -s3; a[7] = s3 & "7"; // a[8] = ~s3; } return a.toString(); } assertEq(stringConvert(), "1,8.7,75,37,1.360,,,5"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/strings.js0000644000175000017500000000105211545150464022305 0ustar chr1schr1sfunction strings() { var a = [], b = -1; var s = "abcdefghij", s2 = "a"; var f = "f"; var c = 0, d = 0, e = 0, g = 0; for (var i = 0; i < 10; i++) { a[i] = (s.substring(i, i+1) + s[i] + String.fromCharCode(s2.charCodeAt(0) + i)).concat(i) + i; if (s[i] == f) c++; if (s[i] != 'b') d++; if ("B" > s2) g++; // f already used if (s2 < "b") e++; b = s.length; } return a.toString() + b + c + d + e + g; } assertEq(strings(), "aaa00,bbb11,ccc22,ddd33,eee44,fff55,ggg66,hhh77,iii88,jjj991019100"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/stringSplitIntoArrayTest.js0000644000175000017500000000034211545150464025630 0ustar chr1schr1sfunction stringSplitIntoArrayTest() { var s = "a,b" var a = []; for (var i = 0; i < 10; ++i) a[i] = s.split(","); return a.join(); } assertEq(stringSplitIntoArrayTest(), "a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b,a,b"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/stringSplitTest.js0000644000175000017500000000025311545150464024000 0ustar chr1schr1sfunction stringSplitTest() { var s = "a,b" var a = null; for (var i = 0; i < 10; ++i) a = s.split(","); return a.join(); } assertEq(stringSplitTest(), "a,b"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/test586387.js0000644000175000017500000000034311545150464022302 0ustar chr1schr1sfunction testFloatArray() { var v = new Float32Array(32); for (var i = 0; i < v.length; ++i) v[i] = i; var t = 0; for (var i = 0; i < v.length; ++i) t += v[i]; return t; } assertEq(testFloatArray(), 496); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/test_JSOP_ARGCNT.js0000644000175000017500000000204111545150464023463 0ustar chr1schr1sfunction test_JSOP_ARGCNT() { function f0() { return arguments.length; } function f1() { return arguments.length; } function f2() { return arguments.length; } function f3() { return arguments.length; } function f4() { return arguments.length; } function f5() { return arguments.length; } function f6() { return arguments.length; } function f7() { return arguments.length; } function f8() { return arguments.length; } function f9() { return arguments.length; } var a = []; for (var i = 0; i < 10; i++) { a[0] = f0('a'); a[1] = f1('a','b'); a[2] = f2('a','b','c'); a[3] = f3('a','b','c','d'); a[4] = f4('a','b','c','d','e'); a[5] = f5('a','b','c','d','e','f'); a[6] = f6('a','b','c','d','e','f','g'); a[7] = f7('a','b','c','d','e','f','g','h'); a[8] = f8('a','b','c','d','e','f','g','h','i'); a[9] = f9('a','b','c','d','e','f','g','h','i','j'); } return a.join(","); } assertEq(test_JSOP_ARGCNT(), "1,2,3,4,5,6,7,8,9,10"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/test_JSOP_ARGSUB.js0000644000175000017500000000175611545150464023504 0ustar chr1schr1sfunction test_JSOP_ARGSUB() { function f0() { return arguments[0]; } function f1() { return arguments[1]; } function f2() { return arguments[2]; } function f3() { return arguments[3]; } function f4() { return arguments[4]; } function f5() { return arguments[5]; } function f6() { return arguments[6]; } function f7() { return arguments[7]; } function f8() { return arguments[8]; } function f9() { return arguments[9]; } var a = []; for (var i = 0; i < 10; i++) { a[0] = f0('a'); a[1] = f1('a','b'); a[2] = f2('a','b','c'); a[3] = f3('a','b','c','d'); a[4] = f4('a','b','c','d','e'); a[5] = f5('a','b','c','d','e','f'); a[6] = f6('a','b','c','d','e','f','g'); a[7] = f7('a','b','c','d','e','f','g','h'); a[8] = f8('a','b','c','d','e','f','g','h','i'); a[9] = f9('a','b','c','d','e','f','g','h','i','j'); } return a.join(""); } assertEq(test_JSOP_ARGSUB(), "abcdefghij"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testAbortedImacroDecompilation.js0000644000175000017500000000015611545150464026743 0ustar chr1schr1sfunction f() { for (var i=0; i<9; i++) assertEq("" + f, expected); } var expected = "" + f; f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testAccessCanonicalArgInGetElem.js0000644000175000017500000000033611545150464026715 0ustar chr1schr1svar o = {x:42}; function f(index,param) { arguments[1] = 0; var ret = 0; for (var i = 0; i < 5; ++i) ret = arguments[index].x; return ret; } assertEq(f(2,o,o), 42); assertEq(f(1,o,o), undefined); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testAddAnyInconvertibleObject.js0000644000175000017500000000142611545150464026534 0ustar chr1schr1sfunction testAddAnyInconvertibleObject() { var count = 0; function toString() { ++count; if (count == 95) return {}; return "" + count; } var o = {valueOf: undefined, toString: toString}; var threw = false; try { for (var i = 0; i < 100; i++) var q = 5 + o; } catch (e) { threw = true; if (i !== 94) return "expected i === 94, got " + i; if (q !== "594") return "expected q === '594', got " + q + " (type " + typeof q + ")"; if (count !== 95) return "expected count === 95, got " + count; } if (!threw) return "expected throw with 5 + o"; // hey, a rhyme! return "pass"; } assertEq(testAddAnyInconvertibleObject(), "pass"); checkStats({ recorderStarted: 1, recorderAborted: 0, sideExitIntoInterpreter: 3 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testAddInconvertibleObjectAny.js0000644000175000017500000000143311545150464026532 0ustar chr1schr1sfunction testAddInconvertibleObjectAny() { var count = 0; function toString() { ++count; if (count == 95) return {}; return "" + count; } var o = {valueOf: undefined, toString: toString}; var threw = false; try { for (var i = 0; i < 100; i++) var q = o + 5; } catch (e) { threw = true; if (i !== 94) return "expected i === 94, got " + i; if (q !== "945") return "expected q === '945', got " + q + " (type " + typeof q + ")"; if (count !== 95) return "expected count === 95, got " + count; } if (!threw) return "expected throw with o + 5"; return "pass"; } assertEq(testAddInconvertibleObjectAny(), "pass"); checkStats({ recorderStarted: 1, recorderAborted: 0, sideExitIntoInterpreter: 3 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testAddInconvertibleObjectInconvertibleObject.js0000644000175000017500000000204011545150464031730 0ustar chr1schr1sfunction testAddInconvertibleObjectInconvertibleObject() { var count1 = 0; function toString1() { ++count1; if (count1 == 95) return {}; return "" + count1; } var o1 = {valueOf: undefined, toString: toString1}; var count2 = 0; function toString2() { ++count2; if (count2 == 95) return {}; return "" + count2; } var o2 = {valueOf: undefined, toString: toString2}; var threw = false; try { for (var i = 0; i < 100; i++) var q = o1 + o2; } catch (e) { threw = true; if (i !== 94) return "expected i === 94, got " + i; if (q !== "9494") return "expected q === '9494', got " + q + " (type " + typeof q + ")"; if (count1 !== 95) return "expected count1 === 95, got " + count1; if (count2 !== 94) return "expected count2 === 94, got " + count2; } if (!threw) return "expected throw with o1 + o2"; return "pass"; } assertEq(testAddInconvertibleObjectInconvertibleObject(), "pass"); checkStats({ recorderStarted: 1, recorderAborted: 0, sideExitIntoInterpreter: 3 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testAddNull.js0000644000175000017500000000036211545150464023042 0ustar chr1schr1sfunction testAddNull() { var rv; for (var x = 0; x < HOTLOOP + 1; ++x) rv = null + [,,]; return rv; } assertEq(testAddNull(), "null,"); checkStats({ recorderStarted: 1, sideExitIntoInterpreter: 1, recorderAborted: 0 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testAddUndefined.js0000644000175000017500000000015711545150464024033 0ustar chr1schr1sfunction testAddUndefined() { for (var j = 0; j < 3; ++j) (0 + void 0) && 0; } testAddUndefined(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/argumentsPassedToBuiltin.js0000644000175000017500000000031611545150464025615 0ustar chr1schr1s// bug 504797 function f() { g(arguments, 1); } function g(a, b) { var s = Array.prototype.slice.call(a, b); assertEq(s[0] == undefined, false); } for (var i = 0; i < 10; ++i) { f(1, 2, 3, 4); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/arith.js0000644000175000017500000000030011545150464021716 0ustar chr1schr1s// |jit-test| TMFLAGS: full,fragprofile,treevis function arith() { var accum = 0; for (var i = 0; i < 100; i++) { accum += (i * 2) - 1; } return accum; } assertEq(arith(), 9800); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/arityMismatchExtraArg.js0000644000175000017500000000035411545150464025074 0ustar chr1schr1sfunction arityMismatchMissingArg(arg) { for (var a = 0, i = 1; i < 10000; i *= 2) { a += i; } return a; } function arityMismatchExtraArg() { return arityMismatchMissingArg(1, 2); } assertEq(arityMismatchExtraArg(), 16383); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/arityMismatchMissingArg.js0000644000175000017500000000024011545150464025414 0ustar chr1schr1sfunction arityMismatchMissingArg(arg) { for (var a = 0, i = 1; i < 10000; i *= 2) { a += i; } return a; } assertEq(arityMismatchMissingArg(), 16383); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bigLoadStoreDisp.js0000644000175000017500000000211611545150464024014 0ustar chr1schr1s// In Nanojit, loads and stores have a maximum displacement of 16-bits. Any // displacements larger than that should be split off into a separate // instruction that adds the displacement to the base pointer. This // program tests if this is done correctly. // // x.y ends up having a dslot offset of 79988, because of the 20000 array // elements before it. If Nanojit incorrectly stores this offset into a // 16-bit value it will truncate to 14452 (because 79988 - 65536 == 14452). // This means that the increments in the second loop will be done to one of // the array elements instead of x.y. And so x.y's final value will be // (99 + HOTLOOP) instead of 1099. // // Note that setting x.y to 99 and checking its value at the end will // access the correct location because those lines are interpreted. Phew. var x = {} for (var i = 0; i < 20000; i++) x[i] = 0; x.y = 99; // not traced, correctly accessed for (var i = 0; i < 1000; ++i) { x.y++; // traced, will access an array elem if disp was truncated } assertEq(x.y, 1099); // not traced, correctly accessed mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bindname-in-strict-eval.js0000644000175000017500000000016111545150464025230 0ustar chr1schr1s'use strict'; eval("var i = 0; var end = RUNLOOP; for(var j = 0; j < end; i++, j++) { i = 0; }"); print("done"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bitwiseAnd.js0000644000175000017500000000036011545150464022706 0ustar chr1schr1sfunction bitwiseAnd_inner(bitwiseAndValue) { for (var i = 0; i < 60000; i++) bitwiseAndValue = bitwiseAndValue & i; return bitwiseAndValue; } function bitwiseAnd() { return bitwiseAnd_inner(12341234); } assertEq(bitwiseAnd(), 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bitwiseGlobal.js0000644000175000017500000000021511545150464023403 0ustar chr1schr1sbitwiseAndValue = Math.pow(2,32); for (var i = 0; i < 60000; i++) bitwiseAndValue = bitwiseAndValue & i; assertEq(bitwiseAndValue, 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug464403.js0000644000175000017500000000025411545150464022061 0ustar chr1schr1sfunction bug464403() { print(8); var u = [print, print, function(){}] for each (x in u) for (u.e in [1,1,1,1]); return "ok"; } assertEq(bug464403(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testArrayNamedProp.js0000644000175000017500000000021111545150464024374 0ustar chr1schr1sfunction testArrayNamedProp() { for (var x = 0; x < 10; ++x) { [4].sort-- } return "ok"; } assertEq(testArrayNamedProp(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testArrayNaNIndex.js0000644000175000017500000000027411545150464024164 0ustar chr1schr1sfunction testArrayNaNIndex() { for (var j = 0; j < 4; ++j) { [this[NaN]]; } for (var j = 0; j < 5; ++j) { if([1][-0]) { } } return "ok"; } assertEq(testArrayNaNIndex(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testArrayPushPop.js0000644000175000017500000000043511545150464024115 0ustar chr1schr1sfunction testArrayPushPop() { var a = [], sum1 = 0, sum2 = 0; for (var i = 0; i < 10; ++i) sum1 += a.push(i); for (var i = 0; i < 10; ++i) sum2 += a.pop(); a.push(sum1); a.push(sum2); return a.join(","); } assertEq(testArrayPushPop(), "55,45"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testAssigningWatchedDeletedProperty.js0000644000175000017500000000016411545150464027775 0ustar chr1schr1svar o = {}; o.watch("p", function() { }); for (var i = 0; i < HOTLOOP + 2; i++) { o.p = 123; delete o.p; } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testAssignmentThatIgnoresSetterRetval.js0000644000175000017500000000022411545150464030341 0ustar chr1schr1svar o = { set x(v) { return 42; } }; for (var i = 0; i < 10; ++i) { var z = o.x = "choose me"; assertEq(z, "choose me"); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testAtomize.js0000644000175000017500000000030211545150464023121 0ustar chr1schr1sfunction testAtomize() { x = {}; for (var i = 0; i < 65536; ++i) x[String.fromCharCode(i)] = 1; var z = 0; for (var p in x) ++z; return z; } assertEq(testAtomize(), 65536) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBitOrAnyInconvertibleObject.js0000644000175000017500000000136211545150464027062 0ustar chr1schr1sfunction testBitOrAnyInconvertibleObject() { var count = 0; function toString() { ++count; if (count == 95) return {}; return count; } var o = {valueOf: undefined, toString: toString}; var threw = false; try { for (var i = 0; i < 100; i++) var q = 1 | o; } catch (e) { threw = true; if (i !== 94) return "expected i === 94, got " + i; if (q !== 95) return "expected q === 95, got " + q; if (count !== 95) return "expected count === 95, got " + count; } if (!threw) return "expected throw with 2 | o"; // hey, a rhyme! return "pass"; } assertEq(testBitOrAnyInconvertibleObject(), "pass"); checkStats({ recorderStarted: 1, recorderAborted: 0, sideExitIntoInterpreter: 3 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBitOrInconvertibleObjectAny.js0000644000175000017500000000134111545150464027057 0ustar chr1schr1sfunction testBitOrInconvertibleObjectAny() { var count = 0; function toString() { ++count; if (count == 95) return {}; return count; } var o = {valueOf: undefined, toString: toString}; var threw = false; try { for (var i = 0; i < 100; i++) var q = o | 1; } catch (e) { threw = true; if (i !== 94) return "expected i === 94, got " + i; if (q !== 95) return "expected q === 95, got " + q; if (count !== 95) return "expected count === 95, got " + count; } if (!threw) return "expected throw with o | 2"; return "pass"; } assertEq(testBitOrInconvertibleObjectAny(), "pass"); checkStats({ recorderStarted: 1, recorderAborted: 0, sideExitIntoInterpreter: 3 }); ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBitOrInconvertibleObjectInconvertibleObject.jsmozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBitOrInconvertibleObjectInconvertibleObject.j0000644000175000017500000000176511545150464032111 0ustar chr1schr1sfunction testBitOrInconvertibleObjectInconvertibleObject() { var count1 = 0; function toString1() { ++count1; if (count1 == 95) return {}; return count1; } var o1 = {valueOf: undefined, toString: toString1}; var count2 = 0; function toString2() { ++count2; if (count2 == 95) return {}; return count2; } var o2 = {valueOf: undefined, toString: toString2}; var threw = false; try { for (var i = 0; i < 100; i++) var q = o1 | o2; } catch (e) { threw = true; if (i !== 94) return "expected i === 94, got " + i; if (q !== 94) return "expected q === 94, got " + q; if (count1 !== 95) return "expected count1 === 95, got " + count1; if (count2 !== 94) return "expected count2 === 94, got " + count2; } if (!threw) return "expected throw with o1 | o2"; return "pass"; } assertEq(testBitOrInconvertibleObjectInconvertibleObject(), "pass"); checkStats({ recorderStarted: 1, recorderAborted: 0, sideExitIntoInterpreter: 3 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBitwise.js0000644000175000017500000000035311545150464023125 0ustar chr1schr1sfunction testBitwise() { var x = 10000; var y = 123456; var z = 987234; for (var i = 0; i < 50; i++) { x = x ^ y; y = y | z; z = ~x; } return x + y + z; } assertEq(testBitwise(), -1298); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBoolToString.js0000644000175000017500000000010011545150464024072 0ustar chr1schr1s// |jit-test| error: TypeError; var bts = true.toString; bts(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBoxDoubleWithDoubleSizedInt.js0000644000175000017500000000035411545150464027044 0ustar chr1schr1sfunction testBoxDoubleWithDoubleSizedInt() { var i = 0; var a = new Array(3); while (i < a.length) a[i++] = 0x5a827999; return a.join(","); } assertEq(testBoxDoubleWithDoubleSizedInt(), "1518500249,1518500249,1518500249"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBranchCse.js0000644000175000017500000000031311545150464023343 0ustar chr1schr1sfunction testBranchCse() { empty = []; out = []; for (var j=0;j<10;++j) { empty[42]; out.push((1 * (1)) | ""); } return out.join(","); } assertEq(testBranchCse(), "1,1,1,1,1,1,1,1,1,1"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBranchingLoop.js0000644000175000017500000000026311545150464024244 0ustar chr1schr1sfunction testBranchingLoop() { var x = 0; for (var i=0; i < 100; ++i) { if (i == 51) { x += 10; } x++; } return x; } assertEq(testBranchingLoop(), 110); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBranchingUnstableLoop.js0000644000175000017500000000030711545150464025741 0ustar chr1schr1sfunction testBranchingUnstableLoop() { var x = 0; for (var i=0; i < 100; ++i) { if (i == 51) { x += 10.1; } x++; } return x; } assertEq(testBranchingUnstableLoop(), 110.1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBranchingUnstableLoopCounter.js0000644000175000017500000000032111545150464027275 0ustar chr1schr1sfunction testBranchingUnstableLoopCounter() { var x = 0; for (var i=0; i < 100; ++i) { if (i == 51) { i += 1.1; } x++; } return x; } assertEq(testBranchingUnstableLoopCounter(), 99); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBranchingUnstableObject.js0000644000175000017500000000036611545150464026243 0ustar chr1schr1sfunction testBranchingUnstableObject() { var x = {s: "a"}; var t = ""; for (var i=0; i < 100; ++i) { if (i == 51) { x.s = 5; } t += x.s; } return t.length; } assertEq(testBranchingUnstableObject(), 100); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBrandedVsGeneric.js0000644000175000017500000000061511545150464024665 0ustar chr1schr1sconst C = function (a, b, c) { return function C() { this.m1 = function () a; this.m2 = function () b; this.m3 = function () c; } }(2,3,4); var c = new C(); var d = function (e) {return {m0: function () e}}(5); for (var i = 0; i < 5; i++) d.m0(); C.call(d); d.__iterator__ = function() {yield 55}; for (i = 0; i < 5; i++) { for (j in d) print(j); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBreak.js0000644000175000017500000000025611545150464022545 0ustar chr1schr1sfor (var i = 10; i < 19; i++) for (var j = 0; j < 9; j++) if (j < i) break; checkStats({recorderStarted: 3, recorderAborted: 1, traceCompleted: 2}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug458838.js0000644000175000017500000000050711545150464022741 0ustar chr1schr1svar escape; function testBug458838() { var a = 1; function g() { var b = 0 for (var i = 0; i < 10; ++i) { b += a; } return b; } return g(); } assertEq(testBug458838(), 10); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug462388.js0000644000175000017500000000026611545150464022736 0ustar chr1schr1s//test no multitrees assert function testBug462388() { var c = 0, v; for each (let x in ["",v,v,v]) { for (c=0;c<4;++c) { } } return true; } assertEq(testBug462388(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug462407.js0000644000175000017500000000025111545150464022720 0ustar chr1schr1s//test no multitrees assert function testBug462407() { for each (let i in [0, {}, 0, 1.5, {}, 0, 1.5, 0, 0]) { } return true; } assertEq(testBug462407(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug463490.js0000644000175000017500000000061411545150464022726 0ustar chr1schr1s//test no multitrees assert function testBug463490() { function f(a, b, d) { for (var i = 0; i < 10; i++) { if (d) b /= 2; } return a + b; } //integer stable loop f(2, 2, false); //double stable loop f(3, 4.5, false); //integer unstable branch f(2, 2, true); return true; }; assertEq(testBug463490(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug465261.js0000644000175000017500000000032411545150464022722 0ustar chr1schr1s// Test no assert or crash function testBug465261() { for (let z = 0; z < 2; ++z) { for each (let x in [0, true, (void 0), 0, (void 0)]) { if(x){} } }; return true; } assertEq(testBug465261(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug465272.js0000644000175000017500000000024411545150464022725 0ustar chr1schr1sfunction testBug465272() { var a = new Array(5); for (j=0;j<5;++j) a[j] = "" + ((5) - 2); return a.join(","); } assertEq(testBug465272(), "3,3,3,3,3"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug465483.js0000644000175000017500000000031311545150464022726 0ustar chr1schr1sfunction testBug465483() { var a = new Array(4); var c = 0; for each (i in [4, 'a', 'b', (void 0)]) a[c++] = '' + (i + i); return a.join(','); } assertEq(testBug465483(), '8,aa,bb,NaN'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug465688.js0000644000175000017500000000023111545150464022734 0ustar chr1schr1s//test no assert function testBug465688() { for each (let d in [-0x80000000, -0x80000000]) - -d; return true; } assertEq(testBug465688(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug466128.js0000644000175000017500000000032611545150464022727 0ustar chr1schr1s//test no multitrees assert function testBug466128() { for (let a = 0; a < 3; ++a) { for each (let b in [1, 2, "three", 4, 5, 6, 7, 8]) { } } return true; } assertEq(testBug466128(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug466262.js0000644000175000017500000000030311545150464022721 0ustar chr1schr1s//test no assert function testBug466262() { var e = 1; for (var d = 0; d < 3; ++d) { if (d == 2) { e = ""; } } return true; } assertEq(testBug466262(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug474769.js0000644000175000017500000000035711545150464022745 0ustar chr1schr1sdelete b; delete q; for each (testBug474769_b in [1, 1, 1, 1.5, 1, 1]) { (function() { for each (let testBug474769_h in [0, 0, 1.4, ""]) {} })() } function testBug474769() { return testBug474769_b; } assertEq(testBug474769(), 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug501690.js0000644000175000017500000000074211545150464022723 0ustar chr1schr1sfunction testBug501690() { // Property cache assertion when 3 objects along a prototype chain have the same shape. function B(){} B.prototype = {x: 123}; function D(){} D.prototype = new B; D.prototype.x = 1; // [1] shapeOf(B.prototype) == shapeOf(D.prototype) arr = [new D, new D, new D, D.prototype]; // [2] all the same shape for (var i = 0; i < 4; i++) assertEq(arr[i].x, 1); // same kshape [2], same vshape [1] } testBug501690(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug502914.js0000644000175000017500000000103611545150464022720 0ustar chr1schr1sfunction testBug502914() { // Assigning a non-function to a function-valued property on trace should // bump the shape. function f1() {} function C() {} var x = C.prototype = {m: f1}; x.m(); // brand scope var arr = [new C, new C, new C, x]; try { for (var i = 0; i < 4; i++) { arr[i].m = 12; x.m(); // should throw last time through } } catch (exc) { return exc.constructor.name; } return "no exception"; } assertEq(testBug502914(), "TypeError"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug504520.js0000644000175000017500000000046511545150464022720 0ustar chr1schr1sfunction testBug504520() { // A bug involving comparisons. var arr = [1/0, 1/0, 1/0, 1/0, 1/0, 1/0, 1/0, 1/0, 1/0, 0]; assertEq(arr.length > RUNLOOP, true); var s = ''; for (var i = 0; i < arr.length; i++) arr[i] >= 1/0 ? null : (s += i); assertEq(s, '9'); } testBug504520(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug504520Harder.js0000644000175000017500000000250611545150464024044 0ustar chr1schr1sfunction testBug504520Harder() { // test 1024 similar cases var vals = [1/0, -1/0, 0, 0/0]; var ops = ["===", "!==", "==", "!=", "<", ">", "<=", ">="]; for each (var x in vals) { for each (var y in vals) { for each (var op in ops) { for each (var z in vals) { // Assume eval is correct. This depends on the global // Infinity property not having been reassigned. var xz = eval(x + op + z); var yz = eval(y + op + z); var arr = [x, x, x, x, x, x, x, x, x, y]; assertEq(arr.length > RUNLOOP, true); var expected = [xz, xz, xz, xz, xz, xz, xz, xz, xz, yz]; // ?: looks superfluous but that's what we're testing here var fun = eval( '(function (arr, results) {\n' + ' for (let i = 0; i < arr.length; i++)\n' + ' results.push(arr[i]' + op + z + ' ? "true" : "false");\n' + '});\n'); var actual = []; fun(arr, actual); print(x, y, op, z); assertEq("" + actual, "" + expected); } } } } } testBug504520Harder(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug507425.js0000644000175000017500000000054611545150464022727 0ustar chr1schr1s// |jit-test| allow-oom; function testBug507425() { var r = /x/; for (var i = 0; i < 3; i++) r.lastIndex = 0; // call a setter var s = ';'; try { for (i = 0; i < 80; i++) s += s; // call js_CanLeaveTrace } catch (exc) { return "ok"; } } assertEq(testBug507425(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug520503-1.js0000644000175000017500000000033111545150464023045 0ustar chr1schr1s(new Function("for (var j=0; j<9; ++j) { (function sum_indexing(array,start){return array.length==start ? 0 : array[start]+ sum_indexing(array,start+1)})([true,true,undefined],0)}"))() /* Should not have crashed. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug520503-2.js0000644000175000017500000000066011545150464023053 0ustar chr1schr1sfor each(let a in [new Boolean(false)]) {} for (var b = 0; b < 13; ++b) { if (b % 3 == 1) { (function f(c) { if (c <= 1) { return 1; } return f(c - 1) + f(c - 2); })(3) } else { (function g(d, e) {; return d.length == e ? 0 : d[e] + g(d, e + 1); })([false, new Boolean(true), false], 0) } } /* Should not have crashed. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug520503-3.js0000644000175000017500000000031711545150464023053 0ustar chr1schr1s(Function("for (var a = 0; a < 6; a++) {\ (function sum_indexing(b, c) {\ return b.length == c ? 0 : b[c] + sum_indexing(b, c + 1)\ })([(void 0), Infinity, Infinity], 0)\ }"))() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug529147.js0000644000175000017500000000046611545150464022735 0ustar chr1schr1svar magicNumbers = [1, -1, 0, 0]; var magicIndex = 0; var sum = 0; function foo(n) { for (var i = 0; i < n; ++i) { sum += 10; bar(); } } function bar() { var q = magicNumbers[magicIndex++]; if (q != -1) { sum += 1; foo(q); } } foo(3); assertEq(sum, 43); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug547791.js0000644000175000017500000000036711545150464022742 0ustar chr1schr1s function Bext(k) { if (k > 0) { let i = k + 1; if (k == 10) { function x () { i = 2; } } Bext(i - 2); Bext(i - 2); } return 0; } function f() { Bext(12); } f(); /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug550210.js0000644000175000017500000000031011545150464022702 0ustar chr1schr1sfunction g(e) { return ("" + e); } function blah() { do { yield; } while ({}(p = arguments)); } rv = blah(); try { for (a in rv) ; } catch (e) { print("" + g(e)); } gc(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug552248.js0000644000175000017500000000137611545150464022734 0ustar chr1schr1s// |jit-test| debug setDebug(true); var a = new Array(); function i(save) { var x = 9; evalInFrame(0, "a.push(x)", save); evalInFrame(1, "a.push(z)", save); evalInFrame(2, "a.push(z)", save); evalInFrame(3, "a.push(y)", save); evalInFrame(4, "a.push(x)", save); } function h() { var z = 5; evalInFrame(0, "a.push(z)"); evalInFrame(1, "a.push(y)"); evalInFrame(2, "a.push(x)"); evalInFrame(0, "i(false)"); evalInFrame(0, "a.push(z)", true); evalInFrame(1, "a.push(y)", true); evalInFrame(2, "a.push(x)", true); evalInFrame(0, "i(true)", true); } function g() { var y = 4; h(); } function f() { var x = 3; g(); } f(); assertEq(a+'', [5, 4, 3, 9, 5, 5, 4, 3, 5, 4, 3, 9, 5, 5, 4, 3]+''); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug554043.js0000644000175000017500000000016211545150464022717 0ustar chr1schr1s(function () { for (var a = 0; a < 5; a++) { print(-false) assertEq(-false, -0.0); } })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug555484.js0000644000175000017500000000024211545150464022730 0ustar chr1schr1svar result = ""; o = { valueOf:function(){ throw "cow" } }; try { String.fromCharCode(o); } catch (e) { result = e.toString(); } assertEq(result, "cow"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug558446.js0000644000175000017500000000044011545150464022731 0ustar chr1schr1sfunction f(a, b) { return a + " " + b; } for (var i = 0; i < 10; ++i) { var s = ''; var a = {toString: function () { s += 'a'; return 'a'; }}; var b = {toString: function () { s += 'b'; return 'b'; }}; f(a, b); assertEq(s, 'ab'); } checkStats({ traceTriggered:1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug560098.js0000644000175000017500000000103211545150464022723 0ustar chr1schr1sFunction("\ for each(let w in [(5), false, Number, false]) {\ (function f(zzzzzz) {\ return zzzzzz.length == 0 ? 0 : zzzzzz[0] + f(zzzzzz.slice(1))\ })([, [], [], w, , ])\ }\ ")() Function("\ for each(let w in [(void 0), (void 0), false, false, false, false, false, \ undefined, undefined, false, (void 0), undefined]) {\ (function f(zzzzzz) {\ return zzzzzz.length == 0 ? 0 : zzzzzz[0] + f(zzzzzz.slice(1))\ })([w, , w, w, [], []])\ }\ ")() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug566556.js0000644000175000017500000000033111545150464022731 0ustar chr1schr1svar msg = ""; try { this.__defineSetter__('x', Object.create); this.watch('x', function() {}); x = 3; } catch (e) { msg = e.toString(); } assertEq(msg, "TypeError: (void 0) is not an object or null"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug578044.js0000644000175000017500000000031411545150464022725 0ustar chr1schr1sthis.watch("x", Object.create) try { (function() { this.__defineGetter__("x", function() { return this }) })() } catch(e) {} Object.defineProperty(x, "x", ({ set: Uint16Array })) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug579602.js0000644000175000017500000000042211545150464022726 0ustar chr1schr1s// don't panic f = function() { x = yield } rv = f() for (a in rv) (function() {}) x = Proxy.create((function() { return { defineProperty: gc } })(), x) with({ d: (({ x: Object.defineProperty(x, "", ({ set: Array.e })) })) }) {} // don't crash mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug579646.js0000644000175000017500000000053611545150464022744 0ustar chr1schr1sif (typeof gczeal != "function") gczeal = function() {} for (a = 0; a < 9; a++) for (b = 0; b < 1; b++) for (c = 0; c < 2; c++) gczeal(); for each(e in [NaN]) for (d = 0; d < 1; d++) z = 0; for (w in [0, 0]) {} x = 0; for (e = 0; e < 3; e++) for (f = 0; f < 4; f++) x = -x // don't crash mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug579647.js0000644000175000017500000000032011545150464022734 0ustar chr1schr1sexpected = "TypeError: NaN is not a function"; actual = ""; try { a = "" for each(x in [0, 0, 0, 0]) { a %= x } ( - a)() } catch (e) { actual = '' + e; } assertEq(expected, actual); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug582766.js0000644000175000017500000000053211545150464022735 0ustar chr1schr1sexpected = 4; var fourth = { nextSibling: null }; var third = { nextSibling: fourth }; var second = { nextSibling: third }; var first = { nextSibling: second }; function f() { let loopcount = 0; for (let node = first; node; node = node.nextSibling) { loopcount++; } return loopcount; } actual = f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug584650.js0000644000175000017500000000023011545150464022722 0ustar chr1schr1sif (typeof gczeal != "function") gczeal = function() {} // don't crash x = (evalcx('lazy')) x.watch("", function () {}) gczeal(1) for (w in x) {} mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug586866.js0000644000175000017500000000040211545150464022736 0ustar chr1schr1svar magic = HOTLOOP; var obj = {}; for (var i = 1; i <= magic; ++i) obj[i] = "a"; function func() { var i = 1; while (i in obj) { ++i; } return i - 1; } assertEq(func(), magic); assertEq(func(), magic); assertEq(func(), magic); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug593559.js0000644000175000017500000000030611545150464022736 0ustar chr1schr1svar gen = (function () {yield})(); var t = gen.throw; try { new t; } catch (e) { actual = "" + e; } assertEq(actual, "TypeError: Generator.prototype.throw called on incompatible Object"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug595916.js0000644000175000017500000000025611545150464022741 0ustar chr1schr1s(function () { try { eval("\ for each(let d in[0,0,0,0,0,0,0,0]) {\ for(let b in[0,0]) {}\ }\ ") } catch (e) {} })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug597736.js0000644000175000017500000000202611545150464022740 0ustar chr1schr1sfunction leak_test() { // Create a reference loop function->script->traceFragment->object->function // that GC must be able to break. To embedd object into the fragment the // code use prototype chain of depth 2 which caches obj.__proto__.__proto__ // into the fragment. // To make sure that we have no references to the function f after this // function returns due via the conservative scan of the native stack we // loop here multiple times overwriting the stack and registers with new garabge. for (var j = 0; j != 8; ++j) { var f = Function("a", "var s = 0; for (var i = 0; i != 100; ++i) s += a.b; return s;"); var c = {b: 1, f: f, leakDetection: makeFinalizeObserver()}; f({ __proto__: { __proto__: c}}); f = c = a = null; gc(); } } function test() { if (typeof finalizeCount != "function") return; var base = finalizeCount(); leak_test(); gc(); gc(); var n = finalizeCount(); assertEq(base + 4 < finalizeCount(), true, "Some finalizations must happen"); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug602413.js0000644000175000017500000000131611545150464022714 0ustar chr1schr1svar so = []; function U(unusedV) { for (var i = 0; i < so.length; ++i) return false; so.push(0); } function C(v) { if (typeof v == "object" || typeof v == "function") { for (var i = 0; i < 10; ++i) {} U(v); } } function exploreProperties(obj) { var props = []; for (var o = obj; o; o = Object.getPrototypeOf(o)) { props = props.concat(Object.getOwnPropertyNames(o)); } for (var i = 0; i < props.length; ++i) { var p = props[i]; try { var v = obj[p]; C(v); } catch(e) { } } } function boom() { var a = []; var b = function(){}; var c = [{}]; exploreProperties(a); exploreProperties(b); exploreProperties(c); exploreProperties(c); } boom(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug603193.js0000644000175000017500000000036611545150464022726 0ustar chr1schr1sfunction g(code) { f = Function(code); for (a in f()) {} } /* Get call ic in a state to call CompileFunction for new functions. */ g() g("(function(){})") g() /* Call generator with frame created by call ic + CompileFunction. */ g("yield") mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug604210.js0000644000175000017500000000030111545150464022702 0ustar chr1schr1sfunction f() { var msg = ''; try { var x = undefined; print(x.foo); } catch (e) { msg = '' + e; } assertEq(msg, "TypeError: x is undefined"); } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug606138.js0000644000175000017500000000021211545150464022716 0ustar chr1schr1s// The proxy is going to mutate thisv in place. InvokeSessionGuard should be // cool with that with(evalcx(''))[7, 8].map(Int16Array, []) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug607659.js0000644000175000017500000000026711545150464022741 0ustar chr1schr1svar g = 0; Object.defineProperty(RegExp.prototype, 'test', { get:function() { ++g } }); function f() { for (var i = 0; i < 100; ++i) /a/.exec('a'); } f(); assertEq(g, 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug614653.js0000644000175000017500000000040411545150464022722 0ustar chr1schr1s/* Bug 614653 - This test .2 seconds with the fix, 20 minutes without. */ for (var i = 0; i < 100; ++i) { var arr = []; var s = "abcdefghijklmnop"; for (var i = 0; i < 50000; ++i) { s = "<" + s + ">"; arr.push(s); } gc(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug614752.js0000644000175000017500000000022211545150464022720 0ustar chr1schr1s// |jit-test| error: TypeError Object.prototype.apply = Function.prototype.apply; ({}).apply(null, null); // don't assert mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug616119.js0000644000175000017500000000014111545150464022717 0ustar chr1schr1s// don't assert for (a = 0; a < 9; ++a) { M: for (let c in >) { break M } } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug616454.js0000644000175000017500000000013511545150464022724 0ustar chr1schr1sfunction isnan(x) { return x !== x } assertEq(isnan(deserialize(serialize(-'test'))), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug621202.js0000644000175000017500000000037211545150464022712 0ustar chr1schr1sconst MAX = 10000; var arr = []; var str = ""; for (var i = 0; i < MAX; ++i) { /x/.test(str); str = str + 'xxxxxxxxxxxxxx'; arr.push(str); } arr.length = Math.floor(MAX/3); gc(); for (var i = 0; i < MAX; ++i) { /x/.test(arr[i]); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug628564.js0000644000175000017500000000021711545150464022732 0ustar chr1schr1sx = 0 for (a = 0; a < HOTLOOP+5; ++a) { if (a == HOTLOOP-1) { if (!x) { __defineSetter__("x", Object.defineProperties) } } } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug629974.js0000644000175000017500000000017111545150464022737 0ustar chr1schr1sfoo = {} foo.y = 3; foo.y = function () {} Object.defineProperty(foo, "y", { set:function(){} }) gc() delete foo.y gc(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug630064.js0000644000175000017500000000142611545150464022721 0ustar chr1schr1svar BUGNUMBER = ''; function printBugNumber (num) { return "foo"; } function optionsClear() { var x = printBugNumber().split(','); } function optionsReset() { optionsClear(); } var code = new Array(); code.push("evaluate"); var x0 = "\ printBugNumber(BUGNUMBER);\n\ function gen()\n\ {\n\ try {\n\ yield 0;\n\ } finally {\n\ }\n\ }\n\ var iter1 = gen( iter1=\"NaN\", new gen(gen)) ;\n\ gc();\n\ "; code.push(x0); code.push("evaluate"); var files = new Array(); while (true) { var file = code.shift(); if (file == "evaluate") { loadFiles(files); } else if (file == undefined) { break; } else { files.push(file); } } function loadFiles(x) { for (i in x) { try { eval(x[i]); } catch (e) { } } optionsReset(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug634590.js0000644000175000017500000000056111545150464022730 0ustar chr1schr1sthis.name = "outer"; var sb = evalcx(''); sb.name = "inner"; sb.parent = this; function f() { return this.name; } assertEq(evalcx('this.f = parent.f;\n' + 'var s = "";\n' + 'for (i = 0; i < 10; ++i)\n' + ' s += f();\n' + 's', sb), "innerinnerinnerinnerinnerinnerinnerinnerinnerinner"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug634590b.js0000644000175000017500000000117711545150464023076 0ustar chr1schr1sthis.name = "outer"; var sb = evalcx(''); sb.name = "inner"; sb.parent = this; function f() { return this.name; } f.notMuchTodo = '42'; assertEq(evalcx('{\n' + ' let f = parent.f;\n' + ' let name = "block";\n' + ' (function () {\n' + ' eval(f.notMuchTodo);\n' + // reify Block ' var s = "";\n' + ' for (i = 0; i < 10; ++i)\n' + ' s += f();\n' + ' return s;\n' + ' })();\n' + '}', sb), "outerouterouterouterouterouterouterouterouterouter"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug634590c.js0000644000175000017500000000136611545150464023077 0ustar chr1schr1sthis.name = "outer"; var sb = evalcx(''); sb.name = "inner"; sb.parent = this; function f() { return this.name; } f.notMuchTodo = '42'; assertEq(evalcx('(function () {\n' + ' arguments = null;\n' + // force heavyweight ' var f = parent.f;\n' + ' var name = "call";\n' + ' return (function () {\n' + ' eval(f.notMuchTodo);\n' + // reify Call, make f() compile to JSOP_CALLNAME ' var s = "";\n' + ' for (i = 0; i < 10; ++i)\n' + ' s += f();\n' + ' return s;\n' + ' })();\n' + '})()', sb), "outerouterouterouterouterouterouterouterouterouter"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug634590d.js0000644000175000017500000000075311545150464023077 0ustar chr1schr1sthis.name = "outer"; var sb = evalcx(''); sb.name = "inner"; sb.parent = this; this.f = function name(outer) { if (outer) { return function () { return name(false); }(); } return this.name; } assertEq(evalcx('this.f = parent.f;\n' + 'var s = "";\n' + 'for (i = 0; i < 10; ++i)\n' + ' s += f(true);\n' + 's', sb), "outerouterouterouterouterouterouterouterouterouter"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testBug634590ma.js0000644000175000017500000000061411545150464023245 0ustar chr1schr1s// |jit-test| mjitalways; this.name = "outer"; var sb = evalcx(''); sb.name = "inner"; sb.parent = this; function f() { return this.name; } assertEq(evalcx('this.f = parent.f;\n' + 'var s = "";\n' + 'for (i = 0; i < 10; ++i)\n' + ' s += f();\n' + 's', sb), "innerinnerinnerinnerinnerinnerinnerinnerinnerinner"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testCallApply.js0000644000175000017500000001260611545150464023404 0ustar chr1schr1sfunction script1() { return arguments.length; } function script2(x) { return x; } function script3(x) { var o = arguments; return o[0]; } function genClosure() { var x = 3; eval("x = 4"); return function(y) { return x + y } }; var closed1 = genClosure(); var closed2 = genClosure(); var closed3 = genClosure(); var native1 = String.prototype.search; var native2 = String.prototype.match; var tricky1 = { call:function(x,y) { return y }, apply:function(x,y) { return y } }; test0(); test1(); test2(); test3(); function test0() { assertEq(script1.call(null), 0); assertEq(script1.call(null, 1), 1); assertEq(script1.call(null, 1,2), 2); assertEq(native1.call("aabc", /b/), 2); assertEq(native1.call("abc"), -1); assertEq(tricky1.call(null, 9), 9); assertEq(script1.apply(null), 0); assertEq(script1.apply(null, [1]), 1); assertEq(script1.apply(null, [1,2]), 2); assertEq(native1.apply("aabc", [/b/]), 2); assertEq(native1.apply("abc"), -1); assertEq(tricky1.apply(null, 1), 1); } test0(); function test1() { function f(arr) { for (var i = 0; i < 10; ++i) { for (var j = 0; j < arr.length; ++j) { arr[j].call('a'); arr[j].apply('a', []); var arg0 = []; arr[j].apply('a', arg0); (function() { arr[j].apply('a', arguments); })(); arr[j].call('a', 1); arr[j].apply('a', [1]); var arg0 = [1]; arr[j].apply('a', arg0); (function() { arr[j].apply('a', arguments); })(1); arr[j].call('a', 1,'g'); arr[j].apply('a', [1,'g']); var arg0 = [1,'g']; arr[j].apply('a', arg0); (function() { arr[j].apply('a', arguments); })(1,'g'); arr[j].call('a', 1,'g',3,4,5,6,7,8,9); arr[j].apply('a', [1,'g',3,4,5,6,7,8,9]); var arg0 = [1,'g',3,4,5,6,7,8,9]; arr[j].apply('a', arg0); (function() { arr[j].apply('a', arguments); })(1,'g',3,4,5,6,7,8,9); } } } f([script1, script1, script1, script1, script2, script2, script1, script2]); f([script1, script2, script3, script1, script2, script3, script3, script3]); f([script1, script2, script2, script2, script2, script3, script1, script2]); f([script1, script1, script1, native1, native1, native1, native1, script1]); f([native1, native1, native1, native2, native2, native2, native2, native1]); f([native1, native2, native1, native2, native1, native2, native1, native2]); f([native1, native1, native1, script1, script2, script2, native1, script3]); f([closed1, closed1, closed1, closed2, closed2, closed2, script3, script3]); f([closed1, closed2, closed1, closed2, closed1, closed2, closed1, closed2]); f([closed1, closed2, closed3, closed1, closed2, closed3, script1, script2]); f([closed1, closed1, closed1, closed2, closed2, closed2, native1, native2]); f([closed1, closed1, closed1, closed2, closed2, closed2, native1, native2]); f([native1, native1, native1, closed1, closed2, script1, script2, native2]); } // test things that break our speculation function test2() { var threw = false; try { (3).call(null, 1,2); } catch (e) { threw = true; } assertEq(threw, true); var threw = false; try { (3).apply(null, [1,2]); } catch (e) { threw = true; } assertEq(threw, true); var threw = false; try { var arr = [1,2]; (3).apply(null, arr); } catch (e) { threw = true; } assertEq(threw, true); function tryAndFail(o) { var threw = false; try { o.call(null, 1,2); } catch(e) { threw = true; } assertEq(threw, true); threw = false; try { o.apply(null, [1,2]); } catch(e) { threw = true; } assertEq(threw, true); } tryAndFail(1); tryAndFail({}); tryAndFail({call:{}, apply:{}}); tryAndFail({call:function() { throw "not js_fun_call"}, apply:function(){ throw "not js_fun_apply" }}); } // hit the stubs::CompileFunction path function test3() { function genFreshFunction(s) { return new Function(s, "return " + s); } function callIt(f) { assertEq(f.call(null, 1,2), 1); } callIt(script2); callIt(script2); callIt(script2); callIt(script2); callIt(genFreshFunction("x")); callIt(genFreshFunction("y")); callIt(genFreshFunction("z")); function applyIt(f) { var arr = [1,2]; assertEq(f.apply(null, arr), 1); } applyIt(script2); applyIt(script2); applyIt(script2); applyIt(script2); applyIt(genFreshFunction("x")); applyIt(genFreshFunction("y")); applyIt(genFreshFunction("z")); function applyIt1(f) { function g() { assertEq(f.apply(null, arguments), 1); } g(1,2); } applyIt1(script2); applyIt1(script2); applyIt1(script2); applyIt1(script2); applyIt1(genFreshFunction("x")); applyIt1(genFreshFunction("y")); applyIt1(genFreshFunction("z")); function applyIt2(f) { assertEq(f.apply(null, [1,2]), 1); } applyIt2(script2); applyIt2(script2); applyIt2(script2); applyIt2(script2); applyIt2(genFreshFunction("x")); applyIt2(genFreshFunction("y")); applyIt2(genFreshFunction("z")); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testCallElem.js0000644000175000017500000000037311545150464023177 0ustar chr1schr1sfunction testCALLELEM() { function f() { return 5; } function g() { return 7; } var x = [f,f,f,f,g]; var y = 0; for (var i = 0; i < 5; ++i) y = x[i](); return y; } assertEq(testCALLELEM(), 7); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testCallNull.js0000644000175000017500000000021111545150464023216 0ustar chr1schr1sfunction f() {} for (var i = 0; i < HOTLOOP; ++i) { f.call(null); } checkStats({ recorderStarted: 1, recorderAborted: 0 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testCallPick.js0000644000175000017500000000046211545150464023202 0ustar chr1schr1sfunction testCallPick() { function g(x,a) { x.f(); } var x = []; x.f = function() { } var y = []; y.f = function() { } var z = [x,x,x,x,x,y,y,y,y,y]; for (var i = 0; i < 10; ++i) g.call(this, z[i], ""); return true; } assertEq(testCallPick(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testCallProtoMethod.js0000644000175000017500000000060411545150464024556 0ustar chr1schr1sfunction testCallProtoMethod() { function X() { this.x = 1; } X.prototype.getName = function () { return "X"; } function Y() { this.x = 2; } Y.prototype.getName = function() "Y"; var a = [new X, new X, new X, new X, new Y]; var s = ''; for (var i = 0; i < a.length; i++) s += a[i].getName(); return s; } assertEq(testCallProtoMethod(), 'XXXXY'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testCaseAbort.js0000644000175000017500000000042411545150464023361 0ustar chr1schr1sfunction testCaseAbort() { var four = "4"; var r = 0; for (var i = 0; i < 5; i++) { switch (i) { case four: r += 1; break; default: r += 2; break; } } return "" + r; } assertEq(testCaseAbort(), "10"); checkStats({ recorderAborted: 0 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testCaseTypeMismatchBadness.js0000644000175000017500000000047411545150464026226 0ustar chr1schr1sfunction testCaseTypeMismatchBadness() { for (var z = 0; z < 3; ++z) { switch ("") { default: case 9: break; case "": case : break; } } return "no crash"; } assertEq(testCaseTypeMismatchBadness(), "no crash"); checkStats({ recorderAborted: 0 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testChangingObjectWithLength.js0000644000175000017500000000177411545150464026372 0ustar chr1schr1sfunction testChangingObjectWithLength() { var obj = { length: 10 }; var dense = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; var slow = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; slow.slow = 5; /* * The elements of objs constitute a De Bruijn sequence repeated 4x to trace * and run native code for every object and transition. */ var objs = [obj, obj, obj, obj, obj, obj, obj, obj, dense, dense, dense, dense, obj, obj, obj, obj, slow, slow, slow, slow, dense, dense, dense, dense, dense, dense, dense, dense, slow, slow, slow, slow, slow, slow, slow, slow, obj, obj, obj, obj]; var counter = 0; for (var i = 0, sz = objs.length; i < sz; i++) { var o = objs[i]; for (var j = 0; j < o.length; j++) counter++; } return counter; } assertEq(testChangingObjectWithLength(), 400); checkStats({ recorderAborted: 0, sideExitIntoInterpreter: 15 // empirically determined }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testChangingTypeDuringRecording.js0000644000175000017500000000015611545150464027106 0ustar chr1schr1sX = { value: "" } z = 0; for (var i = 0; i < 20; i++) { Object.defineProperty(this, "z", X); z = 1; } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testClosingRecursion.js0000644000175000017500000000050311545150464025004 0ustar chr1schr1s// Test no assert (bug 464089) function shortRecursiveLoop(b, c) { for (var i = 0; i < c; i++) { if (b) shortRecursiveLoop(c - 1); } } function testClosingRecursion() { shortRecursiveLoop(false, 1); shortRecursiveLoop(true, 3); return true; } assertEq(testClosingRecursion(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testClosureIncrSideExit.js0000644000175000017500000000064411545150464025411 0ustar chr1schr1sfunction testClosureIncrSideExit() { let(f = function (y) { let(ff = function (g) { for each(let h in g) { if (++y > 5) { return 'ddd'; } } return 'qqq'; }) { return ff(['', null, '', false, '', '', null]); } }) { return f(-1); } } assertEq(testClosureIncrSideExit(), "ddd"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testClosures.js0000644000175000017500000000057411545150464023323 0ustar chr1schr1sfunction testClosures() { function MyObject(id) { var thisObject = this; this.id = id; this.toString = str; function str() { return "" + this.id + thisObject.id; } } var a = []; for (var i = 0; i < 5; i++) a.push(new MyObject(i)); return a.toString(); } assertEq(testClosures(), "00,11,22,33,44"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testComparisons.js0000644000175000017500000010133011545150464024011 0ustar chr1schr1sfunction testComparisons() { // All the special values from each of the types in // ECMA-262, 3rd ed. section 8 var undefinedType, nullType, booleanType, stringType, numberType, objectType; var types = []; types[undefinedType = 0] = "Undefined"; types[nullType = 1] = "Null"; types[booleanType = 2] = "Boolean"; types[stringType = 3] = "String"; types[numberType = 4] = "Number"; types[objectType = 5] = "Object"; var JSVAL_INT_MIN = -Math.pow(2, 30); var JSVAL_INT_MAX = Math.pow(2, 30) - 1; // Values from every ES3 type, hitting all the edge-case and special values // that can be dreamed up var values = { "undefined": { value: function() { return undefined; }, type: undefinedType }, "null": { value: function() { return null; }, type: nullType }, "true": { value: function() { return true; }, type: booleanType }, "false": { value: function() { return false; }, type: booleanType }, '""': { value: function() { return ""; }, type: stringType }, '"a"': { // a > [, for string-object comparisons value: function() { return "a"; }, type: stringType }, '"Z"': { // Z < [, for string-object comparisons value: function() { return "Z"; }, type: stringType }, "0": { value: function() { return 0; }, type: numberType }, "-0": { value: function() { return -0; }, type: numberType }, "1": { value: function() { return 1; }, type: numberType }, "Math.E": { value: function() { return Math.E; }, type: numberType }, "JSVAL_INT_MIN - 1": { value: function() { return JSVAL_INT_MIN - 1; }, type: numberType }, "JSVAL_INT_MIN": { value: function() { return JSVAL_INT_MIN; }, type: numberType }, "JSVAL_INT_MIN + 1": { value: function() { return JSVAL_INT_MIN + 1; }, type: numberType }, "JSVAL_INT_MAX - 1": { value: function() { return JSVAL_INT_MAX - 1; }, type: numberType }, "JSVAL_INT_MAX": { value: function() { return JSVAL_INT_MAX; }, type: numberType }, "JSVAL_INT_MAX + 1": { value: function() { return JSVAL_INT_MAX + 1; }, type: numberType }, "Infinity": { value: function() { return Infinity; }, type: numberType }, "-Infinity": { value: function() { return -Infinity; }, type: numberType }, "NaN": { value: function() { return NaN; }, type: numberType }, "{}": { value: function() { return {}; }, type: objectType }, "{ valueOf: undefined }": { value: function() { return { valueOf: undefined }; }, type: objectType }, "[]": { value: function() { return []; }, type: objectType }, '[""]': { value: function() { return [""]; }, type: objectType }, '["a"]': { value: function() { return ["a"]; }, type: objectType }, "[0]": { value: function() { return [0]; }, type: objectType } }; var orderOps = { "<": function(a, b) { return a < b; }, ">": function(a, b) { return a > b; }, "<=": function(a, b) { return a <= b; }, ">=": function(a, b) { return a >= b; } }; var eqOps = { "==": function(a, b) { return a == b; }, "!=": function(a, b) { return a != b; }, "===": function(a, b) { return a === b; }, "!==": function(a, b) { return a !== b; } }; var notEqualIncomparable = { eq: { "==": false, "!=": true, "===": false, "!==": true }, order: { "<": false, ">": false, "<=": false, ">=": false } }; var notEqualLessThan = { eq: { "==": false, "!=": true, "===": false, "!==": true }, order: { "<": true, ">": false, "<=": true, ">=": false } }; var notEqualGreaterThan = { eq: { "==": false, "!=": true, "===": false, "!==": true }, order: { "<": false, ">": true, "<=": false, ">=": true } }; var notEqualNorDifferent = { eq: { "==": false, "!=": true, "===": false, "!==": true }, order: { "<": false, ">": false, "<=": true, ">=": true } }; var strictlyEqual = { eq: { "==": true, "!=": false, "===": true, "!==": false }, order: { "<": false, ">": false, "<=": true, ">=": true } }; var looselyEqual = { eq: { "==": true, "!=": false, "===": false, "!==": true }, order: { "<": false, ">": false, "<=": true, ">=": true } }; var looselyEqualNotDifferent = { eq: { "==": true, "!=": false, "===": false, "!==": true }, order: { "<": false, ">": false, "<=": true, ">=": true } }; var looselyEqualIncomparable = { eq: { "==": true, "!=": false, "===": false, "!==": true }, order: { "<": false, ">": false, "<=": false, ">=": false } }; var strictlyEqualNotDifferent = { eq: { "==": true, "!=": false, "===": true, "!==": false }, order: { "<": false, ">": false, "<=": true, ">=": true } }; var strictlyEqualIncomparable = { eq: { "==": true, "!=": false, "===": true, "!==": false }, order: { "<": false, ">": false, "<=": false, ">=": false } }; var comparingZeroToSomething = { "undefined": notEqualIncomparable, "null": notEqualNorDifferent, "true": notEqualLessThan, "false": looselyEqual, '""': looselyEqualNotDifferent, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": strictlyEqual, "-0": strictlyEqual, "1": notEqualLessThan, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": looselyEqual, '[""]': looselyEqual, '["a"]': notEqualIncomparable, "[0]": looselyEqual }; var comparingObjectOrObjectWithValueUndefined = { "undefined": notEqualIncomparable, "null": notEqualIncomparable, "true": notEqualIncomparable, "false": notEqualIncomparable, '""': notEqualGreaterThan, '"a"': notEqualLessThan, '"Z"': notEqualGreaterThan, "0": notEqualIncomparable, "-0": notEqualIncomparable, "1": notEqualIncomparable, "Math.E": notEqualIncomparable, "JSVAL_INT_MIN - 1": notEqualIncomparable, "JSVAL_INT_MIN": notEqualIncomparable, "JSVAL_INT_MIN + 1": notEqualIncomparable, "JSVAL_INT_MAX - 1": notEqualIncomparable, "JSVAL_INT_MAX": notEqualIncomparable, "JSVAL_INT_MAX + 1": notEqualIncomparable, "Infinity": notEqualIncomparable, "-Infinity": notEqualIncomparable, "NaN": notEqualIncomparable, "{}": notEqualNorDifferent, "{ valueOf: undefined }": notEqualNorDifferent, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': notEqualLessThan, "[0]": notEqualGreaterThan }; // Constructed expected-value matrix var expected = { "undefined": { "undefined": strictlyEqualIncomparable, "null": looselyEqualIncomparable, "true": notEqualIncomparable, "false": notEqualIncomparable, '""': notEqualIncomparable, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualIncomparable, "-0": notEqualIncomparable, "1": notEqualIncomparable, "Math.E": notEqualIncomparable, "JSVAL_INT_MIN - 1": notEqualIncomparable, "JSVAL_INT_MIN": notEqualIncomparable, "JSVAL_INT_MIN + 1": notEqualIncomparable, "JSVAL_INT_MAX - 1": notEqualIncomparable, "JSVAL_INT_MAX": notEqualIncomparable, "JSVAL_INT_MAX + 1": notEqualIncomparable, "Infinity": notEqualIncomparable, "-Infinity": notEqualIncomparable, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualIncomparable, '[""]': notEqualIncomparable, '["a"]': notEqualIncomparable, "[0]": notEqualIncomparable }, "null": { "undefined": looselyEqualIncomparable, "null": strictlyEqualNotDifferent, "true": notEqualLessThan, "false": notEqualNorDifferent, '""': notEqualNorDifferent, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualNorDifferent, "-0": notEqualNorDifferent, "1": notEqualLessThan, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualNorDifferent, '[""]': notEqualNorDifferent, '["a"]': notEqualIncomparable, "[0]": notEqualNorDifferent }, "true": { "undefined": notEqualIncomparable, "null": notEqualGreaterThan, "true": strictlyEqual, "false": notEqualGreaterThan, '""': notEqualGreaterThan, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualGreaterThan, "-0": notEqualGreaterThan, "1": looselyEqual, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': notEqualIncomparable, "[0]": notEqualGreaterThan }, "false": { "undefined": notEqualIncomparable, "null": notEqualNorDifferent, "true": notEqualLessThan, "false": strictlyEqual, '""': looselyEqualNotDifferent, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": looselyEqual, "-0": looselyEqual, "1": notEqualLessThan, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": looselyEqual, '[""]': looselyEqual, '["a"]': notEqualIncomparable, "[0]": looselyEqual }, '""': { "undefined": notEqualIncomparable, "null": notEqualNorDifferent, "true": notEqualLessThan, "false": looselyEqual, '""': strictlyEqual, '"a"': notEqualLessThan, '"Z"': notEqualLessThan, "0": looselyEqual, "-0": looselyEqual, "1": notEqualLessThan, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualLessThan, "{ valueOf: undefined }": notEqualLessThan, "[]": looselyEqual, '[""]': looselyEqual, '["a"]': notEqualLessThan, "[0]": notEqualLessThan }, '"a"': { "undefined": notEqualIncomparable, "null": notEqualIncomparable, "true": notEqualIncomparable, "false": notEqualIncomparable, '""': notEqualGreaterThan, '"a"': strictlyEqual, '"Z"': notEqualGreaterThan, "0": notEqualIncomparable, "-0": notEqualIncomparable, "1": notEqualIncomparable, "Math.E": notEqualIncomparable, "JSVAL_INT_MIN - 1": notEqualIncomparable, "JSVAL_INT_MIN": notEqualIncomparable, "JSVAL_INT_MIN + 1": notEqualIncomparable, "JSVAL_INT_MAX - 1": notEqualIncomparable, "JSVAL_INT_MAX": notEqualIncomparable, "JSVAL_INT_MAX + 1": notEqualIncomparable, "Infinity": notEqualIncomparable, "-Infinity": notEqualIncomparable, "NaN": notEqualIncomparable, "{}": notEqualGreaterThan, "{ valueOf: undefined }": notEqualGreaterThan, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': looselyEqualNotDifferent, "[0]": notEqualGreaterThan }, '"Z"': { "undefined": notEqualIncomparable, "null": notEqualIncomparable, "true": notEqualIncomparable, "false": notEqualIncomparable, '""': notEqualGreaterThan, '"a"': notEqualLessThan, '"Z"': strictlyEqual, "0": notEqualIncomparable, "-0": notEqualIncomparable, "1": notEqualIncomparable, "Math.E": notEqualIncomparable, "JSVAL_INT_MIN - 1": notEqualIncomparable, "JSVAL_INT_MIN": notEqualIncomparable, "JSVAL_INT_MIN + 1": notEqualIncomparable, "JSVAL_INT_MAX - 1": notEqualIncomparable, "JSVAL_INT_MAX": notEqualIncomparable, "JSVAL_INT_MAX + 1": notEqualIncomparable, "Infinity": notEqualIncomparable, "-Infinity": notEqualIncomparable, "NaN": notEqualIncomparable, "{}": notEqualLessThan, "{ valueOf: undefined }": notEqualLessThan, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': notEqualLessThan, "[0]": notEqualGreaterThan }, "0": comparingZeroToSomething, "-0": comparingZeroToSomething, "1": { "undefined": notEqualIncomparable, "null": notEqualGreaterThan, "true": looselyEqual, "false": notEqualGreaterThan, '""': notEqualGreaterThan, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualGreaterThan, "-0": notEqualGreaterThan, "1": strictlyEqual, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': notEqualIncomparable, "[0]": notEqualGreaterThan }, "Math.E": { "undefined": notEqualIncomparable, "null": notEqualGreaterThan, "true": notEqualGreaterThan, "false": notEqualGreaterThan, '""': notEqualGreaterThan, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualGreaterThan, "-0": notEqualGreaterThan, "1": notEqualGreaterThan, "Math.E": strictlyEqual, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': notEqualIncomparable, "[0]": notEqualGreaterThan }, "JSVAL_INT_MIN - 1": { "undefined": notEqualIncomparable, "null": notEqualLessThan, "true": notEqualLessThan, "false": notEqualLessThan, '""': notEqualLessThan, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualLessThan, "-0": notEqualLessThan, "1": notEqualLessThan, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": strictlyEqual, "JSVAL_INT_MIN": notEqualLessThan, "JSVAL_INT_MIN + 1": notEqualLessThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualLessThan, '[""]': notEqualLessThan, '["a"]': notEqualIncomparable, "[0]": notEqualLessThan }, "JSVAL_INT_MIN": { "undefined": notEqualIncomparable, "null": notEqualLessThan, "true": notEqualLessThan, "false": notEqualLessThan, '""': notEqualLessThan, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualLessThan, "-0": notEqualLessThan, "1": notEqualLessThan, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": strictlyEqual, "JSVAL_INT_MIN + 1": notEqualLessThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualLessThan, '[""]': notEqualLessThan, '["a"]': notEqualIncomparable, "[0]": notEqualLessThan }, "JSVAL_INT_MIN + 1": { "undefined": notEqualIncomparable, "null": notEqualLessThan, "true": notEqualLessThan, "false": notEqualLessThan, '""': notEqualLessThan, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualLessThan, "-0": notEqualLessThan, "1": notEqualLessThan, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": strictlyEqual, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualLessThan, '[""]': notEqualLessThan, '["a"]': notEqualIncomparable, "[0]": notEqualLessThan }, "JSVAL_INT_MAX - 1": { "undefined": notEqualIncomparable, "null": notEqualGreaterThan, "true": notEqualGreaterThan, "false": notEqualGreaterThan, '""': notEqualGreaterThan, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualGreaterThan, "-0": notEqualGreaterThan, "1": notEqualGreaterThan, "Math.E": notEqualGreaterThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": strictlyEqual, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': notEqualIncomparable, "[0]": notEqualGreaterThan }, "JSVAL_INT_MAX": { "undefined": notEqualIncomparable, "null": notEqualGreaterThan, "true": notEqualGreaterThan, "false": notEqualGreaterThan, '""': notEqualGreaterThan, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualGreaterThan, "-0": notEqualGreaterThan, "1": notEqualGreaterThan, "Math.E": notEqualGreaterThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualGreaterThan, "JSVAL_INT_MAX": strictlyEqual, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': notEqualIncomparable, "[0]": notEqualGreaterThan }, "JSVAL_INT_MAX + 1": { "undefined": notEqualIncomparable, "null": notEqualGreaterThan, "true": notEqualGreaterThan, "false": notEqualGreaterThan, '""': notEqualGreaterThan, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualGreaterThan, "-0": notEqualGreaterThan, "1": notEqualGreaterThan, "Math.E": notEqualGreaterThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualGreaterThan, "JSVAL_INT_MAX": notEqualGreaterThan, "JSVAL_INT_MAX + 1": strictlyEqual, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': notEqualIncomparable, "[0]": notEqualGreaterThan }, "Infinity": { "undefined": notEqualIncomparable, "null": notEqualGreaterThan, "true": notEqualGreaterThan, "false": notEqualGreaterThan, '""': notEqualGreaterThan, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualGreaterThan, "-0": notEqualGreaterThan, "1": notEqualGreaterThan, "Math.E": notEqualGreaterThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualGreaterThan, "JSVAL_INT_MAX": notEqualGreaterThan, "JSVAL_INT_MAX + 1": notEqualGreaterThan, "Infinity": strictlyEqual, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': notEqualIncomparable, "[0]": notEqualGreaterThan }, "-Infinity": { "undefined": notEqualIncomparable, "null": notEqualLessThan, "true": notEqualLessThan, "false": notEqualLessThan, '""': notEqualLessThan, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualLessThan, "-0": notEqualLessThan, "1": notEqualLessThan, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualLessThan, "JSVAL_INT_MIN": notEqualLessThan, "JSVAL_INT_MIN + 1": notEqualLessThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": strictlyEqual, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualLessThan, '[""]': notEqualLessThan, '["a"]': notEqualIncomparable, "[0]": notEqualLessThan }, "NaN": { "undefined": notEqualIncomparable, "null": notEqualIncomparable, "true": notEqualIncomparable, "false": notEqualIncomparable, '""': notEqualIncomparable, '"a"': notEqualIncomparable, '"Z"': notEqualIncomparable, "0": notEqualIncomparable, "-0": notEqualIncomparable, "1": notEqualIncomparable, "Math.E": notEqualIncomparable, "JSVAL_INT_MIN - 1": notEqualIncomparable, "JSVAL_INT_MIN": notEqualIncomparable, "JSVAL_INT_MIN + 1": notEqualIncomparable, "JSVAL_INT_MAX - 1": notEqualIncomparable, "JSVAL_INT_MAX": notEqualIncomparable, "JSVAL_INT_MAX + 1": notEqualIncomparable, "Infinity": notEqualIncomparable, "-Infinity": notEqualIncomparable, "NaN": notEqualIncomparable, "{}": notEqualIncomparable, "{ valueOf: undefined }": notEqualIncomparable, "[]": notEqualIncomparable, '[""]': notEqualIncomparable, '["a"]': notEqualIncomparable, "[0]": notEqualIncomparable }, "{}": comparingObjectOrObjectWithValueUndefined, "{ valueOf: undefined }": comparingObjectOrObjectWithValueUndefined, "[]": { "undefined": notEqualIncomparable, "null": notEqualNorDifferent, "true": notEqualLessThan, "false": looselyEqual, '""': looselyEqual, '"a"': notEqualLessThan, '"Z"': notEqualLessThan, "0": looselyEqual, "-0": looselyEqual, "1": notEqualLessThan, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualLessThan, "{ valueOf: undefined }": notEqualLessThan, "[]": notEqualNorDifferent, '[""]': notEqualNorDifferent, '["a"]': notEqualLessThan, "[0]": notEqualLessThan }, '[""]': { "undefined": notEqualIncomparable, "null": notEqualNorDifferent, "true": notEqualLessThan, "false": looselyEqual, '""': looselyEqual, '"a"': notEqualLessThan, '"Z"': notEqualLessThan, "0": looselyEqual, "-0": looselyEqual, "1": notEqualLessThan, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualLessThan, "{ valueOf: undefined }": notEqualLessThan, "[]": notEqualNorDifferent, '[""]': notEqualNorDifferent, '["a"]': notEqualLessThan, "[0]": notEqualLessThan }, '["a"]': { "undefined": notEqualIncomparable, "null": notEqualIncomparable, "true": notEqualIncomparable, "false": notEqualIncomparable, '""': notEqualGreaterThan, '"a"': looselyEqual, '"Z"': notEqualGreaterThan, "0": notEqualIncomparable, "-0": notEqualIncomparable, "1": notEqualIncomparable, "Math.E": notEqualIncomparable, "JSVAL_INT_MIN - 1": notEqualIncomparable, "JSVAL_INT_MIN": notEqualIncomparable, "JSVAL_INT_MIN + 1": notEqualIncomparable, "JSVAL_INT_MAX - 1": notEqualIncomparable, "JSVAL_INT_MAX": notEqualIncomparable, "JSVAL_INT_MAX + 1": notEqualIncomparable, "Infinity": notEqualIncomparable, "-Infinity": notEqualIncomparable, "NaN": notEqualIncomparable, "{}": notEqualGreaterThan, "{ valueOf: undefined }": notEqualGreaterThan, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': notEqualNorDifferent, "[0]": notEqualGreaterThan }, "[0]": { "undefined": notEqualIncomparable, "null": notEqualNorDifferent, "true": notEqualLessThan, "false": looselyEqual, '""': notEqualGreaterThan, '"a"': notEqualLessThan, '"Z"': notEqualLessThan, "0": looselyEqual, "-0": looselyEqual, "1": notEqualLessThan, "Math.E": notEqualLessThan, "JSVAL_INT_MIN - 1": notEqualGreaterThan, "JSVAL_INT_MIN": notEqualGreaterThan, "JSVAL_INT_MIN + 1": notEqualGreaterThan, "JSVAL_INT_MAX - 1": notEqualLessThan, "JSVAL_INT_MAX": notEqualLessThan, "JSVAL_INT_MAX + 1": notEqualLessThan, "Infinity": notEqualLessThan, "-Infinity": notEqualGreaterThan, "NaN": notEqualIncomparable, "{}": notEqualLessThan, "{ valueOf: undefined }": notEqualLessThan, "[]": notEqualGreaterThan, '[""]': notEqualGreaterThan, '["a"]': notEqualLessThan, "[0]": notEqualNorDifferent } }; var failures = []; function fail(a, ta, b, tb, ex, ac, op) { failures.push("(" + a + " " + op + " " + b + ") wrong: " + "expected " + ex + ", got " + ac + " (types " + types[ta] + ", " + types[tb] + ")"); } var result = false; for (var i in values) { for (var j in values) { // Constants, so hoist to help JIT know that var vala = values[i], valb = values[j]; var a = vala.value(), b = valb.value(); for (var opname in orderOps) { var op = orderOps[opname]; var expect = expected[i][j].order[opname]; var failed = false; for (var iter = 0; iter < 5; iter++) { result = op(a, b); failed = failed || result !== expect; } if (failed) fail(i, vala.type, j, valb.type, expect, result, opname); } for (var opname in eqOps) { var op = eqOps[opname]; var expect = expected[i][j].eq[opname]; var failed = false; for (var iter = 0; iter < 5; iter++) { result = op(a, b); failed = failed || result !== expect; } if (failed) fail(i, vala.type, j, valb.type, expect, result, opname); } } } if (failures.length == 0) return "no failures reported!"; return "\n" + failures.join(",\n"); } assertEq(testComparisons(), "no failures reported!"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testConcatNWithSideEffects.js0000644000175000017500000000050711545150464026006 0ustar chr1schr1svar log; function b(x) { log += 'b'; return 'B'; } function g() { log = ''; var a = {toString: function () { log += 'a'; return 'A'; }}; assertEq("[" + a + b() + "]", "[AB]"); assertEq(log, "ab"); } for (var i = 0; i < 1000; ++i) g(); checkStats({recorderStarted:1, recorderAborted:0, traceCompleted:1}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testConstantBooleanExpr.js0000644000175000017500000000023411545150464025445 0ustar chr1schr1sfunction testConstantBooleanExpr() { for (var j = 0; j < 3; ++j) { if(true <= true) { } } return "ok"; } assertEq(testConstantBooleanExpr(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testConstIf.js0000644000175000017500000000020611545150464023061 0ustar chr1schr1sfunction testConstIf() { var x; for (var j=0;j<5;++j) { if (1.1 || 5) { } x = 2;} return x; } assertEq(testConstIf(), 2); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testConstructorArgs-1.js0000644000175000017500000000034411545150464025017 0ustar chr1schr1sfunction f(a, b) { this.a = a; assertEq(b, 'x'); } for (var x = 0; x < RUNLOOP; ++x) { f.prototype = {}; var obj = new f(x, 'x'); assertEq(obj.a, x); assertEq(Object.getPrototypeOf(obj), f.prototype); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testConstructorArgs-2.js0000644000175000017500000000044211545150464025017 0ustar chr1schr1sfunction f(a, b, c) { this.a = a; assertEq(b, 'x'); assertEq(c, void 0); } for (var x = 0; x < RUNLOOP; ++x) { f.prototype = {}; var obj = new f(x, 'x'); // fewer than f.length arguments assertEq(obj.a, x); assertEq(Object.getPrototypeOf(obj), f.prototype); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testConstructorArgs-3.js0000644000175000017500000000041511545150464025020 0ustar chr1schr1sfunction f(a) { this.a = a; assertEq(arguments[1], 'x'); } for (var x = 0; x < RUNLOOP; ++x) { f.prototype = {}; var obj = new f(x, 'x'); // more than f.length arguments assertEq(obj.a, x); assertEq(Object.getPrototypeOf(obj), f.prototype); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testConstructorBail.js0000644000175000017500000000015311545150464024632 0ustar chr1schr1sfunction testConstructorBail() { for (let i = 0; i < 5; ++i) new Number(/x/); } testConstructorBail(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testConstSwitch.js0000644000175000017500000000050111545150464023762 0ustar chr1schr1s// No test case, just make sure this doesn't assert. function testNegZero2() { var z = 0; for (let j = 0; j < 5; ++j) { ({p: (-z)}); } } testNegZero2(); function testConstSwitch() { var x; for (var j=0;j<5;++j) { switch(1.1) { case NaN: case 2: } x = 2; } return x; } assertEq(testConstSwitch(), 2); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testConstSwitch2.js0000644000175000017500000000022411545150464024046 0ustar chr1schr1sfunction testConstSwitch2() { var x; for (var j = 0; j < 4; ++j) { switch(0/0) { } } return "ok"; } assertEq(testConstSwitch2(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testContinue.js0000644000175000017500000000031311545150464023277 0ustar chr1schr1sfunction testContinue() { var i; var total = 0; for (i = 0; i < 20; ++i) { if (i == 11) continue; total++; } return total; } assertEq(testContinue(), 19); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testContinueWithLabel.js0000644000175000017500000000047411545150464025103 0ustar chr1schr1sfunction testContinueWithLabel() { var i = 0; var j = 20; checkiandj : while (i < 10) { i += 1; checkj : while (j > 10) { j -= 1; if ((j % 2) == 0) continue checkj; } } return i + j; } assertEq(testContinueWithLabel(), 20); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testContinueWithLabel2.js0000644000175000017500000000027511545150464025164 0ustar chr1schr1souter: for (var i = 10; i < 19; i++) for (var j = 0; j < 9; j++) if (j < i) continue outer; checkStats({recorderStarted: 3, recorderAborted: 1, traceCompleted: 2});mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testContinueWithLabel3.js0000644000175000017500000000020611545150464025157 0ustar chr1schr1s// bug 511575 comment 3 outer: for (var j = 0; j < 10; j++) for (var p in {x:1}) if (p > "q") continue outer; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testContinueWithLabel4.js0000644000175000017500000000064611545150464025170 0ustar chr1schr1s// bug 511575 Function.prototype.X = 42; function ownProperties() { var props = {}; var r = function () {}; outer: for (var a in r) { for (var b in r) { if (a == b) { continue outer; } } print("SHOULD NOT BE REACHED"); props[a] = true; } return props; } for (var i = 0; i < 12; ++i) { print(i); ownProperties(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testConvertibleObjectEqUndefined.js0000644000175000017500000000200711545150464027230 0ustar chr1schr1sfunction x4(v) { return "" + v + v + v + v; } function testConvertibleObjectEqUndefined() { var compares = [ false, false, false, false, undefined, undefined, undefined, undefined, false, false, false, false, undefined, undefined, undefined, undefined, false, false, false, false, undefined, undefined, undefined, undefined, false, false, false, false, undefined, undefined, undefined, undefined, false, false, false, false, undefined, undefined, undefined, undefined, ]; var count = 0; var obj = { valueOf: function() { count++; return 1; } }; var results = compares.map(function(v) { return "unwritten"; }); for (var i = 0, sz = compares.length; i < sz; i++) results[i] = compares[i] == obj; return results.join("") + count; } assertEq(testConvertibleObjectEqUndefined(), x4(false) + x4(false) + x4(false) + x4(false) + x4(false) + x4(false) + x4(false) + x4(false) + x4(false) + x4(false) + "20"); checkStats({ sideExitIntoInterpreter: 3 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testCustomIterator.js0000644000175000017500000000161311545150464024503 0ustar chr1schr1sfunction my_iterator_next() { if (this.i == 10) { this.i = 0; throw this.StopIteration; } return this.i++; } function testCustomIterator() { var o = { __iterator__: function () { return { i: 0, next: my_iterator_next, StopIteration: StopIteration }; } }; var a=[]; for (var k = 0; k < 100; k += 10) { for(var j in o) { a[k + (j >> 0)] = j*k; } } return a.join(); } assertEq(testCustomIterator(), "0,0,0,0,0,0,0,0,0,0,0,10,20,30,40,50,60,70,80,90,0,20,40,60,80,100,120,140,160,180,0,30,60,90,120,150,180,210,240,270,0,40,80,120,160,200,240,280,320,360,0,50,100,150,200,250,300,350,400,450,0,60,120,180,240,300,360,420,480,540,0,70,140,210,280,350,420,490,560,630,0,80,160,240,320,400,480,560,640,720,0,90,180,270,360,450,540,630,720,810"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDateNow.js0000644000175000017500000000066611545150464023067 0ustar chr1schr1sfunction testDateNow() { // Accessing global.Date for the first time will change the global shape, // so do it before the loop starts; otherwise we have to loop an extra time // to pick things up. var time = Date.now(); for (var j = 0; j < RUNLOOP; ++j) time = Date.now(); return "ok"; } assertEq(testDateNow(), "ok"); checkStats({ recorderStarted: 1, recorderAborted: 0, traceTriggered: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDecayingInnerLoop.js0000644000175000017500000000031311545150464025064 0ustar chr1schr1sfunction testDecayingInnerLoop() { var i, j, k = 10; for (i = 0; i < 5000; ++i) { for (j = 0; j < k; ++j); --k; } return i; } assertEq(testDecayingInnerLoop(), 5000); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDecElem1.js0000644000175000017500000000042011545150464023071 0ustar chr1schr1svar obj = {p: 100}; var name = "p"; var a = []; for (var i = 0; i < 10; i++) a[i] = --obj[name]; assertEq(a.join(','), '99,98,97,96,95,94,93,92,91,90'); assertEq(obj.p, 90); checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDecElem2.js0000644000175000017500000000047311545150464023102 0ustar chr1schr1svar obj = {s: ""}; var name = "s"; var a = []; for (var i = 0; i <= RECORDLOOP + 5; i++) { a[i] = 'x'; if (i > RECORDLOOP) a[i] = --obj[name]; // first recording changes obj.s from string to number } assertEq(a.join(','), Array(RECORDLOOP + 2).join('x,') + '-1,-2,-3,-4,-5'); assertEq(obj.s, -5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDeepBail1.js0000644000175000017500000000016711545150464023250 0ustar chr1schr1sfunction testDeepBail1() { var y = ; for (var i = 0; i < RUNLOOP; i++) "" in y; } testDeepBail1(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDeepBailFromHasInstance.js0000644000175000017500000000052311545150464026130 0ustar chr1schr1svar arr = [StopIteration, StopIteration, StopIteration, StopIteration, {}]; var obj = {}; var x; var result = 'no error'; try { for (var i = 0; i < arr.length; i++) x = (obj instanceof arr[i]); // last iteration throws, triggering deep bail } catch (exc) { result = exc.constructor.name; } assertEq(result, 'TypeError'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDeepBailInMoreIter.js0000644000175000017500000000013611545150464025121 0ustar chr1schr1sw = (function() { yield })(); w.next(); for (var i = 0; i < 100; ++i) { for (v in w) {} } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDeepBailWhileRecording.js0000644000175000017500000000061611545150464026014 0ustar chr1schr1svar o = {}; var arr = [o,o,o,o,o,o,o,o,o,o,o,o,o]; var out = []; const OUTER = 10; for (var i = 0; i < 10; ++i) { for (var j = 0; j < arr.length; ++j) { out.push(String.prototype.indexOf.call(arr[i], 'object')); } } assertEq(out.length, 10 * arr.length); for (var i = 0; i < out.length; ++i) assertEq(out[i], 1); checkStats({ traceCompleted:2, recorderAborted:1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDeepPropertyShadowing.js0000644000175000017500000000053511545150464026007 0ustar chr1schr1sfunction testDeepPropertyShadowing() { function h(node) { var x = 0; while (node) { x++; node = node.parent; } return x; } var tree = {__proto__: {__proto__: {parent: null}}}; h(tree); h(tree); tree.parent = {}; assertEq(h(tree), 2); } testDeepPropertyShadowing(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDefinePropertyAcrossCompartment.js0000644000175000017500000000014511545150464030042 0ustar chr1schr1svar a = evalcx(''); Object.defineProperty(a, "", ({ get: function() {}, })) gc() // don't crash mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDenseArrayProp.js0000644000175000017500000000045111545150464024414 0ustar chr1schr1sfunction testDenseArrayProp() { [].__proto__.x = 1; ({}).__proto__.x = 2; var a = [[],[],[],({}).__proto__]; for (var i = 0; i < a.length; ++i) uneval(a[i].x); delete [].__proto__.x; delete ({}).__proto__.x; return "ok"; } assertEq(testDenseArrayProp(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDenseToSlowArray.js0000644000175000017500000001001111545150464024714 0ustar chr1schr1s// test dense -> slow array transitions during the recording and on trace // for various array functions and property accessors function test_set_elem() { function f() { var bag = []; for (var i = 0; i != 100; ++i) { var a = [0]; a[100*100] = i; bag.push(a); } for (var i = 0; i != 100; ++i) { var a = [0]; a[200 + i] = i; bag.push(a); } return bag; } var bag = f(); for (var i = 0; i != 100; ++i) { var a = bag[i]; assertEq(a.length, 100 * 100 + 1); assertEq(a[100*100], i); assertEq(a[0], 0); assertEq(1 + i in a, false); } for (var i = 0; i != 100; ++i) { var a = bag[100 + i]; assertEq(a.length, 200 + i + 1); assertEq(a[200 + i], i); assertEq(a[0], 0); assertEq(1 + i in a, false); } } function test_reverse() { function prepare_arays() { var bag = []; var base_index = 245; for (var i = 0; i != 50; ++i) { var a = [1, 2, 3, 4, 5]; a.length = i + base_index; bag.push(a); } return bag; } function test(bag) { for (var i = 0; i != bag.length; ++i) { var a = bag[i]; a.reverse(); a[0] = 1; } } var bag = prepare_arays(); test(bag); for (var i = 0; i != bag.length; ++i) { var a = bag[i]; assertEq(a[0], 1); for (var j = 1; j <= 5; ++j) { assertEq(a[a.length - j], j); } for (var j = 1; j < a.length - 5; ++j) { assertEq(j in a, false); } } } function test_push() { function prepare_arays() { var bag = []; var base_index = 245; for (var i = 0; i != 50; ++i) { var a = [0]; a.length = i + base_index; bag.push(a); } return bag; } function test(bag) { for (var i = 0; i != bag.length; ++i) { var a = bag[i]; a.push(2); a[0] = 1; } } var bag = prepare_arays(); test(bag); for (var i = 0; i != bag.length; ++i) { var a = bag[i]; assertEq(a[0], 1); assertEq(a[a.length - 1], 2); for (var j = 1; j < a.length - 1; ++j) { assertEq(j in a, false); } } } function test_unshift() { function prepare_arays() { var bag = []; var base_index = 245; for (var i = 0; i != 50; ++i) { var a = [0]; a.length = i + base_index; bag.push(a); } return bag; } function test(bag) { for (var i = 0; i != bag.length; ++i) { var a = bag[i]; a.unshift(1); a[2] = 2; } } var bag = prepare_arays(); test(bag); for (var i = 0; i != bag.length; ++i) { var a = bag[i]; assertEq(a[0], 1); assertEq(a[1], 0); assertEq(a[2], 2); for (var j = 3; j < a.length; ++j) { assertEq(j in a, false); } } } function test_splice() { function prepare_arays() { var bag = []; var base_index = 245; for (var i = 0; i != 50; ++i) { var a = [1, 2]; a.length = i + base_index; bag.push(a); } return bag; } function test(bag) { for (var i = 0; i != bag.length; ++i) { var a = bag[i]; a.splice(1, 0, "a", "b", "c"); a[2] = 100; } } var bag = prepare_arays(); test(bag); for (var i = 0; i != bag.length; ++i) { var a = bag[i]; assertEq(a[0], 1); assertEq(a[1], "a"); assertEq(a[2], 100); assertEq(a[3], "c"); assertEq(a[4], 2); for (var j = 5; j < a.length; ++j) { assertEq(j in a, false); } } } test_set_elem(); test_reverse(); test_push(); test_unshift(); test_splice(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDestructuring.js0000644000175000017500000000033411545150464024360 0ustar chr1schr1sfunction testDestructuring() { var t = 0; for (var i = 0; i < HOTLOOP + 1; ++i) { var [r, g, b] = [1, 1, 1]; t += r + g + b; } return t } assertEq(testDestructuring(), (HOTLOOP + 1) * 3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDifferingArgc.js0000644000175000017500000000052011545150464024205 0ustar chr1schr1sfunction doTestDifferingArgc(a, b) { var k = 0; for (var i = 0; i < 10; i++) { k += i; } return k; } function testDifferingArgc() { var x = 0; x += doTestDifferingArgc(1, 2); x += doTestDifferingArgc(1); x += doTestDifferingArgc(1, 2, 3); return x; } assertEq(testDifferingArgc(), 45*3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDivision.js0000644000175000017500000000024311545150464023301 0ustar chr1schr1sfunction testDivision() { var a = 32768; var b; while (b !== 1) { b = a / 2; a = b; } return a; } assertEq(testDivision(), 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug613151.js0000644000175000017500000000046311545150464022057 0ustar chr1schr1s// Iterating over a property with an XML id. function n() {} function g() {} eval("\ function a() {}\ function b() {\ for (w in this) {}\ Object.defineProperty(\ this, \ new QName, \ ({enumerable: true})\ )\ }\ for (z in [0, 0, 0]) b()\ ") // Test it doesn't assert. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug613399.js0000644000175000017500000000005311545150464022070 0ustar chr1schr1s// don't assert /((?=()+))?/.exec(""); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug614915.js0000644000175000017500000000010011545150464022054 0ustar chr1schr1svar s = [undefined, undefined].sort(); assertEq(s.length, 2); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug616762.js0000644000175000017500000000074211545150464022072 0ustar chr1schr1s// vim: set ts=4 sw=4 tw=99 et: document = { ready: function (x) { this.exec = x; } }; var $ = function (x) { return document; }; (function ($) { eval("(function(){\n" + " var Private={};\n" + " $(document).ready(function(){\n" + " init()\n" + " });\n" + " function init(){\n" + " $(Private)\n" + " };\n" + "})();"); })($); document.exec(); // Don't crash or assert. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug617139.js0000644000175000017500000000015111545150464022063 0ustar chr1schr1s// |jit-test| error: InternalError // don't assert gczeal(2) function x() { [null].some(x) } x(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug617171.js0000644000175000017500000000013311545150464022057 0ustar chr1schr1svar a = 6; Object.defineProperty(this, "a", {writable: false}); a = 7; assertEq(a, 6); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug618350.js0000644000175000017500000000100211545150464022053 0ustar chr1schr1s var global = 0; Object.defineProperty(Object.prototype, 0, {set: function() { global++; }}); for (var x = 0; x < 20; ++x) [1,2]; assertEq(global, 0); Object.defineProperty(Object.prototype, 1, {set: function() { global++; }}); for (var x = 0; x < 20; ++x) [1,2]; assertEq(global, 0); Object.defineProperty(Object.prototype, "b", {set: function() { global++; }}); for (var x = 0; x < 20; ++x) { var s = { a:0, b:1, 0: 2, 1: 3 }; } assertEq(global, 0); assertEq([42][0], 42); assertEq([42].length, 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug618577.js0000644000175000017500000000013211545150464022071 0ustar chr1schr1svar x = Uint32Array(); for (var i = 0; i < 100; i++) x[77] = x[77]; // Don't assert. mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/bug619004.js0000644000175000017500000000005611545150464022060 0ustar chr1schr1s// don't crash gczeal(2) evalcx('split') mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testElemInc1.js0000644000175000017500000000043311545150464023113 0ustar chr1schr1svar obj = {p: 100}; var name = "p"; var a = []; for (var i = 0; i < 10; i++) a[i] = obj[name]++; assertEq(a.join(','), '100,101,102,103,104,105,106,107,108,109'); assertEq(obj.p, 110); checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testElemInc2.js0000644000175000017500000000030711545150464023114 0ustar chr1schr1svar obj = {s: ""}; var name = "s"; for (var i = 0; i <= RECORDLOOP + 5; i++) if (i > RECORDLOOP) obj[name]++; // first recording changes obj.s from string to number assertEq(obj.s, 5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testEliminatedGuardWithinAnchor.js0000644000175000017500000000041611545150464027073 0ustar chr1schr1sfunction testEliminatedGuardWithinAnchor() { for (let i = 0; i < 5; ++i) { i / (i * i); } return "ok"; } assertEq(testEliminatedGuardWithinAnchor(), "ok"); if (HAVE_TM) { checkStats({ sideExitIntoInterpreter: (jitstats.archIsARM ? 1 : 3) }); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testEqFalseEmptyString.js0000644000175000017500000000027511545150464025250 0ustar chr1schr1sfunction testEqFalseEmptyString() { var x = []; for (var i=0;i<5;++i) x.push(false == ""); return x.join(","); } assertEq(testEqFalseEmptyString(), "true,true,true,true,true"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testErrorReportIn_getPrototypeOf.js0000644000175000017500000000027611545150464027351 0ustar chr1schr1sactual = ""; expect = "TypeError: \"kittens\" is not an object"; try { Object.getPrototypeOf.apply(null, ["kittens",4,3]) } catch (e) { actual = "" + e; } assertEq(actual, expect); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testEvalCalledFromWatchOverSetter.js0000644000175000017500000000011011545150464027340 0ustar chr1schr1sthis.__defineSetter__("x", function(){}); this.watch("x", eval); x = 0; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testEvalInFunctionCallee.js0000644000175000017500000000010711545150464025506 0ustar chr1schr1sfunction f(x,y) { eval("assertEq(arguments.callee, f)"); } f(1,2); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testExistingPropToJoinedMethodAttempt-2.js0000644000175000017500000000027711545150464030452 0ustar chr1schr1sfunction f() { var a = [], i, N = HOTLOOP + 2; for (i = 0; i < N; i++) a[i] = {m: i, m: function() { return 0; }}; assertEq(a[N - 2].m === a[N - 1].m, false); } f(); f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testExistingPropToJoinedMethodAttempt-3.js0000644000175000017500000000052211545150464030444 0ustar chr1schr1sfunction f() { var a = [], i, N = HOTLOOP + 2; for (i = 0; i < N; i++) { a[i] = {}; a[i].m = function() { return 0; }; a[i].m = function() { return 1; }; } assertEq(a[N - 2].m === a[N - 1].m, false); for (i = 0; i < N; i++) { var f = a[i].m; assertEq(f(), 1); } } f(); f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testExistingPropToJoinedMethodAttempt-4.js0000644000175000017500000000045411545150464030451 0ustar chr1schr1sfunction f() { var a = [], i, N = HOTLOOP + 2; for (i = 0; i < N; i++) a[i] = {m: function() { return 0; }, m: function() { return 1; }}; assertEq(a[N - 2].m === a[N - 1].m, false); for (i = 0; i < N; i++) { var f = a[i].m; assertEq(f(), 1); } } f(); f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testExistingPropToJoinedMethodAttempt.js0000644000175000017500000000035111545150464030304 0ustar chr1schr1sfunction f() { var a = [], i, N = HOTLOOP + 2; for (i = 0; i < N; i++) a[i] = {m: i}; for (i = 0; i < N; i++) a[i].m = function() { return 0; }; assertEq(a[N - 2].m === a[N - 1].m, false); } f(); f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testFewerGlobalsInInnerTree.js0000644000175000017500000000055211545150464026177 0ustar chr1schr1sfunction testFewerGlobalsInInnerTree() { for each (a in [new Number(1), new Number(1), {}, {}, new Number(1)]) { for each (b in [2, "", 2, "", "", ""]) { for each (c in [{}, {}, 3, 3, 3, 3, {}, {}]) { 4 + a; } } } delete a; delete b; delete c; return "ok"; } assertEq(testFewerGlobalsInInnerTree(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testFloatArrayIndex.js0000644000175000017500000000031211545150464024546 0ustar chr1schr1sfunction testFloatArrayIndex() { var a = []; for (var i = 0; i < 10; ++i) { a[3] = 5; a[3.5] = 7; } return a[3] + "," + a[3.5]; } assertEq(testFloatArrayIndex(), "5,7"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testForEach.js0000644000175000017500000000040711545150464023026 0ustar chr1schr1sfunction testForEach() { var r; var a = ["zero", "one", "two", "three"]; for (var i = 0; i < RUNLOOP; i++) { r = ""; for each (var s in a) r += s + " "; } return r; } assertEq(testForEach(), "zero one two three "); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testForInLoopChangeIteratorType.js0000644000175000017500000000044211545150464027047 0ustar chr1schr1sfunction testForInLoopChangeIteratorType() { for(y in [0,1,2]) y = NaN; (function(){ [].__proto__.u = void 0; for (let y in [5,6,7,8]) y = NaN; delete [].__proto__.u; })() return "ok"; } assertEq(testForInLoopChangeIteratorType(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testFunctionIdentityChange.js0000644000175000017500000000052311545150464026123 0ustar chr1schr1sfunction testFunctionIdentityChange() { function a() {} function b() {} var o = { a: a, b: b }; for (var prop in o) { for (var i = 0; i < 1000; i++) o[prop](); } return true; } assertEq(testFunctionIdentityChange(), true); checkStats({ recorderStarted: 2, traceCompleted: 2, sideExitIntoInterpreter: 3 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGCWhileRecording.js0000644000175000017500000000031011545150464024627 0ustar chr1schr1sfunction test() { for (let z = 0; z < 4; ++z) { uneval({ x: 9 }); gc() } return "pass"; } assertEq(test(), "pass"); checkStats({ recorderStarted: 1, recorderAborted: 0 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGeneratorDeepBail.js0000644000175000017500000000046411545150464025036 0ustar chr1schr1sfunction testGeneratorDeepBail() { function g() { yield 2; } var iterables = [[1], [], [], [], g()]; var total = 0; for (let i = 0; i < iterables.length; i++) for each (let j in iterables[i]) total += j; return total; } assertEq(testGeneratorDeepBail(), 3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGetCallObj.js0000644000175000017500000000034311545150464023464 0ustar chr1schr1sfunction testGetCallObjInlined(i) { if (i > 7) eval("1"); return 1; } function testGetCallObj() { for (var i = 0; i < 10; ++i) testGetCallObjInlined(i); return "ok"; } assertEq(testGetCallObj(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGetThis.js0000644000175000017500000000023411545150464023064 0ustar chr1schr1sfunction testGetThis() { for (var i = 0; i < 3; ++i) { (function() { return this; })(); } return "ok"; } assertEq(testGetThis(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGlobalAsProto.js0000644000175000017500000000011711545150464024225 0ustar chr1schr1svar b = Object.create(this); for (var i = 0; i < 9; i++) assertEq(b.i, i); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGlobalMultitrees1.js0000644000175000017500000000036611545150464025062 0ustar chr1schr1s//test no multitrees assert function testGlobalMultitrees1() { (function() { for (var j = 0; j < 4; ++j) { for each (e in ['A', 1, 'A']) { } } })(); return true; } assertEq(testGlobalMultitrees1(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGlobalOptimize-2.js0000644000175000017500000000017311545150464024577 0ustar chr1schr1svar test; { let (a = 5) { with ({a: 2}) { test = (function () { return a; })(); } } } assertEq(test, 2); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGlobalOptimize-3.js0000644000175000017500000000017311545150464024600 0ustar chr1schr1svar test; { with ({a: 2}) { let (a = 5) { test = (function () { return a; })(); } } } assertEq(test, 5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGlobalOptimize-4.js0000644000175000017500000000016011545150464024575 0ustar chr1schr1svar test; { with ({a: 2}) { test = (function () { return a; })(); } let a = 5; } assertEq(test, 2); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGlobalOptimize-5.js0000644000175000017500000000021511545150464024577 0ustar chr1schr1svar test; function f() { let (a = 5) { with ({a: 2}) { test = (function () { return a;} )(); } } } f(); assertEq(test, 2); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGlobalOptimize-6.js0000644000175000017500000000021511545150464024600 0ustar chr1schr1svar test; function f() { with ({a: 2}) { let (a = 5) { test = (function () { return a; })(); } } } f(); assertEq(test, 5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGlobalProtoAccess.js0000644000175000017500000000023211545150464025061 0ustar chr1schr1sfunction testGlobalProtoAccess() { return "ok"; } this.__proto__.a = 3; for (var j = 0; j < 4; ++j) { [a]; } assertEq(testGlobalProtoAccess(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGlobalShapeChangeAfterDeepBail.js0000644000175000017500000000106411545150464027356 0ustar chr1schr1s// Complicated whitebox test for bug 487845. function testGlobalShapeChangeAfterDeepBail() { function f(name) { this[name] = 1; // may change global shape for (var i = 0; i < 4; i++) ; // MonitorLoopEdge eventually triggers assertion } // When i==3, deep-bail, then change global shape enough times to exhaust // the array of GlobalStates. var arr = [[], [], [], ["bug0", "bug1", "bug2", "bug3", "bug4"]]; for (var i = 0; i < arr.length; i++) arr[i].forEach(f); } testGlobalShapeChangeAfterDeepBail(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGroupAssignment.js0000644000175000017500000000131411545150464024642 0ustar chr1schr1sassertEq( (function () { var arr = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 ]; for (var i = 0; i < 4; ++i) { var src = i * 8; var dst = i * 8 + 7; for (var j = 0; j < 4; ++j) { [arr[dst--], arr[src++]] = [arr[src], arr[dst]]; } } return arr; })().toSource(), "[7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8, 23, 22, 21, 20, 19, 18, 17, 16, 31, 30, 29, 28, 27, 26, 25, 24, 32]"); checkStats({ recorderStarted: 2, traceCompleted: 2, sideExitIntoInterpreter: 3, traceTriggered: 3 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGrowDenseArray.js0000644000175000017500000000027611545150464024417 0ustar chr1schr1sfunction testGrowDenseArray() { var a = new Array(); for (var i = 0; i < 10; ++i) a[i] |= 5; return a.join(","); } assertEq(testGrowDenseArray(), "5,5,5,5,5,5,5,5,5,5"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGuardCalleeSneakAttack.js0000644000175000017500000000174311545150464026005 0ustar chr1schr1sfunction loop(f, expected) { // This is the loop that breaks us. // At record time, f's parent is a Call object with no fp. // At second execute time, it is a Call object with fp, // and all the Call object's dslots are still JSVAL_VOID. for (var i = 0; i < 9; i++) assertEq(f(), expected); } function C(bad) { var x = bad; function f() { return x; // We trick TR::callProp() into emitting code that gets // JSVAL_VOID (from the Call object's dslots) // rather than the actual value (true or false). } this.m = f; return f; } var obj = { set m(f) { if (f()) // Call once to resolve x on the Call object, // for shape consistency. Otherwise loop gets // recorded twice. loop(f, true); } }; loop(C.call(obj, false), false); C.call(obj, true); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 2, traceTriggered: 4 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testGuardCalleeSneakAttack2.js0000644000175000017500000000214211545150464026061 0ustar chr1schr1sfunction loop(f, expected) { // This is the loop that breaks us. // At record time, f's parent is a Call object with no fp. // At second execute time, it is a Call object with fp, // and all the Call object's dslots are still JSVAL_VOID. for (var i = 0; i < 9; i++) assertEq(f(), expected); } function C(bad) { var x = bad; function f() { return x; // We trick TR::callProp() into emitting code that gets // JSVAL_VOID (from the Call object's dslots) // rather than the actual value (true or false). } if (bad) void (f + "a!"); return f; } var obj = { }; // Warm up and trace with C's Call object entrained but its stack frame gone. loop(C.call(obj, false), false); // Sneaky access to f via a prototype method called implicitly by operator +. Function.prototype.toString = function () { loop(this, true); return "hah"; }; // Fail hard if we don't handle the implicit call out of C to F.p.toString. C.call(obj, true); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 2, traceTriggered: 4 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testHeavy.js0000644000175000017500000000033211545150464022570 0ustar chr1schr1sfunction heavyFn1(i) { if (i == 3) { var x = 3; return [0, i].map(function (i) i + x); } return []; } function testHeavy() { for (var i = 0; i <= 3; i++) heavyFn1(i); } testHeavy(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testHeavy2.js0000644000175000017500000000047611545150464022663 0ustar chr1schr1sfunction heavyFn1(i) { if (i == 3) { var x = 3; return [0, i].map(function (i) i + x); } return []; } function heavyFn2(i) { if (i < 1000) return heavyFn1(i); return function () i; } function testHeavy2() { for (var i = 0; i <= 3; i++) heavyFn2(i); } testHeavy2(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testHoleInDenseArray.js0000644000175000017500000000066711545150464024663 0ustar chr1schr1svar s; function f(i) { if (i > 4) /* side exit when arr[i] changes from bool to undefined (via a hole) */ assertEq(s, undefined); else assertEq(s, false); return 1; } /* trailing 'true' ensures array has capacity >= 10 */ var arr = [ false, false, false, false, false, , , , , , true ]; for (var i = 0; i < 10; ++i) { (s = arr[i]) + f(i); } checkStats({ traceTriggered: 2, sideExitIntoInterpreter: 2 }) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testHolePushing.js0000644000175000017500000000057711545150464023754 0ustar chr1schr1sfunction testHolePushing() { var a = ["foobar", "baz"]; for (var i = 0; i < 5; i++) a = [, "overwritten", "new"]; var s = "["; for (i = 0; i < a.length; i++) { s += (i in a) ? a[i] : ""; if (i != a.length - 1) s += ","; } return s + "], " + (0 in a); } assertEq(testHolePushing(), "[,overwritten,new], false"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testHolesAndIndexPropertiesOnThePrototype.js0000644000175000017500000000067411545150464031153 0ustar chr1schr1sfunction f(x,y,z) { return x + y + z; } Array.prototype[1] = 10; function g() { var arr = [1, ,3,4,5,6]; for (var i = 0; i < 10; ++i) { assertEq(f.apply(null, arr), 14); } } g(); Object.prototype[1] = 20; function h() { delete arguments[1]; return f.apply(null, arguments); } assertEq(h(1,2,3), 24); function i() { o = arguments; delete o[1]; return f.apply(null, o); } assertEq(i(1,2,3), 24); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testHOTLOOPCorrectness.js0000644000175000017500000000052511545150464025057 0ustar chr1schr1sfunction testHOTLOOPCorrectness() { var b = 0; for (var i = 0; i < HOTLOOP; ++i) ++b; return b; } // Change the global shape right before doing the test this.testHOTLOOPCorrectnessVar = 1; assertEq(testHOTLOOPCorrectness(), HOTLOOP); checkStats({ recorderStarted: 1, recorderAborted: 0, traceTriggered: 0 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testHOTLOOPSize.js0000644000175000017500000000013211545150464023471 0ustar chr1schr1sfunction testHOTLOOPSize() { return HOTLOOP > 1; } assertEq(testHOTLOOPSize(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testif.js0000644000175000017500000000027511545150464022120 0ustar chr1schr1sfunction testif() { var q = 0; for (var i = 0; i < 100; i++) { if ((i & 1) == 0) q++; else q--; } return q; } assertEq(testif(), 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testIn.js0000644000175000017500000000136611545150464022072 0ustar chr1schr1sfunction testIn() { var array = [3]; var obj = { "-1": 5, "1.7": 3, "foo": 5, "1": 7 }; var a = []; for (let j = 0; j < 5; ++j) { a.push("0" in array); a.push(-1 in obj); a.push(1.7 in obj); a.push("foo" in obj); a.push(1 in obj); a.push("1" in array); a.push(-2 in obj); a.push(2.7 in obj); a.push("bar" in obj); a.push(2 in obj); } return a.join(","); } assertEq(testIn(), "true,true,true,true,true,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false,true,true,true,true,true,false,false,false,false,false"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testIncDec.js0000644000175000017500000000064511545150464022650 0ustar chr1schr1sfunction testIncDec2(ii) { var x = []; for (let j=0;j<5;++j) { ii=j; jj=j; var kk=j; x.push(ii--); x.push(jj--); x.push(kk--); x.push(++ii); x.push(++jj); x.push(++kk); } return x.join(","); } function testIncDec() { return testIncDec2(0); } assertEq(testIncDec(), "0,0,0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testIncDecReadOnly.js0000644000175000017500000000056311545150464024305 0ustar chr1schr1svar r; Object.defineProperty(this, "x", {value: 0, writable: false}); for (var a = 0; a < 10; ++a) r = ++x; assertEq(x, 0); assertEq(r, 1); for (var a = 0; a < 10; ++a) r = --x; assertEq(x, 0); assertEq(r, -1); for (var a = 0; a < 10; ++a) r = x++; assertEq(x, 0); assertEq(r, 0); for (var a = 0; a < 10; ++a) r = x--; assertEq(x, 0); assertEq(r, 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testIncElem1.js0000644000175000017500000000043311545150464023113 0ustar chr1schr1svar obj = {p: 100}; var name = "p"; var a = []; for (var i = 0; i < 10; i++) a[i] = ++obj[name]; assertEq(a.join(','), '101,102,103,104,105,106,107,108,109,110'); assertEq(obj.p, 110); checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testIncElem2.js0000644000175000017500000000046511545150464023121 0ustar chr1schr1svar obj = {s: ""}; var name = "s"; var a = []; for (var i = 0; i <= RECORDLOOP + 5; i++) { a[i] = 'x'; if (i > RECORDLOOP) a[i] = ++obj[name]; // first recording changes obj.s from string to number } assertEq(a.join(','), Array(RECORDLOOP + 2).join('x,') + '1,2,3,4,5'); assertEq(obj.s, 5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testIncElem3.js0000644000175000017500000000016011545150464023112 0ustar chr1schr1svar arr; for (var j = 0; j < 2 * RUNLOOP; ++j ) { arr = [,]; ++arr[0]; } assertEq(isNaN(arr[0]), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testincops.js0000644000175000017500000000106111545150464023007 0ustar chr1schr1svar globalinc = 0; function testincops(n) { var i = 0, o = {p:0}, a = [0]; n = 100; for (i = 0; i < n; i++); while (i-- > 0); for (i = 0; i < n; ++i); while (--i >= 0); for (o.p = 0; o.p < n; o.p++) globalinc++; while (o.p-- > 0) --globalinc; for (o.p = 0; o.p < n; ++o.p) ++globalinc; while (--o.p >= 0) globalinc--; ++i; // set to 0 for (a[i] = 0; a[i] < n; a[i]++); while (a[i]-- > 0); for (a[i] = 0; a[i] < n; ++a[i]); while (--a[i] >= 0); return [++o.p, ++a[i], globalinc].toString(); } assertEq(testincops(), "0,0,0"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInitDictionary.js0000644000175000017500000000453011545150464024451 0ustar chr1schr1s var shapes = {}; function stringify(a) { assertEq(shapes[shapeOf(a)], undefined); shapes[shapeOf(a)] = 1; var b = ""; for (var c in a) { b += c + ":"; if (typeof a[c] == "function") b += "function,"; else b += a[c] + ","; } return b; } function test1() { return stringify({a: 0, b: 1, a: function() {} }); } for (var i = 0; i < 3; i++) assertEq(test1(), "a:function,b:1,"); // This does not cause the object to go to dictionary mode, unlike the above. function test2() { return stringify({a: 0, b: 1, a: 2, b: 3}); } assertEq(test2(), "a:2,b:3,"); function test3() { return stringify({ aa:0,ab:1,ac:2,ad:3,ae:4,af:5,ag:6,ah:7,ai:8,aj:9, ba:0,bb:1,bc:2,bd:3,be:4,bf:5,bg:6,bh:7,bi:8,bj:9, ca:0,cb:1,cc:2,cd:3,ce:4,cf:5,cg:6,ch:7,ci:8,cj:9, da:0,db:1,dc:2,dd:3,de:4,df:5,dg:6,dh:7,di:8,dj:9, ea:0,eb:1,ec:2,ed:3,ee:4,ef:5,eg:6,eh:7,ei:8,ej:9, fa:0,fb:1,fc:2,fd:3,fe:4,ff:5,fg:6,fh:7,fi:8,fj:9, ga:0,gb:1,gc:2,gd:3,ge:4,gf:5,gg:6,gh:7,gi:8,gj:9, ha:0,hb:1,hc:2,hd:3,he:4,hf:5,hg:6,hh:7,hi:8,hj:9, ia:0,ib:1,ic:2,id:3,ie:4,if:5,ig:6,ih:7,ii:8,ij:9, ja:0,jb:1,jc:2,jd:3,je:4,jf:5,jg:6,jh:7,ji:8,jj:9, ka:0,kb:1,kc:2,kd:3,ke:4,kf:5,kg:6,kh:7,ki:8,kj:9, la:0,lb:1,lc:2,ld:3,le:4,lf:5,lg:6,lh:7,li:8,lj:9, ma:0,mb:1,mc:2,md:3,me:4,mf:5,mg:6,mh:7,mi:8,mj:9, na:0,nb:1,nc:2,nd:3,ne:4,nf:5,ng:6,nh:7,ni:8,nj:9, oa:0,ob:1,oc:2,od:3,oe:4,of:5,og:6,oh:7,oi:8,oj:9, pa:0,pb:1,pc:2,pd:3,pe:4,pf:5,pg:6,ph:7,pi:8,pj:9, }); } for (var i = 0; i < HOTLOOP + 2; i++) assertEq(test3(), "aa:0,ab:1,ac:2,ad:3,ae:4,af:5,ag:6,ah:7,ai:8,aj:9,ba:0,bb:1,bc:2,bd:3,be:4,bf:5,bg:6,bh:7,bi:8,bj:9,ca:0,cb:1,cc:2,cd:3,ce:4,cf:5,cg:6,ch:7,ci:8,cj:9,da:0,db:1,dc:2,dd:3,de:4,df:5,dg:6,dh:7,di:8,dj:9,ea:0,eb:1,ec:2,ed:3,ee:4,ef:5,eg:6,eh:7,ei:8,ej:9,fa:0,fb:1,fc:2,fd:3,fe:4,ff:5,fg:6,fh:7,fi:8,fj:9,ga:0,gb:1,gc:2,gd:3,ge:4,gf:5,gg:6,gh:7,gi:8,gj:9,ha:0,hb:1,hc:2,hd:3,he:4,hf:5,hg:6,hh:7,hi:8,hj:9,ia:0,ib:1,ic:2,id:3,ie:4,if:5,ig:6,ih:7,ii:8,ij:9,ja:0,jb:1,jc:2,jd:3,je:4,jf:5,jg:6,jh:7,ji:8,jj:9,ka:0,kb:1,kc:2,kd:3,ke:4,kf:5,kg:6,kh:7,ki:8,kj:9,la:0,lb:1,lc:2,ld:3,le:4,lf:5,lg:6,lh:7,li:8,lj:9,ma:0,mb:1,mc:2,md:3,me:4,mf:5,mg:6,mh:7,mi:8,mj:9,na:0,nb:1,nc:2,nd:3,ne:4,nf:5,ng:6,nh:7,ni:8,nj:9,oa:0,ob:1,oc:2,od:3,oe:4,of:5,og:6,oh:7,oi:8,oj:9,pa:0,pb:1,pc:2,pd:3,pe:4,pf:5,pg:6,ph:7,pi:8,pj:9,"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testINITELEM.js0000644000175000017500000000023211545150464022721 0ustar chr1schr1sfunction testINITELEM() { var x; for (var i = 0; i < 10; ++i) x = { 0: 5, 1: 5 }; return x[0] + x[1]; } assertEq(testINITELEM(), 10); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInitelemCond.js0000644000175000017500000000037411545150464024074 0ustar chr1schr1s /* Element initializers with unknown index. */ function foo(i) { var x = [1,2,i == 1 ? 3 : 4,5,6]; var y = "" + x; if (i == 1) assertEq(y, "1,2,3,5,6"); else assertEq(y, "1,2,4,5,6"); } for (var i = 0; i < HOTLOOP + 2; i++) foo(i); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInitelemWithFloatIndex.js0000644000175000017500000000010111545150464026066 0ustar chr1schr1sfor (i = 0; i < 9; i++) x = {1.5: 0}; assertEq(x["1.5"], 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInitelemWithSetter.js0000644000175000017500000000015411545150464025307 0ustar chr1schr1sObject.prototype.__defineSetter__(1, function () { throw "fit"; }); for (var i =0; i<9; i++) ({1:'a'}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInitMethod.js0000644000175000017500000000030211545150464023555 0ustar chr1schr1sfor (var i = 0; i < 9; i++) x = {a: function() {}, b: function() {}}; checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInitPropOverMethod.js0000644000175000017500000000031511545150464025256 0ustar chr1schr1sfor (var i = 0; i < HOTLOOP + 2; i++) x = {a: function () { return 33; }, a: 4}; try { result = x.a(); } catch (exc) { result = "threw " + exc.name; } assertEq(result, "threw TypeError"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInitPropWithIntName.js0000644000175000017500000000005611545150464025373 0ustar chr1schr1sfor (var j=0; j; for (var j = 0; j < 4; ++j) { +[e]; } } testInterpreterReentery8(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInterpreterReentry.js0000644000175000017500000000026311545150464025373 0ustar chr1schr1sfunction testInterpreterReentry() { this.__defineSetter__('x', function(){}) for (var j = 0; j < 5; ++j) { x = 3; } return 1; } assertEq(testInterpreterReentry(), 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInterpreterReentry2.js0000644000175000017500000000044311545150464025455 0ustar chr1schr1sfunction testInterpreterReentry2() { var a = false; var b = {}; var c = false; var d = {}; this.__defineGetter__('e', function(){}); for (let f in this) print(f); [1 for each (g in this) for each (h in [])] return 1; } assertEq(testInterpreterReentry2(), 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInterpreterReentry3.js0000644000175000017500000000037311545150464025460 0ustar chr1schr1sfunction testInterpreterReentry3() { for (let i=0;i<5;++i) this["y" + i] = function(){}; this.__defineGetter__('e', function (x2) { yield; }); [1 for each (a in this) for (b in {})]; return 1; } assertEq(testInterpreterReentry3(), 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInterpreterReentry4.js0000644000175000017500000000023411545150464025455 0ustar chr1schr1sfunction testInterpreterReentry4() { var obj = {a:1, b:1, c:1, d:1, get e() 1000 }; for (var p in obj) obj[p]; } testInterpreterReentry4(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInterpreterReentry5.js0000644000175000017500000000035011545150464025455 0ustar chr1schr1sfunction testInterpreterReentry5() { var arr = [0, 1, 2, 3, 4]; arr.__defineGetter__("4", function() 1000); for (var i = 0; i < 5; i++) arr[i]; for (var p in arr) arr[p]; } testInterpreterReentry5(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInterpreterReentry6.js0000644000175000017500000000032611545150464025461 0ustar chr1schr1sfunction testInterpreterReentry6() { var obj = {a:1, b:1, c:1, d:1, set e(x) { this._e = x; }}; for (var p in obj) obj[p] = "grue"; return obj._e; } assertEq(testInterpreterReentry6(), "grue"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInterpreterReentry7.js0000644000175000017500000000052511545150464025463 0ustar chr1schr1sfunction testInterpreterReentry7() { var arr = [0, 1, 2, 3, 4]; arr.__defineSetter__("4", function(x) { this._4 = x; }); for (var i = 0; i < 5; i++) arr[i] = "grue"; var tmp = arr._4; for (var p in arr) arr[p] = "bleen"; return tmp + " " + arr._4; } assertEq(testInterpreterReentry7(), "grue bleen"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testIntFloor.js0000644000175000017500000000021511545150464023250 0ustar chr1schr1sfunction testIntFloor() { var a; for (var x = 0; x < 3; ++x) { a = Math.floor('') } return a; } assertEq(testIntFloor(), 0) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testIntOverflow.js0000644000175000017500000000050311545150464023772 0ustar chr1schr1sfunction testIntOverflow() { // int32_max - 7 var ival = 2147483647 - 7; for (var i = 0; i < 30; i++) { ival += 30; } return (ival < 2147483647); } assertEq(testIntOverflow(), false); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1, }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testIntUnderflow.js0000644000175000017500000000050611545150464024137 0ustar chr1schr1sfunction testIntUnderflow() { // int32_min + 8 var ival = -2147483648 + 8; for (var i = 0; i < 30; i++) { ival -= 2; } return (ival > -2147483648); } assertEq(testIntUnderflow(), false); checkStats({ recorderStarted: 2, recorderAborted: 0, traceCompleted: 2, traceTriggered: 2, }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInvalidCharCodeAt.js0000644000175000017500000000043611545150464024765 0ustar chr1schr1sfunction doTestInvalidCharCodeAt(input) { var q = ""; for (var i = 0; i < 10; i++) q += input.charCodeAt(i); return q; } function testInvalidCharCodeAt() { return doTestInvalidCharCodeAt(""); } assertEq(testInvalidCharCodeAt(), "NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testInvertNullAfterNegateNull.js0000644000175000017500000000031311545150464026556 0ustar chr1schr1sfunction testInvertNullAfterNegateNull() { for (var i = 0; i < 5; i++) !null; for (var i = 0; i < 5; i++) -null; return "no assertion"; } assertEq(testInvertNullAfterNegateNull(), "no assertion"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testIteratorReification.js0000644000175000017500000000003111545150464025456 0ustar chr1schr1sfor (b in evalcx('')) {} mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testLambdaCtor.js0000644000175000017500000000063511545150464023532 0ustar chr1schr1sfunction testLambdaCtor() { var a = []; for (var x = 0; x < RUNLOOP; ++x) { var f = function(){}; a[a.length] = new f; } // This prints false until the upvar2 bug is fixed: // print(a[HOTLOOP].__proto__ !== a[HOTLOOP-1].__proto__); // Assert that the last f was properly constructed. return a[RUNLOOP-1].__proto__ === f.prototype; } assertEq(testLambdaCtor(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testLambdaInitedVar.js0000644000175000017500000000025611545150464024507 0ustar chr1schr1sfunction testLambdaInitedVar() { var jQuery = function (a, b) { return jQuery && jQuery.length; } return jQuery(); } assertEq(testLambdaInitedVar(), 2); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testLengthInString.js0000644000175000017500000000047711545150464024425 0ustar chr1schr1sfunction testLengthInString() { var s = new String(); var res = "length" in s; for (var i = 0; i < 5; i++) res = res && ("length" in s); res = res && s.hasOwnProperty("length"); for (var i = 0; i < 5; i++) res = res && s.hasOwnProperty("length"); return res; } assertEq(testLengthInString(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testLengthOnNonNativeProto.js0000644000175000017500000000056311545150464026106 0ustar chr1schr1sfunction testLengthOnNonNativeProto() { var o = {}; o.__proto__ = [3]; for (var j = 0; j < 5; j++) o[0]; var o2 = {}; o2.__proto__ = []; for (var j = 0; j < 5; j++) o2.length; function foo() { } foo.__proto__ = []; for (var j = 0; j < 5; j++) foo.length; return "no assertion"; } assertEq(testLengthOnNonNativeProto(), "no assertion"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testLetWithUnstableGlobal.js0000644000175000017500000000070011545150464025712 0ustar chr1schr1svar q = []; for each (b in [0x3FFFFFFF, 0x3FFFFFFF, 0x3FFFFFFF]) { for each (let e in [{}, {}, {}, "", {}]) { b = (b | 0x40000000) + 1; q.push(b); } } function testLetWithUnstableGlobal() { return q.join(","); } assertEq(testLetWithUnstableGlobal(), "2147483648,-1073741823,-1073741822,-1073741821,-1073741820,2147483648,-1073741823,-1073741822,-1073741821,-1073741820,2147483648,-1073741823,-1073741822,-1073741821,-1073741820"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testLirBufOOM.js0000644000175000017500000000144511545150464023260 0ustar chr1schr1sfunction testLirBufOOM() { var a = [ "12345678901234", "123456789012", "1234567890123456789012345678", "12345678901234567890123456789012345678901234567890123456", "f", "$", "", "f()", "(\\*)", "b()", "()", "(#)", "ABCDEFGHIJK", "ABCDEFGHIJKLM", "ABCDEFGHIJKLMNOPQ", "ABCDEFGH", "(.)", "(|)", "()$", "/()", "(.)$" ]; for (var j = 0; j < 200; ++j) { var js = "" + j; for (var i = 0; i < a.length; i++) "".match(a[i] + js) } return "ok"; } assertEq(testLirBufOOM(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testLogicalNotNaN.js0000644000175000017500000000031211545150464024142 0ustar chr1schr1sfunction testLogicalNotNaN() { var i = 0; var a = new Array(5); while (i < a.length) a[i++] = !NaN; return a.join(); } assertEq(testLogicalNotNaN(), "true,true,true,true,true"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testLongNumToString.js0000644000175000017500000000030311545150464024563 0ustar chr1schr1sfunction testLongNumToString() { var s; for (var i = 0; i < 5; i++) s = (0x08000000).toString(2); return s; } assertEq(testLongNumToString(), '1000000000000000000000000000'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testLoopingAccumulator.js0000644000175000017500000000055711545150464025334 0ustar chr1schr1sfunction addAccumulations(f) { var a = f(); var b = f(); return a() + b(); } function loopingAccumulator() { var x = 0; return function () { for (var i = 0; i < 10; ++i) { ++x; } return x; } } function testLoopingAccumulator() { var x = addAccumulations(loopingAccumulator); return x; } assertEq(testLoopingAccumulator(), 20); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testLoopWithUndefined1.js0000644000175000017500000000057311545150464025173 0ustar chr1schr1sfunction loopWithUndefined1(t, val) { var a = new Array(6); for (var i = 0; i < 6; i++) a[i] = (t > val); return a; } loopWithUndefined1(5.0, 2); //compile version with val=int function testLoopWithUndefined1() { return loopWithUndefined1(5.0).join(","); //val=undefined }; assertEq(testLoopWithUndefined1(), "false,false,false,false,false,false"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testLoopWithUndefined2.js0000644000175000017500000000112211545150464025163 0ustar chr1schr1sfunction loopWithUndefined2(t, dostuff, val) { var a = new Array(6); for (var i = 0; i < 6; i++) { if (dostuff) { val = 1; a[i] = (t > val); } else { a[i] = (val == undefined); } } return a; } function testLoopWithUndefined2() { var a = loopWithUndefined2(5.0, true, 2); var b = loopWithUndefined2(5.0, true); var c = loopWithUndefined2(5.0, false, 8); var d = loopWithUndefined2(5.0, false); return [a[0], b[0], c[0], d[0]].join(","); } assertEq(testLoopWithUndefined2(), "true,true,false,true"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMatchAsCondition.js0000644000175000017500000000027111545150464024705 0ustar chr1schr1sfunction testMatchAsCondition() { var a = ['0', '0', '0', '0']; var r = /0/; "x".q; for (var z = 0; z < 4; z++) a[z].match(r) ? 1 : 2; } testMatchAsCondition(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMatchStringObject.js0000644000175000017500000000030011545150464025061 0ustar chr1schr1sfunction testMatchStringObject() { var a = new String("foo"); var b; for (i = 0; i < 300; i++) b = a.match(/bar/); return b; } assertEq(testMatchStringObject(), null); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMethodInc.js0000644000175000017500000000034011545150464023365 0ustar chr1schr1sfor (var i = 0; i < 9; i++) { var x = {f: function() {}}; x.f++; assertEq(""+x.f, "NaN"); } checkStats({ recorderStarted: 1, recorderAborted: 1, traceCompleted: 0, sideExitIntoInterpreter: 0 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMethodInit.js0000644000175000017500000000051311545150464023561 0ustar chr1schr1sfunction testMethodInit() { // bug 503198 function o() { return 'o'; } function k() { return 'k'; } var x; for (var i = 0; i < 10; i++) x = {o: o, k: k}; return x.o() + x.k(); } assertEq(testMethodInit(), "ok"); checkStats({ recorderStarted: 1, traceCompleted: 1, sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMethodInitDeref.js0000644000175000017500000000026111545150464024527 0ustar chr1schr1sfor (var j = 0; j < 7; ++j) ({x: function () {}}).x; checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMethodInitSafety.js0000644000175000017500000000053011545150464024734 0ustar chr1schr1sfunction testMethodInitSafety() { function f() { return 'fail'; } function g() { return 'ok'; } var s; var arr = [f, f, f, f, g]; //assertEq(arr.length > RUNLOOP, true); for (var i = 0; i < arr.length; i++) { var x = {m: arr[i]}; s = x.m(); } return s; } assertEq(testMethodInitSafety(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMethodInitUneval.js0000644000175000017500000000026511545150464024740 0ustar chr1schr1sfor (var j = 0; j < 7; ++j) uneval({x: function () {}}); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, sideExitIntoInterpreter: 4 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMethodOverride.js0000644000175000017500000000053411545150464024440 0ustar chr1schr1sfunction Q() { this.m = function () {}; } function callm(q) { q.m(); } var a = []; for (var i = 0; i < 5; i++) { var q = new Q; callm(q); q.m = function () { return 42; }; a[i] = q; } for (var i = 0; i < 5; i++) callm(a[i]); checkStats({ recorderStarted: 2, traceCompleted: 3, sideExitIntoInterpreter: 4 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMethodSet.js0000644000175000017500000000055111545150464023413 0ustar chr1schr1sfunction testMethodSet() { // bug 503198 function o() { return 'o'; } function k() { return 'k'; } var x; for (var i = 0; i < 10; i++) { x = {}; x.o = o; x.k = k; } return x.o() + x.k(); } assertEq(testMethodSet(), "ok"); checkStats({ recorderStarted: 1, traceCompleted: 1, sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMethodWriteBarrier.js0000644000175000017500000000016211545150464025257 0ustar chr1schr1svar x = {p: 0.1, m: function(){}}; x.m(); // the interpreter brands x for (var i = 0; i < 9; i++) x.p = 0.1; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMethodWriteBarrier2.js0000644000175000017500000000063711545150464025350 0ustar chr1schr1sfunction C() { this.m = function () {}; // JSOP_SETMETHOD } var a = [new C, new C, new C, new C, new C, new C, new C, new C, new C]; var b = [new C, new C, new C, new C, new C, new C, a[8], new C, new C]; var thrown = 'none'; try { for (var i = 0; i < 9; i++) { a[i].m(); b[i].m = 0.7; // MethodWriteBarrier required here } } catch (exc) { thrown = exc.name; } assertEq(thrown, 'TypeError'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMethodWriteBarrier3.js0000644000175000017500000000066011545150464025345 0ustar chr1schr1sfunction g() {} function h() { for (var i = 0; i < 9; i++) x.f = i; } function j() { x.f(); } var x = {f: 0.7, g: g}; x.g(); // interpreter brands x h(); print(shapeOf(x)); x.f = function (){}; // does not change x's shape j(); print(shapeOf(x)); h(); // should change x's shape var thrown = 'none'; try { j(); // should throw since x.f === 8 } catch (exc) { thrown = exc.name; } assertEq(thrown, 'TypeError');mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMethodWriteBarrier4.js0000644000175000017500000000031411545150464025342 0ustar chr1schr1svar z = 0; function f() { this.b = function() {}; this.b = undefined; if (z++ > HOTLOOP) this.b(); } try { for (var i = 0; i < HOTLOOP + 2; i++) new f(); } catch (exc) {} mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMissingMethod.js0000644000175000017500000000036311545150464024272 0ustar chr1schr1svar o = {y: function () {}}; var a = [o, o, o, o, o, o, o, o, o]; a[RECORDLOOP - 1] = {}; try { for (var i = 0; i < 9; i++) a[i].y(); } catch (exc) { assertEq(exc.name, "TypeError"); // should happen when i == RECORDLOOP - 1 } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMissingMethod2.js0000644000175000017500000000041111545150464024346 0ustar chr1schr1svar o = {y: function() {}}; var a = [o, o, o, o, o, o, o, o, o]; Number.prototype.y = 0; a[RECORDLOOP - 1] = 0; try { for (var i = 0; i < 9; i++) a[i].y(); } catch (exc) { assertEq(exc.name, "TypeError"); // should happen when i == RECORDLOOP - 1 } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testModuloWithNegative1.js0000644000175000017500000000036611545150464025362 0ustar chr1schr1sfunction testModuloWithNegative1() { var v = 0; for (var i = 0; i < 2; ++i) { c = v; v -= 1; for (var j = 0; j < 2; ++j) c %= -1; } return 1/c; } assertEq(testModuloWithNegative1(), -Infinity); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testModuloWithNegative2.js0000644000175000017500000000016411545150464025357 0ustar chr1schr1sfunction f(v, e) { for (var i = 0; i < 9; i++) v %= e; return v; } f(0, 1); assertEq(f(-2, 2), -0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMoreArgcThanNargs.js0000644000175000017500000000044011545150464025021 0ustar chr1schr1sfunction doTestMoreArgcThanNargs() { var x = 0; for (var i = 0; i < 10; i++) { x = x + arguments[3]; } return x; } function testMoreArgcThanNargs() { return doTestMoreArgcThanNargs(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); } assertEq(testMoreArgcThanNargs(), 4*10); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMoreClosures.js0000644000175000017500000000041611545150464024141 0ustar chr1schr1sfunction testMoreClosures() { var f = {}, max = 3; var hello = function(n) { function howdy() { return n * n } f.test = howdy; }; for (var i = 0; i <= max; i++) hello(i); return f.test(); } assertEq(testMoreClosures(), 9); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMulOverflow.js0000644000175000017500000000034611545150464024002 0ustar chr1schr1sfunction testMulOverflow() { var a = []; for (let j=0;j<5;++j) a.push(0 | ((0x60000009) * 0x60000009)); return a.join(","); } assertEq(testMulOverflow(), "-1073741824,-1073741824,-1073741824,-1073741824,-1073741824"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMultipleArgumentsObjects.js0000644000175000017500000000056011545150464026512 0ustar chr1schr1sfunction testMultipleArgumentsObjects() { var testargs = arguments; var f = function (name, which) { var args = [testargs, arguments]; return args[which][0]; }; var arr = [0, 0, 0, 0, 1]; for (var i = 0; i < arr.length; i++) arr[i] = f("f", arr[i]); return arr + ''; } assertEq(testMultipleArgumentsObjects(), ",,,,f"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testMultiplePendingGlobalWrites.js0000644000175000017500000000022311545150464027132 0ustar chr1schr1svar a, b; function g(x) { var y = x++; return [x, y]; } function f() { for(var i=0; i<20; i++) { [a,b] = g("10"); } } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNativeArgsRooting.js0000644000175000017500000000045211545150464025124 0ustar chr1schr1sif ('gczeal' in this) (function () { (eval("\ (function () {\ for (var y = 0; y < 16; ++y) {\ if (y % 3 == 2) {\ gczeal(1);\ } else {\ print(0 / 0);\ }\ }\ });\ "))() })(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNativeLog.js0000644000175000017500000000030711545150464023406 0ustar chr1schr1sfunction testNativeLog() { var a = new Array(5); for (var i = 0; i < 5; i++) { a[i] = Math.log(Math.pow(Math.E, 10)); } return a.join(","); } assertEq(testNativeLog(), "10,10,10,10,10"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNativeMax.js0000644000175000017500000000061511545150464023414 0ustar chr1schr1sfunction testNativeMax() { var out = [], k; for (var i = 0; i < 5; ++i) { k = Math.max(k, i); } out.push(k); k = 0; for (var i = 0; i < 5; ++i) { k = Math.max(k, i); } out.push(k); for (var i = 0; i < 5; ++i) { k = Math.max(0, -0); } out.push((1 / k) < 0); return out.join(","); } assertEq(testNativeMax(), "NaN,4,false"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNativeSetter.js0000644000175000017500000000046611545150464024141 0ustar chr1schr1sfunction testNativeSetter() { var re = /foo/; var N = RUNLOOP + 10; for (var i = 0; i < N; i++) re.lastIndex = i; assertEq(re.lastIndex, N - 1); } testNativeSetter(); checkStats({ recorderStarted: 1, recorderAborted: 0, traceTriggered: 1, sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNegativeArrayLength.js0000644000175000017500000000030011545150464025412 0ustar chr1schr1sfunction f() { try { for ( var i = HOTLOOP-1; i > -2; i-- ) new Array(i).join('*'); } catch (e) { return e instanceof RangeError; } return false; } assertEq(f(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNegativeGETELEMIndex.js0000644000175000017500000000021011545150464025244 0ustar chr1schr1sfunction testNegativeGETELEMIndex() { for (let i=0;i<3;++i) /x/[-4]; return "ok"; } assertEq(testNegativeGETELEMIndex(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNegZero1.js0000644000175000017500000000043511545150464023152 0ustar chr1schr1sfunction testNegZero1Helper(z) { for (let j = 0; j < 5; ++j) { z = -z; } return Math.atan2(0, -0) == Math.atan2(0, z); } var testNegZero1 = function() { return testNegZero1Helper(0); } testNegZero1.name = 'testNegZero1'; testNegZero1Helper(1); assertEq(testNegZero1(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNestedClosures.js0000644000175000017500000000120211545150464024453 0ustar chr1schr1sfunction testNestedClosures() { function f(a, b) { function g(x, y) { function h(m, n) { function k(u, v) { var s = ''; for (var i = 0; i < 5; ++i) s = a + ',' + b + ',' + x + ',' + y + ',' + m + ',' + n + ',' + u + ',' + v; return s; } return k(m+1, n+1); } return h(x+1, y+1); } return g(a+1, b+1); } var s1; for (var i = 0; i < 5; ++i) s1 = f(i, i+i); return s1; } assertEq(testNestedClosures(), '4,8,5,9,6,10,7,11'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testApply.js0000644000175000017500000000027411545150464022606 0ustar chr1schr1sfunction testApply() { var q = []; for (var i = 0; i < 10; ++i) Array.prototype.push.apply(q, [5]); return q.join(","); } assertEq(testApply(), "5,5,5,5,5,5,5,5,5,5"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testApplyAtJoinPoint.js0000644000175000017500000000031111545150464024715 0ustar chr1schr1svar isTrue = true; function g(x) { return x; } function f() { return g.apply(null, isTrue ? ["happy"] : arguments); } for (var i = 0; i < HOTLOOP + 10; ++i) assertEq(f("sad"), "happy"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testApplyCall.js0000644000175000017500000000326011545150464023400 0ustar chr1schr1sfunction testApplyCallHelper(f) { var r = []; for (var i = 0; i < 10; ++i) f.call(); r.push(x); for (var i = 0; i < 10; ++i) f.call(this); r.push(x); for (var i = 0; i < 10; ++i) f.apply(this); r.push(x); for (var i = 0; i < 10; ++i) f.call(this,0); r.push(x); for (var i = 0; i < 10; ++i) f.apply(this,[0]); r.push(x); for (var i = 0; i < 10; ++i) f.call(this,0,1); r.push(x); for (var i = 0; i < 10; ++i) f.apply(this,[0,1]); r.push(x); for (var i = 0; i < 10; ++i) f.call(this,0,1,2); r.push(x); for (var i = 0; i < 10; ++i) f.apply(this,[0,1,2]); r.push(x); for (var i = 0; i < 10; ++i) f.call(this,0,1,2,3); r.push(x); for (var i = 0; i < 10; ++i) f.apply(this,[0,1,2,3]); r.push(x); for (var i = 0; i < 10; ++i) f.call(this,0,1,2,3,4); r.push(x); for (var i = 0; i < 10; ++i) f.apply(this,[0,1,2,3,4]); r.push(x); for (var i = 0; i < 10; ++i) f.call(this,0,1,2,3,4,5); r.push(x); for (var i = 0; i < 10; ++i) f.apply(this,[0,1,2,3,4,5]) r.push(x); return(r.join(",")); } function testApplyCall() { var r = testApplyCallHelper(function (a0,a1,a2,a3,a4,a5,a6,a7) { x = [a0,a1,a2,a3,a4,a5,a6,a7]; }); r += testApplyCallHelper(function (a0,a1,a2,a3,a4,a5,a6,a7) { x = [a0,a1,a2,a3,a4,a5,a6,a7]; }); return r; } assertEq(testApplyCall(), ",,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,,0,,,,,,,,0,1,,,,,,,0,1,,,,,,,0,1,2,,,,,,0,1,2,,,,,,0,1,2,3,,,,,0,1,2,3,,,,,0,1,2,3,4,,,,0,1,2,3,4,,,,0,1,2,3,4,5,,,0,1,2,3,4,5,," + ",,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,,0,,,,,,,,0,1,,,,,,,0,1,,,,,,,0,1,2,,,,,,0,1,2,,,,,,0,1,2,3,,,,,0,1,2,3,,,,,0,1,2,3,4,,,,0,1,2,3,4,,,,0,1,2,3,4,5,,,0,1,2,3,4,5,,"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testApplyUnbox.js0000644000175000017500000000047111545150464023621 0ustar chr1schr1sfunction testApplyUnboxHelper(f,a) { var q; for (var i = 0; i < 10; ++i) q = f.apply(f,a); return q; } function testApplyUnbox() { var f = function(x) { return x; } return [testApplyUnboxHelper(f,[1]), testApplyUnboxHelper(f,[true])].join(","); } assertEq(testApplyUnbox(), "1,true"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testArrayComp1.js0000644000175000017500000000022511545150464023473 0ustar chr1schr1sload(libdir + 'range.js'); function testArrayComp1() { return [a for (a in range(0, 10))].join(''); } assertEq(testArrayComp1(), '0123456789'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testArrayComp2.js0000644000175000017500000000027711545150464023503 0ustar chr1schr1sload(libdir + 'range.js'); function testArrayComp2() { return [a + b for (a in range(0, 5)) for (b in range(0, 5))].join(''); } assertEq(testArrayComp2(), '0123412345234563456745678'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testArrayDensityChange.js0000644000175000017500000000051011545150464025236 0ustar chr1schr1sfunction testArrayDensityChange() { var x = []; var count = 0; for (var i=0; i < 100; ++i) { x[i] = "asdf"; } for (var i=0; i < x.length; ++i) { if (i == 51) { x[199] = "asdf"; } if (x[i]) count += x[i].length; } return count; } assertEq(testArrayDensityChange(), 404); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testArrayIn.js0000644000175000017500000000166511545150464023073 0ustar chr1schr1s// Give us enough room to work with some holes too const array_size = RUNLOOP + 20; function testArrayIn() { var arr = new Array(array_size); var i; for (i = 0; i < array_size; ++i) { arr[i] = i; } // Sanity check here checkStats({ traceCompleted: 1, traceTriggered: 1, sideExitIntoInterpreter: 1 }); delete arr[RUNLOOP + 5]; delete arr[RUNLOOP + 10]; var ret = []; for (i = 0; i < array_size; ++i) { ret.push(i in arr); } checkStats({ traceCompleted: 2, traceTriggered: 2, sideExitIntoInterpreter: 2 }); var ret2; for (i = 0; i < RUNLOOP; ++i) { ret2 = array_size in arr; } checkStats({ traceCompleted: 3, traceTriggered: 3, sideExitIntoInterpreter: 3 }); return [ret, ret2]; } var [ret, ret2] = testArrayIn(); assertEq(ret2, false); for (var i = 0; i < array_size; ++i) { assertEq(ret[i], i != RUNLOOP + 5 && i != RUNLOOP + 10); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testArrayInWithIndexedProto.js0000644000175000017500000000150211545150464026242 0ustar chr1schr1sfunction testArrayInWithIndexedProto() { Array.prototype[0] = "Got me"; var zeroPresent, zeroPresent2; // Need to go to 2*RUNLOOP because in the failure mode this is // testing we have various side-exits in there due to interp and // tracer not agreeing that confuse the issue and cause us to not // hit the bad case within RUNLOOP iterations. for (var j = 0; j < 2*RUNLOOP; ++j) { zeroPresent = 0 in []; } var arr = [1, 2]; delete arr[0]; for (var j = 0; j < 2*RUNLOOP; ++j) { zeroPresent2 = 0 in arr; } return [zeroPresent, zeroPresent2]; } var [ret, ret2] = testArrayInWithIndexedProto(); assertEq(ret, true); assertEq(ret2, true); checkStats({ traceCompleted: 0, traceTriggered: 0, sideExitIntoInterpreter: 0, recorderStarted: 2, recorderAborted: 2 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNestedDeepBail.js0000644000175000017500000000050711545150464024330 0ustar chr1schr1svar _quit; function testNestedDeepBail() { _quit = false; function loop() { for (var i = 0; i < 4; i++) ; } loop(); function f() { loop(); _quit = true; } var stk = [[1], [], [], [], []]; while (!_quit) stk.pop().forEach(f); } testNestedDeepBail(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNestedEscapingLambdas.js0000644000175000017500000000133611545150464025701 0ustar chr1schr1sfunction testNestedEscapingLambdas() { try { return (function() { var a = [], r = []; function setTimeout(f, t) { a.push(f); } function runTimeouts() { for (var i = 0; i < a.length; i++) a[i](); } var $foo = "#nothiddendiv"; setTimeout(function(){ r.push($foo); setTimeout(function(){ r.push($foo); }, 100); }, 100); runTimeouts(); return r.join(""); })(); } catch (e) { return e; } } assertEq(testNestedEscapingLambdas(), "#nothiddendiv#nothiddendiv"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNestedExitStackOuter.js0000644000175000017500000000133511545150464025601 0ustar chr1schr1s// Test stack reconstruction after a nested exit function testNestedExitStackInner(j, counter) { ++counter; var b = 0; for (var i = 1; i <= RUNLOOP; i++) { ++b; var a; // Make sure that once everything has been traced we suddenly switch to // a different control flow the first time we run the outermost tree, // triggering a side exit. if (j < RUNLOOP) a = 1; else a = 0; ++b; b += a; } return counter + b; } function testNestedExitStackOuter() { var counter = 0; for (var j = 1; j <= RUNLOOP; ++j) { for (var k = 1; k <= RUNLOOP; ++k) { counter = testNestedExitStackInner(j, counter); } } return counter; } //assertEq(testNestedExitStackOuter(), 81); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNestedForIn.js0000644000175000017500000000035111545150464023675 0ustar chr1schr1sfunction testNestedForIn() { var a = {x: 1, y: 2, z: 3}; var s = ''; for (var p1 in a) for (var p2 in a) s += p1 + p2 + ' '; return s; } assertEq(testNestedForIn(), 'xx xy xz yx yy yz zx zy zz '); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNewArrayCount.js0000644000175000017500000000042411545150464024257 0ustar chr1schr1sfunction testNewArrayCount() { function count(a) { var n = 0; for (var p in a) n++; return n; } var a = []; for (var i = 0; i < 5; i++) a = [0]; assertEq(count(a), 1); for (var i = 0; i < 5; i++) a = [0, , 2]; assertEq(count(a), 2); } testNewArrayCount(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNewArrayCount2.js0000644000175000017500000000035511545150464024344 0ustar chr1schr1sfunction testNewArrayCount2() { function count(a) { var n = 0; for (var p in a) n++; return n; } var x = 0; for (var i = 0; i < 10; ++i) x = count(new Array(1,2,3)); return x; } assertEq(testNewArrayCount2(), 3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNewDate.js0000644000175000017500000000074711545150464023055 0ustar chr1schr1sfunction testNewDate() { // Accessing global.Date for the first time will change the global shape, // so do it before the loop starts; otherwise we have to loop an extra time // to pick things up. var start = new Date(); var time = new Date(); for (var j = 0; j < RUNLOOP; ++j) time = new Date(); return time > 0 && time >= start; } assertEq(testNewDate(), true); checkStats({ recorderStarted: 1, recorderAborted: 0, traceTriggered: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNEWINIT.js0000644000175000017500000000022011545150464022625 0ustar chr1schr1sfunction testNEWINIT() { var a; for (var i = 0; i < 10; ++i) a = [{}]; return uneval(a); } assertEq(testNEWINIT(), "[{}]"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNEWINIT_DOUBLE.js0000644000175000017500000000021411545150464023662 0ustar chr1schr1sfunction testNEWINIT_DOUBLE() { for (var z = 0; z < 2; ++z) { ({ 0.1: null })} return "ok"; } assertEq(testNEWINIT_DOUBLE(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNewObject.js0000644000175000017500000000024211545150464023374 0ustar chr1schr1sfunction testNewObject() { var a = {}; for (var i = 0; i < 10; ++i) a = new Object(); return a; } assertEq(testNewObject().__proto__, {}.__proto__); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNewString.js0000644000175000017500000000143111545150464023435 0ustar chr1schr1sfunction testNewString() { var o = { toString: function() { return "string"; } }; var r = []; for (var i = 0; i < 5; i++) r.push(typeof new String(o)); for (var i = 0; i < 5; i++) r.push(typeof new String(3)); for (var i = 0; i < 5; i++) r.push(typeof new String(2.5)); for (var i = 0; i < 5; i++) r.push(typeof new String("string")); for (var i = 0; i < 5; i++) r.push(typeof new String(null)); for (var i = 0; i < 5; i++) r.push(typeof new String(true)); for (var i = 0; i < 5; i++) r.push(typeof new String(undefined)); return r.length === 35 && r.every(function(v) { return v === "object"; }); } assertEq(testNewString(), true); checkStats({ recorderStarted: 7, recorderAborted: 0, traceCompleted: 7, sideExitIntoInterpreter: 7 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNewWithNonNativeProto.js0000644000175000017500000000054211545150464025752 0ustar chr1schr1sfunction testNewWithNonNativeProto() { function f() { } var a = f.prototype = []; for (var i = 0; i < 5; i++) var o = new f(); return Object.getPrototypeOf(o) === a && o.splice === Array.prototype.splice; } assertEq(testNewWithNonNativeProto(), true); checkStats({ recorderStarted: 1, recorderAborted: 0, sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNonStubGetter.js0000644000175000017500000000036111545150464024261 0ustar chr1schr1sfunction testNonStubGetter() { let ([] = false) { (this.watch("x", /a/g)); }; (function () { (eval("(function(){for each (x in [1, 2, 2]);});"))(); })(); this.unwatch("x"); return "ok"; } assertEq(testNonStubGetter(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNot.js0000644000175000017500000000054311545150464022260 0ustar chr1schr1sfunction testNot() { var a = new Object(), b = null, c = "foo", d = "", e = 5, f = 0, g = 5.5, h = -0, i = true, j = false, k = undefined; var r; for (var i = 0; i < 10; ++i) r = [!a, !b, !c, !d, !e, !f, !g, !h, !i, !j, !k]; return r.join(","); } assertEq(testNot(), "false,true,false,true,false,true,false,true,false,true,true"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNullCallee.js0000644000175000017500000000061111545150464023534 0ustar chr1schr1sfunction testNullCallee() { try { function f() { var x = new Array(5); for (var i = 0; i < 5; i++) x[i] = a[i].toString(); return x.join(','); } f([[1],[2],[3],[4],[5]]); f([null, null, null, null, null]); } catch (e) { return true; } return false; } assertEq(testNullCallee(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNullIncrement.js0000644000175000017500000000045511545150464024301 0ustar chr1schr1sfunction f() { var n; var k; for (var i = 0; i < 2*RUNLOOP; ++i) { n = null; k = n++; if (k) { } } return [k, n]; } var [a, b] = f(); assertEq(a, 0); assertEq(b, 1); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNullRelCmp.js0000644000175000017500000000043111545150464023531 0ustar chr1schr1sfunction testNullRelCmp() { var out = []; for(j=0;j<3;++j) { out.push(3 > null); out.push(3 < null); out.push(0 == null); out.push(3 == null); } return out.join(","); } assertEq(testNullRelCmp(), "true,false,false,false,true,false,false,false,true,false,false,false"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNullToString.js0000644000175000017500000000065511545150464024130 0ustar chr1schr1sfunction testNullToString() { var a = []; for (var i = 0; i < 10; i++) a.push(String(null)); for (i = 0; i < 10; i++) { var t = typeof a[i]; if (t != "string") a.push(t); } return a.join(","); } assertEq(testNullToString(), "null,null,null,null,null,null,null,null,null,null"); checkStats({ recorderStarted: 2, sideExitIntoInterpreter: 2, recorderAborted: 0 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNumberToString.js0000644000175000017500000000021111545150464024432 0ustar chr1schr1sfunction testNumberToString() { var x = new Number(0); for (var i = 0; i < 4; i++) x.toString(); } testNumberToString(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testNumToString.js0000644000175000017500000000077511545150464023760 0ustar chr1schr1sfunction testNumToString() { var r = []; var d = 123456789; for (var i = 0; i < 10; ++i) { r = [ d.toString(), (-d).toString(), d.toString(10), (-d).toString(10), d.toString(16), (-d).toString(16), d.toString(36), (-d).toString(36) ]; } return r.join(","); } assertEq(testNumToString(), "123456789,-123456789,123456789,-123456789,75bcd15,-75bcd15,21i3v9,-21i3v9"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testObjectConstructorReturningObject.js0000644000175000017500000000031311545150464030214 0ustar chr1schr1sfor (var i = 0; i < HOTLOOP+4; ++i) { var o; o = new Object(Object); assertEq(o, Object); (function () { x = constructor })(); o = new(x)(x); assertEq(o, Object); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testObjectLength.js0000644000175000017500000000044011545150464024064 0ustar chr1schr1sfunction testObjectLength() { var counter = 0; var a = {}; a.length = 10000000; for (var i = 0; i < a.length; i++) counter++; return counter; } assertEq(testObjectLength(), 10000000); checkStats({ recorderStarted: 1, recorderAborted: 0, sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testObjectOrderedCmp.js0000644000175000017500000000027611545150464024676 0ustar chr1schr1sfunction testObjectOrderedCmp() { var a = new Array(5); for(var i=0;i<5;++i) a[i] = ({} < {}); return a.join(","); } assertEq(testObjectOrderedCmp(), "false,false,false,false,false"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testObjectOrderedCmp2.js0000644000175000017500000000027611545150464024760 0ustar chr1schr1sfunction testObjectOrderedCmp2() { var a = new Array(5); for(var i=0;i<5;++i) a[i] = ("" <= null); return a.join(","); } assertEq(testObjectOrderedCmp2(), "true,true,true,true,true"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testObjectToNumber.js0000644000175000017500000000027111545150464024400 0ustar chr1schr1sfunction testObjectToNumber() { var o = {valueOf: function()-3}; var x = 0; for (var i = 0; i < 10; i++) x -= o; return x; } assertEq(testObjectToNumber(), 30); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testObjectToString.js0000644000175000017500000000033411545150464024416 0ustar chr1schr1sfunction testObjectToString() { var o = {toString: function()"foo"}; var s = ""; for (var i = 0; i < 10; i++) s += o; return s; } assertEq(testObjectToString(), "foofoofoofoofoofoofoofoofoofoo"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testObjectVsPrototype.js0000644000175000017500000000037611545150464025171 0ustar chr1schr1sfunction testObjectVsPrototype() { function D() {} var b = D.prototype = {x: 1}; var d = new D; var arr = [b, b, b, d]; for (var i = 0; i < 4; i++) arr[i].x = i; d.y = 12; assertEq(d.x, 3); } testObjectVsPrototype(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testOwnPropertyWithInOperator.js0000644000175000017500000000047211545150464026670 0ustar chr1schr1sfunction testOwnPropertyWithInOperator() { var o = { 0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6 }; var a = []; for (var i = 0; i < 7; i++) a.push(i in o); return a.join(","); } assertEq(testOwnPropertyWithInOperator(), "true,true,true,true,true,true,true"); checkStats({ sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testPartialFlatClosure.js0000644000175000017500000000050511545150464025256 0ustar chr1schr1sassertEq((('-r', function (s) { function C(i) { this.m = function () { return i * t; } } var t = s; var a = []; for (var i = 0; i < 5; i++) a[a.length] = new C(i); return a; })(42))[4].m(), 168); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testPrimitiveConstructorPrototype.js0000644000175000017500000000031711545150464027663 0ustar chr1schr1sfunction testPrimitiveConstructorPrototype() { var f = function(){}; f.prototype = false; for (let j=0;j<5;++j) { new f; } return "ok"; } assertEq(testPrimitiveConstructorPrototype(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testPropagatedFunArgs.js0000644000175000017500000000153211545150464025073 0ustar chr1schr1sfunction testPropagatedFunArgs() { var win = this; var res = [], q = []; function addEventListener(name, func, flag) { q.push(func); } var pageInfo, obs; addEventListener("load", handleLoad, true); var observer = { observe: function(win, topic, data) { // obs.removeObserver(observer, "page-info-dialog-loaded"); handlePageInfo(); } }; function handleLoad() { pageInfo = { toString: function() { return "pageInfo"; } }; obs = { addObserver: function (obs, topic, data) { obs.observe(win, topic, data); } }; obs.addObserver(observer, "page-info-dialog-loaded", false); } function handlePageInfo() { res.push(pageInfo); function $(aId) { res.push(pageInfo); }; var feedTab = $("feedTab"); } q[0](); return res.join(','); } assertEq(testPropagatedFunArgs(), "pageInfo,pageInfo"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testProxyConstructors.js0000644000175000017500000000063411545150464025273 0ustar chr1schr1s// |jit-test| error: ExitCleanly // proxies can return primitives assertEq(new (Proxy.createFunction({}, function(){}, function(){})), undefined); x = Proxy.createFunction((function () {}), Uint16Array, wrap) new(wrap(x)) // proxies can return the callee var x = Proxy.createFunction({}, function (q) { return q; }); new x(x); // not an error new (Proxy.createFunction({}, "".indexOf)); throw "ExitCleanly" mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testProxyDefinePropertyWithMissingSetter.js0000644000175000017500000000066011545150464031076 0ustar chr1schr1s// throw, don't crash var expect = "TypeError: property descriptor's setter field is neither undefined nor a function"; var actual = ""; try { (x = Proxy.createFunction((function() { return { defineProperty: function(name, desc) { Object.defineProperty(x, name, desc) }, } })(), (eval))); Object.defineProperty(x, "", ({ get: function() {} })) } catch (e) { actual = '' + e; } assertEq(expect, actual); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testPutOnEmptyArgsObject.js0000644000175000017500000000032311545150464025544 0ustar chr1schr1svar g; function h() { return arguments.length; } function f() { var args = arguments; g = function() { return h.apply(this, args); } } for (var i = 0; i < 10; ++i) { f(); } assertEq(g(), 0); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testReallyDeepNestedExit.js0000644000175000017500000000173111545150464025543 0ustar chr1schr1sfunction reallyDeepNestedExit(schedule) { var c = 0, j = 0; for (var i = 0; i < 5; i++) { for (j = 0; j < 4; j++) { c += (schedule[i*4 + j] == 1) ? 1 : 2; } } return c; } function testReallyDeepNestedExit() { var c = 0; var schedule1 = new Array(5*4); var schedule2 = new Array(5*4); for (var i = 0; i < 5*4; i++) { schedule1[i] = 0; schedule2[i] = 0; } /** * First innermost compile: true branch runs through. * Second '': false branch compiles new loop edge. * First outer compile: expect true branch. * Second '': hit false branch. */ schedule1[0*4 + 3] = 1; var schedules = [schedule1, schedule2, schedule1, schedule2, schedule2]; for (var i = 0; i < 5; i++) { c += reallyDeepNestedExit(schedules[i]); } return c; } assertEq(testReallyDeepNestedExit(), 198); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testRebranding.js0000644000175000017500000000031511545150464023570 0ustar chr1schr1sq = ""; function g() { q += "g"; } function h() { q += "h"; } a = [g, g, g, g, h]; for (i=0; i<5; i++) { f = a[i]; f(); } function testRebranding() { return q; } assertEq(testRebranding(), "ggggh"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testRebranding2.js0000644000175000017500000000071211545150464023653 0ustar chr1schr1sdelete q; delete g; delete h; delete a; delete f; function testRebranding2() { // Same as testRebranding, but the object to be rebranded isn't the global. var x = "FAIL"; function g(){} function h(){ x = "ok"; } var obj = {m: g}; var arr = [g, g, g, g, h]; //assertEq(arr.length > RUNLOOP, true); for (var i = 0; i < 5; i++) { obj.m = arr[i]; obj.m(); } return x; } assertEq(testRebranding2(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testReconstructImacroPCStack.js0000644000175000017500000000075311545150464026402 0ustar chr1schr1sx = Proxy.create((function () { return { get: function () {} } }()), Object.e) var hit = false; try { Function("\ for(var a = 0; a < 2; ++a) {\ if (a == 0) {}\ else {\ x > x\ }\ }\ ")() } catch (e) { hit = true; var str = String(e); var match = (str == "TypeError: x is not a function" || str == "TypeError: can't convert x to number"); assertEq(match, true); } assertEq(hit, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testRegexpGet.js0000644000175000017500000000030111545150464023402 0ustar chr1schr1sfunction testRegexpGet() { var re = /hi/; var a = []; for (let i = 0; i < 5; ++i) a.push(re.source); return a.toString(); } assertEq(testRegexpGet(), "hi,hi,hi,hi,hi"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testRegExpLiteral.js0000644000175000017500000000047111545150464024227 0ustar chr1schr1sfunction testRegExpLiteral() { var a; for (var i = 0; i < 15; i++) a = /foobar/; } testRegExpLiteral(); checkStats({ recorderStarted: 1, sideExitIntoInterpreter: 1, recorderAborted: 0, traceTriggered: 1, traceCompleted: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testRegExpTest.js0000644000175000017500000000036411545150464023553 0ustar chr1schr1s// |jit-test| TMFLAGS: full,fragprofile,treevis; valgrind function testRegExpTest() { var r = /abc/; var flag = false; for (var i = 0; i < 10; ++i) flag = r.test("abc"); return flag; } assertEq(testRegExpTest(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testReplace2.js0000644000175000017500000000025511545150464023155 0ustar chr1schr1sfunction testReplace2() { var s = "H e l l o", s1; for (i = 0; i < 100; ++i) s1 = s.replace(" ", ""); return s1; } assertEq(testReplace2(), "He l l o"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testReplaceMap.js0000644000175000017500000000144311545150464023531 0ustar chr1schr1s // String.replace on functions returning hashmap elements. function first() { var arr = {a: "hello", b: "there"}; var s = 'a|b'; return s.replace(/[a-z]/g, function(a) { return arr[a]; }, 'g'); } assertEq(first(), "hello|there"); function second() { var arr = {a: "hello", c: "there"}; var s = 'a|b|c'; return s.replace(/[a-z]/g, function(a) { return arr[a]; }, 'g'); } assertEq(second(), "hello|undefined|there"); Object.defineProperty(Object.prototype, "b", {get: function() { return "what"; }}); assertEq(second(), "hello|what|there"); function third() { var arr = {a: "hello", b: {toString: function() { arr = {}; return "three"; }}, c: "there"}; var s = 'a|b|c'; return s.replace(/[a-z]/g, function(a) { return arr[a]; }, 'g'); } assertEq(third(), "hello|three|undefined"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testResumeOp.js0000644000175000017500000000034411545150464023256 0ustar chr1schr1sfunction testResumeOp() { var a = [1,"2",3,"4",5,"6",7,"8",9,"10",11,"12",13,"14",15,"16"]; var x = ""; while (a.length > 0) x += a.pop(); return x; } assertEq(testResumeOp(), "16151413121110987654321"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testReverseArgTypes.js0000644000175000017500000000021211545150464024603 0ustar chr1schr1sfunction testReverseArgTypes() { for (var j = 0; j < 4; ++j) ''.replace('', /x/); return 1; } assertEq(testReverseArgTypes(), 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testRUNLOOPCorrectness.js0000644000175000017500000000053111545150464025066 0ustar chr1schr1sfunction testRUNLOOPCorrectness() { var b = 0; for (var i = 0; i < RUNLOOP; ++i) { ++b; } return b; } // Change the global shape right before doing the test this.testRUNLOOPCorrectnessVar = 1; assertEq(testRUNLOOPCorrectness(), RUNLOOP); checkStats({ recorderStarted: 1, recorderAborted: 0, traceTriggered: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testScriptGetter_JSOP_CALLPROP-2.js0000644000175000017500000000060511545150464026424 0ustar chr1schr1s// Test that the tracer is not confused by a.m() when a is the same shape each // time through the loop but a.m is a scripted getter that returns different // functions. function f() { return 'f'; } function g() { return 'g'; } var arr = [f, f, f, f, f, f, f, f, g]; var a = {get m() { return arr[i]; }}; var s = ''; for (var i = 0; i < 9; i++) s += a.m(); assertEq(s, 'ffffffffg'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testScriptGetter_JSOP_CALLPROP.js0000644000175000017500000000040211545150464026260 0ustar chr1schr1svar a = {_val: 'q', get p() { return f; }}; function f() { return this._val; } var g = ''; for (var i = 0; i < 9; i++) g += a.p(); assertEq(g, 'qqqqqqqqq'); checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testScriptGetter_JSOP_GETARGPROP.js0000644000175000017500000000035411545150464026524 0ustar chr1schr1sfunction test(a) { var s = ''; for (var i = 0; i < 9; i++) s += a.p; assertEq(s, 'qqqqqqqqq'); } test({get p() { return 'q'; }}); checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testScriptGetter_JSOP_GETLOCALPROP.js0000644000175000017500000000037111545150464026744 0ustar chr1schr1sfunction test() { var a = {get p() { return 'q'; }}; var s = ''; for (var i = 0; i < 9; i++) s += a.p; assertEq(s, 'qqqqqqqqq'); } test(); checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testScriptGetter_JSOP_GETPROP.js0000644000175000017500000000034411545150464026171 0ustar chr1schr1svar a = {get p() { return 11; }}; function f() { return a; } var g = 0; for (var i = 0; i < 9; i++) g += f().p; assertEq(g, 99); checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testScriptGetter_JSOP_GETTHISPROP.js0000644000175000017500000000037211545150464026662 0ustar chr1schr1svar a = { get p() { return 11; }, test: function () { var s = 0; for (var i = 0; i < 9; i++) s += this.p; assertEq(s, 99); }}; a.test(); checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSetelemWithFloatIndex.js0000644000175000017500000000012611545150464025725 0ustar chr1schr1svar x, a = {}; for (var i = 0; i < 9; i++) x = a[-3.5] = "ok"; assertEq(x, "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSetGetterOnlyProperty.js0000644000175000017500000000014311545150464026031 0ustar chr1schr1svar o = { get x() { return 17; } }; for (var j = 0; j < 5; ++j) o.x = 42; assertEq(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSetMethod.js0000644000175000017500000000035011545150464023410 0ustar chr1schr1sfunction C() { this.a = function() {}; this.b = function() {}; } for (var i = 0; i < 9; i++) new C; checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSetPropertyFail.js0000644000175000017500000000136711545150464024621 0ustar chr1schr1sfunction test(name, fn, val) { gc(); var ok = {}, bad = {}; bad.__defineSetter__(name, fn); var arr = [ok, ok, ok, ok, ok, bad]; var log = ''; try { for (var i = 0; i < arr.length; i++) { arr[i][name] = val; log += '.'; } } catch (exc) { log += 'E'; } assertEq(log, '.....E'); } test("x", Function.prototype.call, null); // TypeError: Function.prototype.call called on incompatible [object Object] test("y", Array, 0.1); // RangeError: invalid array length test(1, Function.prototype.call, null); // TypeError: Function.prototype.call called on incompatible [object Object] test(1, Array, 0.1); // RangeError: invalid array length mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSetPropNeitherMissNorHit.js0000644000175000017500000000025511545150464026413 0ustar chr1schr1sfunction testSetPropNeitherMissNorHit() { for (var j = 0; j < 5; ++j) { if (({}).__proto__ = 1) { } } return "ok"; } assertEq(testSetPropNeitherMissNorHit(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSetProtoRegeneratesObjectShape.js0000644000175000017500000000070211545150464027571 0ustar chr1schr1sfunction testSetProtoRegeneratesObjectShape() { var f = function() {}; var g = function() {}; g.prototype.__proto__ = {}; function iq(obj) { for (var i = 0; i < 10; ++i) "" + obj.prototype; } iq(f); iq(f); iq(f); iq(f); iq(g); if (shapeOf(f.prototype) === shapeOf(g.prototype)) return "object shapes same after proto of one is changed"; return true; } assertEq(testSetProtoRegeneratesObjectShape(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSettingWatchPointOnReadOnlyProp.js0000644000175000017500000000030511545150464027726 0ustar chr1schr1sfor (var i = 0; i < 5; ++i) { var o = {} Object.defineProperty(o, 'x', { value:"cow", writable:false }); var r = o.watch('x', function() {}); assertEq(r, undefined); o.x = 4; } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testShiftLeft.js0000644000175000017500000000215411545150464023410 0ustar chr1schr1s// |jit-test| TMFLAGS: full,fragprofile,treevis; valgrind /* Test the proper operation of the left shift operator. This is especially * important on ARM as an explicit mask is required at the native instruction * level. */ load(libdir + 'range.js'); function testShiftLeft() { var r = []; var i = 0; var j = 0; var shifts = [0,1,7,8,15,16,23,24,31]; /* Samples from the simple shift range. */ for (i = 0; i < shifts.length; i++) r[j++] = 1 << shifts[i]; /* Samples outside the normal shift range. */ for (i = 0; i < shifts.length; i++) r[j++] = 1 << (shifts[i] + 32); /* Samples far outside the normal shift range. */ for (i = 0; i < shifts.length; i++) r[j++] = 1 << (shifts[i] + 224); for (i = 0; i < shifts.length; i++) r[j++] = 1 << (shifts[i] + 256); return r.join(","); } assertEq(testShiftLeft(), "1,2,128,256,32768,65536,8388608,16777216,-2147483648,"+ "1,2,128,256,32768,65536,8388608,16777216,-2147483648,"+ "1,2,128,256,32768,65536,8388608,16777216,-2147483648,"+ "1,2,128,256,32768,65536,8388608,16777216,-2147483648"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testShiftRightArithmetic.js0000644000175000017500000000254711545150464025613 0ustar chr1schr1s/* Test the proper operation of the arithmetic right shift operator. This is * especially important on ARM as an explicit mask is required at the native * instruction level. */ load(libdir + 'range.js'); /* Test different combinations of literals/variables. */ var s = 4; var t = 100; assertEq(42 >> s, 2); assertEq(s >> 1, 2); assertEq(23 >> 3, 2); assertEq(t >> s, 6); function testShiftRightArithmetic() { var r = []; var i = 0; var j = 0; var shifts = [0,1,7,8,15,16,23,24,31]; /* Samples from the simple shift range. */ for (i = 0; i < shifts.length; i++) r[j++] = -2147483648 >> shifts[i]; /* Samples outside the normal shift range. */ for (i = 0; i < shifts.length; i++) r[j++] = -2147483648 >> (shifts[i] + 32); /* Samples far outside the normal shift range. */ for (i = 0; i < shifts.length; i++) r[j++] = -2147483648 >> (shifts[i] + 224); for (i = 0; i < shifts.length; i++) r[j++] = -2147483648 >> (shifts[i] + 256); return r.join(","); } assertEq(testShiftRightArithmetic(), "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+ "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+ "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+ "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testShiftRightLogical.js0000644000175000017500000000256311545150464025072 0ustar chr1schr1s/* Test the proper operation of the logical right shift operator. This is * especially important on ARM as an explicit mask is required at the native * instruction level. */ load(libdir + 'range.js'); function testShiftRightLogical() { var r = []; var i = 0; var j = 0; var shifts = [0,1,7,8,15,16,23,24,31]; /* Samples from the simple shift range. */ for (i = 0; i < shifts.length; i++) r[j++] = -2147483648 >>> shifts[i]; /* Samples outside the normal shift range. */ for (i = 0; i < shifts.length; i++) r[j++] = -2147483648 >>> (shifts[i] + 32); /* Samples far outside the normal shift range. */ for (i = 0; i < shifts.length; i++) r[j++] = -2147483648 >>> (shifts[i] + 224); for (i = 0; i < shifts.length; i++) r[j++] = -2147483648 >>> (shifts[i] + 256); return r.join(","); } /* Note: Arguments to the ">>>" operator are converted to unsigned 32-bit * integers during evaluation. As a result, -2147483648 >>> 0 evaluates to the * unsigned interpretation of the same value, which is 2147483648. */ assertEq(testShiftRightLogical(), "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1,"+ "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1,"+ "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1,"+ "2147483648,1073741824,16777216,8388608,65536,32768,256,128,1"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSideExitInConstructor.js0000644000175000017500000000142711545150464025775 0ustar chr1schr1s// |jit-test| TMFLAGS: full,fragprofile,treevis; valgrind function testSideExitInConstructor() { var FCKConfig = {}; FCKConfig.CoreStyles = { 'Bold': { }, 'Italic': { }, 'FontFace': { }, 'Size' : { Overrides: [ ] }, 'Color' : { Element: '', Styles: { }, Overrides: [ ] }, 'BackColor': { Element : '', Styles : { 'background-color' : '' } }, }; var FCKStyle = function(A) { A.Element; }; var pass = true; for (var s in FCKConfig.CoreStyles) { var x = new FCKStyle(FCKConfig.CoreStyles[s]); if (!x) pass = false; } return pass; } assertEq(testSideExitInConstructor(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSlowArrayLength.js0000644000175000017500000000044611545150464024607 0ustar chr1schr1sfunction testSlowArrayLength() { var counter = 0; var a = []; a[10000000 - 1] = 0; for (var i = 0; i < a.length; i++) counter++; return counter; } assertEq(testSlowArrayLength(), 10000000); checkStats({ recorderStarted: 1, recorderAborted: 0, sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSlowArrayPop.js0000644000175000017500000000053611545150464024124 0ustar chr1schr1sfunction testSlowArrayPop() { var a = []; for (var i = 0; i < RUNLOOP; i++) a[i] = [0]; a[RUNLOOP-1].__defineGetter__("0", function () { return 'xyzzy'; }); var last; for (var i = 0; i < RUNLOOP; i++) last = a[i].pop(); // reenters interpreter in getter return last; } assertEq(testSlowArrayPop(), 'xyzzy'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSlowArrayPopMultiFrame.js0000644000175000017500000000123411545150464026106 0ustar chr1schr1s// Same thing but it needs to reconstruct multiple stack frames (so, // multiple functions called inside the loop) function testSlowArrayPopMultiFrame() { var a = []; for (var i = 0; i < RUNLOOP; i++) a[i] = [0]; a[RUNLOOP-1].__defineGetter__("0", function () { return 23; }); function child(a, i) { return a[i].pop(); // reenters interpreter in getter } function parent(a, i) { return child(a, i); } function gramps(a, i) { return parent(a, i); } var last; for (var i = 0; i < RUNLOOP; i++) last = gramps(a, i); return last; } assertEq(testSlowArrayPopMultiFrame(), 23); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSlowArrayPopNestedTrees.js0000644000175000017500000000213511545150464026267 0ustar chr1schr1s// Same thing but nested trees, each reconstructing one or more stack frames // (so, several functions with loops, such that the loops end up being // nested though they are not lexically nested) function testSlowArrayPopNestedTrees() { var a = []; for (var i = 0; i < RUNLOOP; i++) a[i] = [0]; a[RUNLOOP-1].__defineGetter__("0", function () { return 3.14159 }); function child(a, i, j, k) { var last = 2.71828; for (var l = 0; l < RUNLOOP; l++) if (i == RUNLOOP-1 && j == RUNLOOP-1 && k == RUNLOOP-1) last = a[l].pop(); // reenters interpreter in getter return last; } function parent(a, i, j) { var last; for (var k = 0; k < RUNLOOP; k++) last = child(a, i, j, k); return last; } function gramps(a, i) { var last; for (var j = 0; j < RUNLOOP; j++) last = parent(a, i, j); return last; } var last; for (var i = 0; i < RUNLOOP; i++) last = gramps(a, i); return last; } assertEq(testSlowArrayPopNestedTrees(), 3.14159); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSlowNativeBail.js0000644000175000017500000000037311545150464024404 0ustar chr1schr1sfunction testSlowNativeBail() { var a = ['0', '1', '2', '3', '+']; try { for (var i = 0; i < a.length; i++) new RegExp(a[i]); } catch (exc) { assertEq(""+exc, "SyntaxError: invalid quantifier"); } } testSlowNativeBail(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSlowNativeCtor.js0000644000175000017500000000017611545150464024445 0ustar chr1schr1sdelete _quit; function testSlowNativeCtor() { for (var i = 0; i < 4; i++) new Date().valueOf(); } testSlowNativeCtor(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSlowNativeWithNullThis.js0000644000175000017500000000014011545150464026123 0ustar chr1schr1sx = 0 for (a = 0; a < 3; a++) { (function () { return Float64Array })()(x, 1) } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStackQuotaExhausted.js0000644000175000017500000000113111545150464025444 0ustar chr1schr1sconst numFatArgs = Math.pow(2,19) - 1024; function fun(x) { if (x <= 0) return 0; return fun(x-1); } function fatStack() { return fun(10000); } function assertRightFailure(e) { assertEq(e.toString() == "InternalError: script stack space quota is exhausted" || e.toString() == "InternalError: too much recursion", true); } exception = false; try { fatStack.apply(null, new Array(numFatArgs)); } catch (e) { assertRightFailure(e); exception = true; } assertEq(exception, true); // No more trace recursion w/ JM checkStats({traceCompleted:0}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStaticsInRegExp.js0000644000175000017500000000037711545150464024541 0ustar chr1schr1s'abcdef'.replace(/a(\w+)c/, function() { assertEq(RegExp.lastMatch, 'abc'); '123456'.replace(/1(\d+)3/, function() { assertEq(RegExp.lastMatch, '123'); }); assertEq(RegExp.lastMatch, '123'); }); assertEq(RegExp.lastMatch, 'abc'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStrict.js0000644000175000017500000000042411545150464022766 0ustar chr1schr1sfunction testStrict() { var n = 10, a = []; for (var i = 0; i < 10; ++i) { a[0] = (n === 10); a[1] = (n !== 10); a[2] = (n === null); a[3] = (n == null); } return a.join(","); } assertEq(testStrict(), "true,false,false,false"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testString.js0000644000175000017500000000065011545150464022765 0ustar chr1schr1sfunction testString() { var q; for (var i = 0; i <= RUNLOOP; ++i) { q = []; q.push(String(void 0)); q.push(String(true)); q.push(String(5)); q.push(String(5.5)); q.push(String("5")); q.push(String([5])); } return q.join(","); } assertEq(testString(), "undefined,true,5,5.5,5,5"); checkStats({ recorderStarted: 1, sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStringConstructorWithExtraArg.js0000644000175000017500000000027411545150464027527 0ustar chr1schr1sfunction testStringConstructorWithExtraArg() { for (let i = 0; i < 5; ++i) new String(new String(), 2); return "ok"; } assertEq(testStringConstructorWithExtraArg(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStringify.js0000644000175000017500000000104111545150464023470 0ustar chr1schr1sfunction testStringify() { var t = true, f = false, u = undefined, n = 5, d = 5.5, s = "x"; var a = []; for (var i = 0; i < 10; ++i) { a[0] = "" + t; a[1] = t + ""; a[2] = "" + f; a[3] = f + ""; a[4] = "" + u; a[5] = u + ""; a[6] = "" + n; a[7] = n + ""; a[8] = "" + d; a[9] = d + ""; a[10] = "" + s; a[11] = s + ""; } return a.join(","); } assertEq(testStringify(), "true,true,false,false,undefined,undefined,5,5,5.5,5.5,x,x"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStringIncrement.js0000644000175000017500000000055611545150464024637 0ustar chr1schr1svar a, b; function f(str) { var n; var k; for (var i = 0; i < 2*RUNLOOP; ++i) { n = str; k = n++; if (k) { } } return [k, n]; } [a, b] = f("10"); assertEq(a, 10); assertEq(b, 11); [a, b] = f("5"); assertEq(a, 5); assertEq(b, 6); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 2 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStringLengthNoTinyId.js0000644000175000017500000000270211545150464025545 0ustar chr1schr1s// Second testPropagatedFunArgs test -- this is a crash-test. (function () { var escapee; function testPropagatedFunArgs() { const magic = 42; var win = this; var res = [], q = []; function addEventListener(name, func, flag) { q.push(func); } var pageInfo = "pageInfo", obs; addEventListener("load", handleLoad, true); var observer = { observe: function(win, topic, data) { // obs.removeObserver(observer, "page-info-dialog-loaded"); handlePageInfo(); } }; function handleLoad() { //pageInfo = { toString: function() { return "pageInfo"; } }; obs = { addObserver: function (obs, topic, data) { obs.observe(win, topic, data); } }; obs.addObserver(observer, "page-info-dialog-loaded", false); } function handlePageInfo() { res.push(pageInfo); function $(aId) { function notSafe() { return magic; } notSafe(); res.push(pageInfo); }; var feedTab = $("feedTab"); } escapee = q[0]; return res.join(','); } testPropagatedFunArgs(); escapee(); })(); function testStringLengthNoTinyId() { var x = "unset"; var t = new String(""); for (var i = 0; i < 5; i++) x = t["-1"]; var r = "t['-1'] is " + x; t["-1"] = "foo"; r += " when unset, '" + t["-1"] + "' when set"; return r; } assertEq(testStringLengthNoTinyId(), "t['-1'] is undefined when unset, 'foo' when set"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStringObjectLength.js0000644000175000017500000000027011545150464025254 0ustar chr1schr1sfunction testStringObjectLength() { var x = new String("foo"), y = 0; for (var i = 0; i < 10; ++i) y = x.length; return y; } assertEq(testStringObjectLength(), 3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStringPropIncrement.js0000644000175000017500000000034711545150464025476 0ustar chr1schr1sfunction f() { var o = { n: "" }; for (var i = 0; i < 2*RUNLOOP; ++i) { o.n = ""; if (o.n++) { } } } f(); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1 });mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStringResolve.js0000644000175000017500000000035511545150464024327 0ustar chr1schr1sfunction testStringResolve() { var x = 0; for each (let d in [new String('q'), new String('q'), new String('q')]) { if (("" + (0 in d)) === "true") x++; } return x; } assertEq(testStringResolve(), 3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStringToInt32.js0000644000175000017500000000023411545150464024106 0ustar chr1schr1sfunction testStringToInt32() { var s = ""; for (let j = 0; j < 5; ++j) s += ("1e+81" ^ 3); return s; } assertEq(testStringToInt32(), "33333"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testStringToNumber.js0000644000175000017500000000156311545150464024445 0ustar chr1schr1sfunction convertToInt(str) { return str | 0; } function convertToIntOnTrace(str) { var z; for (var i = 0; i < RUNLOOP; ++i) { z = str | 0; } return z; } function convertToDouble(str) { return str * 1.5; } function convertToDoubleOnTrace(str) { var z; for (var i = 0; i < RUNLOOP; ++i) { z = str * 1.5; } return z; } assertEq(convertToInt("0x10"), 16); assertEq(convertToInt("-0x10"), 0); assertEq(convertToIntOnTrace("0x10"), 16); checkStats({ traceTriggered: 1 }); assertEq(convertToIntOnTrace("-0x10"), 0); checkStats({ traceTriggered: 2 }); assertEq(convertToDouble("0x10"), 24); assertEq(convertToDouble("-0x10"), NaN); assertEq(convertToDoubleOnTrace("0x10"), 24); checkStats({ traceTriggered: 3 }); assertEq(convertToDoubleOnTrace("-0x10"), NaN); checkStats({ traceTriggered: 4 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSubstring.js0000644000175000017500000000023111545150464023472 0ustar chr1schr1sfunction testSubstring() { for (var i = 0; i < 5; ++i) { actual = "".substring(5); } return actual; } assertEq(testSubstring(), ""); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSuppressDeletedProperty.js0000644000175000017500000000030111545150464026370 0ustar chr1schr1svar obj = { a:1, b:1, c:1, d:1, e:1, f:1, g:1 }; var sum = 0; for each (var i in obj) { sum += i; delete obj.f; } // this isn't even implemented to work yet; just don't crash or iloop mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSwitch.js0000644000175000017500000000077511545150464022770 0ustar chr1schr1sfunction testSwitch() { var x = 0; var ret = 0; for (var i = 0; i < 100; ++i) { switch (x) { case 0: ret += 1; break; case 1: ret += 2; break; case 2: ret += 3; break; case 3: ret += 4; break; default: x = 0; } x++; } return ret; } assertEq(testSwitch(), 226); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSwitchString.js0000644000175000017500000000106511545150464024150 0ustar chr1schr1sfunction testSwitchString() { var x = "asdf"; var ret = 0; for (var i = 0; i < 100; ++i) { switch (x) { case "asdf": x = "asd"; ret += 1; break; case "asd": x = "as"; ret += 2; break; case "as": x = "a"; ret += 3; break; case "a": x = "foo"; ret += 4; break; default: x = "asdf"; } } return ret; } assertEq(testSwitchString(), 200); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testSwitchUndefined.js0000644000175000017500000000032211545150464024576 0ustar chr1schr1sfunction testSwitchUndefined() { var x = undefined; var y = 0; for (var i = 0; i < 5; i++) { switch (x) { default: y++; } } return y; } assertEq(testSwitchUndefined(), 5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testTableSwitch1.js0000644000175000017500000000066111545150464024013 0ustar chr1schr1sfunction testTableSwitch1() { var x = 'miss'; var i, j = 0; for (i = 0; i < RUNLOOP + 10; i++) { switch (x) { case 1: case 2: case 3: case 4: case 5: throw "FAIL"; default: j++; } } assertEq(i, j); } testTableSwitch1(); if (HAVE_TM && jitstats.archIsIA32) { checkStats({ recorderStarted: 1, sideExitIntoInterpreter: 1, recorderAborted: 0, traceCompleted: 1 }); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testTableSwitch2.js0000644000175000017500000000106611545150464024014 0ustar chr1schr1sfunction testTableSwitch2() { var arr = [2, 2, 2, 2, 2, 5, 2, 2, 5, 5, 5, 5, 5, 5, 5, 5]; var s = ''; for (var i = 0; i < arr.length; i++) { switch (arr[i]) { case 0: case 1: case 3: case 4: throw "FAIL"; case 2: s += '2'; break; case 5: s += '5'; } } assertEq(s, arr.join("")); } testTableSwitch2(); if (HAVE_TM && jitstats.archIsIA32) { checkStats({ recorderStarted: 1, sideExitIntoInterpreter: 4, recorderAborted: 0, traceCompleted: 3 }); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testThinForEach.js0000644000175000017500000000033111545150464023645 0ustar chr1schr1sfunction testThinForEach() { var a = ["red"]; var n = 0; for (var i = 0; i < 10; i++) for each (var v in a) if (v) n++; return n; } assertEq(testThinForEach(), 10); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testThinLoopDemote.js0000644000175000017500000000057111545150464024413 0ustar chr1schr1sfunction testThinLoopDemote() { function f() { var k = 1; for (var n = 0; n < 4; n++) { k = (k * 10); } return k; } f(); return f(); } assertEq(testThinLoopDemote(), 10000); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 2, unstableLoopVariable: 0 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testThrowingObjectEqUndefined.js0000644000175000017500000000051111545150464026553 0ustar chr1schr1sfunction testThrowingObjectEqUndefined() { try { var obj = { toString: function() { throw 0; } }; for (var i = 0; i < 5; i++) "" + (obj == undefined); return i === 5; } catch (e) { return "" + e; } } assertEq(testThrowingObjectEqUndefined(), true); checkStats({ sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testToLocaleString.js0000644000175000017500000000010411545150464024402 0ustar chr1schr1svar str = (3.14).toLocaleString(); assertEq(str[str.length-1], "4");mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testToStringBeforeValueOf.js0000644000175000017500000000055511545150464025701 0ustar chr1schr1sfunction testToStringBeforeValueOf() { var o = {toString: function() { return "s"; }, valueOf: function() { return "v"; } }; var a = []; for (var i = 0; i < 10; i++) a.push(String(o)); return a.join(","); } assertEq(testToStringBeforeValueOf(), "s,s,s,s,s,s,s,s,s,s"); checkStats({ recorderStarted: 1, sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testToUpperToLower.js0000644000175000017500000000034311545150464024430 0ustar chr1schr1sfunction testToUpperToLower() { var s = "Hello", s1, s2; for (i = 0; i < 100; ++i) { s1 = s.toLowerCase(); s2 = s.toUpperCase(); } return s1 + s2; } assertEq(testToUpperToLower(), "helloHELLO"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testTrueShiftTrue.js0000644000175000017500000000076311545150464024301 0ustar chr1schr1s// Test no assert or crash from outer recorders (bug 465145) function testBug465145() { this.__defineSetter__("x", function(){}); this.watch("x", function(){}); y = this; for (var z = 0; z < 2; ++z) { x = y }; this.__defineSetter__("x", function(){}); for (var z = 0; z < 2; ++z) { x = y }; } function testTrueShiftTrue() { var a = new Array(5); for (var i=0;i<5;++i) a[i] = "" + (true << true); return a.join(","); } assertEq(testTrueShiftTrue(), "2,2,2,2,2"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testTypedArrayPunning.js0000644000175000017500000000215411545150464025143 0ustar chr1schr1sfunction testNonCanonicalNan() { const bytes = 128; var buf = new ArrayBuffer(bytes); /* create an array of non-canonical double nans */ var ui8arr = new Uint8Array(buf); for (var i = 0; i < ui8arr.length; ++i) ui8arr[i] = 0xff; var dblarr = new Float64Array(buf); assertEq(dblarr.length, bytes / 8); /* ensure they are canonicalized */ for (var i = 0; i < dblarr.length; ++i) { var asstr = dblarr[i] + ""; var asnum = dblarr[i] + 0.0; assertEq(asstr, "NaN"); assertEq(asnum, NaN); } /* create an array of non-canonical float nans */ for (var i = 0; i < ui8arr.length; i += 4) { ui8arr[i+0] = 0xffff; ui8arr[i+1] = 0xffff; ui8arr[i+2] = 0xffff; ui8arr[i+3] = 0xffff; } var fltarr = new Float32Array(buf); assertEq(fltarr.length, bytes / 4); /* ensure they are canonicalized */ for (var i = 0; i < fltarr.length; ++i) { var asstr = fltarr[i] + ""; var asnum = fltarr[i] + 0.0; assertEq(asstr, "NaN"); assertEq(asnum, NaN); } } testNonCanonicalNan(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testTypedArrays.js0000644000175000017500000000451011545150464023765 0ustar chr1schr1sfunction testBasicTypedArrays() { var ar, aridx, idx; var a = new Uint8Array(16); var b = new Uint16Array(16); var c = new Uint32Array(16); var d = new Int8Array(16); var e = new Int16Array(16); var f = new Int32Array(16); var g = new Float32Array(16); var h = new Float64Array(16); var iarrays = [ a, b, c, d, e, f ]; for (aridx = 0; aridx < iarrays.length; ++aridx) { ar = iarrays[aridx]; for (idx = 0; idx < ar.length-4; ++idx) { ar[idx] = 22; ar[idx+1] = 12.7; ar[idx+2] = "99"; ar[idx+3] = { k: "thing" }; ar[idx+4] = Infinity; } assertEq(ar[ar.length-5], 22); assertEq(ar[ar.length-4], 12); assertEq(ar[ar.length-3], 99); assertEq(ar[ar.length-2], 0); assertEq(ar[ar.length-1], 0); } var farrays = [ g, h ]; for (aridx = 0; aridx < farrays.length; ++aridx) { ar = farrays[aridx]; for (idx = 0; idx < ar.length-4; ++idx) { ar[idx] = 22; ar[idx+1] = 12.25; ar[idx+2] = "99"; ar[idx+3] = { k: "thing" }; ar[idx+4] = Infinity; } assertEq(ar[ar.length-5], 22); assertEq(ar[ar.length-4], 12.25); assertEq(ar[ar.length-3], 99); assertEq(!(ar[ar.length-2] == ar[ar.length-2]), true); assertEq(ar[ar.length-1], Infinity); } } function testSpecialTypedArrays() { var ar, aridx, idx; ar = new Uint8ClampedArray(16); for (idx = 0; idx < ar.length-4; ++idx) { ar[idx] = -200; ar[idx+1] = 127.5; ar[idx+2] = 987; ar[idx+3] = Infinity; ar[idx+4] = "hello world"; } assertEq(ar[ar.length-5], 0); assertEq(ar[ar.length-4], 128); assertEq(ar[ar.length-3], 255); assertEq(ar[ar.length-2], 255); assertEq(ar[ar.length-1], 0); } function testTypedArrayOther() { var ar = new Int32Array(16); for (var i = 0; i < ar.length; ++i) { ar[i] = i; } for (var i = 0; i < ar.length; ++i) { // deliberate out of bounds access ar[i-2] = ar[i+2]; } var t = 0; for (var i = 0; i < ar.length; ++i) { t += ar[i]; } assertEq(t, 143); } testBasicTypedArrays(); testSpecialTypedArrays(); testTypedArrayOther(); checkStats({ // Note! These are all inner tree growing aborts, because we change // the array type in the inner loop of the tests. This isn't ideal, // and if we ever fix these to not report as aborts, this should go // back to 0. recorderAborted: 5 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testTypeofHole.js0000644000175000017500000000034611545150464023577 0ustar chr1schr1sfunction testTypeofHole() { var a = new Array(6); a[5] = 3; for (var i = 0; i < 6; ++i) a[i] = typeof a[i]; return a.join(","); } assertEq(testTypeofHole(), "undefined,undefined,undefined,undefined,undefined,number"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testTypeUnstableForIn.js0000644000175000017500000000034211545150464025072 0ustar chr1schr1sfunction testTypeUnstableForIn() { var a = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]; var x = 0; for (var i in a) { i = parseInt(i); x++; } return x; } assertEq(testTypeUnstableForIn(), 16); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testUnaryImacros.js0000644000175000017500000000102711545150464024132 0ustar chr1schr1sfunction testUnaryImacros() { function checkArg(x) { return 1; } var o = { valueOf: checkArg, toString: null }; var count = 0; var v = 0; for (var i = 0; i < 5; i++) v += +o + -(-o); var results = [v === 10 ? "valueOf passed" : "valueOf failed"]; o.valueOf = null; o.toString = checkArg; for (var i = 0; i < 5; i++) v += +o + -(-o); results.push(v === 20 ? "toString passed" : "toString failed"); return results.join(", "); } assertEq(testUnaryImacros(), "valueOf passed, toString passed"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testUndefinedBooleanCmp.js0000644000175000017500000000140711545150464025361 0ustar chr1schr1sfunction testUndefinedBooleanCmp() { var t = true, f = false, x = []; for (var i = 0; i < 10; ++i) { x[0] = t == undefined; x[1] = t != undefined; x[2] = t === undefined; x[3] = t !== undefined; x[4] = t < undefined; x[5] = t > undefined; x[6] = t <= undefined; x[7] = t >= undefined; x[8] = f == undefined; x[9] = f != undefined; x[10] = f === undefined; x[11] = f !== undefined; x[12] = f < undefined; x[13] = f > undefined; x[14] = f <= undefined; x[15] = f >= undefined; } return x.join(","); } assertEq(testUndefinedBooleanCmp(), "false,true,false,true,false,false,false,false,false,true,false,true,false,false,false,false"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testUndefinedCmp.js0000644000175000017500000000025711545150464024063 0ustar chr1schr1sfunction testUndefinedCmp() { var a = false; for (var j = 0; j < 4; ++j) { if (undefined < false) { a = true; } } return a; } assertEq(testUndefinedCmp(), false); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testUndefinedIncrement.js0000644000175000017500000000050711545150464025266 0ustar chr1schr1sfunction f() { var n; var k; for (var i = 0; i < 2*RUNLOOP; ++i) { n = undefined; k = n++; if (k) { } } return [k, n]; } var [a, b] = f(); assertEq(isNaN(a), true); assertEq(isNaN(b), true); checkStats({ recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testUndefinedPropertyAccess.js0000644000175000017500000000063311545150464026310 0ustar chr1schr1sfunction testUndefinedPropertyAccess() { var x = [1,2,3]; var y = {}; var a = { foo: 1 }; y.__proto__ = x; var z = [x, x, x, y, y, y, y, a, a, a]; var s = ""; for (var i = 0; i < z.length; ++i) s += z[i].foo; return s; } assertEq(testUndefinedPropertyAccess(), "undefinedundefinedundefinedundefinedundefinedundefinedundefined111"); checkStats({ traceCompleted: 3 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testUndemotableBinaryOp.js0000644000175000017500000000037511545150464025426 0ustar chr1schr1sfunction testUndemotableBinaryOp() { var out = []; for (let j = 0; j < 5; ++j) { out.push(6 - ((void 0) ^ 0x80000005)); } return out.join(","); } assertEq(testUndemotableBinaryOp(), "2147483649,2147483649,2147483649,2147483649,2147483649"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testUndemoteLateGlobalSlots.js0000644000175000017500000000041511545150464026252 0ustar chr1schr1sfunction testUndemoteLateGlobalSlots() { for each (aaa in ["", "", 0/0, ""]) { ++aaa; for each (bbb in [0, "", aaa, "", 0, "", 0/0]) { } } delete aaa; delete bbb; return "ok"; } assertEq(testUndemoteLateGlobalSlots(), "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testWeirdDateParse.js0000644000175000017500000000273511545150464024370 0ustar chr1schr1svar global = this; function testWeirdDateParseOuter() { var vDateParts = ["11", "17", "2008"]; var out = []; for (var vI = 0; vI < vDateParts.length; vI++) out.push(testWeirdDateParseInner(vDateParts[vI])); /* Mutate the global shape so we fall off trace; this causes * additional oddity */ global.x = Math.random(); return out; } function testWeirdDateParseInner(pVal) { var vR = 0; for (var vI = 0; vI < pVal.length; vI++) { var vC = pVal.charAt(vI); if ((vC >= '0') && (vC <= '9')) vR = (vR * 10) + parseInt(vC); } return vR; } function testWeirdDateParse() { var result = []; result.push(testWeirdDateParseInner("11")); result.push(testWeirdDateParseInner("17")); result.push(testWeirdDateParseInner("2008")); result.push(testWeirdDateParseInner("11")); result.push(testWeirdDateParseInner("17")); result.push(testWeirdDateParseInner("2008")); result = result.concat(testWeirdDateParseOuter()); result = result.concat(testWeirdDateParseOuter()); result.push(testWeirdDateParseInner("11")); result.push(testWeirdDateParseInner("17")); result.push(testWeirdDateParseInner("2008")); return result.join(","); } assertEq(testWeirdDateParse(), "11,17,2008,11,17,2008,11,17,2008,11,17,2008,11,17,2008"); checkStats({ recorderStarted: 8, recorderAborted: 1, traceCompleted: 7, traceTriggered: 13, unstableLoopVariable: 3, noCompatInnerTrees: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testWhileObjectOrNull.js0000644000175000017500000000043211545150464025050 0ustar chr1schr1sfunction testWhileObjectOrNull() { try { for (var i = 0; i < 3; i++) { var o = { p: { p: null } }; while (o.p) o = o.p; } return "pass"; } catch (e) { return "threw exception: " + e; } } assertEq(testWhileObjectOrNull(), "pass"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testWhileWithContinue.js0000644000175000017500000000032111545150464025123 0ustar chr1schr1s// Test using 'while' with 'continue' -- the most ancient, the most powerful, // the most rare of all coding incantations. var i = 0; while (i < HOTLOOP+4) { ++i; continue; } assertEq(i, HOTLOOP+4); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testWithAndShadowing.js0000644000175000017500000000035211545150464024720 0ustar chr1schr1s// see bug 470795 var o = [{},{},{i:42}] var i; var s = []; for (var j = 0; j < 3; ++j) { with (o[j]) { for (i = 0; i < 2; ++i) { s.push(j); s.push(i); } } } assertEq(s.join(), '0,0,0,1,1,0,1,1,2,0,2,1'); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testXMLPropertyNames.js0000644000175000017500000000025411545150464024710 0ustar chr1schr1svar o = {}; o.__defineGetter__(,function(){}); .(o.__defineGetter__(new QName("foo"), function(){})); var i = 0; for (w in o) { ++i; } assertEq(i, 2); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/trees.js0000644000175000017500000000032611545150464021741 0ustar chr1schr1sfunction trees() { var i = 0, o = [0,0,0]; for (i = 0; i < 100; ++i) { if ((i & 1) == 0) o[0]++; else if ((i & 2) == 0) o[1]++; else o[2]++; } return String(o); } assertEq(trees(), "50,25,25"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/truthies.js0000644000175000017500000000164611545150464022474 0ustar chr1schr1sload(libdir + 'andTestHelper.js'); load(libdir + 'orTestHelper.js'); (function () { var opsies = ["||", "&&"]; var falsies = [null, undefined, false, NaN, 0, ""]; var truthies = [{}, true, 1, 42, 1/0, -1/0, "blah"]; var boolies = [falsies, truthies]; // The for each here should abort tracing, so that this test framework // relies only on the interpreter while the orTestHelper and andTestHelper // functions get trace-JITed. for each (var op in opsies) { for (var i in boolies) { for (var j in boolies[i]) { var x = uneval(boolies[i][j]); for (var k in boolies) { for (var l in boolies[k]) { var y = uneval(boolies[k][l]); var prefix = (op == "||") ? "or" : "and"; var f = new Function("return " + prefix + "TestHelper(" + x + "," + y + ",10)"); var expected = eval(x + op + y) ? 45 : 0; assertEq(f(), expected); } } } } } })(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/typeofTest.js0000644000175000017500000000053611545150464022770 0ustar chr1schr1sfunction typeofTest() { var values = ["hi", "hi", "hi", null, 5, 5.1, true, undefined, /foo/, typeofTest, [], {}], types = []; for (var i = 0; i < values.length; i++) types[i] = typeof values[i]; return types.toString(); } assertEq(typeofTest(), "string,string,string,object,number,number,boolean,undefined,object,function,object,object"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/unboxint.js0000644000175000017500000000023011545150464022457 0ustar chr1schr1sfunction unboxint() { var q = 0; var o = [4]; for (var i = 0; i < 100; ++i) q = o[0] << 1; return q; } assertEq(unboxint(), 8); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/wrap-primitive-this.js0000644000175000017500000000204611545150464024544 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * If the tracer fails to notice that computeThis() will produce a wrapped * primitive, then we may get: * * Assertion failure: thisObj == globalObj */ var HOTLOOP = this.tracemonkey ? tracemonkey.HOTLOOP : 8; var a; function f(n) { for (var i = 0; i < HOTLOOP; i++) if (i == HOTLOOP - 2) a = this; } /* * Various sorts of events can cause the global to be reshaped, which * resets our loop counts. Furthermore, we don't record a branch off a * trace until it has been taken HOTEXIT times. So simply calling the * function twice may not be enough to ensure that the 'a = this' branch * gets recorded. This is probably excessive, but it'll work. */ f.call("s", 1); f.call("s", 1); f.call("s", 1); f.call("s", 1); f.call("s", 1); f.call("s", 1); f.call("s", 1); f.call("s", 1); assertEq(typeof a, "object"); assertEq("" + a, "s"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/xprop.js0000644000175000017500000000015511545150464021767 0ustar chr1schr1sfunction xprop() { a = 0; for (var i = 0; i < 20; i++) a += 7; return a; } assertEq(xprop(), 140); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDivisionFloat.js0000644000175000017500000000027411545150464024273 0ustar chr1schr1sfunction testDivisionFloat() { var a = 32768.0; var b; while (b !== 1) { b = a / 2.0; a = b; } return a === 1.0; } assertEq(testDivisionFloat(), true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDivisionWithNegative1.js0000644000175000017500000000024011545150464025676 0ustar chr1schr1sfunction testDivisionWithNegative1() { for (var i = 3; i >= 0; --i) c = i / -1; return 1/c; } assertEq(testDivisionWithNegative1(), -Infinity); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDivOverflow.js0000644000175000017500000000017411545150464023766 0ustar chr1schr1sfor (d in [0, 0]) { const a = (d -= (++d).toString()) for each(b in [Number(1) << d, 0, 0xC]) { b / a } } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDoubleComparison.js0000644000175000017500000000036511545150464024767 0ustar chr1schr1sfunction testDoubleComparison() { for (var i = 0; i < 500000; ++i) { switch (1 / 0) { case Infinity: } } return "finished"; } assertEq(testDoubleComparison(), "finished"); checkStats({ sideExitIntoInterpreter: 1 }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDoubleToStr.js0000644000175000017500000000030511545150464023722 0ustar chr1schr1sfunction testDoubleToStr() { var x = 0.0; var y = 5.5; for (var i = 0; i < 200; i++) { x += parseFloat(y.toString()); } return x; } assertEq(testDoubleToStr(), 5.5*200); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDoubleZeroInSwitch1.js0000644000175000017500000000035411545150464025324 0ustar chr1schr1svar a = Math.sin(Math.PI/2); // spec does not specify precise answer here... if (a === 1) { // ...but if a === 1 here... switch (a) { case 1: break; // ...then it must also match here default: throw "FAIL"; } } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testDoubleZeroInSwitch2.js0000644000175000017500000000020411545150464025317 0ustar chr1schr1svar arr = Float32Array(1); arr[0] = 15; var a = arr[0]; assertEq(a, 15); switch (a) { case 15: break; default: throw "FAIL"; } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testElemDec1.js0000644000175000017500000000042111545150464023072 0ustar chr1schr1svar obj = {p: 100}; var name = "p"; var a = []; for (var i = 0; i < 10; i++) a[i] = obj[name]--; assertEq(a.join(','), '100,99,98,97,96,95,94,93,92,91'); assertEq(obj.p, 90); checkStats({recorderStarted: 1, recorderAborted: 0, traceCompleted: 1, traceTriggered: 1}); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/basic/testElemDec2.js0000644000175000017500000000031011545150464023070 0ustar chr1schr1svar obj = {s: ""}; var name = "s"; for (var i = 0; i <= RECORDLOOP + 5; i++) if (i > RECORDLOOP) obj[name]--; // first recording changes obj.s from string to number assertEq(obj.s, -5); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug496922.js0000644000175000017500000000047511545150464022657 0ustar chr1schr1sactual = ''; expected = '0,0,1,1,2,2,3,3,'; v = 0 let( f = function() { for (let x = 0; x < 4; ++x) { v >> x; (function() { for (let y = 0; y < 2; ++y) { appendToActual(x) } })() } }) { (function() {})() f(v) } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug496987.js0000644000175000017500000000055511545150464022671 0ustar chr1schr1sactual = ''; expected = '0,undefined,0,undefined,1,undefined,0,undefined,1,undefined,0,undefined,1,undefined,nocrash,'; // bug 496987 for each(let a in ["", "", true, "", true, "", true]) { appendToActual((function() { for (var e in [0]) { appendToActual( + a) } })()) } appendToActual('nocrash') assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug497015-1.js0000644000175000017500000000057411545150464023007 0ustar chr1schr1sactual = ''; expected = ',0,0,8888,0,0,8888,0,0,/x/,0,0,'; for each(let a in ['', 8888, 8888, /x/]) { ''; for each(e in ['', false, '']) { (function(e) { for each(let c in ['']) { appendToActual(a); } })(); for (let aa = 0; aa < 1; ++aa) { a = aa; } } } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug497015-2.js0000644000175000017500000000072711545150464023010 0ustar chr1schr1sactual = ''; expected = 'zzz ,zzz 100,zzz 100,zzz 7777,zzz 100,zzz 100,zzz 8888,zzz 100,zzz 100,zzz /x/,zzz 100,zzz 100,'; //function f() { for each(let a in ['', 7777, 8888, /x/]) { for each(e in ['', false, '']) { (function(e) { for each(let c in ['']) { appendToActual('zzz ' + a); } })(); for (let aa = 100; aa < 101; ++aa) { a = aa; } } } //} //f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug540131-2.js0000644000175000017500000000036211545150464022767 0ustar chr1schr1s// |jit-test| error: TypeError (function() { for (let z in [true]) { (new(eval("for(l in[0,0,0,0]){}")) (((function f(a, b) { if (a.length == b) { return (z) } f(a, b + 1) })([,,], 0)), [])) } })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug540131-3.js0000644000175000017500000000027111545150464022767 0ustar chr1schr1s(function() { (eval("\ (function() {\ let(e = eval(\"\ for(z=0;z<5;z++){}\ \"))\ (function(){\ x = e\ })()\ })\ "))() })(); print(x) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug540131.js0000644000175000017500000000012711545150464022627 0ustar chr1schr1stry { (function() { let(x = (eval("for(y in[0,0,0,0]){}"))) {} })() } catch(e) {} mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug540133.js0000644000175000017500000000012311545150464022625 0ustar chr1schr1s(function() { var x; eval("for (x in (gc)()) for each(e in [0]) { print }") })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug540136.js0000644000175000017500000000041511545150464022634 0ustar chr1schr1s// |jit-test| error: TypeError (eval("\ (function () {\ for (var[x] = function(){} in \ (function m(a) {\ if (a < 1) {\ x;\ return\ }\ return m(a - 1) + m(a - 2)\ })(7)\ (eval(\"\"))\ )\ ([])\ })\ "))() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug540242.js0000644000175000017500000000042211545150464022630 0ustar chr1schr1sfor (j = 0; j < 1; j++) { var f = eval("\ (function() {\ for (var a = 0; a < 8; ++a) {\ if (a % 3 == 2) {\ eval(\"\ for(b in[0,0,0,0]) {\ print()\ }\ \")\ }\ gc()\ }\ })\ "); f() } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug540243.js0000644000175000017500000000023711545150464022635 0ustar chr1schr1sfor (a in (eval("\ (function() {\ return function() {\ yield ((function() {\ return d\ })())\ } ();\ var d = []\ })\ "))()); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug540348.js0000644000175000017500000000012311545150464022635 0ustar chr1schr1s(function() { for (var [e] = 1 in (eval("for (b = 0; b < 6; ++b) gc()"))) {} })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug540528.js0000644000175000017500000000007711545150464022645 0ustar chr1schr1s(function() { var a eval("for(b in[0,0,0,0]){}[a=0]") })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug541239.js0000644000175000017500000000035011545150464022637 0ustar chr1schr1sfunction m() { var d = 73; return (eval("\n\ (function() {\n\ return function() {\n\ yield ((function() {\n\ print(d);\n\ return d\n\ })())\n\ } ();\n\ })\n\ "))(); } m().next(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/bug543565.js0000644000175000017500000000017111545150464022644 0ustar chr1schr1sfunction C() { var k = 3; this.x = function () { return k; }; for (var i = 0; i < 9; i++) ; } new C; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/closure-pluseq.js0000644000175000017500000000065411545150464024364 0ustar chr1schr1sactual = ''; expected = '3,6,9,12,15,18,'; function slice(a, b) { //return { x: a + ':' + b }; return b; } function f() { var length = 20; var index = 0; function get3() { //appendToActual("get3 " + index); if (length - index < 3) return null; return slice(index, index += 3); } var bytes = null; while (bytes = get3()) { appendToActual(bytes); } } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/closure-pluseq2.js0000644000175000017500000000064111545150464024442 0ustar chr1schr1sactual = ''; expected = '3,6,9,12,15,18,'; function slice(a, b) { //return { x: a + ':' + b }; return b; } function f(index) { var length = 20; function get3() { //appendToActual("get3 " + index); if (length - index < 3) return null; return slice(index, index += 3); } var bytes = null; while (bytes = get3()) { appendToActual(bytes); } } f(0); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/closure-plusplus.js0000644000175000017500000000070711545150464024741 0ustar chr1schr1sactual = ''; expected = '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,'; function slice(a, b) { //return { x: a + ':' + b }; return b; } function f() { var length = 20; var index = 0; function get3() { //appendToActual("get3 " + index); if (length - index < 3) return null; return slice(index, ++index); } var bytes = null; while (bytes = get3()) { appendToActual(bytes); } } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/closure-tests.js0000644000175000017500000000007211545150464024207 0ustar chr1schr1sactual = ''; expected = ''; assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/flat-closure-1.js0000644000175000017500000000031411545150464024130 0ustar chr1schr1sactual = ''; expected = '0,1,2,3,4,'; function g(a) { } function f(y) { var q; q = function() { appendToActual(y); }; q(); } for (var i = 0; i < 5; ++i) { f(i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/flat-closure-2.js0000644000175000017500000000035211545150464024133 0ustar chr1schr1sactual = ''; expected = 'nocrash,'; let (z = {}) { for (var i = 0; i < 4; ++i) { for each (var e in [{}, 1, {}]) { +(function () z)(); } } } appendToActual('nocrash') assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/flat-closure-3.js0000644000175000017500000000024211545150464024132 0ustar chr1schr1sactual = ''; expected = 'nocrash,'; +[(e = {}, (function () e)()) for each (e in ["", {}, "", {}, ""])]; appendToActual('nocrash') assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/flat-closure-4.js0000644000175000017500000000110711545150464024134 0ustar chr1schr1sactual = ''; expected = ',,,,,[object Object],[object Object],[object Object],[object Object],[object Object],,,,,,[object Object],[object Object],[object Object],[object Object],[object Object],,,,,,[object Object],[object Object],[object Object],[object Object],[object Object],,,,,,[object Object],[object Object],[object Object],[object Object],[object Object],,,,,,'; function f() { var e; for each (e in ["", {}, "", {}, "", {}, "", {}, ""]) { var g = function() { for (var i = 0; i < 5; ++i) appendToActual(e); } g(); } } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/flat-closure-5.js0000644000175000017500000000100711545150464024134 0ustar chr1schr1sactual = ''; expected = 'undefined,[object Object],undefined,[object Object],undefined,[object Object],undefined,[object Object],undefined,[object Object],undefined,[object Object],undefined,[object Object],undefined,[object Object],undefined,[object Object],undefined,[object Object],'; function f() { for (var q = 0; q < 10; ++q) { for each(let b in [(void 0), {}]) { (function() { for (var i = 0; i < 1; ++i) { appendToActual('' + b) } }()) } } } f() assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/flat-closure-6.js0000644000175000017500000000147611545150464024147 0ustar chr1schr1sactual = ''; expected = 'bundefined,aundefined,b[object Object],aundefined,bundefined,aundefined,b[object Object],aundefined,bundefined,aundefined,b[object Object],aundefined,bundefined,aundefined,b[object Object],aundefined,bundefined,aundefined,b[object Object],aundefined,bundefined,aundefined,b[object Object],aundefined,bundefined,aundefined,b[object Object],aundefined,bundefined,aundefined,b[object Object],aundefined,bundefined,aundefined,b[object Object],aundefined,bundefined,aundefined,b[object Object],aundefined,'; // tests nfixed case of getting slot with let. for (var q = 0; q < 10; ++q) { for each(let b in [(void 0), {}]) { appendToActual('a' + ((function() { for (var e in ['']) { appendToActual('b' + b) } })())) } } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/flat-closure-7.js0000644000175000017500000000051111545150464024135 0ustar chr1schr1sactual = ''; expected = '0 0 0 0 0 0 0 0 0,'; var o = []; for (var a = 0; a < 9; ++a) { var unused = 0; let (zero = 0) { for (var ee = 0; ee < 1; ++ee) { o.push((function () zero)()); } } } appendToActual(o.join(" ")); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/flat-closure-8.js0000644000175000017500000000032011545150464024134 0ustar chr1schr1sactual = ''; expected = 'nocrash,'; function b(a) { } function f(y) { function q() { b(y); }; q(); } for (var i = 0; i < 1000; ++i) { f(i); } appendToActual('nocrash') assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/incr-exit-2.js0000644000175000017500000000047511545150464023443 0ustar chr1schr1sactual = ''; expected = '-3,'; v = 0 let(f = function (y) { let(f = function (g) { for each(let h in g) { if (++y > 2) { appendToActual(h) } } }) { f([(--y), false, true, (--y), false, (--y)]) } }) { f(v) } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/incr-exit-3.js0000644000175000017500000000072411545150464023441 0ustar chr1schr1sactual = ''; expected = 'foo4,foo4,'; v = 0 let(f = function (y) { let(f = function (y) { let(f = function (g) { for (h in g) { if (++y > 3) { appendToActual('foo' + y) } } }) { f([y for (b in [1, []])]); f(['', false]) } v = String }) { f(y) f(y) } }) { f(v) } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/incr-exit.js0000644000175000017500000000047611545150464023305 0ustar chr1schr1sactual = ''; expected = 'ddd,'; // Bug 508187 let(f = function (y) { let(ff = function (g) { for each(let h in g) { if (++y > 5) { appendToActual('ddd') } } }) { ff(['', null, '', false, '', '', null]) } }) { f(-1) } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/lambda-inner-heavy.js0000644000175000017500000000066311545150464025044 0ustar chr1schr1sactual = ''; expected = '0,0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,'; function g(a) { a(); } function n() { } function f(y) { for (var i = 0; i < 7; ++i) { var q; q = function() { appendToActual(y); var m = 1; var z = function() { appendToActual(m); } m = 2; }; g(q); } } for (var i = 0; i < 5; ++i) { f(i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/lambda-light-returned.js0000644000175000017500000000046411545150464025553 0ustar chr1schr1sactual = ''; expected = '1,'; function createCounter() { var i = 0; var counter = function() { return ++i; } return counter; } function f() { var counter; for (var i = 0; i < 100; ++i) { counter = createCounter(); } appendToActual(counter()); } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/lambda-light.js0000644000175000017500000000032511545150464023721 0ustar chr1schr1sactual = ''; expected = '10,'; function f(x) { let (x = 10) { for (var i = 0; i < 5; ++i) { var g = function () { appendToActual(x); }; } g(); } } f(1); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/lambda.js0000644000175000017500000000055211545150464022616 0ustar chr1schr1sfunction f() { var k = 0; var g = function() { return ++k; } return g; } function h() { for (var i = 0; i < 10; ++i) { var vf = f(); assertEq(vf(), 1); assertEq(vf(), 2); for (var j = 0; j < 10; ++j) { assertEq(vf(), j + 3); } } } h(); checkStats({ recorderAborted: 8, // Inner tree is trying to grow }); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/lambdafc.js0000644000175000017500000000040011545150464023117 0ustar chr1schr1sactual = ''; expected = '99,'; function g(p) { appendToActual(p()); } function d(k) { return function() { return k; } } function f(k) { var p; for (var i = 0; i < 1000; ++i) { p = d(k); } g(p); } f(99); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/name-both-hvy.js0000644000175000017500000000047311545150464024056 0ustar chr1schr1sactual = ''; expected = ''; // do not crash function q() { } function f() { var j = 12; function g() { eval(""); // makes |g| heavyweight for (var i = 0; i < 3; ++i) { j; } } j = 13; q(g); // escaping |g| makes |f| heavyweight g(); j = 14; } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/name-inactive-missing.js0000644000175000017500000000027211545150464025564 0ustar chr1schr1s// |jit-test| error: ReferenceError function f(k) { function g(j) { return j + q; } return g; } g = f(10); var ans = ''; for (var i = 0; i < 5; ++i) { ans += g(i) + ','; } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/name.js0000644000175000017500000000045011545150464022313 0ustar chr1schr1sactual = ''; expected = '2,5,'; function loop(f) { var p; for (var i = 0; i < 10; ++i) { p = f(); } return p; } function f(i, k) { var g = function() { return k; } k = 2; appendToActual(loop(g)); k = 5; appendToActual(loop(g)); } f(0, 0); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/name2.js0000644000175000017500000000043511545150464022400 0ustar chr1schr1sactual = ''; expected = '0,1,2,3,4,'; function loop(f) { var p; for (var i = 0; i < 10; ++i) { p = f(); } return p; } function f(j, k) { var g = function() { return k; } for (k = 0; k < 5; ++k) { appendToActual(loop(g)); } } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/name2a.js0000644000175000017500000000045311545150464022541 0ustar chr1schr1sactual = ''; expected = '0,1,2,3,4,'; function loop(f) { var p; for (var i = 0; i < 10; ++i) { p = f(1, 2, 3); } return p; } function f(j, k) { var g = function(a, b, c) { return k; } for (k = 0; k < 5; ++k) { appendToActual(loop(g)); } } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/name2b.js0000644000175000017500000000045411545150464022543 0ustar chr1schr1sactual = ''; expected = '0,1,2,3,4,'; function loop(f) { var p; for (var i = 0; i < 10; ++i) { p = f(1, 2, 3); } return p; } function f(j, k) { var g = function(a, b, c) { return k; } for (k = 0; k < 5; ++k) { appendToActual(loop(g)); } } f(1); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/name3.js0000644000175000017500000000044711545150464022404 0ustar chr1schr1sactual = ''; expected = '0,1,2,3,4,'; function loop(f) { var p; for (var i = 0; i < 10; ++i) { p = f(); } return p; } function f(j, k) { var g = function() { return k; } k = j; appendToActual(loop(g)); } for (var i = 0; i < 5; ++i) { f(i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/name4.js0000644000175000017500000000043311545150464022400 0ustar chr1schr1sactual = ''; expected = 'undefined,'; function loop(f) { var p; for (var i = 0; i < 10; ++i) { p = f(); } return p; } function make(k, j) { var g = function() { return k; } k = j; return g; } var f = make(); appendToActual(loop(f)); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/namedLambda.js0000644000175000017500000000036611545150464023566 0ustar chr1schr1s// This just tests that named lambdas don't crash in the tracer. var f = function ff() { var k = 0; var counter = function q() { return ++k; } return counter; } function g() { for (var i = 0; i < 10; ++i) { f(); } } g(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/nameinc-loop-2.js0000644000175000017500000000061711545150464024120 0ustar chr1schr1sactual = ''; expected = '1,2,3,4,5,5,undefined,1,2,3,4,5,5,undefined,1,2,3,4,5,5,undefined,1,2,3,4,5,5,undefined,1,2,3,4,5,5,undefined,'; var f = function() { var p = 0; function g() { for (var i = 0; i < 5; ++i) { p++; appendToActual(p); } } g(); appendToActual(p); } for (var i = 0; i < 5; ++i) { f(); appendToActual(); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/nameinc-loop-3.js0000644000175000017500000000124411545150464024116 0ustar chr1schr1sactual = ''; expected = 'g 1 0,g 2 -1,g 3 -2,g 4 -3,g 5 -4,h 5 -5,f 5,undefined,g 1 0,g 2 -1,g 3 -2,g 4 -3,g 5 -4,h 5 -5,f 5,undefined,g 1 0,g 2 -1,g 3 -2,g 4 -3,g 5 -4,h 5 -5,f 5,undefined,g 1 0,g 2 -1,g 3 -2,g 4 -3,g 5 -4,h 5 -5,f 5,undefined,g 1 0,g 2 -1,g 3 -2,g 4 -3,g 5 -4,h 5 -5,f 5,undefined,'; var f = function() { var p = 0; function h() { var q = 0; function g() { for (var i = 0; i < 5; ++i) { p++; appendToActual('g ' + p + ' ' + q); q--; } } g(); appendToActual('h ' + p + ' ' + q); } h(); appendToActual('f ' + p); } for (var i = 0; i < 5; ++i) { f(); appendToActual(); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/nameinc-loop-missing-2.js0000644000175000017500000000035411545150464025565 0ustar chr1schr1s// |jit-test| error: ReferenceError for (var i = 0; i < 10; ++i) { var f = function() { var p = 0; function g() { for (var i = 0; i < 5; ++i) { x += 5; } } g(); print(p); } f(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/nameinc-loop-missing.js0000644000175000017500000000037211545150464025426 0ustar chr1schr1s// |jit-test| error: ReferenceError for (var i = 0; i < 10; ++i) { var f = function() { var p = 0; function g() { for (var i = 0; i < 5; ++i) { p++; x++; print(p); } } g(); print(p); } f(); } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/nameinc-loop.js0000644000175000017500000000062311545150464023756 0ustar chr1schr1sactual = ''; expected = '1,2,3,4,5,5,1,2,3,4,5,5,1,2,3,4,5,5,1,2,3,4,5,5,1,2,3,4,5,5,1,2,3,4,5,5,1,2,3,4,5,5,1,2,3,4,5,5,1,2,3,4,5,5,1,2,3,4,5,5,'; for (var i = 0; i < 10; ++i) { var f = function() { var p = 0; function g() { for (var i = 0; i < 5; ++i) { p++; appendToActual(p); } } g(); appendToActual(p); } f(); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/nameinc.js0000644000175000017500000000030711545150464023006 0ustar chr1schr1sactual = ''; expected = '5,'; function f() { var p = 0; function g() { for (var i = 0; i < 5; ++i) { p++; } } g(); appendToActual(p); } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/set-outer-trace-1.js0000644000175000017500000000052111545150464024553 0ustar chr1schr1sactual = ''; expected = '10,19,128,337,646,1055,1564,2173,2882,3691,4600,'; function f() { var x = 10; var g = function(p) { for (var i = 0; i < 10; ++i) { x = p + i; } } for (var i = 0; i < 10; ++i) { appendToActual(x); g(100 * i + x); } appendToActual(x); } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/set-outer-trace-2.js0000644000175000017500000000076311545150464024564 0ustar chr1schr1sactual = ''; expected = '10,19,100199,2001001999,30020010019999,400300200100199999,5004003002001001999999,60050040030020010019999999,700600500400300200100199999999,8007006005004003002001001999999999,90080070060050040030020010019999999999,'; function f() { var x = 10; var g = function(p) { for (var i = 0; i < 10; ++i) x = p + i + ''; } for (var i = 0; i < 10; ++i) { appendToActual(x); g(100 * i + x); } appendToActual(x); } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/set-outer-trace-3.js0000644000175000017500000000054111545150464024557 0ustar chr1schr1sactual = ''; expected = '10.5,19.5,128.5,337.5,646.5,1055.5,1564.5,2173.5,2882.5,3691.5,4600.5,'; function f() { var x = 10.5; var g = function(p) { for (var i = 0; i < 10; ++i) x = p + i; } for (var i = 0; i < 10; ++i) { appendToActual(x); g(100 * i + x); } appendToActual(x); } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/set-outer-trace-4.js0000644000175000017500000000056111545150464024562 0ustar chr1schr1sactual = ''; expected = '10,19,1000028,3000037,6000046,10000055,15000064,21000073,28000082,36000091,45000100,'; function f() { var x = 10; var g = function(p) { for (var i = 0; i < 10; ++i) x = p + i; } for (var i = 0; i < 10; ++i) { appendToActual(x); g(1000000 * i + x); } appendToActual(x); } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/set-outer-trace.js0000644000175000017500000000046611545150464024425 0ustar chr1schr1sactual = ''; expected = '10,20,30,40,50,60,70,80,90,100,110,'; function f() { var x = 10; var g = function(p) { for (var i = 0; i < 10; ++i) x++; } for (var i = 0; i < 10; ++i) { appendToActual(x); g(100 * i + x); } appendToActual(x); } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/setname-1.js0000644000175000017500000000043111545150464023164 0ustar chr1schr1sactual = ''; expected = '4,4,4,4,4,'; function f() { var k = 0; function g() { for (var i = 0; i < 5; ++i) { k = i; } } function h() { for (var i = 0; i < 5; ++i) { appendToActual(k); } } g(); h(); } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/setname-closure-2.js0000644000175000017500000000046411545150464024645 0ustar chr1schr1sactual = ''; expected = '16,'; var f = function() { var p = 1; function g() { for (var i = 0; i < 5; ++i) { p = i * i; } } function h() { appendToActual(p); } return [g, h]; }; var [ g,h ] = f(); for (var i = 0; i < 5; ++i) { g(); } h(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/setname-closure.js0000644000175000017500000000073311545150464024505 0ustar chr1schr1sactual = ''; expected = '2,4,8,16,32,undefined,64,128,256,512,1024,undefined,2048,4096,8192,16384,32768,undefined,65536,131072,262144,524288,1048576,undefined,2097152,4194304,8388608,16777216,33554432,undefined,'; var f = function() { var p = 1; function g() { for (var i = 0; i < 5; ++i) { p = p * 2; appendToActual(p); } } return g; } var g = f(); for (var i = 0; i < 5; ++i) { g(); appendToActual(); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/setname-inner-heavy.js0000644000175000017500000000043411545150464025254 0ustar chr1schr1sactual = ''; expected = 'undefined,'; function f() { (eval("\ (function () {\ for (var z = 0; z < 2; ++z) {\ x = ''\ }\ })\ "))(); } this.__defineSetter__("x", eval) f() appendToActual(x); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/setname-loop-2.js0000644000175000017500000000067611545150464024147 0ustar chr1schr1sactual = ''; expected = '2,4,8,16,32,32,undefined,2,4,8,16,32,32,undefined,2,4,8,16,32,32,undefined,2,4,8,16,32,32,undefined,2,4,8,16,32,32,undefined,'; var f = function() { var p = 1; function h() { function g() { for (var i = 0; i < 5; ++i) { p = p * 2; appendToActual(p); } } g(); } h(); appendToActual(p); } for (var i = 0; i < 5; ++i) { f(); appendToActual(); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/setname-loop.js0000644000175000017500000000064411545150464024003 0ustar chr1schr1sactual = ''; expected = '2,4,8,16,32,32,undefined,2,4,8,16,32,32,undefined,2,4,8,16,32,32,undefined,2,4,8,16,32,32,undefined,2,4,8,16,32,32,undefined,'; var f = function() { var p = 1; function g() { for (var i = 0; i < 5; ++i) { p = p * 2; appendToActual(p); } } g(); appendToActual(p); } for (var i = 0; i < 5; ++i) { f(); appendToActual(); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/setname-no-pop.js0000644000175000017500000000037111545150464024237 0ustar chr1schr1sactual = ''; expected = ''; (function () { var y; (eval("(function () {\ for (var x = 0; x < 3; ++x) {\ ''.replace(/a/, (y = 3))\ }\ });\ "))() })() assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t001.js0000644000175000017500000000035311545150464022061 0ustar chr1schr1sactual = ''; expected = '4,4,4,'; function k(f_arg) { for (var i = 0; i < 5; ++i) { f_arg(i); } } function t() { var x = 1; k(function (i) { x = i; }); appendToActual(x); } t(); t(); t(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t002.js0000644000175000017500000000041111545150464022055 0ustar chr1schr1sactual = ''; expected = '54,54,54,'; function k(a, f_arg, b, c) { for (var i = 0; i < 5; ++i) { f_arg(i + a); } } function t() { var x = 1; k(50, function (i) { x = i; }, 100, 200); appendToActual(x); } t(); t(); t(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t003.js0000644000175000017500000000043111545150464022060 0ustar chr1schr1sactual = ''; expected = '54,54,54,'; function k(a, b, f_arg, c) { for (var i = 0; i < 5; ++i) { f_arg(i + a); } } function t(a, b) { var x = 1; k(50, 100, function (i) { x = i; }, 200); appendToActual(x); } t(1); t(2, 3); t(4, 5, 6); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t004.js0000644000175000017500000000044711545150464022070 0ustar chr1schr1sactual = ''; expected = 'NaN,60,74,'; function k(a, b, f_arg, c) { for (var i = 0; i < 5; ++i) { f_arg(i + a); } } function t(a, b) { var x = 1; k(50, 100, function (i) { x = i + a * b; }, 100, 200); appendToActual(x); } t(1); t(2, 3); t(4, 5, 6); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t005.js0000644000175000017500000000037711545150464022073 0ustar chr1schr1sactual = ''; expected = '4,'; function k(f_arg) { for (var i = 0; i < 5; ++i) { f_arg(i); } } function t() { var x = 1; function u() { k(function (i) { x = i; }); appendToActual(x); } u(); } t(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t006.js0000644000175000017500000000037311545150464022070 0ustar chr1schr1sactual = ''; expected = '2,'; function k(f_arg) { (function() { for (var i = 0; i < 10; ++i) { f_arg(); } })(); } function t() { var x = 1; k(function () { x = 2; }); appendToActual(x); } t(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t007.js0000644000175000017500000000042511545150464022067 0ustar chr1schr1sactual = ''; expected = '0,1,2,3,4,5,6,7,8,9,'; function k(f_arg) { for (var i = 0; i < 10; ++i) { f_arg(i); } } function t() { var x = 1; k(function (i) { x = i; }); appendToActual(i); } for (var i = 0; i < 10; ++i) { t(); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t008.js0000644000175000017500000000051311545150464022066 0ustar chr1schr1sactual = ''; expected = '900,'; function k(f_arg) { for (var i = 0; i < 10; ++i) { f_arg(i); } } function t() { var x = 1; k(function (i) { x = i; }); return x; } var ans = 0; for (var j = 0; j < 10; ++j) { for (var i = 0; i < 10; ++i) { ans += t(); } } appendToActual(ans); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t009.js0000644000175000017500000000032211545150464022065 0ustar chr1schr1sactual = ''; expected = '4,'; function k(f_arg) { for (var i = 0; i < 5; ++i) { f_arg(i); } } function t(x) { k(function (i) { x = i; }); appendToActual(x); } t(1); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t010.js0000644000175000017500000000043011545150464022055 0ustar chr1schr1sactual = ''; expected = '101,'; function looper(f) { for (var i = 0; i < 10; ++i) { for (var j = 0; j < 10; ++j) { f(); } } } function tester() { var x = 1; looper(function() { ++x; }); return x; } appendToActual(tester()); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t011.js0000644000175000017500000000031411545150464022057 0ustar chr1schr1sactual = ''; expected = '0,1,2,3,4,'; function g(a) { } function f(y) { var q; q = function() { appendToActual(y); }; q(); } for (var i = 0; i < 5; ++i) { f(i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t012.js0000644000175000017500000000032411545150464022061 0ustar chr1schr1sactual = ''; expected = '0,1,2,3,4,'; function g(a) { a(); } function f(y) { var q; q = function() { appendToActual(y); }; g(q); } for (var i = 0; i < 5; ++i) { f(i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t013.js0000644000175000017500000000047211545150464022066 0ustar chr1schr1sactual = ''; expected = '0,0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,'; function g(a) { a(); } function f(y) { for (var i = 0; i < 7; ++i) { var q; q = function() { appendToActual(y); }; g(q); } } for (var i = 0; i < 5; ++i) { f(i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t014.js0000644000175000017500000000046611545150464022072 0ustar chr1schr1sactual = ''; expected = '0,0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2,2,2,2,3,3,3,3,3,3,3,4,4,4,4,4,4,4,'; function g(a) { a(); } function f(y) { var q; q = function() { appendToActual(y); }; for (var i = 0; i < 7; ++i) { g(q); } } for (var i = 0; i < 5; ++i) { f(i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t015.js0000644000175000017500000000037211545150464022067 0ustar chr1schr1sactual = ''; expected = '0,1,2,3,4,'; function g(a) { a(); } function f(y) { var q; for (var i = 0; i < 7; ++i) { q = function() { appendToActual(y); }; } g(q); } for (var i = 0; i < 5; ++i) { f(i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t016.js0000644000175000017500000000046411545150464022072 0ustar chr1schr1sactual = ''; expected = '0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,'; function g(a) { for (var i = 0; i < 3; ++i) { a(); } } function f(y) { var q; for (var i = 0; i < 7; ++i) { q = function() { appendToActual(y); }; } g(q); } for (var i = 0; i < 5; ++i) { f(i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t017.js0000644000175000017500000000075211545150464022073 0ustar chr1schr1sactual = ''; expected = '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,'; function g(a) { for (var i = 0; i < 3; ++i) { a(); } } function f(y) { var q; for (var i = 0; i < 7; ++i) { q = function() { appendToActual(y); }; g(q); } } for (var i = 0; i < 5; ++i) { f(i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t018.js0000644000175000017500000000071311545150464022071 0ustar chr1schr1sactual = ''; expected = 'undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,'; for (x = 0; x < 10; ++x) { for each(let a in ['', NaN]) { appendToActual((function() { for (let y = 0; y < 1; ++y) { '' + a } })()) } } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t019.js0000644000175000017500000000140111545150464022065 0ustar chr1schr1sactual = ''; expected = 'undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,undefined,'; for (x = 0; x < 10; ++x) { for each(let a in ['', NaN, 3, 5.5, {}]) { appendToActual((function() { for (let y = 0; y < 1; ++y) { '' + a } })()) } } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t020.js0000644000175000017500000000035411545150464022063 0ustar chr1schr1sactual = ''; expected = '0,0,1,1,2,2,3,3,'; let(f = function() { for (let x = 0; x < 4; ++x) { (function() { for (let y = 0; y < 2; ++y) { appendToActual(x); } })() } }) { f(0) } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t021.js0000644000175000017500000000032311545150464022060 0ustar chr1schr1sactual = ''; expected = 'nocrash,'; var v = {}; function a() { var o = 3; v.f = function() { return o; }; } for (i = 0; i < 6; i++) new a; appendToActual('nocrash') assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t022.js0000644000175000017500000000070211545150464022062 0ustar chr1schr1sactual = ''; expected = 'nocrash,'; function jQuery(a, c) { } jQuery.fn = {}; (function() { var e = ["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"]; for (var i = 0; i < e.length; i++) { new function() { var o = e[i]; jQuery.fn[o] = function(f) { return this.bind(o, f); } }; } })(); appendToActual('nocrash') assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t023.js0000644000175000017500000000051111545150464022061 0ustar chr1schr1sactual = ''; expected = '0,1,2,0,1,2,'; for (var a = 0; a < 2; ++a) { for (var b = 0; b < 3; ++b) { (function (x) { (function () { for (var c = 0; c < 1; ++c) { appendToActual(x); } })(); })(b); } } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t024.js0000644000175000017500000000052211545150464022064 0ustar chr1schr1sactual = ''; expected = '787878,'; var q = []; for (var a = 0; a < 3; ++a) { (function () { for (var b = 7; b < 9; ++b) { (function () { for (var c = 0; c < 1; ++c) { q.push(b); } })(); } })(); } appendToActual(q.join("")); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t025.js0000644000175000017500000000044111545150464022065 0ustar chr1schr1sactual = ''; expected = '2,5,'; function loop(f) { var p; for (var i = 0; i < 1000; ++i) { p = f(); } return p; } function f(k) { function g() { return k; } k = 2; appendToActual(loop(g)); k = 5; appendToActual(loop(g)); } f(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t026.js0000644000175000017500000000047311545150464022073 0ustar chr1schr1sactual = ''; expected = '101,nocrash,'; function looper(f) { for (var i = 0; i < 10; ++i) { for (var j = 0; j < 10; ++j) { f(); } } } function tester() { var x = 1; looper(function() { ++x; }); return x; } appendToActual(tester()); appendToActual("nocrash"); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t027.js0000644000175000017500000000044211545150464022070 0ustar chr1schr1sactual = ''; expected = '99,'; function looper(f) { for (var i = 0; i < 10; ++i) { for (var j = 0; j < 10; ++j) { f(10*i + j); } } } function tester() { var x = 1; looper(function(y) { x = y; }); return x; } appendToActual(tester()); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t028.js0000644000175000017500000000044311545150464022072 0ustar chr1schr1sactual = ''; expected = 'undefined,'; function looper(f) { for (var i = 0; i < 10; ++i) { for (var j = 0; j < 10; ++j) { f(); } } } function tester() { var x = 1; function f() { return x; } looper(f); } appendToActual(tester()); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t029.js0000644000175000017500000000043011545150464022067 0ustar chr1schr1sactual = ''; expected = '101,'; function looper(f) { for (var i = 0; i < 10; ++i) { for (var j = 0; j < 10; ++j) { f(); } } } function tester() { var x = 1; looper(function() { ++x; }); return x; } appendToActual(tester()); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t030.js0000644000175000017500000000043011545150464022057 0ustar chr1schr1sactual = ''; expected = '2,'; function looper(f) { for (var i = 0; i < 10; ++i) { for (var j = 0; j < 10; ++j) { f(); } } } function tester() { var x = 1; looper(function() { x = 2; }); return x; } appendToActual(tester()); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t031.js0000644000175000017500000000035311545150464022064 0ustar chr1schr1sactual = ''; expected = '4,4,4,'; function k(f_arg) { for (var i = 0; i < 5; ++i) { f_arg(i); } } function t() { var x = 1; k(function (i) { x = i; }); appendToActual(x); } t(); t(); t(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t032.js0000644000175000017500000000037711545150464022073 0ustar chr1schr1sactual = ''; expected = '4,'; function k(f_arg) { for (var i = 0; i < 5; ++i) { f_arg(i); } } function t() { var x = 1; function u() { k(function (i) { x = i; }); appendToActual(x); } u(); } t(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t033.js0000644000175000017500000000033511545150464022066 0ustar chr1schr1sactual = ''; expected = '2,'; function k(f_arg) { for (var i = 0; i < 100; ++i) { f_arg(); } } function t() { var x = 1; k(function () { x = 2; }); appendToActual(x); } t(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t034.js0000644000175000017500000000035311545150464022067 0ustar chr1schr1sactual = ''; expected = ''; function k(f_arg) { for (var i = 0; i < 10; ++i) { f_arg(i); } } function t() { var x = 1; k(function (i) { x = i; }); } for (var i = 0; i < 100; ++i) { t(); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t035.js0000644000175000017500000000032211545150464022064 0ustar chr1schr1sactual = ''; expected = '4,'; function k(f_arg) { for (var i = 0; i < 5; ++i) { f_arg(i); } } function t(x) { k(function (i) { x = i; }); appendToActual(x); } t(1); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t036.js0000644000175000017500000000037611545150464022076 0ustar chr1schr1sactual = ''; expected = '77,77,'; var o = { x: 11, y: 13 }; function g() { with (o) { var x = 77; for (var i = 0; i < 5; ++i) { var f = function() { appendToActual(x); } } f(); } f(); } g(); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/t037.js0000644000175000017500000000052511545150464022073 0ustar chr1schr1sactual = ''; expected = '7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,'; function heavy(s, t, u) {return eval(s)} for (var i = 0; i < 5; ++i) { var flat = heavy("(function () {var x = t * t; return function(){return x + u}})()", 2, 3); for (var j = 0; j < 5; ++j) { appendToActual(flat()); } } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/test-inner-imports.js0000644000175000017500000000047111545150464025161 0ustar chr1schr1sactual = ''; expected = '0,0,2,2,4,4,6,6,8,8,'; function g(b) { for (var i = 0; i < 10; ++i) { } } function f(xa_arg) { var xa = xa_arg; for (var i = 0; i < 5; ++i) { var j = i + xa[i]; appendToActual(j); g(); appendToActual(j); } } f([ 0, 1, 2, 3, 4 ]); assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/closures/upvar-nest.js0000644000175000017500000000143711545150464023505 0ustar chr1schr1sactual = ''; expected = '0 0 1 1 2 2 3 3,0 0 1 1 2 2 3 3,0 0 1 1 2 2 3 3,0 0 1 1 2 2 3 3,0 0 1 1 2 2 3 3,1 2 2 3 3 4 4 5,1 2 2 3 3 4 4 5,1 2 2 3 3 4 4 5,1 2 2 3 3 4 4 5,1 2 2 3 3 4 4 5,2 4 3 5 4 6 5 7,2 4 3 5 4 6 5 7,2 4 3 5 4 6 5 7,2 4 3 5 4 6 5 7,2 4 3 5 4 6 5 7,3 6 4 7 5 8 6 9,3 6 4 7 5 8 6 9,3 6 4 7 5 8 6 9,3 6 4 7 5 8 6 9,3 6 4 7 5 8 6 9,4 8 5 9 6 10 7 11,4 8 5 9 6 10 7 11,4 8 5 9 6 10 7 11,4 8 5 9 6 10 7 11,4 8 5 9 6 10 7 11,'; function f(a, b) { function g(x, y) { function h(m, n) { function k(u, v) { for (var i = 0; i < 5; ++i) { appendToActual(a + ' ' + b + ' ' + x + ' ' + y + ' ' + m + ' ' + n + ' ' + u + ' ' + v); } } k(m+1, n+1); } h(x+1, y+1); } g(a+1, b+1); } for (var i = 0; i < 5; ++i) { f(i, i+i); } assertEq(actual, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/bug558099.js0000644000175000017500000000235111545150464021572 0ustar chr1schr1s(function()[function() function() function() function() function() function() {}]); foo = [{ text: "(function(){if(d){(1)}})", s: function() {}, test: function() { try { f } catch(e) {} } }, { text: "(function(){t})", s: function() {}, test: function() {} }, { text: "(function(){if(0){}})", s: function() {}, test: function() {} }, { text: "(function(){if(1){}(2)})", s: function() {}, test: function() {} }, { text: "(function(){g})", b: function() {}, test: function() {} }, { text: "(function(){})", s: function() {}, test: function() {} }, { text: "(function(){1})", s: function() {}, test: function() {} }]; (function() { for (i = 0; i < foo.length; ++i) { a = foo[i] text = a.text eval(text.replace(/@/, "")); if (a.test()) {} } } ()); s = [function() function() function() function() function() function() {}] [function() function() function() function() {}]; (function() { [function() function() {}] }); (function() {}); (eval("\ (function(){\ for each(d in[\ 0,0,0,0,0,0,0,0,0,0,0,0,0,null,NaN,1,Boolean(false),Boolean(false)\ ]){\ [].filter(new Function,gczeal(2))\ }\ })\ "))(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/bug558616.js0000644000175000017500000000026711545150464021571 0ustar chr1schr1s(function() { for each(let d in [{}, {}, 0]) { for each(e in [0, 0, 0, 0, 0, 0, 0, 0, 0]) { d.__defineSetter__("", function() {}) } } })() // don't assert mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/bug582899.js0000644000175000017500000000025111545150464021574 0ustar chr1schr1stry { (function () { __proto__ = []; for each(y in [0, 0]) { this.__defineGetter__("", function () {}) } })() } catch (e) {} mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/bug584642.js0000644000175000017500000000012111545150464021554 0ustar chr1schr1s// |jit-test| error: ReferenceError Function("x=[(x)=s]")(); /* Don't assert. */ mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/bug595706.js0000644000175000017500000000046411545150464021571 0ustar chr1schr1sfunction f(useArg2, arg2, expect) { var args = arguments; if (useArg2) args = arg2; print(args) assertEq(args.length, expect); } // Generate a PIC for arguments. f(false, 0, 3); f(false, 0, 3); f(false, 0, 3); // Now call it with a slow array. var a = [1, 2, 3]; a.x = 9; f(true, a, 3); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/call_self.js0000644000175000017500000000025411545150464022235 0ustar chr1schr1svar o = { g: function(a) { return a; } }; function f() { var z; for (var i = 0; i < 10; ++i) { z = o.g(i); assertEq(z, i); } } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/densearray.js0000644000175000017500000000030611545150464022444 0ustar chr1schr1sfunction f() { var o = [ 1, 2, 3, 4, 5 ]; for (var i = 6; i < 10; ++i) o.push(i); return o; } var o = f(); assertEq(o.join(','), [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ].join(','));mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/fuzz1.js0000644000175000017500000000012111545150464021361 0ustar chr1schr1s(function() { for (a = 0; a < 2; a++) ''.watch("", function() {}) })() mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/fuzz2.js0000644000175000017500000000006311545150464021367 0ustar chr1schr1sfor each(let x in [0, {}, 0, {}]) { x.valueOf }mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/fuzz3.js0000644000175000017500000000006711545150464021374 0ustar chr1schr1sfor each(let w in [[], 0, [], 0]) { w.unwatch() } mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/grandproto.js0000644000175000017500000000042711545150464022472 0ustar chr1schr1sfunction A() { this.a = 77; this.b = 88; } function B() { } B.prototype = new A; function C() { } C.prototype = new B; function f() { var o = new C; var z; for (var i = 0; i < 5; ++i) { z = o.a; assertEq(z, 77); } } f();mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/length_array.js0000644000175000017500000000041211545150464022764 0ustar chr1schr1s// length, string var expected = "3,6,4,3,6,4,3,6,4,3,6,4,"; var actual = ''; function f() { var ss = [ [1, 2, 3], [1, 2, 3, 4, 5, 6], [1, 2, 3, 4] ]; for (var i = 0; i < 12; ++i) { actual += ss[i%3].length + ','; } } f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/length_mix.js0000644000175000017500000000074011545150464022447 0ustar chr1schr1s// length, various types var expected = "4,5,44,5,44,4,44,4,5,4,5,44,5,44,4,44,4,5,"; var actual = ''; function f() { var a = [ "abcd", [1, 2, 3, 4, 5], { length: 44 } ]; for (var i = 0; i < 6; ++i) { // Use 3 PICs so we start out with each type in one PIC. var i1 = i % 3; var i2 = (i+1) % 3; var i3 = (i+2) % 3; actual += a[i1].length + ','; actual += a[i2].length + ','; actual += a[i3].length + ','; } } f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/length_object.js0000644000175000017500000000035411545150464023121 0ustar chr1schr1s// length, object var expected = "777,777,777,777,777,"; var actual = ''; function f() { var o = { a: 11, length: 777, b: 22 }; for (var i = 0; i < 5; ++i) { actual += o.length + ','; } } f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/length_string.js0000644000175000017500000000036611545150464023164 0ustar chr1schr1s// length, string var expected = "3,6,4,3,6,4,3,6,4,3,6,4,"; var actual = ''; function f() { var ss = [ "abc", "foobar", "quux" ]; for (var i = 0; i < 12; ++i) { actual += ss[i%3].length + ','; } } f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/length_string_object.js0000644000175000017500000000117011545150464024504 0ustar chr1schr1s//length, string, object var expected = "3,6,4,3,6,4,3,6,4,3,6,4,"; var actual = ''; function f() { var ss = [new String("abc"), new String("foobar"), new String("quux")]; for (var i = 0; i < 12; ++i) { actual += ss[i%3].length + ','; } } f(); assertEq(actual, expected); function g(s) { return new String(s).length; } assertEq(g("x"), 1); // Warm-up assertEq(g("x"), 1); // Create IC assertEq(g("x"), 1); // Test IC function h(s) { var x = new String(s); for (var i = 0; i < 100; i++) x[i] = i; return x.length; } assertEq(h("x"), 1); assertEq(h("x"), 1); assertEq(h("x"), 1); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/proto1.js0000644000175000017500000000056411545150464021541 0ustar chr1schr1s// getprop, proto, 1 shape var expected = "11,22,33,11,22,33,11,22,33,11,22,33,11,22,33,"; var actual = ''; var proto = { a: 11, b: 22, c: 33 }; function B() { } B.prototype = proto; function f() { var o = new B(); for (var i = 0; i < 5; ++i) { actual += o.a + ','; actual += o.b + ','; actual += o.c + ','; } } f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/proto3.js0000644000175000017500000000074011545150464021537 0ustar chr1schr1s// getprop, proto, 3 shapes var expected = "22,202,202,22,202,202,22,202,202,"; var actual = ''; var protoB = { a: 11, b: 22, c: 33 }; function B() { } B.prototype = protoB; var protoC = { a: 101, b: 202, c: 303 }; function C() { } C.prototype = protoC; function f() { var o1 = new B(); var o2 = new C(); var o3 = new C(); o3.q = 99; var oa = [ o1, o2, o3 ]; for (var i = 0; i < 9; ++i) { actual += oa[i%3].b + ','; } } f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/proto_self.js0000644000175000017500000000133711545150464022470 0ustar chr1schr1s// getprop, proto and self, 3 shapes var expected = "22,202,99;202,99,22;99,22,202;22,202,99;202,99,22;99,22,202;22,202,99;202,99,22;99,22,202;"; var actual = ''; var protoB = { a: 11, b: 22, c: 33 }; function B() { } B.prototype = protoB; var protoC = { a: 101, b: 202, c: 303 }; function C() { } C.prototype = protoC; function f() { var o1 = new B(); var o2 = new C(); var o3 = new C(); o3.b = 99; var oa = [ o1, o2, o3 ]; for (var i = 0; i < 9; ++i) { // Use 3 PICs so we start out with each type in one PIC. var i1 = i % 3; var i2 = (i+1) % 3; var i3 = (i+2) % 3; actual += oa[i1].b + ','; actual += oa[i2].b + ','; actual += oa[i3].b + ';'; } } f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/self1.js0000644000175000017500000000046611545150464021330 0ustar chr1schr1s// getprop, self, 1 shape var expected = "11,22,33,11,22,33,11,22,33,11,22,33,11,22,33,"; var actual = ''; function f() { var o = { a: 11, b: 22, c: 33 }; for (var i = 0; i < 5; ++i) { actual += o.a + ','; actual += o.b + ','; actual += o.c + ','; } } f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/self2.js0000644000175000017500000000046711545150464021332 0ustar chr1schr1s// getprop, self, 2 shapes var expected = "22,303,22,303,22,303,22,303,"; var actual = ''; function f() { var o1 = { a: 11, b: 22, c: 33 }; var o2 = { x: 101, y: 202, b: 303 }; var oa = [ o1, o2 ]; for (var i = 0; i < 8; ++i) { actual += oa[i%2].b + ','; } } f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/self3.js0000644000175000017500000000055011545150464021324 0ustar chr1schr1s// getprop, self, 3 shapes var expected = "22,303,1001,22,303,1001,22,303,"; var actual = ''; function f() { var o1 = { a: 11, b: 22, c: 33 }; var o2 = { x: 101, y: 202, b: 303 }; var o3 = { b: 1001, x: 2002, y: 3003 }; var oa = [ o1, o2, o3 ]; for (var i = 0; i < 8; ++i) { actual += oa[i%3].b + ','; } } f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/self8.js0000644000175000017500000000107711545150464021336 0ustar chr1schr1s// getprop, self, 8 shapes var expected = "0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,0,1,2,3,4,5,6,7,"; var actual = ''; function letter(i) { return String.fromCharCode(97 + i); } function f() { // Build 8 objects with different shapes and x in different slots. var oa = []; for (var i = 0; i < 8; ++i) { var o = {}; for (var j = 0; j < 8; ++j) { if (j != i) { o[letter(j)] = 1000 + i * 10 + j; } else { o.x = i; } } oa[i] = o; } for (var i = 0; i < 24; ++i) { actual += oa[i%8].x + ','; } } f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/set-assign.js0000644000175000017500000000021711545150464022365 0ustar chr1schr1sfunction f() { var o = { a: 555 }; for (var j = 0; j < 10; ++j) { var i = o.a = 100 + j; assertEq(i, 100 + j); } } f()mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/set1.js0000644000175000017500000000020111545150464021155 0ustar chr1schr1sfunction f() { var o = { a: 5 }; for (var i = 0; i < 5; ++i) { o.a = i; } assertEq(o.a, 4); } f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/set2.js0000644000175000017500000000035711545150464021172 0ustar chr1schr1sfunction f(k) { var o1 = { a: 5 }; var o2 = { b : 7, a : 9 }; for (var i = 0; i < k; ++i) { var o = i % 2 ? o2 : o1; o.a = i; } return o1.a + ',' + o2.a; } assertEq(f(5), '4,3') assertEq(f(6), '4,5') mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/shape_regen.js0000644000175000017500000000116411545150464022572 0ustar chr1schr1s// Try to test that we handle shape regeneration correctly. // This is a fragile test, but as of this writing, on dmandelin's // windows box, we have the same shape number with different // logical shapes in the two assertEq lines. var o; var p; var zz; var o2; function f(x) { return x.a; } gczeal(1); gc(); zz = { q: 11 }; o = { a: 77, b: 88 }; o2 = { c: 11 }; p = { b: 99, a: 11 }; //print('s ' + shapeOf(zz) + ' ' + shapeOf(o) + ' ' + shapeOf(o2) + ' ' + shapeOf(p)); assertEq(f(o), 77); o = undefined; gczeal(1); gc(); //print('s ' + 'x' + ' ' + shapeOf(p)); assertEq(f(p), 11); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/thisprop.js0000644000175000017500000000056211545150464022163 0ustar chr1schr1s// test getthisprop var expected = "22,22,22,;33,33,33,;"; var actual = ''; function f() { for (var i = 0; i < 3; ++i) { actual += this.b + ','; } actual += ';'; } function A() { this.a = 11; this.b = 22; }; A.prototype.f = f; function B() { this.b = 33; this.c = 44; }; B.prototype.f = f; new A().f(); new B().f(); assertEq(actual, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/pic/to-dictionary.js0000644000175000017500000000026011545150464023073 0ustar chr1schr1sfunction f() { var MAX_HEIGHT = 64; var obj = {}; for (var i = 0; i < MAX_HEIGHT; i++) obj['a' + i] = i; obj.m = function () { return 0; }; } f(); f(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-3d-cube.js0000644000175000017500000002102111545150464024042 0ustar chr1schr1s// 3D Cube Rotation // http://www.speich.net/computer/moztesting/3d.htm // Created by Simon Speich var Q = new Array(); var MTrans = new Array(); // transformation matrix var MQube = new Array(); // position information of qube var I = new Array(); // entity matrix var Origin = new Object(); var Testing = new Object(); var LoopTimer; var DisplArea = new Object(); DisplArea.Width = 300; DisplArea.Height = 300; function DrawLine(From, To) { var x1 = From.V[0]; var x2 = To.V[0]; var y1 = From.V[1]; var y2 = To.V[1]; var dx = Math.abs(x2 - x1); var dy = Math.abs(y2 - y1); var x = x1; var y = y1; var IncX1, IncY1; var IncX2, IncY2; var Den; var Num; var NumAdd; var NumPix; if (x2 >= x1) { IncX1 = 1; IncX2 = 1; } else { IncX1 = -1; IncX2 = -1; } if (y2 >= y1) { IncY1 = 1; IncY2 = 1; } else { IncY1 = -1; IncY2 = -1; } if (dx >= dy) { IncX1 = 0; IncY2 = 0; Den = dx; Num = dx / 2; NumAdd = dy; NumPix = dx; } else { IncX2 = 0; IncY1 = 0; Den = dy; Num = dy / 2; NumAdd = dx; NumPix = dy; } NumPix = Math.round(Q.LastPx + NumPix); var i = Q.LastPx; for (; i < NumPix; i++) { Num += NumAdd; if (Num >= Den) { Num -= Den; x += IncX1; y += IncY1; } x += IncX2; y += IncY2; } Q.LastPx = NumPix; } function CalcCross(V0, V1) { var Cross = new Array(); Cross[0] = V0[1]*V1[2] - V0[2]*V1[1]; Cross[1] = V0[2]*V1[0] - V0[0]*V1[2]; Cross[2] = V0[0]*V1[1] - V0[1]*V1[0]; return Cross; } function CalcNormal(V0, V1, V2) { var A = new Array(); var B = new Array(); for (var i = 0; i < 3; i++) { A[i] = V0[i] - V1[i]; B[i] = V2[i] - V1[i]; } A = CalcCross(A, B); var Length = Math.sqrt(A[0]*A[0] + A[1]*A[1] + A[2]*A[2]); for (var i = 0; i < 3; i++) A[i] = A[i] / Length; A[3] = 1; return A; } function CreateP(X,Y,Z) { this.V = [X,Y,Z,1]; } // multiplies two matrices function MMulti(M1, M2) { var M = [[],[],[],[]]; var i = 0; var j = 0; for (; i < 4; i++) { j = 0; for (; j < 4; j++) M[i][j] = M1[i][0] * M2[0][j] + M1[i][1] * M2[1][j] + M1[i][2] * M2[2][j] + M1[i][3] * M2[3][j]; } return M; } //multiplies matrix with vector function VMulti(M, V) { var Vect = new Array(); var i = 0; for (;i < 4; i++) Vect[i] = M[i][0] * V[0] + M[i][1] * V[1] + M[i][2] * V[2] + M[i][3] * V[3]; return Vect; } function VMulti2(M, V) { var Vect = new Array(); var i = 0; for (;i < 3; i++) Vect[i] = M[i][0] * V[0] + M[i][1] * V[1] + M[i][2] * V[2]; return Vect; } // add to matrices function MAdd(M1, M2) { var M = [[],[],[],[]]; var i = 0; var j = 0; for (; i < 4; i++) { j = 0; for (; j < 4; j++) M[i][j] = M1[i][j] + M2[i][j]; } return M; } function Translate(M, Dx, Dy, Dz) { var T = [ [1,0,0,Dx], [0,1,0,Dy], [0,0,1,Dz], [0,0,0,1] ]; return MMulti(T, M); } function RotateX(M, Phi) { var a = Phi; a *= Math.PI / 180; var Cos = Math.cos(a); var Sin = Math.sin(a); var R = [ [1,0,0,0], [0,Cos,-Sin,0], [0,Sin,Cos,0], [0,0,0,1] ]; return MMulti(R, M); } function RotateY(M, Phi) { var a = Phi; a *= Math.PI / 180; var Cos = Math.cos(a); var Sin = Math.sin(a); var R = [ [Cos,0,Sin,0], [0,1,0,0], [-Sin,0,Cos,0], [0,0,0,1] ]; return MMulti(R, M); } function RotateZ(M, Phi) { var a = Phi; a *= Math.PI / 180; var Cos = Math.cos(a); var Sin = Math.sin(a); var R = [ [Cos,-Sin,0,0], [Sin,Cos,0,0], [0,0,1,0], [0,0,0,1] ]; return MMulti(R, M); } function DrawQube() { // calc current normals var CurN = new Array(); var i = 5; Q.LastPx = 0; for (; i > -1; i--) CurN[i] = VMulti2(MQube, Q.Normal[i]); if (CurN[0][2] < 0) { if (!Q.Line[0]) { DrawLine(Q[0], Q[1]); Q.Line[0] = true; }; if (!Q.Line[1]) { DrawLine(Q[1], Q[2]); Q.Line[1] = true; }; if (!Q.Line[2]) { DrawLine(Q[2], Q[3]); Q.Line[2] = true; }; if (!Q.Line[3]) { DrawLine(Q[3], Q[0]); Q.Line[3] = true; }; } if (CurN[1][2] < 0) { if (!Q.Line[2]) { DrawLine(Q[3], Q[2]); Q.Line[2] = true; }; if (!Q.Line[9]) { DrawLine(Q[2], Q[6]); Q.Line[9] = true; }; if (!Q.Line[6]) { DrawLine(Q[6], Q[7]); Q.Line[6] = true; }; if (!Q.Line[10]) { DrawLine(Q[7], Q[3]); Q.Line[10] = true; }; } if (CurN[2][2] < 0) { if (!Q.Line[4]) { DrawLine(Q[4], Q[5]); Q.Line[4] = true; }; if (!Q.Line[5]) { DrawLine(Q[5], Q[6]); Q.Line[5] = true; }; if (!Q.Line[6]) { DrawLine(Q[6], Q[7]); Q.Line[6] = true; }; if (!Q.Line[7]) { DrawLine(Q[7], Q[4]); Q.Line[7] = true; }; } if (CurN[3][2] < 0) { if (!Q.Line[4]) { DrawLine(Q[4], Q[5]); Q.Line[4] = true; }; if (!Q.Line[8]) { DrawLine(Q[5], Q[1]); Q.Line[8] = true; }; if (!Q.Line[0]) { DrawLine(Q[1], Q[0]); Q.Line[0] = true; }; if (!Q.Line[11]) { DrawLine(Q[0], Q[4]); Q.Line[11] = true; }; } if (CurN[4][2] < 0) { if (!Q.Line[11]) { DrawLine(Q[4], Q[0]); Q.Line[11] = true; }; if (!Q.Line[3]) { DrawLine(Q[0], Q[3]); Q.Line[3] = true; }; if (!Q.Line[10]) { DrawLine(Q[3], Q[7]); Q.Line[10] = true; }; if (!Q.Line[7]) { DrawLine(Q[7], Q[4]); Q.Line[7] = true; }; } if (CurN[5][2] < 0) { if (!Q.Line[8]) { DrawLine(Q[1], Q[5]); Q.Line[8] = true; }; if (!Q.Line[5]) { DrawLine(Q[5], Q[6]); Q.Line[5] = true; }; if (!Q.Line[9]) { DrawLine(Q[6], Q[2]); Q.Line[9] = true; }; if (!Q.Line[1]) { DrawLine(Q[2], Q[1]); Q.Line[1] = true; }; } Q.Line = [false,false,false,false,false,false,false,false,false,false,false,false]; Q.LastPx = 0; } function Loop() { if (Testing.LoopCount > Testing.LoopMax) return; var TestingStr = String(Testing.LoopCount); while (TestingStr.length < 3) TestingStr = "0" + TestingStr; MTrans = Translate(I, -Q[8].V[0], -Q[8].V[1], -Q[8].V[2]); MTrans = RotateX(MTrans, 1); MTrans = RotateY(MTrans, 3); MTrans = RotateZ(MTrans, 5); MTrans = Translate(MTrans, Q[8].V[0], Q[8].V[1], Q[8].V[2]); MQube = MMulti(MTrans, MQube); var i = 8; for (; i > -1; i--) { Q[i].V = VMulti(MTrans, Q[i].V); } DrawQube(); Testing.LoopCount++; Loop(); } function Init(CubeSize) { // init/reset vars Origin.V = [150,150,20,1]; Testing.LoopCount = 0; Testing.LoopMax = 50; Testing.TimeMax = 0; Testing.TimeAvg = 0; Testing.TimeMin = 0; Testing.TimeTemp = 0; Testing.TimeTotal = 0; Testing.Init = false; // transformation matrix MTrans = [ [1,0,0,0], [0,1,0,0], [0,0,1,0], [0,0,0,1] ]; // position information of qube MQube = [ [1,0,0,0], [0,1,0,0], [0,0,1,0], [0,0,0,1] ]; // entity matrix I = [ [1,0,0,0], [0,1,0,0], [0,0,1,0], [0,0,0,1] ]; // create qube Q[0] = new CreateP(-CubeSize,-CubeSize, CubeSize); Q[1] = new CreateP(-CubeSize, CubeSize, CubeSize); Q[2] = new CreateP( CubeSize, CubeSize, CubeSize); Q[3] = new CreateP( CubeSize,-CubeSize, CubeSize); Q[4] = new CreateP(-CubeSize,-CubeSize,-CubeSize); Q[5] = new CreateP(-CubeSize, CubeSize,-CubeSize); Q[6] = new CreateP( CubeSize, CubeSize,-CubeSize); Q[7] = new CreateP( CubeSize,-CubeSize,-CubeSize); // center of gravity Q[8] = new CreateP(0, 0, 0); // anti-clockwise edge check Q.Edge = [[0,1,2],[3,2,6],[7,6,5],[4,5,1],[4,0,3],[1,5,6]]; // calculate squad normals Q.Normal = new Array(); for (var i = 0; i < Q.Edge.length; i++) Q.Normal[i] = CalcNormal(Q[Q.Edge[i][0]].V, Q[Q.Edge[i][1]].V, Q[Q.Edge[i][2]].V); // line drawn ? Q.Line = [false,false,false,false,false,false,false,false,false,false,false,false]; // create line pixels Q.NumPx = 9 * 2 * CubeSize; for (var i = 0; i < Q.NumPx; i++) CreateP(0,0,0); MTrans = Translate(MTrans, Origin.V[0], Origin.V[1], Origin.V[2]); MQube = MMulti(MTrans, MQube); var i = 0; for (; i < 9; i++) { Q[i].V = VMulti(MTrans, Q[i].V); } DrawQube(); Testing.Init = true; Loop(); } for ( var i = 20; i <= 160; i *= 2 ) { Init(i); } var actual = ''; for (var i = 0; i < Q.length; ++i) { actual += Q[i].V + ';'; } var expected = "-116.618229186398,212.51135212951073,62.5094191967962,1;127.83701023614447,417.11611179082263,90.41153816299942,1;293.9570894432935,196.58093046570656,252.17789153139591,1;49.501850020750915,-8.02382919560505,224.275772565193,1;6.042910556709444,103.41906953429206,-212.1778915313964,1;250.49814997925202,308.02382919560387,-184.27577256519325,1;416.61822918640064,87.48864787048812,-22.509419196796493,1;172.1629897638581,-117.1161117908236,-50.41153816299975,1;150.0000000000007,149.99999999999952,20,1;"; assertEq(actual, expected); Q = null; MTrans = null; MQube = null; I = null; Origin = null; Testing = null; LoopTime = null; DisplArea = null; mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-3d-morph.js0000644000175000017500000000376711545150464024272 0ustar chr1schr1s/* * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ var loops = 15 var nx = 120 var nz = 120 function morph(a, f) { var PI2nx = Math.PI * 8/nx var sin = Math.sin var f30 = -(50 * sin(f*Math.PI*2)) for (var i = 0; i < nz; ++i) { for (var j = 0; j < nx; ++j) { a[3*(i*nx+j)+1] = sin((j-1) * PI2nx ) * -f30 } } } var a = Array() for (var i=0; i < nx*nz*3; ++i) a[i] = 0 for (var i = 0; i < loops; ++i) { morph(a, i/loops) } testOutput = 0; for (var i = 0; i < nx; i++) testOutput += a[3*(i*nx+i)+1]; a = null; /* not based on any mathematical error calculation.*/ acceptableDelta = 4e-15 assertEq((testOutput - 6.394884621840902e-14) < acceptableDelta, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-3d-raytrace.js0000644000175000017500000010504611545150464024750 0ustar chr1schr1s/* * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ function createVector(x,y,z) { return new Array(x,y,z); } function sqrLengthVector(self) { return self[0] * self[0] + self[1] * self[1] + self[2] * self[2]; } function lengthVector(self) { return Math.sqrt(self[0] * self[0] + self[1] * self[1] + self[2] * self[2]); } function addVector(self, v) { self[0] += v[0]; self[1] += v[1]; self[2] += v[2]; return self; } function subVector(self, v) { self[0] -= v[0]; self[1] -= v[1]; self[2] -= v[2]; return self; } function scaleVector(self, scale) { self[0] *= scale; self[1] *= scale; self[2] *= scale; return self; } function normaliseVector(self) { var len = Math.sqrt(self[0] * self[0] + self[1] * self[1] + self[2] * self[2]); self[0] /= len; self[1] /= len; self[2] /= len; return self; } function add(v1, v2) { return new Array(v1[0] + v2[0], v1[1] + v2[1], v1[2] + v2[2]); } function sub(v1, v2) { return new Array(v1[0] - v2[0], v1[1] - v2[1], v1[2] - v2[2]); } function scalev(v1, v2) { return new Array(v1[0] * v2[0], v1[1] * v2[1], v1[2] * v2[2]); } function dot(v1, v2) { return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]; } function scale(v, scale) { return [v[0] * scale, v[1] * scale, v[2] * scale]; } function cross(v1, v2) { return [v1[1] * v2[2] - v1[2] * v2[1], v1[2] * v2[0] - v1[0] * v2[2], v1[0] * v2[1] - v1[1] * v2[0]]; } function normalise(v) { var len = lengthVector(v); return [v[0] / len, v[1] / len, v[2] / len]; } function transformMatrix(self, v) { var vals = self; var x = vals[0] * v[0] + vals[1] * v[1] + vals[2] * v[2] + vals[3]; var y = vals[4] * v[0] + vals[5] * v[1] + vals[6] * v[2] + vals[7]; var z = vals[8] * v[0] + vals[9] * v[1] + vals[10] * v[2] + vals[11]; return [x, y, z]; } function invertMatrix(self) { var temp = new Array(16); var tx = -self[3]; var ty = -self[7]; var tz = -self[11]; for (h = 0; h < 3; h++) for (v = 0; v < 3; v++) temp[h + v * 4] = self[v + h * 4]; for (i = 0; i < 11; i++) self[i] = temp[i]; self[3] = tx * self[0] + ty * self[1] + tz * self[2]; self[7] = tx * self[4] + ty * self[5] + tz * self[6]; self[11] = tx * self[8] + ty * self[9] + tz * self[10]; return self; } // Triangle intersection using barycentric coord method function Triangle(p1, p2, p3) { var edge1 = sub(p3, p1); var edge2 = sub(p2, p1); var normal = cross(edge1, edge2); if (Math.abs(normal[0]) > Math.abs(normal[1])) if (Math.abs(normal[0]) > Math.abs(normal[2])) this.axis = 0; else this.axis = 2; else if (Math.abs(normal[1]) > Math.abs(normal[2])) this.axis = 1; else this.axis = 2; var u = (this.axis + 1) % 3; var v = (this.axis + 2) % 3; var u1 = edge1[u]; var v1 = edge1[v]; var u2 = edge2[u]; var v2 = edge2[v]; this.normal = normalise(normal); this.nu = normal[u] / normal[this.axis]; this.nv = normal[v] / normal[this.axis]; this.nd = dot(normal, p1) / normal[this.axis]; var det = u1 * v2 - v1 * u2; this.eu = p1[u]; this.ev = p1[v]; this.nu1 = u1 / det; this.nv1 = -v1 / det; this.nu2 = v2 / det; this.nv2 = -u2 / det; this.material = [0.7, 0.7, 0.7]; } Triangle.prototype.intersect = function(orig, dir, near, far) { var u = (this.axis + 1) % 3; var v = (this.axis + 2) % 3; var d = dir[this.axis] + this.nu * dir[u] + this.nv * dir[v]; var t = (this.nd - orig[this.axis] - this.nu * orig[u] - this.nv * orig[v]) / d; if (t < near || t > far) return null; var Pu = orig[u] + t * dir[u] - this.eu; var Pv = orig[v] + t * dir[v] - this.ev; var a2 = Pv * this.nu1 + Pu * this.nv1; if (a2 < 0) return null; var a3 = Pu * this.nu2 + Pv * this.nv2; if (a3 < 0) return null; if ((a2 + a3) > 1) return null; return t; } function Scene(a_triangles) { this.triangles = a_triangles; this.lights = []; this.ambient = [0,0,0]; this.background = [0.8,0.8,1]; } var zero = new Array(0,0,0); Scene.prototype.intersect = function(origin, dir, near, far) { var closest = null; for (i = 0; i < this.triangles.length; i++) { var triangle = this.triangles[i]; var d = triangle.intersect(origin, dir, near, far); if (d == null || d > far || d < near) continue; far = d; closest = triangle; } if (!closest) return [this.background[0],this.background[1],this.background[2]]; var normal = closest.normal; var hit = add(origin, scale(dir, far)); if (dot(dir, normal) > 0) normal = [-normal[0], -normal[1], -normal[2]]; var colour = null; if (closest.shader) { colour = closest.shader(closest, hit, dir); } else { colour = closest.material; } // do reflection var reflected = null; if (colour.reflection > 0.001) { var reflection = addVector(scale(normal, -2*dot(dir, normal)), dir); reflected = this.intersect(hit, reflection, 0.0001, 1000000); if (colour.reflection >= 0.999999) return reflected; } var l = [this.ambient[0], this.ambient[1], this.ambient[2]]; for (var i = 0; i < this.lights.length; i++) { var light = this.lights[i]; var toLight = sub(light, hit); var distance = lengthVector(toLight); scaleVector(toLight, 1.0/distance); distance -= 0.0001; if (this.blocked(hit, toLight, distance)) continue; var nl = dot(normal, toLight); if (nl > 0) addVector(l, scale(light.colour, nl)); } l = scalev(l, colour); if (reflected) { l = addVector(scaleVector(l, 1 - colour.reflection), scaleVector(reflected, colour.reflection)); } return l; } Scene.prototype.blocked = function(O, D, far) { var near = 0.0001; var closest = null; for (i = 0; i < this.triangles.length; i++) { var triangle = this.triangles[i]; var d = triangle.intersect(O, D, near, far); if (d == null || d > far || d < near) continue; return true; } return false; } // this camera code is from notes i made ages ago, it is from *somewhere* -- i cannot remember where // that somewhere is function Camera(origin, lookat, up) { var zaxis = normaliseVector(subVector(lookat, origin)); var xaxis = normaliseVector(cross(up, zaxis)); var yaxis = normaliseVector(cross(xaxis, subVector([0,0,0], zaxis))); var m = new Array(16); m[0] = xaxis[0]; m[1] = xaxis[1]; m[2] = xaxis[2]; m[4] = yaxis[0]; m[5] = yaxis[1]; m[6] = yaxis[2]; m[8] = zaxis[0]; m[9] = zaxis[1]; m[10] = zaxis[2]; invertMatrix(m); m[3] = 0; m[7] = 0; m[11] = 0; this.origin = origin; this.directions = new Array(4); this.directions[0] = normalise([-0.7, 0.7, 1]); this.directions[1] = normalise([ 0.7, 0.7, 1]); this.directions[2] = normalise([ 0.7, -0.7, 1]); this.directions[3] = normalise([-0.7, -0.7, 1]); this.directions[0] = transformMatrix(m, this.directions[0]); this.directions[1] = transformMatrix(m, this.directions[1]); this.directions[2] = transformMatrix(m, this.directions[2]); this.directions[3] = transformMatrix(m, this.directions[3]); } Camera.prototype.generateRayPair = function(y) { rays = new Array(new Object(), new Object()); rays[0].origin = this.origin; rays[1].origin = this.origin; rays[0].dir = addVector(scale(this.directions[0], y), scale(this.directions[3], 1 - y)); rays[1].dir = addVector(scale(this.directions[1], y), scale(this.directions[2], 1 - y)); return rays; } function renderRows(camera, scene, pixels, width, height, starty, stopy) { for (var y = starty; y < stopy; y++) { var rays = camera.generateRayPair(y / height); for (var x = 0; x < width; x++) { var xp = x / width; var origin = addVector(scale(rays[0].origin, xp), scale(rays[1].origin, 1 - xp)); var dir = normaliseVector(addVector(scale(rays[0].dir, xp), scale(rays[1].dir, 1 - xp))); var l = scene.intersect(origin, dir); pixels[y][x] = l; } } } Camera.prototype.render = function(scene, pixels, width, height) { var cam = this; var row = 0; renderRows(cam, scene, pixels, width, height, 0, height); } function raytraceScene() { var startDate = new Date().getTime(); var numTriangles = 2 * 6; var triangles = new Array();//numTriangles); var tfl = createVector(-10, 10, -10); var tfr = createVector( 10, 10, -10); var tbl = createVector(-10, 10, 10); var tbr = createVector( 10, 10, 10); var bfl = createVector(-10, -10, -10); var bfr = createVector( 10, -10, -10); var bbl = createVector(-10, -10, 10); var bbr = createVector( 10, -10, 10); // cube!!! // front var i = 0; triangles[i++] = new Triangle(tfl, tfr, bfr); triangles[i++] = new Triangle(tfl, bfr, bfl); // back triangles[i++] = new Triangle(tbl, tbr, bbr); triangles[i++] = new Triangle(tbl, bbr, bbl); // triangles[i-1].material = [0.7,0.2,0.2]; // triangles[i-1].material.reflection = 0.8; // left triangles[i++] = new Triangle(tbl, tfl, bbl); // triangles[i-1].reflection = 0.6; triangles[i++] = new Triangle(tfl, bfl, bbl); // triangles[i-1].reflection = 0.6; // right triangles[i++] = new Triangle(tbr, tfr, bbr); triangles[i++] = new Triangle(tfr, bfr, bbr); // top triangles[i++] = new Triangle(tbl, tbr, tfr); triangles[i++] = new Triangle(tbl, tfr, tfl); // bottom triangles[i++] = new Triangle(bbl, bbr, bfr); triangles[i++] = new Triangle(bbl, bfr, bfl); //Floor!!!! var green = createVector(0.0, 0.4, 0.0); var grey = createVector(0.4, 0.4, 0.4); grey.reflection = 1.0; var floorShader = function(tri, pos, view) { var x = ((pos[0]/32) % 2 + 2) % 2; var z = ((pos[2]/32 + 0.3) % 2 + 2) % 2; if (x < 1 != z < 1) { //in the real world we use the fresnel term... // var angle = 1-dot(view, tri.normal); // angle *= angle; // angle *= angle; // angle *= angle; //grey.reflection = angle; return grey; } else return green; } var ffl = createVector(-1000, -30, -1000); var ffr = createVector( 1000, -30, -1000); var fbl = createVector(-1000, -30, 1000); var fbr = createVector( 1000, -30, 1000); triangles[i++] = new Triangle(fbl, fbr, ffr); triangles[i-1].shader = floorShader; triangles[i++] = new Triangle(fbl, ffr, ffl); triangles[i-1].shader = floorShader; var _scene = new Scene(triangles); _scene.lights[0] = createVector(20, 38, -22); _scene.lights[0].colour = createVector(0.7, 0.3, 0.3); _scene.lights[1] = createVector(-23, 40, 17); _scene.lights[1].colour = createVector(0.7, 0.3, 0.3); _scene.lights[2] = createVector(23, 20, 17); _scene.lights[2].colour = createVector(0.7, 0.7, 0.7); _scene.ambient = createVector(0.1, 0.1, 0.1); // _scene.background = createVector(0.7, 0.7, 1.0); var size = 30; var pixels = new Array(); for (var y = 0; y < size; y++) { pixels[y] = new Array(); for (var x = 0; x < size; x++) { pixels[y][x] = 0; } } var _camera = new Camera(createVector(-40, 40, 40), createVector(0, 0, 0), createVector(0, 1, 0)); _camera.render(_scene, pixels, size, size); return pixels; } function arrayToCanvasCommands(pixels) { var s = '\nvar pixels = ['; var size = 30; for (var y = 0; y < size; y++) { s += "["; for (var x = 0; x < size; x++) { s += "[" + pixels[y][x] + "],"; } s+= "],"; } s += '];\n var canvas = document.getElementById("renderCanvas").getContext("2d");\n\ \n\ \n\ var size = 30;\n\ canvas.fillStyle = "red";\n\ canvas.fillRect(0, 0, size, size);\n\ canvas.scale(1, -1);\n\ canvas.translate(0, -size);\n\ \n\ if (!canvas.setFillColor)\n\ canvas.setFillColor = function(r, g, b, a) {\n\ this.fillStyle = "rgb("+[Math.floor(r * 255), Math.floor(g * 255), Math.floor(b * 255)]+")";\n\ }\n\ \n\ for (var y = 0; y < size; y++) {\n\ for (var x = 0; x < size; x++) {\n\ var l = pixels[y][x];\n\ canvas.setFillColor(l[0], l[1], l[2], 1);\n\ canvas.fillRect(x, y, 1, 1);\n\ }\n\ }'; return s; } testOutput = arrayToCanvasCommands(raytraceScene()); expected = ''; assertEq(testOutput, expected) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-access-binary-trees.js0000644000175000017500000000236311545150464026473 0ustar chr1schr1s/* The Great Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ function TreeNode(left,right,item){ this.left = left; this.right = right; this.item = item; } TreeNode.prototype.itemCheck = function(){ if (this.left==null) return this.item; else return this.item + this.left.itemCheck() - this.right.itemCheck(); } function bottomUpTree(item,depth){ if (depth>0){ return new TreeNode( bottomUpTree(2*item-1, depth-1) ,bottomUpTree(2*item, depth-1) ,item ); } else { return new TreeNode(null,null,item); } } var ret; for ( var n = 4; n <= 7; n += 1 ) { var minDepth = 4; var maxDepth = Math.max(minDepth + 2, n); var stretchDepth = maxDepth + 1; var check = bottomUpTree(0,stretchDepth).itemCheck(); var longLivedTree = bottomUpTree(0,maxDepth); for (var depth=minDepth; depth<=maxDepth; depth+=2){ var iterations = 1 << (maxDepth - depth + minDepth); check = 0; for (var i=1; i<=iterations; i++){ check += bottomUpTree(i,depth).itemCheck(); check += bottomUpTree(-i,depth).itemCheck(); } } ret = longLivedTree.itemCheck(); } assertEq(ret, -1) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-access-fannkuch.js0000644000175000017500000000305011545150464025656 0ustar chr1schr1s/* The Great Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ function fannkuch(n) { var check = 0; var perm = Array(n); var perm1 = Array(n); var count = Array(n); var maxPerm = Array(n); var maxFlipsCount = 0; var m = n - 1; for (var i = 0; i < n; i++) perm1[i] = i; var r = n; while (true) { // write-out the first 30 permutations if (check < 30){ var s = ""; for(var i=0; i> 1; for (var i = 0; i < k2; i++) { var temp = perm[i]; perm[i] = perm[k - i]; perm[k - i] = temp; } flipsCount++; } if (flipsCount > maxFlipsCount) { maxFlipsCount = flipsCount; for (var i = 0; i < n; i++) maxPerm[i] = perm1[i]; } } while (true) { if (r == n) return maxFlipsCount; var perm0 = perm1[0]; var i = 0; while (i < r) { var j = i + 1; perm1[i] = perm1[j]; i = j; } perm1[r] = perm0; count[r] = count[r] - 1; if (count[r] > 0) break; r++; } } } var n = 8; var ret = fannkuch(n); assertEq(ret, 22) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-access-nbody.js0000644000175000017500000001013411545150464025175 0ustar chr1schr1s/* The Great Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ var PI = 3.141592653589793; var SOLAR_MASS = 4 * PI * PI; var DAYS_PER_YEAR = 365.24; function Body(x,y,z,vx,vy,vz,mass){ this.x = x; this.y = y; this.z = z; this.vx = vx; this.vy = vy; this.vz = vz; this.mass = mass; } Body.prototype.offsetMomentum = function(px,py,pz) { this.vx = -px / SOLAR_MASS; this.vy = -py / SOLAR_MASS; this.vz = -pz / SOLAR_MASS; return this; } function Jupiter(){ return new Body( 4.84143144246472090e+00, -1.16032004402742839e+00, -1.03622044471123109e-01, 1.66007664274403694e-03 * DAYS_PER_YEAR, 7.69901118419740425e-03 * DAYS_PER_YEAR, -6.90460016972063023e-05 * DAYS_PER_YEAR, 9.54791938424326609e-04 * SOLAR_MASS ); } function Saturn(){ return new Body( 8.34336671824457987e+00, 4.12479856412430479e+00, -4.03523417114321381e-01, -2.76742510726862411e-03 * DAYS_PER_YEAR, 4.99852801234917238e-03 * DAYS_PER_YEAR, 2.30417297573763929e-05 * DAYS_PER_YEAR, 2.85885980666130812e-04 * SOLAR_MASS ); } function Uranus(){ return new Body( 1.28943695621391310e+01, -1.51111514016986312e+01, -2.23307578892655734e-01, 2.96460137564761618e-03 * DAYS_PER_YEAR, 2.37847173959480950e-03 * DAYS_PER_YEAR, -2.96589568540237556e-05 * DAYS_PER_YEAR, 4.36624404335156298e-05 * SOLAR_MASS ); } function Neptune(){ return new Body( 1.53796971148509165e+01, -2.59193146099879641e+01, 1.79258772950371181e-01, 2.68067772490389322e-03 * DAYS_PER_YEAR, 1.62824170038242295e-03 * DAYS_PER_YEAR, -9.51592254519715870e-05 * DAYS_PER_YEAR, 5.15138902046611451e-05 * SOLAR_MASS ); } function Sun(){ return new Body(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SOLAR_MASS); } function NBodySystem(bodies){ this.bodies = bodies; var px = 0.0; var py = 0.0; var pz = 0.0; var size = this.bodies.length; for (var i=0; i0){ for (var i=1; i<=prefixWidth; i++) s = " " + s; } return s; } function nsieve(m, isPrime){ var i, k, count; for (i=2; i<=m; i++) { isPrime[i] = true; } count = 0; for (i=2; i<=m; i++){ if (isPrime[i]) { for (k=i+i; k<=m; k+=i) isPrime[k] = false; count++; } } return count; } var ret = 0; function sieve() { for (var i = 1; i <= 3; i++ ) { var m = (1<> ((b << 1) & 14)); c += 3 & (bi3b >> ((b >> 2) & 14)); c += 3 & (bi3b >> ((b >> 5) & 6)); return c; /* lir4,0xE994; 9 instructions, no memory access, minimal register dependence, 6 shifts, 2 adds, 1 inline assign rlwinmr5,r3,1,28,30 rlwinmr6,r3,30,28,30 rlwinmr7,r3,27,29,30 rlwnmr8,r4,r5,30,31 rlwnmr9,r4,r6,30,31 rlwnmr10,r4,r7,30,31 addr3,r8,r9 addr3,r3,r10 */ } var ret = 0; function TimeFunc(func) { var x, y, t; for(var x=0; x<500; x++) for(var y=0; y<256; y++) { ret += func(y); } } TimeFunc(fast3bitlookup); assertEq(ret, 512000) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-bitops-bits-in-byte.js0000644000175000017500000000066111545150464026433 0ustar chr1schr1s// Copyright (c) 2004 by Arthur Langereis (arthur_ext at domain xfinitegames, tld com) // 1 op = 2 assigns, 16 compare/branches, 8 ANDs, (0-8) ADDs, 8 SHLs // O(n) function bitsinbyte(b) { var m = 1, c = 0; while(m<0x100) { if(b & m) c++; m <<= 1; } return c; } var ret = 0; function TimeFunc(func) { var x, y, t; for(var x=0; x<350; x++) for(var y=0; y<256; y++) ret += func(y); } TimeFunc(bitsinbyte); assertEq(ret, 358400) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-bitops-bitwise-and.js0000644000175000017500000000271511545150464026335 0ustar chr1schr1s/* * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ bitwiseAndValue = 4294967296; for (var i = 0; i < 60; i++) bitwiseAndValue = bitwiseAndValue & i; assertEq(bitwiseAndValue, 0) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-bitops-nsieve-bits.js0000644000175000017500000000142711545150464026356 0ustar chr1schr1s// The Great Computer Language Shootout // http://shootout.alioth.debian.org // // Contributed by Ian Osgood var result = []; function pad(n,width) { var s = n.toString(); while (s.length < width) s = ' ' + s; return s; } function primes(isPrime, n) { var i, count = 0, m = 10000<>5; for (i=0; i>5] & 1<<(i&31)) { for (var j=i+i; j>5] &= ~(1<<(j&31))); count++; } } function sieve() { for (var i = 4; i <= 4; i++) { var isPrime = new Array((10000<>5); primes(isPrime, i); } } sieve(); var ret = 0; for (var i = 0; i < result.length; ++i) ret += result[i]; assertEq(ret, -211235557404919) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-controlflow-recursive.js0000644000175000017500000000106011545150464027176 0ustar chr1schr1s// The Computer Language Shootout // http://shootout.alioth.debian.org/ // contributed by Isaac Gouy function ack(m,n){ if (m==0) { return n+1; } if (n==0) { return ack(m-1,1); } return ack(m-1, ack(m,n-1) ); } function fib(n) { if (n < 2){ return 1; } return fib(n-2) + fib(n-1); } function tak(x,y,z) { if (y >= x) return z; return tak(tak(x-1,y,z), tak(y-1,z,x), tak(z-1,x,y)); } var ret = 0; for ( var i = 3; i <= 5; i++ ) { ret += ack(3,i); ret += fib(17.0+i); ret += tak(3*i+3,2*i+2,i+1); } assertEq(ret, 57775); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-crypto-aes.js0000644000175000017500000004127311545150464024721 0ustar chr1schr1s/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* * AES Cipher function: encrypt 'input' with Rijndael algorithm * * takes byte-array 'input' (16 bytes) * 2D byte-array key schedule 'w' (Nr+1 x Nb bytes) * * applies Nr rounds (10/12/14) using key schedule w for 'add round key' stage * * returns byte-array encrypted value (16 bytes) */ function Cipher(input, w) { // main Cipher function [§5.1] var Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES) var Nr = w.length/Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys var state = [[],[],[],[]]; // initialise 4xNb byte-array 'state' with input [§3.4] for (var i=0; i<4*Nb; i++) state[i%4][Math.floor(i/4)] = input[i]; state = AddRoundKey(state, w, 0, Nb); for (var round=1; round 6 && i%Nk == 4) { temp = SubWord(temp); } for (var t=0; t<4; t++) w[i][t] = w[i-Nk][t] ^ temp[t]; } return w; } function SubWord(w) { // apply SBox to 4-byte word w for (var i=0; i<4; i++) w[i] = Sbox[w[i]]; return w; } function RotWord(w) { // rotate 4-byte word w left by one byte w[4] = w[0]; for (var i=0; i<4; i++) w[i] = w[i+1]; return w; } // Sbox is pre-computed multiplicative inverse in GF(2^8) used in SubBytes and KeyExpansion [§5.1.1] var Sbox = [0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76, 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0, 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15, 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75, 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84, 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf, 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8, 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2, 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73, 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb, 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79, 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08, 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a, 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e, 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf, 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16]; // Rcon is Round Constant used for the Key Expansion [1st col is 2^(r-1) in GF(2^8)] [§5.2] var Rcon = [ [0x00, 0x00, 0x00, 0x00], [0x01, 0x00, 0x00, 0x00], [0x02, 0x00, 0x00, 0x00], [0x04, 0x00, 0x00, 0x00], [0x08, 0x00, 0x00, 0x00], [0x10, 0x00, 0x00, 0x00], [0x20, 0x00, 0x00, 0x00], [0x40, 0x00, 0x00, 0x00], [0x80, 0x00, 0x00, 0x00], [0x1b, 0x00, 0x00, 0x00], [0x36, 0x00, 0x00, 0x00] ]; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* * Use AES to encrypt 'plaintext' with 'password' using 'nBits' key, in 'Counter' mode of operation * - see http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf * for each block * - outputblock = cipher(counter, key) * - cipherblock = plaintext xor outputblock */ function AESEncryptCtr(plaintext, password, nBits) { if (!(nBits==128 || nBits==192 || nBits==256)) return ''; // standard allows 128/192/256 bit keys // for this example script, generate the key by applying Cipher to 1st 16/24/32 chars of password; // for real-world applications, a more secure approach would be to hash the password e.g. with SHA-1 var nBytes = nBits/8; // no bytes in key var pwBytes = new Array(nBytes); for (var i=0; i>> i*8) & 0xff; for (var i=0; i<4; i++) counterBlock[i+4] = (nonce/0x100000000 >>> i*8) & 0xff; // generate key schedule - an expansion of the key into distinct Key Rounds for each round var keySchedule = KeyExpansion(key); var blockCount = Math.ceil(plaintext.length/blockSize); var ciphertext = new Array(blockCount); // ciphertext as array of strings for (var b=0; b>> c*8) & 0xff; for (var c=0; c<4; c++) counterBlock[15-c-4] = (b/0x100000000 >>> c*8) var cipherCntr = Cipher(counterBlock, keySchedule); // -- encrypt counter block -- // calculate length of final block: var blockLength = b>> c*8) & 0xff; for (var c=0; c<4; c++) counterBlock[15-c-4] = ((b/0x100000000-1) >>> c*8) & 0xff; var cipherCntr = Cipher(counterBlock, keySchedule); // encrypt counter block ciphertext[b] = unescCtrlChars(ciphertext[b]); var pt = ''; for (var i=0; i>18 & 0x3f; h2 = bits>>12 & 0x3f; h3 = bits>>6 & 0x3f; h4 = bits & 0x3f; // end of string? index to '=' in b64 if (isNaN(o3)) h4 = 64; if (isNaN(o2)) h3 = 64; // use hexets to index into b64, and append result to encoded string enc += b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); } while (i < str.length); return enc; } function decodeBase64(str) { var o1, o2, o3, h1, h2, h3, h4, bits, i=0, enc=''; do { // unpack four hexets into three octets using index points in b64 h1 = b64.indexOf(str.charAt(i++)); h2 = b64.indexOf(str.charAt(i++)); h3 = b64.indexOf(str.charAt(i++)); h4 = b64.indexOf(str.charAt(i++)); bits = h1<<18 | h2<<12 | h3<<6 | h4; o1 = bits>>16 & 0xff; o2 = bits>>8 & 0xff; o3 = bits & 0xff; if (h3 == 64) enc += String.fromCharCode(o1); else if (h4 == 64) enc += String.fromCharCode(o1, o2); else enc += String.fromCharCode(o1, o2, o3); } while (i < str.length); return decodeUTF8(enc); // decode UTF-8 byte-array back to Unicode } function encodeUTF8(str) { // encode multi-byte string into utf-8 multiple single-byte characters str = str.replace( /[\u0080-\u07ff]/g, // U+0080 - U+07FF = 2-byte chars function(c) { var cc = c.charCodeAt(0); return String.fromCharCode(0xc0 | cc>>6, 0x80 | cc&0x3f); } ); str = str.replace( /[\u0800-\uffff]/g, // U+0800 - U+FFFF = 3-byte chars function(c) { var cc = c.charCodeAt(0); return String.fromCharCode(0xe0 | cc>>12, 0x80 | cc>>6&0x3F, 0x80 | cc&0x3f); } ); return str; } function decodeUTF8(str) { // decode utf-8 encoded string back into multi-byte characters str = str.replace( /[\u00c0-\u00df][\u0080-\u00bf]/g, // 2-byte chars function(c) { var cc = (c.charCodeAt(0)&0x1f)<<6 | c.charCodeAt(1)&0x3f; return String.fromCharCode(cc); } ); str = str.replace( /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, // 3-byte chars function(c) { var cc = (c.charCodeAt(0)&0x0f)<<12 | (c.charCodeAt(1)&0x3f<<6) | c.charCodeAt(2)&0x3f; return String.fromCharCode(cc); } ); return str; } function byteArrayToHexStr(b) { // convert byte array to hex string for displaying test vectors var s = ''; for (var i=0; i> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); c = md5_ff(c, d, a, b, x[i+10], 17, -42063); b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); } return Array(a, b, c, d); } /* * These functions implement the four basic operations the algorithm uses. */ function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); } function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); } function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); } function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); } function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); } /* * Calculate the HMAC-MD5, of a key and some data */ function core_hmac_md5(key, data) { var bkey = str2binl(key); if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); return core_md5(opad.concat(hash), 512 + 128); } /* * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */ function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } /* * Bitwise rotate a 32-bit number to the left. */ function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } /* * Convert a string to an array of little-endian words * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. */ function str2binl(str) { var bin = Array(); var mask = (1 << chrsz) - 1; for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); return bin; } /* * Convert an array of little-endian words to a string */ function binl2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); return str; } /* * Convert an array of little-endian words to a hex string. */ function binl2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); } return str; } /* * Convert an array of little-endian words to a base-64 string */ function binl2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); for(var j = 0; j < 4; j++) { if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); } } return str; } var plainText = "Rebellious subjects, enemies to peace,\n\ Profaners of this neighbour-stained steel,--\n\ Will they not hear? What, ho! you men, you beasts,\n\ That quench the fire of your pernicious rage\n\ With purple fountains issuing from your veins,\n\ On pain of torture, from those bloody hands\n\ Throw your mistemper'd weapons to the ground,\n\ And hear the sentence of your moved prince.\n\ Three civil brawls, bred of an airy word,\n\ By thee, old Capulet, and Montague,\n\ Have thrice disturb'd the quiet of our streets,\n\ And made Verona's ancient citizens\n\ Cast by their grave beseeming ornaments,\n\ To wield old partisans, in hands as old,\n\ Canker'd with peace, to part your canker'd hate:\n\ If ever you disturb our streets again,\n\ Your lives shall pay the forfeit of the peace.\n\ For this time, all the rest depart away:\n\ You Capulet; shall go along with me:\n\ And, Montague, come you this afternoon,\n\ To know our further pleasure in this case,\n\ To old Free-town, our common judgment-place.\n\ Once more, on pain of death, all men depart." for (var i = 0; i <4; i++) { plainText += plainText; } var md5Output = hex_md5(plainText); assertEq(md5Output, "a831e91e0f70eddcb70dc61c6f82f6cd") mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-crypto-sha1.js0000644000175000017500000001440411545150464025001 0ustar chr1schr1s/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined * in FIPS PUB 180-1 * Version 2.1a Copyright Paul Johnston 2000 - 2002. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet * Distributed under the BSD License * See http://pajhome.org.uk/crypt/md5 for details. */ /* * Configurable variables. You may need to tweak these to be compatible with * the server-side, but the defaults work in most cases. */ var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ /* * These are the functions you'll usually want to call * They take string arguments and return either hex or base-64 encoded strings */ function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));} function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));} function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));} function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));} function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));} function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));} /* * Perform a simple self-test to see if the VM is working */ function sha1_vm_test() { return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d"; } /* * Calculate the SHA-1 of an array of big-endian words, and a bit length */ function core_sha1(x, len) { /* append padding */ x[len >> 5] |= 0x80 << (24 - len % 32); x[((len + 64 >> 9) << 4) + 15] = len; var w = Array(80); var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; var e = -1009589776; for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; var olde = e; for(var j = 0; j < 80; j++) { if(j < 16) w[j] = x[i + j]; else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j))); e = d; d = c; c = rol(b, 30); b = a; a = t; } a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); e = safe_add(e, olde); } return Array(a, b, c, d, e); } /* * Perform the appropriate triplet combination function for the current * iteration */ function sha1_ft(t, b, c, d) { if(t < 20) return (b & c) | ((~b) & d); if(t < 40) return b ^ c ^ d; if(t < 60) return (b & c) | (b & d) | (c & d); return b ^ c ^ d; } /* * Determine the appropriate additive constant for the current iteration */ function sha1_kt(t) { return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : (t < 60) ? -1894007588 : -899497514; } /* * Calculate the HMAC-SHA1 of a key and some data */ function core_hmac_sha1(key, data) { var bkey = str2binb(key); if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz); return core_sha1(opad.concat(hash), 512 + 160); } /* * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */ function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } /* * Bitwise rotate a 32-bit number to the left. */ function rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } /* * Convert an 8-bit or 16-bit string to an array of big-endian words * In 8-bit function, characters >255 have their hi-byte silently ignored. */ function str2binb(str) { var bin = Array(); var mask = (1 << chrsz) - 1; for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32); return bin; } /* * Convert an array of big-endian words to a string */ function binb2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask); return str; } /* * Convert an array of big-endian words to a hex string. */ function binb2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF); } return str; } /* * Convert an array of big-endian words to a base-64 string */ function binb2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) | ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF); for(var j = 0; j < 4; j++) { if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); } } return str; } var plainText = "Two households, both alike in dignity,\n\ In fair Verona, where we lay our scene,\n\ From ancient grudge break to new mutiny,\n\ Where civil blood makes civil hands unclean.\n\ From forth the fatal loins of these two foes\n\ A pair of star-cross'd lovers take their life;\n\ Whole misadventured piteous overthrows\n\ Do with their death bury their parents' strife.\n\ The fearful passage of their death-mark'd love,\n\ And the continuance of their parents' rage,\n\ Which, but their children's end, nought could remove,\n\ Is now the two hours' traffic of our stage;\n\ The which if you with patient ears attend,\n\ What here shall miss, our toil shall strive to mend."; for (var i = 0; i <4; i++) { plainText += plainText; } var sha1Output = hex_sha1(plainText); assertEq(sha1Output, "2524d264def74cce2498bf112bedf00e6c0b796d") mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-date-format-tofte.js0000644000175000017500000010110411545150464026143 0ustar chr1schr1sfunction arrayExists(array, x) { for (var i = 0; i < array.length; i++) { if (array[i] == x) return true; } return false; } Date.prototype.formatDate = function (input,time) { // formatDate : // a PHP date like function, for formatting date strings // See: http://www.php.net/date // // input : format string // time : epoch time (seconds, and optional) // // if time is not passed, formatting is based on // the current "this" date object's set time. // // supported: // a, A, B, d, D, F, g, G, h, H, i, j, l (lowercase L), L, // m, M, n, O, r, s, S, t, U, w, W, y, Y, z // // unsupported: // I (capital i), T, Z var switches = ["a", "A", "B", "d", "D", "F", "g", "G", "h", "H", "i", "j", "l", "L", "m", "M", "n", "O", "r", "s", "S", "t", "U", "w", "W", "y", "Y", "z"]; var daysLong = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var daysShort = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; var monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var daysSuffix = ["st", "nd", "rd", "th", "th", "th", "th", // 1st - 7th "th", "th", "th", "th", "th", "th", "th", // 8th - 14th "th", "th", "th", "th", "th", "th", "st", // 15th - 21st "nd", "rd", "th", "th", "th", "th", "th", // 22nd - 28th "th", "th", "st"]; // 29th - 31st function a() { // Lowercase Ante meridiem and Post meridiem return self.getHours() > 11? "pm" : "am"; } function A() { // Uppercase Ante meridiem and Post meridiem return self.getHours() > 11? "PM" : "AM"; } function B(){ // Swatch internet time. code simply grabbed from ppk, // since I was feeling lazy: // http://www.xs4all.nl/~ppk/js/beat.html var off = (self.getTimezoneOffset() + 60)*60; var theSeconds = (self.getHours() * 3600) + (self.getMinutes() * 60) + self.getSeconds() + off; var beat = Math.floor(theSeconds/86.4); if (beat > 1000) beat -= 1000; if (beat < 0) beat += 1000; if ((""+beat).length == 1) beat = "00"+beat; if ((""+beat).length == 2) beat = "0"+beat; return beat; } function d() { // Day of the month, 2 digits with leading zeros return new String(self.getDate()).length == 1? "0"+self.getDate() : self.getDate(); } function D() { // A textual representation of a day, three letters return daysShort[self.getDay()]; } function F() { // A full textual representation of a month return monthsLong[self.getMonth()]; } function g() { // 12-hour format of an hour without leading zeros return self.getHours() > 12? self.getHours()-12 : self.getHours(); } function G() { // 24-hour format of an hour without leading zeros return self.getHours(); } function h() { // 12-hour format of an hour with leading zeros if (self.getHours() > 12) { var s = new String(self.getHours()-12); return s.length == 1? "0"+ (self.getHours()-12) : self.getHours()-12; } else { var s = new String(self.getHours()); return s.length == 1? "0"+self.getHours() : self.getHours(); } } function H() { // 24-hour format of an hour with leading zeros return new String(self.getHours()).length == 1? "0"+self.getHours() : self.getHours(); } function i() { // Minutes with leading zeros return new String(self.getMinutes()).length == 1? "0"+self.getMinutes() : self.getMinutes(); } function j() { // Day of the month without leading zeros return self.getDate(); } function l() { // A full textual representation of the day of the week return daysLong[self.getDay()]; } function L() { // leap year or not. 1 if leap year, 0 if not. // the logic should match iso's 8601 standard. var y_ = Y(); if ( (y_ % 4 == 0 && y_ % 100 != 0) || (y_ % 4 == 0 && y_ % 100 == 0 && y_ % 400 == 0) ) { return 1; } else { return 0; } } function m() { // Numeric representation of a month, with leading zeros return self.getMonth() < 9? "0"+(self.getMonth()+1) : self.getMonth()+1; } function M() { // A short textual representation of a month, three letters return monthsShort[self.getMonth()]; } function n() { // Numeric representation of a month, without leading zeros return self.getMonth()+1; } function O() { // Difference to Greenwich time (GMT) in hours var os = Math.abs(self.getTimezoneOffset()); var h = ""+Math.floor(os/60); var m = ""+(os%60); h.length == 1? h = "0"+h:1; m.length == 1? m = "0"+m:1; return self.getTimezoneOffset() < 0 ? "+"+h+m : "-"+h+m; } function r() { // RFC 822 formatted date var r; // result // Thu , 21 Dec 2000 r = D() + ", " + j() + " " + M() + " " + Y() + // 16 : 01 : 07 +0200 " " + H() + ":" + i() + ":" + s() + " " + O(); return r; } function S() { // English ordinal suffix for the day of the month, 2 characters return daysSuffix[self.getDate()-1]; } function s() { // Seconds, with leading zeros return new String(self.getSeconds()).length == 1? "0"+self.getSeconds() : self.getSeconds(); } function t() { // thanks to Matt Bannon for some much needed code-fixes here! var daysinmonths = [null,31,28,31,30,31,30,31,31,30,31,30,31]; if (L()==1 && n()==2) return 29; // leap day return daysinmonths[n()]; } function U() { // Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) return Math.round(self.getTime()/1000); } function W() { // Weeknumber, as per ISO specification: // http://www.cl.cam.ac.uk/~mgk25/iso-time.html // if the day is three days before newyears eve, // there's a chance it's "week 1" of next year. // here we check for that. var beforeNY = 364+L() - z(); var afterNY = z(); var weekday = w()!=0?w()-1:6; // makes sunday (0), into 6. if (beforeNY <= 2 && weekday <= 2-beforeNY) { return 1; } // similarly, if the day is within threedays of newyears // there's a chance it belongs in the old year. var ny = new Date("January 1 " + Y() + " 00:00:00"); var nyDay = ny.getDay()!=0?ny.getDay()-1:6; if ( (afterNY <= 2) && (nyDay >=4) && (afterNY >= (6-nyDay)) ) { // Since I'm not sure we can just always return 53, // i call the function here again, using the last day // of the previous year, as the date, and then just // return that week. var prevNY = new Date("December 31 " + (Y()-1) + " 00:00:00"); return prevNY.formatDate("W"); } // week 1, is the week that has the first thursday in it. // note that this value is not zero index. if (nyDay <= 3) { // first day of the year fell on a thursday, or earlier. return 1 + Math.floor( ( z() + nyDay ) / 7 ); } else { // first day of the year fell on a friday, or later. return 1 + Math.floor( ( z() - ( 7 - nyDay ) ) / 7 ); } } function w() { // Numeric representation of the day of the week return self.getDay(); } function Y() { // A full numeric representation of a year, 4 digits // we first check, if getFullYear is supported. if it // is, we just use that. ppks code is nice, but wont // work with dates outside 1900-2038, or something like that if (self.getFullYear) { var newDate = new Date("January 1 2001 00:00:00 +0000"); var x = newDate .getFullYear(); if (x == 2001) { // i trust the method now return self.getFullYear(); } } // else, do this: // codes thanks to ppk: // http://www.xs4all.nl/~ppk/js/introdate.html var x = self.getYear(); var y = x % 100; y += (y < 38) ? 2000 : 1900; return y; } function y() { // A two-digit representation of a year var y = Y()+""; return y.substring(y.length-2,y.length); } function z() { // The day of the year, zero indexed! 0 through 366 var t = new Date("January 1 " + Y() + " 00:00:00"); var diff = self.getTime() - t.getTime(); return Math.floor(diff/1000/60/60/24); } var self = this; if (time) { // save time var prevTime = self.getTime(); self.setTime(time); } var ia = input.split(""); var ij = 0; while (ia[ij]) { if (ia[ij] == "\\") { // this is our way of allowing users to escape stuff ia.splice(ij,1); } else { if (arrayExists(switches,ia[ij])) { ia[ij] = eval(ia[ij] + "()"); } } ij++; } // reset time, back to what it was if (prevTime) { self.setTime(prevTime); } return ia.join(""); } var date = new Date("1/1/2007 1:11:11"); var ret = ""; for (i = 0; i < 500; ++i) { var shortFormat = date.formatDate("Y-m-d"); var longFormat = date.formatDate("l, F d, Y g:i:s A"); ret += shortFormat + longFormat; date.setTime(date.getTime() + 84266956); } var expected = "2007-01-01Monday, January 01, 2007 1:11:11 AM2007-01-02Tuesday, January 02, 2007 0:35:37 AM2007-01-03Wednesday, January 03, 2007 0:00:04 AM2007-01-03Wednesday, January 03, 2007 11:24:31 PM2007-01-04Thursday, January 04, 2007 10:48:58 PM2007-01-05Friday, January 05, 2007 10:13:25 PM2007-01-06Saturday, January 06, 2007 9:37:52 PM2007-01-07Sunday, January 07, 2007 9:02:19 PM2007-01-08Monday, January 08, 2007 8:26:46 PM2007-01-09Tuesday, January 09, 2007 7:51:13 PM2007-01-10Wednesday, January 10, 2007 7:15:40 PM2007-01-11Thursday, January 11, 2007 6:40:07 PM2007-01-12Friday, January 12, 2007 6:04:34 PM2007-01-13Saturday, January 13, 2007 5:29:01 PM2007-01-14Sunday, January 14, 2007 4:53:28 PM2007-01-15Monday, January 15, 2007 4:17:55 PM2007-01-16Tuesday, January 16, 2007 3:42:22 PM2007-01-17Wednesday, January 17, 2007 3:06:49 PM2007-01-18Thursday, January 18, 2007 2:31:16 PM2007-01-19Friday, January 19, 2007 1:55:43 PM2007-01-20Saturday, January 20, 2007 1:20:10 PM2007-01-21Sunday, January 21, 2007 12:44:37 PM2007-01-22Monday, January 22, 2007 12:09:04 PM2007-01-23Tuesday, January 23, 2007 11:33:30 AM2007-01-24Wednesday, January 24, 2007 10:57:57 AM2007-01-25Thursday, January 25, 2007 10:22:24 AM2007-01-26Friday, January 26, 2007 9:46:51 AM2007-01-27Saturday, January 27, 2007 9:11:18 AM2007-01-28Sunday, January 28, 2007 8:35:45 AM2007-01-29Monday, January 29, 2007 8:00:12 AM2007-01-30Tuesday, January 30, 2007 7:24:39 AM2007-01-31Wednesday, January 31, 2007 6:49:06 AM2007-02-01Thursday, February 01, 2007 6:13:33 AM2007-02-02Friday, February 02, 2007 5:38:00 AM2007-02-03Saturday, February 03, 2007 5:02:27 AM2007-02-04Sunday, February 04, 2007 4:26:54 AM2007-02-05Monday, February 05, 2007 3:51:21 AM2007-02-06Tuesday, February 06, 2007 3:15:48 AM2007-02-07Wednesday, February 07, 2007 2:40:15 AM2007-02-08Thursday, February 08, 2007 2:04:42 AM2007-02-09Friday, February 09, 2007 1:29:09 AM2007-02-10Saturday, February 10, 2007 0:53:36 AM2007-02-11Sunday, February 11, 2007 0:18:03 AM2007-02-11Sunday, February 11, 2007 11:42:30 PM2007-02-12Monday, February 12, 2007 11:06:57 PM2007-02-13Tuesday, February 13, 2007 10:31:24 PM2007-02-14Wednesday, February 14, 2007 9:55:50 PM2007-02-15Thursday, February 15, 2007 9:20:17 PM2007-02-16Friday, February 16, 2007 8:44:44 PM2007-02-17Saturday, February 17, 2007 8:09:11 PM2007-02-18Sunday, February 18, 2007 7:33:38 PM2007-02-19Monday, February 19, 2007 6:58:05 PM2007-02-20Tuesday, February 20, 2007 6:22:32 PM2007-02-21Wednesday, February 21, 2007 5:46:59 PM2007-02-22Thursday, February 22, 2007 5:11:26 PM2007-02-23Friday, February 23, 2007 4:35:53 PM2007-02-24Saturday, February 24, 2007 4:00:20 PM2007-02-25Sunday, February 25, 2007 3:24:47 PM2007-02-26Monday, February 26, 2007 2:49:14 PM2007-02-27Tuesday, February 27, 2007 2:13:41 PM2007-02-28Wednesday, February 28, 2007 1:38:08 PM2007-03-01Thursday, March 01, 2007 1:02:35 PM2007-03-02Friday, March 02, 2007 12:27:02 PM2007-03-03Saturday, March 03, 2007 11:51:29 AM2007-03-04Sunday, March 04, 2007 11:15:56 AM2007-03-05Monday, March 05, 2007 10:40:23 AM2007-03-06Tuesday, March 06, 2007 10:04:50 AM2007-03-07Wednesday, March 07, 2007 9:29:17 AM2007-03-08Thursday, March 08, 2007 8:53:44 AM2007-03-09Friday, March 09, 2007 8:18:10 AM2007-03-10Saturday, March 10, 2007 7:42:37 AM2007-03-11Sunday, March 11, 2007 8:07:04 AM2007-03-12Monday, March 12, 2007 7:31:31 AM2007-03-13Tuesday, March 13, 2007 6:55:58 AM2007-03-14Wednesday, March 14, 2007 6:20:25 AM2007-03-15Thursday, March 15, 2007 5:44:52 AM2007-03-16Friday, March 16, 2007 5:09:19 AM2007-03-17Saturday, March 17, 2007 4:33:46 AM2007-03-18Sunday, March 18, 2007 3:58:13 AM2007-03-19Monday, March 19, 2007 3:22:40 AM2007-03-20Tuesday, March 20, 2007 2:47:07 AM2007-03-21Wednesday, March 21, 2007 2:11:34 AM2007-03-22Thursday, March 22, 2007 1:36:01 AM2007-03-23Friday, March 23, 2007 1:00:28 AM2007-03-24Saturday, March 24, 2007 0:24:55 AM2007-03-24Saturday, March 24, 2007 11:49:22 PM2007-03-25Sunday, March 25, 2007 11:13:49 PM2007-03-26Monday, March 26, 2007 10:38:16 PM2007-03-27Tuesday, March 27, 2007 10:02:43 PM2007-03-28Wednesday, March 28, 2007 9:27:10 PM2007-03-29Thursday, March 29, 2007 8:51:37 PM2007-03-30Friday, March 30, 2007 8:16:03 PM2007-03-31Saturday, March 31, 2007 7:40:30 PM2007-04-01Sunday, April 01, 2007 7:04:57 PM2007-04-02Monday, April 02, 2007 6:29:24 PM2007-04-03Tuesday, April 03, 2007 5:53:51 PM2007-04-04Wednesday, April 04, 2007 5:18:18 PM2007-04-05Thursday, April 05, 2007 4:42:45 PM2007-04-06Friday, April 06, 2007 4:07:12 PM2007-04-07Saturday, April 07, 2007 3:31:39 PM2007-04-08Sunday, April 08, 2007 2:56:06 PM2007-04-09Monday, April 09, 2007 2:20:33 PM2007-04-10Tuesday, April 10, 2007 1:45:00 PM2007-04-11Wednesday, April 11, 2007 1:09:27 PM2007-04-12Thursday, April 12, 2007 12:33:54 PM2007-04-13Friday, April 13, 2007 11:58:21 AM2007-04-14Saturday, April 14, 2007 11:22:48 AM2007-04-15Sunday, April 15, 2007 10:47:15 AM2007-04-16Monday, April 16, 2007 10:11:42 AM2007-04-17Tuesday, April 17, 2007 9:36:09 AM2007-04-18Wednesday, April 18, 2007 9:00:36 AM2007-04-19Thursday, April 19, 2007 8:25:03 AM2007-04-20Friday, April 20, 2007 7:49:30 AM2007-04-21Saturday, April 21, 2007 7:13:57 AM2007-04-22Sunday, April 22, 2007 6:38:23 AM2007-04-23Monday, April 23, 2007 6:02:50 AM2007-04-24Tuesday, April 24, 2007 5:27:17 AM2007-04-25Wednesday, April 25, 2007 4:51:44 AM2007-04-26Thursday, April 26, 2007 4:16:11 AM2007-04-27Friday, April 27, 2007 3:40:38 AM2007-04-28Saturday, April 28, 2007 3:05:05 AM2007-04-29Sunday, April 29, 2007 2:29:32 AM2007-04-30Monday, April 30, 2007 1:53:59 AM2007-05-01Tuesday, May 01, 2007 1:18:26 AM2007-05-02Wednesday, May 02, 2007 0:42:53 AM2007-05-03Thursday, May 03, 2007 0:07:20 AM2007-05-03Thursday, May 03, 2007 11:31:47 PM2007-05-04Friday, May 04, 2007 10:56:14 PM2007-05-05Saturday, May 05, 2007 10:20:41 PM2007-05-06Sunday, May 06, 2007 9:45:08 PM2007-05-07Monday, May 07, 2007 9:09:35 PM2007-05-08Tuesday, May 08, 2007 8:34:02 PM2007-05-09Wednesday, May 09, 2007 7:58:29 PM2007-05-10Thursday, May 10, 2007 7:22:56 PM2007-05-11Friday, May 11, 2007 6:47:23 PM2007-05-12Saturday, May 12, 2007 6:11:50 PM2007-05-13Sunday, May 13, 2007 5:36:17 PM2007-05-14Monday, May 14, 2007 5:00:43 PM2007-05-15Tuesday, May 15, 2007 4:25:10 PM2007-05-16Wednesday, May 16, 2007 3:49:37 PM2007-05-17Thursday, May 17, 2007 3:14:04 PM2007-05-18Friday, May 18, 2007 2:38:31 PM2007-05-19Saturday, May 19, 2007 2:02:58 PM2007-05-20Sunday, May 20, 2007 1:27:25 PM2007-05-21Monday, May 21, 2007 12:51:52 PM2007-05-22Tuesday, May 22, 2007 12:16:19 PM2007-05-23Wednesday, May 23, 2007 11:40:46 AM2007-05-24Thursday, May 24, 2007 11:05:13 AM2007-05-25Friday, May 25, 2007 10:29:40 AM2007-05-26Saturday, May 26, 2007 9:54:07 AM2007-05-27Sunday, May 27, 2007 9:18:34 AM2007-05-28Monday, May 28, 2007 8:43:01 AM2007-05-29Tuesday, May 29, 2007 8:07:28 AM2007-05-30Wednesday, May 30, 2007 7:31:55 AM2007-05-31Thursday, May 31, 2007 6:56:22 AM2007-06-01Friday, June 01, 2007 6:20:49 AM2007-06-02Saturday, June 02, 2007 5:45:16 AM2007-06-03Sunday, June 03, 2007 5:09:43 AM2007-06-04Monday, June 04, 2007 4:34:10 AM2007-06-05Tuesday, June 05, 2007 3:58:37 AM2007-06-06Wednesday, June 06, 2007 3:23:03 AM2007-06-07Thursday, June 07, 2007 2:47:30 AM2007-06-08Friday, June 08, 2007 2:11:57 AM2007-06-09Saturday, June 09, 2007 1:36:24 AM2007-06-10Sunday, June 10, 2007 1:00:51 AM2007-06-11Monday, June 11, 2007 0:25:18 AM2007-06-11Monday, June 11, 2007 11:49:45 PM2007-06-12Tuesday, June 12, 2007 11:14:12 PM2007-06-13Wednesday, June 13, 2007 10:38:39 PM2007-06-14Thursday, June 14, 2007 10:03:06 PM2007-06-15Friday, June 15, 2007 9:27:33 PM2007-06-16Saturday, June 16, 2007 8:52:00 PM2007-06-17Sunday, June 17, 2007 8:16:27 PM2007-06-18Monday, June 18, 2007 7:40:54 PM2007-06-19Tuesday, June 19, 2007 7:05:21 PM2007-06-20Wednesday, June 20, 2007 6:29:48 PM2007-06-21Thursday, June 21, 2007 5:54:15 PM2007-06-22Friday, June 22, 2007 5:18:42 PM2007-06-23Saturday, June 23, 2007 4:43:09 PM2007-06-24Sunday, June 24, 2007 4:07:36 PM2007-06-25Monday, June 25, 2007 3:32:03 PM2007-06-26Tuesday, June 26, 2007 2:56:30 PM2007-06-27Wednesday, June 27, 2007 2:20:56 PM2007-06-28Thursday, June 28, 2007 1:45:23 PM2007-06-29Friday, June 29, 2007 1:09:50 PM2007-06-30Saturday, June 30, 2007 12:34:17 PM2007-07-01Sunday, July 01, 2007 11:58:44 AM2007-07-02Monday, July 02, 2007 11:23:11 AM2007-07-03Tuesday, July 03, 2007 10:47:38 AM2007-07-04Wednesday, July 04, 2007 10:12:05 AM2007-07-05Thursday, July 05, 2007 9:36:32 AM2007-07-06Friday, July 06, 2007 9:00:59 AM2007-07-07Saturday, July 07, 2007 8:25:26 AM2007-07-08Sunday, July 08, 2007 7:49:53 AM2007-07-09Monday, July 09, 2007 7:14:20 AM2007-07-10Tuesday, July 10, 2007 6:38:47 AM2007-07-11Wednesday, July 11, 2007 6:03:14 AM2007-07-12Thursday, July 12, 2007 5:27:41 AM2007-07-13Friday, July 13, 2007 4:52:08 AM2007-07-14Saturday, July 14, 2007 4:16:35 AM2007-07-15Sunday, July 15, 2007 3:41:02 AM2007-07-16Monday, July 16, 2007 3:05:29 AM2007-07-17Tuesday, July 17, 2007 2:29:56 AM2007-07-18Wednesday, July 18, 2007 1:54:23 AM2007-07-19Thursday, July 19, 2007 1:18:50 AM2007-07-20Friday, July 20, 2007 0:43:16 AM2007-07-21Saturday, July 21, 2007 0:07:43 AM2007-07-21Saturday, July 21, 2007 11:32:10 PM2007-07-22Sunday, July 22, 2007 10:56:37 PM2007-07-23Monday, July 23, 2007 10:21:04 PM2007-07-24Tuesday, July 24, 2007 9:45:31 PM2007-07-25Wednesday, July 25, 2007 9:09:58 PM2007-07-26Thursday, July 26, 2007 8:34:25 PM2007-07-27Friday, July 27, 2007 7:58:52 PM2007-07-28Saturday, July 28, 2007 7:23:19 PM2007-07-29Sunday, July 29, 2007 6:47:46 PM2007-07-30Monday, July 30, 2007 6:12:13 PM2007-07-31Tuesday, July 31, 2007 5:36:40 PM2007-08-01Wednesday, August 01, 2007 5:01:07 PM2007-08-02Thursday, August 02, 2007 4:25:34 PM2007-08-03Friday, August 03, 2007 3:50:01 PM2007-08-04Saturday, August 04, 2007 3:14:28 PM2007-08-05Sunday, August 05, 2007 2:38:55 PM2007-08-06Monday, August 06, 2007 2:03:22 PM2007-08-07Tuesday, August 07, 2007 1:27:49 PM2007-08-08Wednesday, August 08, 2007 12:52:16 PM2007-08-09Thursday, August 09, 2007 12:16:43 PM2007-08-10Friday, August 10, 2007 11:41:10 AM2007-08-11Saturday, August 11, 2007 11:05:36 AM2007-08-12Sunday, August 12, 2007 10:30:03 AM2007-08-13Monday, August 13, 2007 9:54:30 AM2007-08-14Tuesday, August 14, 2007 9:18:57 AM2007-08-15Wednesday, August 15, 2007 8:43:24 AM2007-08-16Thursday, August 16, 2007 8:07:51 AM2007-08-17Friday, August 17, 2007 7:32:18 AM2007-08-18Saturday, August 18, 2007 6:56:45 AM2007-08-19Sunday, August 19, 2007 6:21:12 AM2007-08-20Monday, August 20, 2007 5:45:39 AM2007-08-21Tuesday, August 21, 2007 5:10:06 AM2007-08-22Wednesday, August 22, 2007 4:34:33 AM2007-08-23Thursday, August 23, 2007 3:59:00 AM2007-08-24Friday, August 24, 2007 3:23:27 AM2007-08-25Saturday, August 25, 2007 2:47:54 AM2007-08-26Sunday, August 26, 2007 2:12:21 AM2007-08-27Monday, August 27, 2007 1:36:48 AM2007-08-28Tuesday, August 28, 2007 1:01:15 AM2007-08-29Wednesday, August 29, 2007 0:25:42 AM2007-08-29Wednesday, August 29, 2007 11:50:09 PM2007-08-30Thursday, August 30, 2007 11:14:36 PM2007-08-31Friday, August 31, 2007 10:39:03 PM2007-09-01Saturday, September 01, 2007 10:03:30 PM2007-09-02Sunday, September 02, 2007 9:27:56 PM2007-09-03Monday, September 03, 2007 8:52:23 PM2007-09-04Tuesday, September 04, 2007 8:16:50 PM2007-09-05Wednesday, September 05, 2007 7:41:17 PM2007-09-06Thursday, September 06, 2007 7:05:44 PM2007-09-07Friday, September 07, 2007 6:30:11 PM2007-09-08Saturday, September 08, 2007 5:54:38 PM2007-09-09Sunday, September 09, 2007 5:19:05 PM2007-09-10Monday, September 10, 2007 4:43:32 PM2007-09-11Tuesday, September 11, 2007 4:07:59 PM2007-09-12Wednesday, September 12, 2007 3:32:26 PM2007-09-13Thursday, September 13, 2007 2:56:53 PM2007-09-14Friday, September 14, 2007 2:21:20 PM2007-09-15Saturday, September 15, 2007 1:45:47 PM2007-09-16Sunday, September 16, 2007 1:10:14 PM2007-09-17Monday, September 17, 2007 12:34:41 PM2007-09-18Tuesday, September 18, 2007 11:59:08 AM2007-09-19Wednesday, September 19, 2007 11:23:35 AM2007-09-20Thursday, September 20, 2007 10:48:02 AM2007-09-21Friday, September 21, 2007 10:12:29 AM2007-09-22Saturday, September 22, 2007 9:36:56 AM2007-09-23Sunday, September 23, 2007 9:01:23 AM2007-09-24Monday, September 24, 2007 8:25:49 AM2007-09-25Tuesday, September 25, 2007 7:50:16 AM2007-09-26Wednesday, September 26, 2007 7:14:43 AM2007-09-27Thursday, September 27, 2007 6:39:10 AM2007-09-28Friday, September 28, 2007 6:03:37 AM2007-09-29Saturday, September 29, 2007 5:28:04 AM2007-09-30Sunday, September 30, 2007 4:52:31 AM2007-10-01Monday, October 01, 2007 4:16:58 AM2007-10-02Tuesday, October 02, 2007 3:41:25 AM2007-10-03Wednesday, October 03, 2007 3:05:52 AM2007-10-04Thursday, October 04, 2007 2:30:19 AM2007-10-05Friday, October 05, 2007 1:54:46 AM2007-10-06Saturday, October 06, 2007 1:19:13 AM2007-10-07Sunday, October 07, 2007 0:43:40 AM2007-10-08Monday, October 08, 2007 0:08:07 AM2007-10-08Monday, October 08, 2007 11:32:34 PM2007-10-09Tuesday, October 09, 2007 10:57:01 PM2007-10-10Wednesday, October 10, 2007 10:21:28 PM2007-10-11Thursday, October 11, 2007 9:45:55 PM2007-10-12Friday, October 12, 2007 9:10:22 PM2007-10-13Saturday, October 13, 2007 8:34:49 PM2007-10-14Sunday, October 14, 2007 7:59:16 PM2007-10-15Monday, October 15, 2007 7:23:43 PM2007-10-16Tuesday, October 16, 2007 6:48:09 PM2007-10-17Wednesday, October 17, 2007 6:12:36 PM2007-10-18Thursday, October 18, 2007 5:37:03 PM2007-10-19Friday, October 19, 2007 5:01:30 PM2007-10-20Saturday, October 20, 2007 4:25:57 PM2007-10-21Sunday, October 21, 2007 3:50:24 PM2007-10-22Monday, October 22, 2007 3:14:51 PM2007-10-23Tuesday, October 23, 2007 2:39:18 PM2007-10-24Wednesday, October 24, 2007 2:03:45 PM2007-10-25Thursday, October 25, 2007 1:28:12 PM2007-10-26Friday, October 26, 2007 12:52:39 PM2007-10-27Saturday, October 27, 2007 12:17:06 PM2007-10-28Sunday, October 28, 2007 11:41:33 AM2007-10-29Monday, October 29, 2007 11:06:00 AM2007-10-30Tuesday, October 30, 2007 10:30:27 AM2007-10-31Wednesday, October 31, 2007 9:54:54 AM2007-11-01Thursday, November 01, 2007 9:19:21 AM2007-11-02Friday, November 02, 2007 8:43:48 AM2007-11-03Saturday, November 03, 2007 8:08:15 AM2007-11-04Sunday, November 04, 2007 6:32:42 AM2007-11-05Monday, November 05, 2007 5:57:09 AM2007-11-06Tuesday, November 06, 2007 5:21:36 AM2007-11-07Wednesday, November 07, 2007 4:46:03 AM2007-11-08Thursday, November 08, 2007 4:10:29 AM2007-11-09Friday, November 09, 2007 3:34:56 AM2007-11-10Saturday, November 10, 2007 2:59:23 AM2007-11-11Sunday, November 11, 2007 2:23:50 AM2007-11-12Monday, November 12, 2007 1:48:17 AM2007-11-13Tuesday, November 13, 2007 1:12:44 AM2007-11-14Wednesday, November 14, 2007 0:37:11 AM2007-11-15Thursday, November 15, 2007 0:01:38 AM2007-11-15Thursday, November 15, 2007 11:26:05 PM2007-11-16Friday, November 16, 2007 10:50:32 PM2007-11-17Saturday, November 17, 2007 10:14:59 PM2007-11-18Sunday, November 18, 2007 9:39:26 PM2007-11-19Monday, November 19, 2007 9:03:53 PM2007-11-20Tuesday, November 20, 2007 8:28:20 PM2007-11-21Wednesday, November 21, 2007 7:52:47 PM2007-11-22Thursday, November 22, 2007 7:17:14 PM2007-11-23Friday, November 23, 2007 6:41:41 PM2007-11-24Saturday, November 24, 2007 6:06:08 PM2007-11-25Sunday, November 25, 2007 5:30:35 PM2007-11-26Monday, November 26, 2007 4:55:02 PM2007-11-27Tuesday, November 27, 2007 4:19:29 PM2007-11-28Wednesday, November 28, 2007 3:43:56 PM2007-11-29Thursday, November 29, 2007 3:08:22 PM2007-11-30Friday, November 30, 2007 2:32:49 PM2007-12-01Saturday, December 01, 2007 1:57:16 PM2007-12-02Sunday, December 02, 2007 1:21:43 PM2007-12-03Monday, December 03, 2007 12:46:10 PM2007-12-04Tuesday, December 04, 2007 12:10:37 PM2007-12-05Wednesday, December 05, 2007 11:35:04 AM2007-12-06Thursday, December 06, 2007 10:59:31 AM2007-12-07Friday, December 07, 2007 10:23:58 AM2007-12-08Saturday, December 08, 2007 9:48:25 AM2007-12-09Sunday, December 09, 2007 9:12:52 AM2007-12-10Monday, December 10, 2007 8:37:19 AM2007-12-11Tuesday, December 11, 2007 8:01:46 AM2007-12-12Wednesday, December 12, 2007 7:26:13 AM2007-12-13Thursday, December 13, 2007 6:50:40 AM2007-12-14Friday, December 14, 2007 6:15:07 AM2007-12-15Saturday, December 15, 2007 5:39:34 AM2007-12-16Sunday, December 16, 2007 5:04:01 AM2007-12-17Monday, December 17, 2007 4:28:28 AM2007-12-18Tuesday, December 18, 2007 3:52:55 AM2007-12-19Wednesday, December 19, 2007 3:17:22 AM2007-12-20Thursday, December 20, 2007 2:41:49 AM2007-12-21Friday, December 21, 2007 2:06:16 AM2007-12-22Saturday, December 22, 2007 1:30:42 AM2007-12-23Sunday, December 23, 2007 0:55:09 AM2007-12-24Monday, December 24, 2007 0:19:36 AM2007-12-24Monday, December 24, 2007 11:44:03 PM2007-12-25Tuesday, December 25, 2007 11:08:30 PM2007-12-26Wednesday, December 26, 2007 10:32:57 PM2007-12-27Thursday, December 27, 2007 9:57:24 PM2007-12-28Friday, December 28, 2007 9:21:51 PM2007-12-29Saturday, December 29, 2007 8:46:18 PM2007-12-30Sunday, December 30, 2007 8:10:45 PM2007-12-31Monday, December 31, 2007 7:35:12 PM2008-01-01Tuesday, January 01, 2008 6:59:39 PM2008-01-02Wednesday, January 02, 2008 6:24:06 PM2008-01-03Thursday, January 03, 2008 5:48:33 PM2008-01-04Friday, January 04, 2008 5:13:00 PM2008-01-05Saturday, January 05, 2008 4:37:27 PM2008-01-06Sunday, January 06, 2008 4:01:54 PM2008-01-07Monday, January 07, 2008 3:26:21 PM2008-01-08Tuesday, January 08, 2008 2:50:48 PM2008-01-09Wednesday, January 09, 2008 2:15:15 PM2008-01-10Thursday, January 10, 2008 1:39:42 PM2008-01-11Friday, January 11, 2008 1:04:09 PM2008-01-12Saturday, January 12, 2008 12:28:36 PM2008-01-13Sunday, January 13, 2008 11:53:02 AM2008-01-14Monday, January 14, 2008 11:17:29 AM2008-01-15Tuesday, January 15, 2008 10:41:56 AM2008-01-16Wednesday, January 16, 2008 10:06:23 AM2008-01-17Thursday, January 17, 2008 9:30:50 AM2008-01-18Friday, January 18, 2008 8:55:17 AM2008-01-19Saturday, January 19, 2008 8:19:44 AM2008-01-20Sunday, January 20, 2008 7:44:11 AM2008-01-21Monday, January 21, 2008 7:08:38 AM2008-01-22Tuesday, January 22, 2008 6:33:05 AM2008-01-23Wednesday, January 23, 2008 5:57:32 AM2008-01-24Thursday, January 24, 2008 5:21:59 AM2008-01-25Friday, January 25, 2008 4:46:26 AM2008-01-26Saturday, January 26, 2008 4:10:53 AM2008-01-27Sunday, January 27, 2008 3:35:20 AM2008-01-28Monday, January 28, 2008 2:59:47 AM2008-01-29Tuesday, January 29, 2008 2:24:14 AM2008-01-30Wednesday, January 30, 2008 1:48:41 AM2008-01-31Thursday, January 31, 2008 1:13:08 AM2008-02-01Friday, February 01, 2008 0:37:35 AM2008-02-02Saturday, February 02, 2008 0:02:02 AM2008-02-02Saturday, February 02, 2008 11:26:29 PM2008-02-03Sunday, February 03, 2008 10:50:56 PM2008-02-04Monday, February 04, 2008 10:15:22 PM2008-02-05Tuesday, February 05, 2008 9:39:49 PM2008-02-06Wednesday, February 06, 2008 9:04:16 PM2008-02-07Thursday, February 07, 2008 8:28:43 PM2008-02-08Friday, February 08, 2008 7:53:10 PM2008-02-09Saturday, February 09, 2008 7:17:37 PM2008-02-10Sunday, February 10, 2008 6:42:04 PM2008-02-11Monday, February 11, 2008 6:06:31 PM2008-02-12Tuesday, February 12, 2008 5:30:58 PM2008-02-13Wednesday, February 13, 2008 4:55:25 PM2008-02-14Thursday, February 14, 2008 4:19:52 PM2008-02-15Friday, February 15, 2008 3:44:19 PM2008-02-16Saturday, February 16, 2008 3:08:46 PM2008-02-17Sunday, February 17, 2008 2:33:13 PM2008-02-18Monday, February 18, 2008 1:57:40 PM2008-02-19Tuesday, February 19, 2008 1:22:07 PM2008-02-20Wednesday, February 20, 2008 12:46:34 PM2008-02-21Thursday, February 21, 2008 12:11:01 PM2008-02-22Friday, February 22, 2008 11:35:28 AM2008-02-23Saturday, February 23, 2008 10:59:55 AM2008-02-24Sunday, February 24, 2008 10:24:22 AM2008-02-25Monday, February 25, 2008 9:48:49 AM2008-02-26Tuesday, February 26, 2008 9:13:15 AM2008-02-27Wednesday, February 27, 2008 8:37:42 AM2008-02-28Thursday, February 28, 2008 8:02:09 AM2008-02-29Friday, February 29, 2008 7:26:36 AM2008-03-01Saturday, March 01, 2008 6:51:03 AM2008-03-02Sunday, March 02, 2008 6:15:30 AM2008-03-03Monday, March 03, 2008 5:39:57 AM2008-03-04Tuesday, March 04, 2008 5:04:24 AM2008-03-05Wednesday, March 05, 2008 4:28:51 AM2008-03-06Thursday, March 06, 2008 3:53:18 AM2008-03-07Friday, March 07, 2008 3:17:45 AM2008-03-08Saturday, March 08, 2008 2:42:12 AM2008-03-09Sunday, March 09, 2008 3:06:39 AM2008-03-10Monday, March 10, 2008 2:31:06 AM2008-03-11Tuesday, March 11, 2008 1:55:33 AM2008-03-12Wednesday, March 12, 2008 1:20:00 AM2008-03-13Thursday, March 13, 2008 0:44:27 AM2008-03-14Friday, March 14, 2008 0:08:54 AM2008-03-14Friday, March 14, 2008 11:33:21 PM2008-03-15Saturday, March 15, 2008 10:57:48 PM2008-03-16Sunday, March 16, 2008 10:22:15 PM2008-03-17Monday, March 17, 2008 9:46:42 PM2008-03-18Tuesday, March 18, 2008 9:11:09 PM2008-03-19Wednesday, March 19, 2008 8:35:35 PM2008-03-20Thursday, March 20, 2008 8:00:02 PM2008-03-21Friday, March 21, 2008 7:24:29 PM2008-03-22Saturday, March 22, 2008 6:48:56 PM2008-03-23Sunday, March 23, 2008 6:13:23 PM2008-03-24Monday, March 24, 2008 5:37:50 PM2008-03-25Tuesday, March 25, 2008 5:02:17 PM2008-03-26Wednesday, March 26, 2008 4:26:44 PM2008-03-27Thursday, March 27, 2008 3:51:11 PM2008-03-28Friday, March 28, 2008 3:15:38 PM2008-03-29Saturday, March 29, 2008 2:40:05 PM2008-03-30Sunday, March 30, 2008 2:04:32 PM2008-03-31Monday, March 31, 2008 1:28:59 PM2008-04-01Tuesday, April 01, 2008 12:53:26 PM2008-04-02Wednesday, April 02, 2008 12:17:53 PM2008-04-03Thursday, April 03, 2008 11:42:20 AM2008-04-04Friday, April 04, 2008 11:06:47 AM2008-04-05Saturday, April 05, 2008 10:31:14 AM2008-04-06Sunday, April 06, 2008 9:55:41 AM2008-04-07Monday, April 07, 2008 9:20:08 AM2008-04-08Tuesday, April 08, 2008 8:44:35 AM2008-04-09Wednesday, April 09, 2008 8:09:02 AM2008-04-10Thursday, April 10, 2008 7:33:29 AM2008-04-11Friday, April 11, 2008 6:57:55 AM2008-04-12Saturday, April 12, 2008 6:22:22 AM2008-04-13Sunday, April 13, 2008 5:46:49 AM2008-04-14Monday, April 14, 2008 5:11:16 AM2008-04-15Tuesday, April 15, 2008 4:35:43 AM2008-04-16Wednesday, April 16, 2008 4:00:10 AM2008-04-17Thursday, April 17, 2008 3:24:37 AM2008-04-18Friday, April 18, 2008 2:49:04 AM2008-04-19Saturday, April 19, 2008 2:13:31 AM2008-04-20Sunday, April 20, 2008 1:37:58 AM2008-04-21Monday, April 21, 2008 1:02:25 AM2008-04-22Tuesday, April 22, 2008 0:26:52 AM2008-04-22Tuesday, April 22, 2008 11:51:19 PM2008-04-23Wednesday, April 23, 2008 11:15:46 PM2008-04-24Thursday, April 24, 2008 10:40:13 PM2008-04-25Friday, April 25, 2008 10:04:40 PM2008-04-26Saturday, April 26, 2008 9:29:07 PM2008-04-27Sunday, April 27, 2008 8:53:34 PM2008-04-28Monday, April 28, 2008 8:18:01 PM2008-04-29Tuesday, April 29, 2008 7:42:28 PM2008-04-30Wednesday, April 30, 2008 7:06:55 PM2008-05-01Thursday, May 01, 2008 6:31:22 PM" assertEq(ret, expected); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-date-format-xparb.js0000644000175000017500000002777311545150464026161 0ustar chr1schr1s/* * Copyright (C) 2004 Baron Schwartz * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, version 2.1. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ Date.parseFunctions = {count:0}; Date.parseRegexes = []; Date.formatFunctions = {count:0}; Date.prototype.dateFormat = function(format) { if (Date.formatFunctions[format] == null) { Date.createNewFormat(format); } var func = Date.formatFunctions[format]; return this[func](); } Date.createNewFormat = function(format) { var funcName = "format" + Date.formatFunctions.count++; Date.formatFunctions[format] = funcName; var code = "Date.prototype." + funcName + " = function(){return "; var special = false; var ch = ''; for (var i = 0; i < format.length; ++i) { ch = format.charAt(i); if (!special && ch == "\\") { special = true; } else if (special) { special = false; code += "'" + String.escape(ch) + "' + "; } else { code += Date.getFormatCode(ch); } } eval(code.substring(0, code.length - 3) + ";}"); } Date.getFormatCode = function(character) { switch (character) { case "d": return "String.leftPad(this.getDate(), 2, '0') + "; case "D": return "Date.dayNames[this.getDay()].substring(0, 3) + "; case "j": return "this.getDate() + "; case "l": return "Date.dayNames[this.getDay()] + "; case "S": return "this.getSuffix() + "; case "w": return "this.getDay() + "; case "z": return "this.getDayOfYear() + "; case "W": return "this.getWeekOfYear() + "; case "F": return "Date.monthNames[this.getMonth()] + "; case "m": return "String.leftPad(this.getMonth() + 1, 2, '0') + "; case "M": return "Date.monthNames[this.getMonth()].substring(0, 3) + "; case "n": return "(this.getMonth() + 1) + "; case "t": return "this.getDaysInMonth() + "; case "L": return "(this.isLeapYear() ? 1 : 0) + "; case "Y": return "this.getFullYear() + "; case "y": return "('' + this.getFullYear()).substring(2, 4) + "; case "a": return "(this.getHours() < 12 ? 'am' : 'pm') + "; case "A": return "(this.getHours() < 12 ? 'AM' : 'PM') + "; case "g": return "((this.getHours() %12) ? this.getHours() % 12 : 12) + "; case "G": return "this.getHours() + "; case "h": return "String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + "; case "H": return "String.leftPad(this.getHours(), 2, '0') + "; case "i": return "String.leftPad(this.getMinutes(), 2, '0') + "; case "s": return "String.leftPad(this.getSeconds(), 2, '0') + "; case "O": return "this.getGMTOffset() + "; case "T": return "this.getTimezone() + "; case "Z": return "(this.getTimezoneOffset() * -60) + "; default: return "'" + String.escape(character) + "' + "; } } Date.parseDate = function(input, format) { if (Date.parseFunctions[format] == null) { Date.createParser(format); } var func = Date.parseFunctions[format]; return Date[func](input); } Date.createParser = function(format) { var funcName = "parse" + Date.parseFunctions.count++; var regexNum = Date.parseRegexes.length; var currentGroup = 1; Date.parseFunctions[format] = funcName; var code = "Date." + funcName + " = function(input){\n" + "var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n" + "var d = new Date();\n" + "y = d.getFullYear();\n" + "m = d.getMonth();\n" + "d = d.getDate();\n" + "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n" + "if (results && results.length > 0) {" var regex = ""; var special = false; var ch = ''; for (var i = 0; i < format.length; ++i) { ch = format.charAt(i); if (!special && ch == "\\") { special = true; } else if (special) { special = false; regex += String.escape(ch); } else { obj = Date.formatCodeToRegex(ch, currentGroup); currentGroup += obj.g; regex += obj.s; if (obj.g && obj.c) { code += obj.c; } } } code += "if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n" + "{return new Date(y, m, d, h, i, s);}\n" + "else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n" + "{return new Date(y, m, d, h, i);}\n" + "else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n" + "{return new Date(y, m, d, h);}\n" + "else if (y > 0 && m >= 0 && d > 0)\n" + "{return new Date(y, m, d);}\n" + "else if (y > 0 && m >= 0)\n" + "{return new Date(y, m);}\n" + "else if (y > 0)\n" + "{return new Date(y);}\n" + "}return null;}"; Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$"); eval(code); } Date.formatCodeToRegex = function(character, currentGroup) { switch (character) { case "D": return {g:0, c:null, s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"}; case "j": case "d": return {g:1, c:"d = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{1,2})"}; case "l": return {g:0, c:null, s:"(?:" + Date.dayNames.join("|") + ")"}; case "S": return {g:0, c:null, s:"(?:st|nd|rd|th)"}; case "w": return {g:0, c:null, s:"\\d"}; case "z": return {g:0, c:null, s:"(?:\\d{1,3})"}; case "W": return {g:0, c:null, s:"(?:\\d{2})"}; case "F": return {g:1, c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "].substring(0, 3)], 10);\n", s:"(" + Date.monthNames.join("|") + ")"}; case "M": return {g:1, c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "]], 10);\n", s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"}; case "n": case "m": return {g:1, c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n", s:"(\\d{1,2})"}; case "t": return {g:0, c:null, s:"\\d{1,2}"}; case "L": return {g:0, c:null, s:"(?:1|0)"}; case "Y": return {g:1, c:"y = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{4})"}; case "y": return {g:1, c:"var ty = parseInt(results[" + currentGroup + "], 10);\n" + "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", s:"(\\d{1,2})"}; case "a": return {g:1, c:"if (results[" + currentGroup + "] == 'am') {\n" + "if (h == 12) { h = 0; }\n" + "} else { if (h < 12) { h += 12; }}", s:"(am|pm)"}; case "A": return {g:1, c:"if (results[" + currentGroup + "] == 'AM') {\n" + "if (h == 12) { h = 0; }\n" + "} else { if (h < 12) { h += 12; }}", s:"(AM|PM)"}; case "g": case "G": case "h": case "H": return {g:1, c:"h = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{1,2})"}; case "i": return {g:1, c:"i = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{2})"}; case "s": return {g:1, c:"s = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{2})"}; case "O": return {g:0, c:null, s:"[+-]\\d{4}"}; case "T": return {g:0, c:null, s:"[A-Z]{3}"}; case "Z": return {g:0, c:null, s:"[+-]\\d{1,5}"}; default: return {g:0, c:null, s:String.escape(character)}; } } Date.prototype.getTimezone = function() { return this.toString().replace( /^.*? ([A-Z]{3}) [0-9]{4}.*$/, "$1").replace( /^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3"); } Date.prototype.getGMTOffset = function() { return (this.getTimezoneOffset() > 0 ? "-" : "+") + String.leftPad(Math.floor(this.getTimezoneOffset() / 60), 2, "0") + String.leftPad(this.getTimezoneOffset() % 60, 2, "0"); } Date.prototype.getDayOfYear = function() { var num = 0; Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; for (var i = 0; i < this.getMonth(); ++i) { num += Date.daysInMonth[i]; } return num + this.getDate() - 1; } Date.prototype.getWeekOfYear = function() { // Skip to Thursday of this week var now = this.getDayOfYear() + (4 - this.getDay()); // Find the first Thursday of the year var jan1 = new Date(this.getFullYear(), 0, 1); var then = (7 - jan1.getDay() + 4); document.write(then); return String.leftPad(((now - then) / 7) + 1, 2, "0"); } Date.prototype.isLeapYear = function() { var year = this.getFullYear(); return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year))); } Date.prototype.getFirstDayOfMonth = function() { var day = (this.getDay() - (this.getDate() - 1)) % 7; return (day < 0) ? (day + 7) : day; } Date.prototype.getLastDayOfMonth = function() { var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7; return (day < 0) ? (day + 7) : day; } Date.prototype.getDaysInMonth = function() { Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; return Date.daysInMonth[this.getMonth()]; } Date.prototype.getSuffix = function() { switch (this.getDate()) { case 1: case 21: case 31: return "st"; case 2: case 22: return "nd"; case 3: case 23: return "rd"; default: return "th"; } } String.escape = function(string) { return string.replace(/('|\\)/g, "\\$1"); } String.leftPad = function (val, size, ch) { var result = new String(val); if (ch == null) { ch = " "; } while (result.length < size) { result = ch + result; } return result; } Date.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31]; Date.monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; Date.dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; Date.y2kYear = 50; Date.monthNumbers = { Jan:0, Feb:1, Mar:2, Apr:3, May:4, Jun:5, Jul:6, Aug:7, Sep:8, Oct:9, Nov:10, Dec:11}; Date.patterns = { ISO8601LongPattern:"Y-m-d H:i:s", ISO8601ShortPattern:"Y-m-d", ShortDatePattern: "n/j/Y", LongDatePattern: "l, F d, Y", FullDateTimePattern: "l, F d, Y g:i:s A", MonthDayPattern: "F d", ShortTimePattern: "g:i A", LongTimePattern: "g:i:s A", SortableDateTimePattern: "Y-m-d\\TH:i:s", UniversalSortableDateTimePattern: "Y-m-d H:i:sO", YearMonthPattern: "F, Y"}; var date = new Date("1/1/2007 1:11:11"); var ret; for (i = 0; i < 4000; ++i) { var shortFormat = date.dateFormat("Y-m-d"); var longFormat = date.dateFormat("l, F d, Y g:i:s A"); ret = shortFormat + longFormat; date.setTime(date.getTime() + 84266956); } // No exact match because the output depends on the locale's time zone. See bug 524490. assertEq(/^2017-09-05Tuesday, September 05, 2017 [0-9:]* AM$/.exec(ret) != null, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-math-cordic.js0000644000175000017500000000526411545150464025025 0ustar chr1schr1s/* * Copyright (C) Rich Moore. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /////. Start CORDIC var AG_CONST = 0.6072529350; function FIXED(X) { return X * 65536.0; } function FLOAT(X) { return X / 65536.0; } function DEG2RAD(X) { return 0.017453 * (X); } var Angles = [ FIXED(45.0), FIXED(26.565), FIXED(14.0362), FIXED(7.12502), FIXED(3.57633), FIXED(1.78991), FIXED(0.895174), FIXED(0.447614), FIXED(0.223811), FIXED(0.111906), FIXED(0.055953), FIXED(0.027977) ]; function cordicsincos() { var X; var Y; var TargetAngle; var CurrAngle; var Step; X = FIXED(AG_CONST); /* AG_CONST * cos(0) */ Y = 0; /* AG_CONST * sin(0) */ TargetAngle = FIXED(28.027); CurrAngle = 0; for (Step = 0; Step < 12; Step++) { var NewX; if (TargetAngle > CurrAngle) { NewX = X - (Y >> Step); Y = (X >> Step) + Y; X = NewX; CurrAngle += Angles[Step]; } else { NewX = X + (Y >> Step); Y = -(X >> Step) + Y; X = NewX; CurrAngle -= Angles[Step]; } } return CurrAngle; } ///// End CORDIC function cordic( runs ) { var actual; var start = new Date(); for ( var i = 0 ; i < runs ; i++ ) { actual = cordicsincos(); } var end = new Date(); assertEq(actual, 1834995.3515519998) return end.getTime() - start.getTime(); } cordic(25000); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-math-partial-sums.js0000644000175000017500000000347411545150464026204 0ustar chr1schr1s// The Computer Language Shootout // http://shootout.alioth.debian.org/ // contributed by Isaac Gouy function partial(n){ var a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0.0; var twothirds = 2.0/3.0; var alt = -1.0; var k2 = k3 = sk = ck = 0.0; for (var k = 1; k <= n; k++){ k2 = k*k; k3 = k2*k; sk = Math.sin(k); ck = Math.cos(k); alt = -alt; a1 += Math.pow(twothirds,k-1); a2 += Math.pow(k,-0.5); a3 += 1.0/(k*(k+1.0)); a4 += 1.0/(k3 * sk*sk); a5 += 1.0/(k3 * ck*ck); a6 += 1.0/k; a7 += 1.0/k2; a8 += alt/k; a9 += alt/(2*k -1); } return [ a1, a2, a3, a4, a5, a6, a7, a8, a9 ]; } var actual = []; for (var i = 1024; i <= 16384; i *= 2) Array.prototype.push.apply(actual, partial(i)); var eps = 1e-12; var expect = [2.9999999999999987,62.555269219624684,0.9990243902439033,30.174793391263677,42.99468748637077,7.509175672278132,1.6439579810301654,0.6926591377284127,0.785154022830656,2.9999999999999987,89.06036157695789,0.9995119570522216,30.30796333494624,42.99485339033617,8.202078771817716,1.6444459047881168,0.6929030995395857,0.7852760930922243,2.9999999999999987,126.54745783224483,0.999755918965097,30.314167756318135,42.994888939123,8.89510389696629,1.6446899560231332,0.6930251251486118,0.7853371282421086,2.9999999999999987,179.56450569047874,0.9998779445868421,30.314499725429847,42.99489723774016,9.588190046095265,1.644812003986005,0.693086149128997,0.785367645819433,2.9999999999999987,254.54355172132264,0.9999389685688135,30.31451920492601,42.99489939769195,10.281306710008463,1.6448730335545856,0.6931166639131536,0.7853829046083998]; assertEq(actual.length, expect.length); for (var i = 0; i < expect.length; ++i) assertEq(Math.abs(actual[i] - expect[i]) < eps, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-math-spectral-norm.js0000644000175000017500000000174311545150464026346 0ustar chr1schr1s// The Great Computer Language Shootout // http://shootout.alioth.debian.org/ // // contributed by Ian Osgood function A(i,j) { return 1/((i+j)*(i+j+1)/2+i+1); } function Au(u,v) { for (var i=0; i (1<>=1; //bpe=number of bits in one element of the array representing the bigInt mask=(1<>=bpe; } } //is x > y? (x and y both nonnegative) function greater(x,y) { var i; var k=(x.length=0;i--) if (x[i]>y[i]) return 1; else if (x[i]0 && n[kn-1]==0;kn--); //ignore leading zeros of n for (;ky>0 && y[ky-1]==0;ky--); //ignore leading zeros of y copyInt_(sa,0); //the following loop consumes 95% of the runtime for randTruePrime_() and powMod_() for large keys for (i=0; i> bpe; t=x[i]; //do sa=(sa+x[i]*y+ui*n)/b where b=2**bpe for (j=1;j>=bpe; } for (;j>=bpe; } sa[j-1]=c & mask; } if (!greater(n,sa)) sub_(sa,n); copy_(x,sa); } mont_(x, x, n, np); var passed = expected.length == x.length; for (var i = 0; i < expected.length; i++) { if (passed) passed = expected[i] == x[i]; } assertEq(passed, true); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-regexp-dna.js0000644000175000017500000032323111545150464024662 0ustar chr1schr1s// The Computer Language Shootout // http://shootout.alioth.debian.org/ // // contributed by Jesse Millikan // Base on the Ruby version by jose fco. gonzalez var l; var dnaInput = ">ONE Homo sapiens alu\n\ GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA\n\ TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT\n\ AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG\n\ GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG\n\ CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT\n\ GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA\n\ GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA\n\ TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG\n\ AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA\n\ GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT\n\ AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC\n\ AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG\n\ GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC\n\ CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG\n\ AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT\n\ TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA\n\ TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT\n\ GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG\n\ TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT\n\ CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG\n\ CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG\n\ TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA\n\ CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG\n\ AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG\n\ GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC\n\ TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA\n\ TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA\n\ GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT\n\ GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC\n\ ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT\n\ TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC\n\ CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG\n\ CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG\n\ GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC\n\ CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT\n\ GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC\n\ GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA\n\ GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA\n\ GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA\n\ GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG\n\ AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT\n\ CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA\n\ GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA\n\ AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC\n\ GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT\n\ ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG\n\ GAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATC\n\ GCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGC\n\ GGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGG\n\ TCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAA\n\ AAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAG\n\ GAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACT\n\ CCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCC\n\ TGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAG\n\ ACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGC\n\ GTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGA\n\ ACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGA\n\ CAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCA\n\ CTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCA\n\ ACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCG\n\ CCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGG\n\ AGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTC\n\ CGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCG\n\ AGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACC\n\ CCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAG\n\ CTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAG\n\ CCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGG\n\ CCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATC\n\ ACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAA\n\ AAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGC\n\ TGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCC\n\ ACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGG\n\ CTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGG\n\ AGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATT\n\ AGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAA\n\ TCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGC\n\ CTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAA\n\ TCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAG\n\ CCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGT\n\ GGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCG\n\ GGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAG\n\ CGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG\n\ GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATG\n\ GTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGT\n\ AATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTT\n\ GCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCT\n\ CAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCG\n\ GGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTC\n\ TCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACT\n\ CGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAG\n\ ATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGG\n\ CGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTG\n\ AGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATA\n\ CAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGG\n\ CAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGC\n\ ACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCAC\n\ GCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTC\n\ GAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCG\n\ GGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCT\n\ TGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGG\n\ CGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCA\n\ GCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGG\n\ CCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGC\n\ GCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGG\n\ CGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGA\n\ CTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGG\n\ CCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAA\n\ ACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCC\n\ CAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGT\n\ GAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAA\n\ AGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGG\n\ ATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTAC\n\ TAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGA\n\ GGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGC\n\ GCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGG\n\ TGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTC\n\ AGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAA\n\ ATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGA\n\ GAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC\n\ AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTG\n\ TAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGAC\n\ CAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGT\n\ GGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC\n\ CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACA\n\ GAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACT\n\ TTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAAC\n\ ATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCC\n\ TGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAG\n\ GTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCG\n\ TCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAG\n\ GCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCC\n\ GTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCT\n\ ACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCC\n\ GAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCC\n\ GGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCAC\n\ CTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAA\n\ ATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTG\n\ AGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCAC\n\ TGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCT\n\ CACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAG\n\ TTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAG\n\ CCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATC\n\ GCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCT\n\ GGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATC\n\ CCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCC\n\ TGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGG\n\ CGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG\n\ AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCG\n\ AGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGG\n\ AGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGT\n\ GAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAA\n\ TCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGC\n\ AGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCA\n\ AAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGG\n\ CGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTC\n\ TACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCG\n\ GGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGAT\n\ CGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCG\n\ CGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAG\n\ GTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACA\n\ AAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCA\n\ GGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCAC\n\ TCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGC\n\ CTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA\n\ GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGG\n\ CGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTG\n\ AACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCG\n\ ACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGC\n\ ACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCC\n\ AACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGC\n\ GCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCG\n\ GAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACT\n\ CCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCC\n\ GAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAAC\n\ CCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA\n\ GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGA\n\ GCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAG\n\ GCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGAT\n\ CACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTA\n\ AAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGG\n\ CTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGC\n\ CACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTG\n\ GCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAG\n\ GAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAAT\n\ TAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGA\n\ ATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAG\n\ CCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTA\n\ ATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCA\n\ GCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGG\n\ TGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCC\n\ GGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGA\n\ GCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT\n\ GGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT\n\ GGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTG\n\ TAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGT\n\ TGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTC\n\ TCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGC\n\ GGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGT\n\ CTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTAC\n\ TCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGA\n\ GATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGG\n\ GCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCT\n\ GAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT\n\ ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAG\n\ GCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG\n\ CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCA\n\ CGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTT\n\ CGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCC\n\ GGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGC\n\ TTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGG\n\ GCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCC\n\ AGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTG\n\ GCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCG\n\ CGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAG\n\ GCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAG\n\ ACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAG\n\ GCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGA\n\ AACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATC\n\ CCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAG\n\ TGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAA\n\ AAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCG\n\ GATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTA\n\ CTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGG\n\ AGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCG\n\ CGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCG\n\ GTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGT\n\ CAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAA\n\ AATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGG\n\ AGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTC\n\ CAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCT\n\ GTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA\n\ CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCG\n\ TGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAA\n\ CCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGAC\n\ AGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCAC\n\ TTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAA\n\ CATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGC\n\ CTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGA\n\ GGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCC\n\ GTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGA\n\ GGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCC\n\ CGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGC\n\ TACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGC\n\ CGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGC\n\ CGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCA\n\ CCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA\n\ AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCT\n\ GAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCA\n\ CTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGC\n\ TCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGA\n\ GTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTA\n\ GCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAAT\n\ CGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCC\n\ TGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAAT\n\ CCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGC\n\ CTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTG\n\ GCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGG\n\ GAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGC\n\ GAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG\n\ GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGG\n\ TGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTA\n\ ATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTG\n\ CAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTC\n\ AAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGG\n\ GCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCT\n\ CTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTC\n\ GGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGA\n\ TCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGC\n\ GCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGA\n\ GGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATAC\n\ AAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGC\n\ AGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCA\n\ CTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACG\n\ CCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCG\n\ AGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGG\n\ GCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTT\n\ GAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGC\n\ GACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAG\n\ CACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGC\n\ CAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCG\n\ CGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGC\n\ GGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGAC\n\ TCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGC\n\ CGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAA\n\ CCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCC\n\ AGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTG\n\ AGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA\n\ GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA\n\ TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT\n\ AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG\n\ GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG\n\ CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT\n\ GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA\n\ GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA\n\ TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG\n\ AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA\n\ GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT\n\ AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC\n\ AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG\n\ GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC\n\ CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG\n\ AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT\n\ TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA\n\ TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT\n\ GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG\n\ TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT\n\ CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG\n\ CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG\n\ TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA\n\ CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG\n\ AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG\n\ GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC\n\ TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA\n\ TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA\n\ GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT\n\ GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC\n\ ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT\n\ TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC\n\ CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG\n\ CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG\n\ GGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCC\n\ CAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCT\n\ GGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGC\n\ GCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGA\n\ GGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGA\n\ GACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGA\n\ GGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTG\n\ AAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT\n\ CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCA\n\ GTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAA\n\ AAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGC\n\ GGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCT\n\ ACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGG\n\ GAGGCTGAGGCAGGAGAATC\n\ >TWO IUB ambiguity codes\n\ cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg\n\ tactDtDagcctatttSVHtHttKtgtHMaSattgWaHKHttttagacatWatgtRgaaa\n\ NtactMcSMtYtcMgRtacttctWBacgaaatatagScDtttgaagacacatagtVgYgt\n\ cattHWtMMWcStgttaggKtSgaYaaccWStcgBttgcgaMttBYatcWtgacaYcaga\n\ gtaBDtRacttttcWatMttDBcatWtatcttactaBgaYtcttgttttttttYaaScYa\n\ HgtgttNtSatcMtcVaaaStccRcctDaataataStcYtRDSaMtDttgttSagtRRca\n\ tttHatSttMtWgtcgtatSSagactYaaattcaMtWatttaSgYttaRgKaRtccactt\n\ tattRggaMcDaWaWagttttgacatgttctacaaaRaatataataaMttcgDacgaSSt\n\ acaStYRctVaNMtMgtaggcKatcttttattaaaaagVWaHKYagtttttatttaacct\n\ tacgtVtcVaattVMBcttaMtttaStgacttagattWWacVtgWYagWVRctDattBYt\n\ gtttaagaagattattgacVatMaacattVctgtBSgaVtgWWggaKHaatKWcBScSWa\n\ accRVacacaaactaccScattRatatKVtactatatttHttaagtttSKtRtacaaagt\n\ RDttcaaaaWgcacatWaDgtDKacgaacaattacaRNWaatHtttStgttattaaMtgt\n\ tgDcgtMgcatBtgcttcgcgaDWgagctgcgaggggVtaaScNatttacttaatgacag\n\ cccccacatYScaMgtaggtYaNgttctgaMaacNaMRaacaaacaKctacatagYWctg\n\ ttWaaataaaataRattagHacacaagcgKatacBttRttaagtatttccgatctHSaat\n\ actcNttMaagtattMtgRtgaMgcataatHcMtaBSaRattagttgatHtMttaaKagg\n\ YtaaBataSaVatactWtataVWgKgttaaaacagtgcgRatatacatVtHRtVYataSa\n\ KtWaStVcNKHKttactatccctcatgWHatWaRcttactaggatctataDtDHBttata\n\ aaaHgtacVtagaYttYaKcctattcttcttaataNDaaggaaaDYgcggctaaWSctBa\n\ aNtgctggMBaKctaMVKagBaactaWaDaMaccYVtNtaHtVWtKgRtcaaNtYaNacg\n\ gtttNattgVtttctgtBaWgtaattcaagtcaVWtactNggattctttaYtaaagccgc\n\ tcttagHVggaYtgtNcDaVagctctctKgacgtatagYcctRYHDtgBattDaaDgccK\n\ tcHaaStttMcctagtattgcRgWBaVatHaaaataYtgtttagMDMRtaataaggatMt\n\ ttctWgtNtgtgaaaaMaatatRtttMtDgHHtgtcattttcWattRSHcVagaagtacg\n\ ggtaKVattKYagactNaatgtttgKMMgYNtcccgSKttctaStatatNVataYHgtNa\n\ BKRgNacaactgatttcctttaNcgatttctctataScaHtataRagtcRVttacDSDtt\n\ aRtSatacHgtSKacYagttMHtWataggatgactNtatSaNctataVtttRNKtgRacc\n\ tttYtatgttactttttcctttaaacatacaHactMacacggtWataMtBVacRaSaatc\n\ cgtaBVttccagccBcttaRKtgtgcctttttRtgtcagcRttKtaaacKtaaatctcac\n\ aattgcaNtSBaaccgggttattaaBcKatDagttactcttcattVtttHaaggctKKga\n\ tacatcBggScagtVcacattttgaHaDSgHatRMaHWggtatatRgccDttcgtatcga\n\ aacaHtaagttaRatgaVacttagattVKtaaYttaaatcaNatccRttRRaMScNaaaD\n\ gttVHWgtcHaaHgacVaWtgttScactaagSgttatcttagggDtaccagWattWtRtg\n\ ttHWHacgattBtgVcaYatcggttgagKcWtKKcaVtgaYgWctgYggVctgtHgaNcV\n\ taBtWaaYatcDRaaRtSctgaHaYRttagatMatgcatttNattaDttaattgttctaa\n\ ccctcccctagaWBtttHtBccttagaVaatMcBHagaVcWcagBVttcBtaYMccagat\n\ gaaaaHctctaacgttagNWRtcggattNatcRaNHttcagtKttttgWatWttcSaNgg\n\ gaWtactKKMaacatKatacNattgctWtatctaVgagctatgtRaHtYcWcttagccaa\n\ tYttWttaWSSttaHcaaaaagVacVgtaVaRMgattaVcDactttcHHggHRtgNcctt\n\ tYatcatKgctcctctatVcaaaaKaaaagtatatctgMtWtaaaacaStttMtcgactt\n\ taSatcgDataaactaaacaagtaaVctaggaSccaatMVtaaSKNVattttgHccatca\n\ cBVctgcaVatVttRtactgtVcaattHgtaaattaaattttYtatattaaRSgYtgBag\n\ aHSBDgtagcacRHtYcBgtcacttacactaYcgctWtattgSHtSatcataaatataHt\n\ cgtYaaMNgBaatttaRgaMaatatttBtttaaaHHKaatctgatWatYaacttMctctt\n\ ttVctagctDaaagtaVaKaKRtaacBgtatccaaccactHHaagaagaaggaNaaatBW\n\ attccgStaMSaMatBttgcatgRSacgttVVtaaDMtcSgVatWcaSatcttttVatag\n\ ttactttacgatcaccNtaDVgSRcgVcgtgaacgaNtaNatatagtHtMgtHcMtagaa\n\ attBgtataRaaaacaYKgtRccYtatgaagtaataKgtaaMttgaaRVatgcagaKStc\n\ tHNaaatctBBtcttaYaBWHgtVtgacagcaRcataWctcaBcYacYgatDgtDHccta\n\ aagacYRcaggattHaYgtKtaatgcVcaataMYacccatatcacgWDBtgaatcBaata\n\ cKcttRaRtgatgaBDacggtaattaaYtataStgVHDtDctgactcaaatKtacaatgc\n\ gYatBtRaDatHaactgtttatatDttttaaaKVccYcaaccNcBcgHaaVcattHctcg\n\ attaaatBtatgcaaaaatYMctSactHatacgaWacattacMBgHttcgaatVaaaaca\n\ BatatVtctgaaaaWtctRacgBMaatSgRgtgtcgactatcRtattaScctaStagKga\n\ DcWgtYtDDWKRgRtHatRtggtcgaHgggcgtattaMgtcagccaBggWVcWctVaaat\n\ tcgNaatcKWagcNaHtgaaaSaaagctcYctttRVtaaaatNtataaccKtaRgtttaM\n\ tgtKaBtRtNaggaSattHatatWactcagtgtactaKctatttgRYYatKatgtccgtR\n\ tttttatttaatatVgKtttgtatgtNtataRatWYNgtRtHggtaaKaYtKSDcatcKg\n\ taaYatcSRctaVtSMWtVtRWHatttagataDtVggacagVcgKWagBgatBtaaagNc\n\ aRtagcataBggactaacacRctKgttaatcctHgDgttKHHagttgttaatgHBtatHc\n\ DaagtVaBaRccctVgtgDtacRHSctaagagcggWYaBtSaKtHBtaaactYacgNKBa\n\ VYgtaacttagtVttcttaatgtBtatMtMtttaattaatBWccatRtttcatagVgMMt\n\ agctStKctaMactacDNYgKYHgaWcgaHgagattacVgtttgtRaSttaWaVgataat\n\ gtgtYtaStattattMtNgWtgttKaccaatagNYttattcgtatHcWtctaaaNVYKKt\n\ tWtggcDtcgaagtNcagatacgcattaagaccWctgcagcttggNSgaNcHggatgtVt\n\ catNtRaaBNcHVagagaaBtaaSggDaatWaatRccaVgggStctDaacataKttKatt\n\ tggacYtattcSatcttagcaatgaVBMcttDattctYaaRgatgcattttNgVHtKcYR\n\ aatRKctgtaaacRatVSagctgtWacBtKVatctgttttKcgtctaaDcaagtatcSat\n\ aWVgcKKataWaYttcccSaatgaaaacccWgcRctWatNcWtBRttYaattataaNgac\n\ acaatagtttVNtataNaYtaatRaVWKtBatKagtaatataDaNaaaaataMtaagaaS\n\ tccBcaatNgaataWtHaNactgtcDtRcYaaVaaaaaDgtttRatctatgHtgttKtga\n\ aNSgatactttcgagWaaatctKaaDaRttgtggKKagcDgataaattgSaacWaVtaNM\n\ acKtcaDaaatttctRaaVcagNacaScRBatatctRatcctaNatWgRtcDcSaWSgtt\n\ RtKaRtMtKaatgttBHcYaaBtgatSgaSWaScMgatNtctcctatttctYtatMatMt\n\ RRtSaattaMtagaaaaStcgVgRttSVaScagtgDtttatcatcatacRcatatDctta\n\ tcatVRtttataaHtattcYtcaaaatactttgVctagtaaYttagatagtSYacKaaac\n\ gaaKtaaatagataatSatatgaaatSgKtaatVtttatcctgKHaatHattagaaccgt\n\ YaaHactRcggSBNgtgctaaBagBttgtRttaaattYtVRaaaattgtaatVatttctc\n\ ttcatgBcVgtgKgaHaaatattYatagWacNctgaaMcgaattStagWaSgtaaKagtt\n\ ttaagaDgatKcctgtaHtcatggKttVDatcaaggtYcgccagNgtgcVttttagagat\n\ gctaccacggggtNttttaSHaNtatNcctcatSaaVgtactgBHtagcaYggYVKNgta\n\ KBcRttgaWatgaatVtagtcgattYgatgtaatttacDacSctgctaaaStttaWMagD\n\ aaatcaVYctccgggcgaVtaaWtStaKMgDtttcaaMtVgBaatccagNaaatcYRMBg\n\ gttWtaaScKttMWtYataRaDBMaDataatHBcacDaaKDactaMgagttDattaHatH\n\ taYatDtattDcRNStgaatattSDttggtattaaNSYacttcDMgYgBatWtaMagact\n\ VWttctttgYMaYaacRgHWaattgRtaagcattctMKVStatactacHVtatgatcBtV\n\ NataaBttYtSttacKgggWgYDtgaVtYgatDaacattYgatggtRDaVDttNactaSa\n\ MtgNttaacaaSaBStcDctaccacagacgcaHatMataWKYtaYattMcaMtgSttDag\n\ cHacgatcaHttYaKHggagttccgatYcaatgatRaVRcaagatcagtatggScctata\n\ ttaNtagcgacgtgKaaWaactSgagtMYtcttccaKtStaacggMtaagNttattatcg\n\ tctaRcactctctDtaacWYtgaYaSaagaWtNtatttRacatgNaatgttattgWDDcN\n\ aHcctgaaHacSgaataaRaataMHttatMtgaSDSKatatHHaNtacagtccaYatWtc\n\ actaactatKDacSaStcggataHgYatagKtaatKagStaNgtatactatggRHacttg\n\ tattatgtDVagDVaRctacMYattDgtttYgtctatggtKaRSttRccRtaaccttaga\n\ gRatagSaaMaacgcaNtatgaaatcaRaagataatagatactcHaaYKBctccaagaRa\n\ BaStNagataggcgaatgaMtagaatgtcaKttaaatgtaWcaBttaatRcggtgNcaca\n\ aKtttScRtWtgcatagtttWYaagBttDKgcctttatMggNttattBtctagVtacata\n\ aaYttacacaaRttcYtWttgHcaYYtaMgBaBatctNgcDtNttacgacDcgataaSat\n\ YaSttWtcctatKaatgcagHaVaacgctgcatDtgttaSataaaaYSNttatagtaNYt\n\ aDaaaNtggggacttaBggcHgcgtNtaaMcctggtVtaKcgNacNtatVaSWctWtgaW\n\ cggNaBagctctgaYataMgaagatBSttctatacttgtgtKtaattttRagtDtacata\n\ tatatgatNHVgBMtKtaKaNttDHaagatactHaccHtcatttaaagttVaMcNgHata\n\ tKtaNtgYMccttatcaaNagctggacStttcNtggcaVtattactHaSttatgNMVatt\n\ MMDtMactattattgWMSgtHBttStStgatatRaDaagattttctatMtaaaaaggtac\n\ taaVttaSacNaatactgMttgacHaHRttgMacaaaatagttaatatWKRgacDgaRta\n\ tatttattatcYttaWtgtBRtWatgHaaattHataagtVaDtWaVaWtgStcgtMSgaS\n\ RgMKtaaataVacataatgtaSaatttagtcgaaHtaKaatgcacatcggRaggSKctDc\n\ agtcSttcccStYtccRtctctYtcaaKcgagtaMttttcRaYDttgttatctaatcata\n\ NctctgctatcaMatactataggDaHaaSttMtaDtcNatataattctMcStaaBYtaNa\n\ gatgtaatHagagSttgWHVcttatKaYgDctcttggtgttMcRaVgSgggtagacaata\n\ aDtaattSaDaNaHaBctattgNtaccaaRgaVtKNtaaYggHtaKKgHcatctWtctDt\n\ ttctttggSDtNtaStagttataaacaattgcaBaBWggHgcaaaBtYgctaatgaaatW\n\ cDcttHtcMtWWattBHatcatcaaatctKMagtDNatttWaBtHaaaNgMttaaStagt\n\ tctctaatDtcRVaYttgttMtRtgtcaSaaYVgSWDRtaatagctcagDgcWWaaaBaa\n\ RaBctgVgggNgDWStNaNBKcBctaaKtttDcttBaaggBttgaccatgaaaNgttttt\n\ tttatctatgttataccaaDRaaSagtaVtDtcaWatBtacattaWacttaSgtattggD\n\ gKaaatScaattacgWcagKHaaccaYcRcaRttaDttRtttHgaHVggcttBaRgtccc\n\ tDatKaVtKtcRgYtaKttacgtatBtStaagcaattaagaRgBagSaattccSWYttta\n\ ttVaataNctgHgttaaNBgcVYgtRtcccagWNaaaacaDNaBcaaaaRVtcWMgBagM\n\ tttattacgDacttBtactatcattggaaatVccggttRttcatagttVYcatYaSHaHc\n\ ttaaagcNWaHataaaRWtctVtRYtagHtaaaYMataHYtNBctNtKaatattStgaMc\n\ BtRgctaKtgcScSttDgYatcVtggaaKtaagatWccHccgKYctaNNctacaWctttt\n\ gcRtgtVcgaKttcMRHgctaHtVaataaDtatgKDcttatBtDttggNtacttttMtga\n\ acRattaaNagaactcaaaBBVtcDtcgaStaDctgaaaSgttMaDtcgttcaccaaaag\n\ gWtcKcgSMtcDtatgtttStaaBtatagDcatYatWtaaaBacaKgcaDatgRggaaYc\n\ taRtccagattDaWtttggacBaVcHtHtaacDacYgtaatataMagaatgHMatcttat\n\ acgtatttttatattacHactgttataMgStYaattYaccaattgagtcaaattaYtgta\n\ tcatgMcaDcgggtcttDtKgcatgWRtataatatRacacNRBttcHtBgcRttgtgcgt\n\ catacMtttBctatctBaatcattMttMYgattaaVYatgDaatVagtattDacaacDMa\n\ tcMtHcccataagatgBggaccattVWtRtSacatgctcaaggggYtttDtaaNgNtaaB\n\ atggaatgtctRtaBgBtcNYatatNRtagaacMgagSaSDDSaDcctRagtVWSHtVSR\n\ ggaacaBVaccgtttaStagaacaMtactccagtttVctaaRaaHttNcttagcaattta\n\ ttaatRtaaaatctaacDaBttggSagagctacHtaaRWgattcaaBtctRtSHaNtgta\n\ cattVcaHaNaagtataccacaWtaRtaaVKgMYaWgttaKggKMtKcgWatcaDatYtK\n\ SttgtacgaccNctSaattcDcatcttcaaaDKttacHtggttHggRRaRcaWacaMtBW\n\ VHSHgaaMcKattgtaRWttScNattBBatYtaNRgcggaagacHSaattRtttcYgacc\n\ BRccMacccKgatgaacttcgDgHcaaaaaRtatatDtatYVtttttHgSHaSaatagct\n\ NYtaHYaVYttattNtttgaaaYtaKttWtctaNtgagaaaNctNDctaaHgttagDcRt\n\ tatagccBaacgcaRBtRctRtggtaMYYttWtgataatcgaataattattataVaaaaa\n\ ttacNRVYcaaMacNatRttcKatMctgaagactaattataaYgcKcaSYaatMNctcaa\n\ cgtgatttttBacNtgatDccaattattKWWcattttatatatgatBcDtaaaagttgaa\n\ VtaHtaHHtBtataRBgtgDtaataMttRtDgDcttattNtggtctatctaaBcatctaR\n\ atgNacWtaatgaagtcMNaacNgHttatactaWgcNtaStaRgttaaHacccgaYStac\n\ aaaatWggaYaWgaattattcMaactcBKaaaRVNcaNRDcYcgaBctKaacaaaaaSgc\n\ tccYBBHYaVagaatagaaaacagYtctVccaMtcgtttVatcaatttDRtgWctagtac\n\ RttMctgtDctttcKtWttttataaatgVttgBKtgtKWDaWagMtaaagaaattDVtag\n\ gttacatcatttatgtcgMHaVcttaBtVRtcgtaYgBRHatttHgaBcKaYWaatcNSc\n\ tagtaaaaatttacaatcactSWacgtaatgKttWattagttttNaggtctcaagtcact\n\ attcttctaagKggaataMgtttcataagataaaaatagattatDgcBVHWgaBKttDgc\n\ atRHaagcaYcRaattattatgtMatatattgHDtcaDtcaaaHctStattaatHaccga\n\ cNattgatatattttgtgtDtRatagSacaMtcRtcattcccgacacSattgttKaWatt\n\ NHcaacttccgtttSRtgtctgDcgctcaaMagVtBctBMcMcWtgtaacgactctcttR\n\ ggRKSttgYtYatDccagttDgaKccacgVatWcataVaaagaataMgtgataaKYaaat\n\ cHDaacgataYctRtcYatcgcaMgtNttaBttttgatttaRtStgcaacaaaataccVg\n\ aaDgtVgDcStctatatttattaaaaRKDatagaaagaKaaYYcaYSgKStctccSttac\n\ agtcNactttDVttagaaagMHttRaNcSaRaMgBttattggtttaRMggatggcKDgWR\n\ tNaataataWKKacttcKWaaagNaBttaBatMHtccattaacttccccYtcBcYRtaga\n\ ttaagctaaYBDttaNtgaaaccHcaRMtKtaaHMcNBttaNaNcVcgVttWNtDaBatg\n\ ataaVtcWKcttRggWatcattgaRagHgaattNtatttctctattaattaatgaDaaMa\n\ tacgttgggcHaYVaaNaDDttHtcaaHtcVVDgBVagcMacgtgttaaBRNtatRtcag\n\ taagaggtttaagacaVaaggttaWatctccgtVtaDtcDatttccVatgtacNtttccg\n\ tHttatKgScBatgtVgHtYcWagcaKtaMYaaHgtaattaSaHcgcagtWNaatNccNN\n\ YcacgVaagaRacttctcattcccRtgtgtaattagcSttaaStWaMtctNNcSMacatt\n\ ataaactaDgtatWgtagtttaagaaaattgtagtNagtcaataaatttgatMMYactaa\n\ tatcggBWDtVcYttcDHtVttatacYaRgaMaacaStaatcRttttVtagaDtcacWat\n\ ttWtgaaaagaaagNRacDtttStVatBaDNtaactatatcBSMcccaSttccggaMatg\n\ attaaWatKMaBaBatttgataNctgttKtVaagtcagScgaaaDggaWgtgttttKtWt\n\ atttHaatgtagttcactaaKMagttSYBtKtaYgaactcagagRtatagtVtatcaaaW\n\ YagcgNtaDagtacNSaaYDgatBgtcgataacYDtaaactacagWDcYKaagtttatta\n\ gcatcgagttKcatDaattgattatDtcagRtWSKtcgNtMaaaaacaMttKcaWcaaSV\n\ MaaaccagMVtaMaDtMaHaBgaacataBBVtaatVYaNSWcSgNtDNaaKacacBttta\n\ tKtgtttcaaHaMctcagtaacgtcgYtactDcgcctaNgagagcYgatattttaaattt\n\ ccattttacatttDaaRctattttWctttacgtDatYtttcagacgcaaVttagtaaKaa\n\ aRtgVtccataBggacttatttgtttaWNtgttVWtaWNVDaattgtatttBaagcBtaa\n\ BttaaVatcHcaVgacattccNggtcgacKttaaaRtagRtctWagaYggtgMtataatM\n\ tgaaRttattttgWcttNtDRRgMDKacagaaaaggaaaRStcccagtYccVattaNaaK\n\ StNWtgacaVtagaagcttSaaDtcacaacgDYacWDYtgtttKatcVtgcMaDaSKStV\n\ cgtagaaWaKaagtttcHaHgMgMtctataagBtKaaaKKcactggagRRttaagaBaaN\n\ atVVcgRcKSttDaactagtSttSattgttgaaRYatggttVttaataaHttccaagDtg\n\ atNWtaagHtgcYtaactRgcaatgMgtgtRaatRaNaacHKtagactactggaatttcg\n\ ccataacgMctRgatgttaccctaHgtgWaYcactcacYaattcttaBtgacttaaacct\n\ gYgaWatgBttcttVttcgttWttMcNYgtaaaatctYgMgaaattacNgaHgaacDVVM\n\ tttggtHtctaaRgtacagacgHtVtaBMNBgattagcttaRcttacaHcRctgttcaaD\n\ BggttKaacatgKtttYataVaNattccgMcgcgtagtRaVVaattaKaatggttRgaMc\n\ agtatcWBttNtHagctaatctagaaNaaacaYBctatcgcVctBtgcaaagDgttVtga\n\ HtactSNYtaaNccatgtgDacgaVtDcgKaRtacDcttgctaagggcagMDagggtBWR\n\ tttSgccttttttaacgtcHctaVtVDtagatcaNMaVtcVacatHctDWNaataRgcgt\n\ aVHaggtaaaaSgtttMtattDgBtctgatSgtRagagYtctSaKWaataMgattRKtaa\n\ catttYcgtaacacattRWtBtcggtaaatMtaaacBatttctKagtcDtttgcBtKYYB\n\ aKttctVttgttaDtgattttcttccacttgSaaacggaaaNDaattcYNNaWcgaaYat\n\ tttMgcBtcatRtgtaaagatgaWtgaccaYBHgaatagataVVtHtttVgYBtMctaMt\n\ cctgaDcYttgtccaaaRNtacagcMctKaaaggatttacatgtttaaWSaYaKttBtag\n\ DacactagctMtttNaKtctttcNcSattNacttggaacaatDagtattRtgSHaataat\n\ gccVgacccgatactatccctgtRctttgagaSgatcatatcgDcagWaaHSgctYYWta\n\ tHttggttctttatVattatcgactaagtgtagcatVgtgHMtttgtttcgttaKattcM\n\ atttgtttWcaaStNatgtHcaaaDtaagBaKBtRgaBgDtSagtatMtaacYaatYtVc\n\ KatgtgcaacVaaaatactKcRgtaYtgtNgBBNcKtcttaccttKgaRaYcaNKtactt\n\ tgagSBtgtRagaNgcaaaNcacagtVtttHWatgttaNatBgtttaatNgVtctgaata\n\ tcaRtattcttttttttRaaKcRStctcggDgKagattaMaaaKtcaHacttaataataK\n\ taRgDtKVBttttcgtKaggHHcatgttagHggttNctcgtatKKagVagRaaaggaaBt\n\ NatttVKcRttaHctaHtcaaatgtaggHccaBataNaNaggttgcWaatctgatYcaaa\n\ HaatWtaVgaaBttagtaagaKKtaaaKtRHatMaDBtBctagcatWtatttgWttVaaa\n\ ScMNattRactttgtYtttaaaagtaagtMtaMaSttMBtatgaBtttaKtgaatgagYg\n\ tNNacMtcNRacMMHcttWtgtRtctttaacaacattattcYaMagBaacYttMatcttK\n\ cRMtgMNccattaRttNatHaHNaSaaHMacacaVaatacaKaSttHatattMtVatWga\n\ ttttttaYctttKttHgScWaacgHtttcaVaaMgaacagNatcgttaacaaaaagtaca\n\ HBNaattgttKtcttVttaaBtctgctacgBgcWtttcaggacacatMgacatcccagcg\n\ gMgaVKaBattgacttaatgacacacaaaaaatRKaaBctacgtRaDcgtagcVBaacDS\n\ BHaaaaSacatatacagacRNatcttNaaVtaaaataHattagtaaaaSWccgtatWatg\n\ gDttaactattgcccatcttHaSgYataBttBaactattBtcHtgatcaataSttaBtat\n\ KSHYttWggtcYtttBttaataccRgVatStaHaKagaatNtagRMNgtcttYaaSaact\n\ cagDSgagaaYtMttDtMRVgWKWtgMaKtKaDttttgactatacataatcNtatNaHat\n\ tVagacgYgatatatttttgtStWaaatctWaMgagaRttRatacgStgattcttaagaD\n\ taWccaaatRcagcagaaNKagtaaDggcgccBtYtagSBMtactaaataMataBSacRM\n\ gDgattMMgtcHtcaYDtRaDaacggttDaggcMtttatgttaNctaattaVacgaaMMt\n\ aatDccSgtattgaRtWWaccaccgagtactMcgVNgctDctaMScatagcgtcaactat\n\ acRacgHRttgctatttaatgaattataYKttgtaagWgtYttgcHgMtaMattWaWVta\n\ RgcttgYgttBHtYataSccStBtgtagMgtDtggcVaaSBaatagDttgBgtctttctc\n\ attttaNagtHKtaMWcYactVcgcgtatMVtttRacVagDaatcttgctBBcRDgcaac\n\ KttgatSKtYtagBMagaRtcgBattHcBWcaactgatttaatttWDccatttatcgagS\n\ KaWttataHactaHMttaatHtggaHtHagaatgtKtaaRactgtttMatacgatcaagD\n\ gatKaDctataMggtHDtggHacctttRtatcttYattttgacttgaaSaataaatYcgB\n\ aaaaccgNatVBttMacHaKaataagtatKgtcaagactcttaHttcggaattgttDtct\n\ aaccHttttWaaatgaaatataaaWattccYDtKtaaaacggtgaggWVtctattagtga\n\ ctattaagtMgtttaagcatttgSgaaatatccHaaggMaaaattttcWtatKctagDtY\n\ tMcctagagHcactttactatacaaacattaacttaHatcVMYattYgVgtMttaaRtga\n\ aataaDatcaHgtHHatKcDYaatcttMtNcgatYatgSaMaNtcttKcWataScKggta\n\ tcttacgcttWaaagNatgMgHtctttNtaacVtgttcMaaRatccggggactcMtttaY\n\ MtcWRgNctgNccKatcttgYDcMgattNYaRagatHaaHgKctcataRDttacatBatc\n\ cattgDWttatttaWgtcggagaaaaatacaatacSNtgggtttccttacSMaagBatta\n\ caMaNcactMttatgaRBacYcYtcaaaWtagctSaacttWgDMHgaggatgBVgcHaDt\n\ ggaactttggtcNatNgtaKaBcccaNtaagttBaacagtatacDYttcctNgWgcgSMc\n\ acatStctHatgRcNcgtacacaatRttMggaNKKggataaaSaYcMVcMgtaMaHtgat\n\ tYMatYcggtcttcctHtcDccgtgRatcattgcgccgatatMaaYaataaYSggatagc\n\ gcBtNtaaaScaKgttBgagVagttaKagagtatVaactaSacWactSaKatWccaKaaa\n\ atBKgaaKtDMattttgtaaatcRctMatcaaMagMttDgVatggMaaWgttcgaWatga\n\ aatttgRtYtattaWHKcRgctacatKttctaccaaHttRatctaYattaaWatVNccat\n\ NgagtcKttKataStRaatatattcctRWatDctVagttYDgSBaatYgttttgtVaatt\n\ taatagcagMatRaacttBctattgtMagagattaaactaMatVtHtaaatctRgaaaaa\n\ aaatttWacaacaYccYDSaattMatgaccKtaBKWBattgtcaagcHKaagttMMtaat\n\ ttcKcMagNaaKagattggMagaggtaatttYacatcWaaDgatMgKHacMacgcVaaca\n\ DtaDatatYggttBcgtatgWgaSatttgtagaHYRVacaRtctHaaRtatgaactaata\n\ tctSSBgggaaHMWtcaagatKgagtDaSatagttgattVRatNtctMtcSaagaSHaat\n\ aNataataRaaRgattctttaataaagWaRHcYgcatgtWRcttgaaggaMcaataBRaa\n\ ccagStaaacNtttcaatataYtaatatgHaDgcStcWttaacctaRgtYaRtataKtgM\n\ ttttatgactaaaatttacYatcccRWtttHRtattaaatgtttatatttgttYaatMca\n\ RcSVaaDatcgtaYMcatgtagacatgaaattgRtcaaYaaYtRBatKacttataccaNa\n\ aattVaBtctggacaagKaaYaaatatWtMtatcYaaVNtcgHaactBaagKcHgtctac\n\ aatWtaDtSgtaHcataHtactgataNctRgttMtDcDttatHtcgtacatcccaggStt\n\ aBgtcacacWtccNMcNatMVaVgtccDYStatMaccDatggYaRKaaagataRatttHK\n\ tSaaatDgataaacttaHgttgVBtcttVttHgDacgaKatgtatatNYataactctSat\n\ atatattgcHRRYttStggaactHgttttYtttaWtatMcttttctatctDtagVHYgMR\n\ BgtHttcctaatYRttKtaagatggaVRataKDctaMtKBNtMtHNtWtttYcVtattMc\n\ gRaacMcctNSctcatttaaagDcaHtYccSgatgcaatYaaaaDcttcgtaWtaattct\n\ cgttttScttggtaatctttYgtctaactKataHacctMctcttacHtKataacacagcN\n\ RatgKatttttSaaatRYcgDttaMRcgaaattactMtgcgtaagcgttatBtttttaat\n\ taagtNacatHgttcRgacKcBBtVgatKttcgaBaatactDRgtRtgaNacWtcacYtt\n\ aaKcgttctHaKttaNaMgWgWaggtctRgaKgWttSttBtDcNtgtttacaaatYcDRt\n\ gVtgcctattcNtctaaaDMNttttNtggctgagaVctDaacVtWccaagtaacacaNct\n\ gaScattccDHcVBatcgatgtMtaatBgHaatDctMYgagaatgYWKcctaatNaStHa\n\ aaKccgHgcgtYaaYtattgtStgtgcaaRtattaKatattagaWVtcaMtBagttatta\n\ gNaWHcVgcaattttDcMtgtaRHVYtHtctgtaaaaHVtMKacatcgNaatttMatatg\n\ ttgttactagWYtaRacgataKagYNKcattataNaRtgaacKaYgcaaYYacaNccHat\n\ MatDcNgtHttRaWttagaaDcaaaaaatagggtKDtStaDaRtaVtHWKNtgtattVct\n\ SVgRgataDaRaWataBgaagaaKtaataaYgDcaStaNgtaDaaggtattHaRaWMYaY\n\ aWtggttHYgagVtgtgcttttcaaDKcagVcgttagacNaaWtagtaataDttctggtt\n\ VcatcataaagtgKaaaNaMtaBBaattaatWaattgctHaVKaSgDaaVKaHtatatat\n\ HatcatSBagNgHtatcHYMHgttDgtaHtBttWatcgtttaRaattgStKgSKNWKatc\n\ agDtctcagatttctRtYtBatBgHHtKaWtgYBgacVVWaKtacKcDttKMaKaVcggt\n\ gttataagaataaHaatattagtataatMHgttYgaRttagtaRtcaaVatacggtcMcg\n\ agtaaRttacWgactKRYataaaagSattYaWgagatYagKagatgSaagKgttaatMgg\n\ tataatgttWYttatgagaaacctNVataatHcccKtDctcctaatactggctHggaSag\n\ gRtKHaWaattcgSatMatttagaggcYtctaMcgctcataSatatgRagacNaaDagga\n\ VBagaYttKtacNaKgtSYtagttggaWcatcWttaatctatgaVtcgtgtMtatcaYcg\n\ tRccaaYgDctgcMgtgtWgacWtgataacacgcgctBtgttaKtYDtatDcatcagKaV\n\ MctaatcttgVcaaRgcRMtDcgattaHttcaNatgaatMtactacVgtRgatggaWttt\n\ actaaKatgagSaaKggtaNtactVaYtaaKRagaacccacaMtaaMtKtatBcttgtaa\n\ WBtMctaataaVcDaaYtcRHBtcgttNtaaHatttBNgRStVDattBatVtaagttaYa\n\ tVattaagaBcacggtSgtVtatttaRattgatgtaHDKgcaatattKtggcctatgaWD\n\ KRYcggattgRctatNgatacaatMNttctgtcRBYRaaaHctNYattcHtaWcaattct\n\ BtMKtVgYataatMgYtcagcttMDataVtggRtKtgaatgccNcRttcaMtRgattaac\n\ attRcagcctHtWMtgtDRagaKaBtgDttYaaaaKatKgatctVaaYaacWcgcatagB\n\ VtaNtRtYRaggBaaBtgKgttacataagagcatgtRattccacttaccatRaaatgWgD\n\ aMHaYVgVtaSctatcgKaatatattaDgacccYagtgtaYNaaatKcagtBRgagtcca\n\ tgKgaaaccBgaagBtgSttWtacgatWHaYatcgatttRaaNRgcaNaKVacaNtDgat\n\ tgHVaatcDaagcgtatgcNttaDataatcSataaKcaataaHWataBtttatBtcaKtK\n\ tatagttaDgSaYctacaRatNtaWctSaatatttYaKaKtaccWtatcRagacttaYtt\n\ VcKgSDcgagaagatccHtaattctSttatggtKYgtMaHagVaBRatttctgtRgtcta\n\ tgggtaHKgtHacHtSYacgtacacHatacKaaBaVaccaDtatcSaataaHaagagaat\n\ ScagactataaRttagcaaVcaHataKgDacatWccccaagcaBgagWatctaYttgaaa\n\ tctVNcYtttWagHcgcgcDcVaaatgttKcHtNtcaatagtgtNRaactttttcaatgg\n\ WgBcgDtgVgtttctacMtaaataaaRggaaacWaHttaRtNtgctaaRRtVBctYtVta\n\ tDcattDtgaccYatagatYRKatNYKttNgcctagtaWtgaactaMVaacctgaStttc\n\ tgaKVtaaVaRKDttVtVctaDNtataaaDtccccaagtWtcgatcactDgYaBcatcct\n\ MtVtacDaaBtYtMaKNatNtcaNacgDatYcatcgcaRatWBgaacWttKttagYtaat\n\ tcggttgSWttttDWctttacYtatatWtcatDtMgtBttgRtVDggttaacYtacgtac\n\ atgaattgaaWcttMStaDgtatattgaDtcRBcattSgaaVBRgagccaaKtttcDgcg\n\ aSMtatgWattaKttWtgDBMaggBBttBaatWttRtgcNtHcgttttHtKtcWtagHSt\n\ aacagttgatatBtaWSaWggtaataaMttaKacDaatactcBttcaatatHttcBaaSa\n\ aatYggtaRtatNtHcaatcaHtagVtgtattataNggaMtcttHtNagctaaaggtaga\n\ YctMattNaMVNtcKtactBKcaHHcBttaSagaKacataYgctaKaYgttYcgacWVtt\n\ WtSagcaacatcccHaccKtcttaacgaKttcacKtNtacHtatatRtaaatacactaBt\n\ ttgaHaRttggttWtatYagcatYDatcggagagcWBataagRtacctataRKgtBgatg\n\ aDatataSttagBaHtaatNtaDWcWtgtaattacagKttcNtMagtattaNgtctcgtc\n\ ctcttBaHaKcKccgtRcaaYagSattaagtKataDatatatagtcDtaacaWHcaKttD\n\ gaaRcgtgYttgtcatatNtatttttatggccHtgDtYHtWgttatYaacaattcaWtat\n\ NgctcaaaSttRgctaatcaaatNatcgtttaBtNNVtgttataagcaaagattBacgtD\n\ atttNatttaaaDcBgtaSKgacgtagataatttcHMVNttgttBtDtgtaWKaaRMcKM\n\ tHtaVtagataWctccNNaSWtVaHatctcMgggDgtNHtDaDttatatVWttgttattt\n\ aacctttcacaaggaSaDcggttttttatatVtctgVtaacaStDVaKactaMtttaSNa\n\ gtgaaattaNacttSKctattcctctaSagKcaVttaagNaVcttaVaaRNaHaaHttat\n\ gtHttgtgatMccaggtaDcgaccgtWgtWMtttaHcRtattgScctatttKtaaccaag\n\ tYagaHgtWcHaatgccKNRtttagtMYSgaDatctgtgaWDtccMNcgHgcaaacNDaa\n\ aRaStDWtcaaaaHKtaNBctagBtgtattaactaattttVctagaatggcWSatMaccc\n\ ttHttaSgSgtgMRcatRVKtatctgaaaccDNatYgaaVHNgatMgHRtacttaaaRta\n\ tStRtDtatDttYatattHggaBcttHgcgattgaKcKtttcRataMtcgaVttWacatN\n\ catacctRataDDatVaWNcggttgaHtgtMacVtttaBHtgagVttMaataattatgtt\n\ cttagtttgtgcDtSatttgBtcaacHattaaBagVWcgcaSYttMgcttacYKtVtatc\n\ aYaKctgBatgcgggcYcaaaaacgNtctagKBtattatctttKtaVttatagtaYtRag\n\ NtaYataaVtgaatatcHgcaaRataHtacacatgtaNtgtcgYatWMatttgaactacR\n\ ctaWtWtatacaatctBatatgYtaagtatgtgtatSttactVatcttYtaBcKgRaSgg\n\ RaaaaatgcagtaaaWgtaRgcgataatcBaataccgtatttttccatcNHtatWYgatH\n\ SaaaDHttgctgtccHtggggcctaataatttttctatattYWtcattBtgBRcVttaVM\n\ RSgctaatMagtYtttaaaaatBRtcBttcaaVtaacagctccSaaSttKNtHtKYcagc\n\ agaaaccccRtttttaaDcDtaStatccaagcgctHtatcttaDRYgatDHtWcaaaBcW\n\ gKWHttHataagHacgMNKttMKHccaYcatMVaacgttaKgYcaVaaBtacgcaacttt\n\ MctaaHaatgtBatgagaSatgtatgSRgHgWaVWgataaatatttccKagVgataattW\n\ aHNcYggaaatgctHtKtaDtctaaagtMaatVDVactWtSaaWaaMtaHtaSKtcBRaN\n\ cttStggtBttacNagcatagRgtKtgcgaacaacBcgKaatgataagatgaaaattgta\n\ ctgcgggtccHHWHaaNacaBttNKtKtcaaBatatgctaHNgtKcDWgtttatNgVDHg\n\ accaacWctKaaggHttgaRgYaatHcaBacaatgagcaaattactgtaVaaYaDtagat\n\ tgagNKggtggtgKtWKaatacagDRtatRaMRtgattDggtcaaYRtatttNtagaDtc\n\ acaaSDctDtataatcgtactaHttatacaatYaacaaHttHatHtgcgatRRttNgcat\n\ SVtacWWgaaggagtatVMaVaaattScDDKNcaYBYaDatHgtctatBagcaacaagaa\n\ tgagaaRcataaKNaRtBDatcaaacgcattttttaaBtcSgtacaRggatgtMNaattg\n\ gatatWtgagtattaaaVctgcaYMtatgatttttYgaHtgtcttaagWBttHttgtctt\n\ attDtcgtatWtataataSgctaHagcDVcNtaatcaagtaBDaWaDgtttagYctaNcc\n\ DtaKtaHcttaataacccaRKtacaVaatNgcWRaMgaattatgaBaaagattVYaHMDc\n\ aDHtcRcgYtcttaaaWaaaVKgatacRtttRRKYgaatacaWVacVcRtatMacaBtac\n\ tggMataaattttHggNagSctacHgtBagcgtcgtgattNtttgatSaaggMttctttc\n\ ttNtYNagBtaaacaaatttMgaccttacataattgYtcgacBtVMctgStgMDtagtaR\n\ ctHtatgttcatatVRNWataDKatWcgaaaaagttaaaagcacgHNacgtaatctttMR\n\ tgacttttDacctataaacgaaatatgattagaactccSYtaBctttaataacWgaaaYa\n\ tagatgWttcatKtNgatttttcaagHtaYgaaRaDaagtaggagcttatVtagtctttc\n\ attaaaatcgKtattaRttacagVaDatgcatVgattgggtctttHVtagKaaRBtaHta\n\ aggccccaaaaKatggtttaMWgtBtaaacttcactttKHtcgatctccctaYaBacMgt\n\ cttBaBaNgcgaaacaatctagtHccHtKttcRtRVttccVctttcatacYagMVtMcag\n\ aMaaacaataBctgYtaatRaaagattaaccatVRatHtaRagcgcaBcgDttStttttc\n\ VtttaDtKgcaaWaaaaatSccMcVatgtKgtaKgcgatatgtagtSaaaDttatacaaa\n\ catYaRRcVRHctKtcgacKttaaVctaDaatgttMggRcWaacttttHaDaKaDaBctg\n\ taggcgtttaHBccatccattcNHtDaYtaataMttacggctNVaacDattgatatttta\n\ cVttSaattacaaRtataNDgacVtgaacataVRttttaDtcaaacataYDBtttaatBa\n\ DtttYDaDaMccMttNBttatatgagaaMgaNtattHccNataattcaHagtgaaggDga\n\ tgtatatatgYatgaStcataaBStWacgtcccataRMaaDattggttaaattcMKtctM\n\ acaBSactcggaatDDgatDgcWctaacaccgggaVcacWKVacggtaNatatacctMta\n\ tgatagtgcaKagggVaDtgtaacttggagtcKatatcgMcttRaMagcattaBRaStct\n\ YSggaHYtacaactMBaagDcaBDRaaacMYacaHaattagcattaaaHgcgctaaggSc\n\ cKtgaaKtNaBtatDDcKBSaVtgatVYaagVtctSgMctacgttaacWaaattctSgtD\n\ actaaStaaattgcagBBRVctaatatacctNttMcRggctttMttagacRaHcaBaacV\n\ KgaataHttttMgYgattcYaNRgttMgcVaaacaVVcDHaatttgKtMYgtatBtVVct\n\ WgVtatHtacaaHttcacgatagcagtaaNattBatatatttcVgaDagcggttMaagtc\n\ ScHagaaatgcYNggcgtttttMtStggtRatctacttaaatVVtBacttHNttttaRca\n\ aatcacagHgagagtMgatcSWaNRacagDtatactaaDKaSRtgattctccatSaaRtt\n\ aaYctacacNtaRtaactggatgaccYtacactttaattaattgattYgttcagDtNKtt\n\ agDttaaaaaaaBtttaaNaYWKMBaaaacVcBMtatWtgBatatgaacVtattMtYatM\n\ NYDKNcKgDttDaVtaaaatgggatttctgtaaatWtctcWgtVVagtcgRgacttcccc\n\ taDcacagcRcagagtgtWSatgtacatgttaaSttgtaaHcgatgggMagtgaacttat\n\ RtttaVcaccaWaMgtactaatSSaHtcMgaaYtatcgaaggYgggcgtgaNDtgttMNg\n\ aNDMtaattcgVttttaacatgVatgtWVMatatcaKgaaattcaBcctccWcttgaaWH\n\ tWgHtcgNWgaRgctcBgSgaattgcaaHtgattgtgNagtDttHHgBttaaWcaaWagc\n\ aSaHHtaaaVctRaaMagtaDaatHtDMtcVaWMtagSagcttHSattaacaaagtRacM\n\ tRtctgttagcMtcaBatVKtKtKacgagaSNatSactgtatatcBctgagVtYactgta\n\ aattaaaggcYgDHgtaacatSRDatMMccHatKgttaacgactKtgKagtcttcaaHRV\n\ tccttKgtSataatttacaactggatDNgaacttcaRtVaagDcaWatcBctctHYatHa\n\ DaaatttagYatSatccaWtttagaaatVaacBatHcatcgtacaatatcgcNYRcaata\n\ YaRaYtgattVttgaatgaVaactcRcaNStgtgtattMtgaggtNttBaDRcgaaaagc\n\ tNgBcWaWgtSaDcVtgVaatMKBtttcgtttctaaHctaaagYactgMtatBDtcStga\n\ ccgtSDattYaataHctgggaYYttcggttaWaatctggtRagWMaDagtaacBccacta\n\ cgHWMKaatgatWatcctgHcaBaSctVtcMtgtDttacctaVgatYcWaDRaaaaRtag\n\ atcgaMagtggaRaWctctgMgcWttaagKBRtaaDaaWtctgtaagYMttactaHtaat\n\ cttcataacggcacBtSgcgttNHtgtHccatgttttaaagtatcgaKtMttVcataYBB\n\ aKtaMVaVgtattNDSataHcagtWMtaggtaSaaKgttgBtVtttgttatcatKcgHac\n\ acRtctHatNVagSBgatgHtgaRaSgttRcctaacaaattDNttgacctaaYtBgaaaa\n\ tagttattactcttttgatgtNNtVtgtatMgtcttRttcatttgatgacacttcHSaaa\n\ ccaWWDtWagtaRDDVNacVaRatgttBccttaatHtgtaaacStcVNtcacaSRttcYa\n\ gacagaMMttttgMcNttBcgWBtactgVtaRttctccaaYHBtaaagaBattaYacgat\n\ ttacatctgtaaMKaRYtttttactaaVatWgctBtttDVttctggcDaHaggDaagtcg\n\ aWcaagtagtWttHtgKtVataStccaMcWcaagataagatcactctHatgtcYgaKcat\n\ cagatactaagNSStHcctRRNtattgtccttagttagMVgtatagactaactctVcaat\n\ MctgtttgtgttgccttatWgtaBVtttctggMcaaKgDWtcgtaaYStgSactatttHg\n\ atctgKagtagBtVacRaagRtMctatgggcaaaKaaaatacttcHctaRtgtDcttDat\n\ taggaaatttcYHaRaaBttaatggcacKtgctHVcaDcaaaVDaaaVcgMttgtNagcg\n\ taDWgtcgttaatDgKgagcSatatcSHtagtagttggtgtHaWtaHKtatagctgtVga\n\ ttaBVaatgaataagtaatVatSttaHctttKtttgtagttaccttaatcgtagtcctgB\n\ cgactatttVcMacHaaaggaatgDatggKtaHtgStatattaaSagctWcctccRtata\n\ BaDYcgttgcNaagaggatRaaaYtaWgNtSMcaatttactaacatttaaWttHtatBat\n\ tgtcgacaatNgattgcNgtMaaaKaBDattHacttggtRtttaYaacgVactBtaBaKt\n\ gBttatgVttgtVttcaatcWcNctDBaaBgaDHacBttattNtgtDtatttVSaaacag\n\ gatgcRatSgtaSaNtgBatagttcHBgcBBaaattaHgtDattatDaKaatBaaYaaMa\n\ ataaataKtttYtagtBgMatNcatgtttgaNagtgttgtgKaNaSagtttgaSMaYBca\n\ aaacDStagttVacaaaaactaaWttBaagtctgtgcgtMgtaattctcctacctcaNtt\n\ taaccaaaaVtBcacataacaccccBcWMtatVtggaatgaWtcaaWaaaaaaaaWtDta\n\ atatRcctDWtcctaccMtVVatKttaWaaKaaatataaagScHBagaggBaSMtaWaVt\n\ atattactSaaaKNaactatNatccttgaYctattcaaaVgatttYHcRagattttaSat\n\ aggttattcVtaaagaKgtattattKtRttNcggcRgtgtgtWYtaacHgKatKgatYta\n\ cYagDtWcHBDctctgRaYKaYagcactKcacSaRtBttttBHKcMtNtcBatttatttt\n\ tgSatVgaaagaWtcDtagDatatgMacaacRgatatatgtttgtKtNRaatatNatgYc\n\ aHtgHataacKtgagtagtaacYttaNccaaatHcacaacaVDtagtaYtccagcattNt\n\ acKtBtactaaagaBatVtKaaHBctgStgtBgtatgaSNtgDataaccctgtagcaBgt\n\ gatcttaDataStgaMaccaSBBgWagtacKcgattgaDgNNaaaacacagtSatBacKD\n\ gcgtataBKcatacactaSaatYtYcDaactHttcatRtttaatcaattataRtttgtaa\n\ gMcgNttcatcBtYBagtNWNMtSHcattcRctttttRWgaKacKttgggagBcgttcgc\n\ MaWHtaatactgtctctatttataVgtttaBScttttaBMaNaatMacactYtBMggtHa\n\ cMagtaRtctgcatttaHtcaaaatttgagKtgNtactBacaHtcgtatttctMaSRagc\n\ agttaatgtNtaaattgagagWcKtaNttagVtacgatttgaatttcgRtgtWcVatcgt\n\ taaDVctgtttBWgaccagaaagtcSgtVtatagaBccttttcctaaattgHtatcggRa\n\ ttttcaaggcYSKaagWaWtRactaaaacccBatMtttBaatYtaagaactSttcgaaSc\n\ aatagtattgaccaagtgttttctaacatgtttNVaatcaaagagaaaNattaaRtttta\n\ VaaaccgcaggNMtatattVctcaagaggaacgBgtttaacaagttcKcYaatatactaa\n\ ccBaaaSggttcNtattctagttRtBacgScVctcaatttaatYtaaaaaaatgSaatga\n\ tagaMBRatgRcMcgttgaWHtcaVYgaatYtaatctttYttatRaWtctgBtDcgatNa\n\ tcKaBaDgatgtaNatWKctccgatattaacattNaaacDatgBgttctgtDtaaaMggt\n\ gaBaSHataacgccSctaBtttaRBtcNHcDatcDcctagagtcRtaBgWttDRVHagat\n\ tYatgtatcWtaHtttYcattWtaaagtctNgtStggRNcgcggagSSaaagaaaatYcH\n\ DtcgctttaatgYcKBVSgtattRaYBaDaaatBgtatgaHtaaRaRgcaSWNtagatHa\n\ acttNctBtcaccatctMcatattccaSatttgcgaDagDgtatYtaaaVDtaagtttWV\n\ aagtagYatRttaagDcNgacKBcScagHtattatcDaDactaaaaaYgHttBcgaDttg\n\ gataaaKSRcBMaBcgaBSttcWtgNBatRaccgattcatttataacggHVtaattcaca\n\ agagVttaaRaatVVRKcgWtVgacctgDgYaaHaWtctttcacMagggatVgactagMa\n\ aataKaaNWagKatagNaaWtaaaatttgaattttatttgctaaVgaHatBatcaaBWcB\n\ gttcMatcgBaaNgttcgSNaggSaRtttgHtRtattaNttcDcatSaVttttcgaaaaa\n\ ttgHatctaRaggSaNatMDaaatDcacgattttagaHgHaWtYgattaatHNSttatMS\n\ gggNtcKtYatRggtttgtMWVtttaYtagcagBagHaYagttatatggtBacYcattaR\n\ SataBatMtttaaatctHcaaaSaaaagttNSaaWcWRccRtKaagtBWtcaaattSttM\n\ tattggaaaccttaacgttBtWatttatatWcDaatagattcctScacctaagggRaaYt\n\ aNaatgVtBcttaaBaacaMVaaattatStYgRcctgtactatcMcVKatttcgSgatRH\n\ MaaaHtagtaaHtVgcaaataatatcgKKtgccaatBNgaaWcVttgagttaKatagttc\n\ aggKDatDtattgaKaVcaKtaataDataataHSaHcattagttaatRVYcNaHtaRcaa\n\ ggtNHcgtcaaccaBaaagYtHWaaaRcKgaYaaDttgcWYtataRgaatatgtYtgcKt\n\ aNttWacatYHctRaDtYtattcBttttatcSataYaYgttWaRagcacHMgtttHtYtt\n\ YaatcggtatStttcgtRSattaaDaKMaatatactaNBaWgctacacYtgaYVgtgHta\n\ aaRaaRgHtagtWattataaaSDaaWtgMattatcgaaaagtaYRSaWtSgNtBgagcRY\n\ aMDtactaacttaWgtatctagacaagNtattHggataatYttYatcataDcgHgttBtt\n\ ctttVttgccgaaWtaaaacgKgtatctaaaaaNtccDtaDatBMaMggaatNKtatBaa\n\ atVtccRaHtaSacataHattgtttKVYattcataVaattWtcgtgMttcttKtgtctaa\n\ cVtatctatatBRataactcgKatStatattcatHHRttKtccaacgtgggtgRgtgaMt\n\ attattggctatcgtgacMtRcBDtcttgtactaatRHttttaagatcgVMDStattatY\n\ BtttDttgtBtNttgRcMtYtgBacHaWaBaatDKctaagtgaaactaatgRaaKgatcc\n\ aagNaaaatattaggWNtaagtatacttttKcgtcggSYtcttgRctataYcttatataa\n\ agtatattaatttataVaacacaDHatctatttttKYVatHRactttaBHccaWagtact\n\ BtcacgaVgcgttRtttttttSVgtSagtBaaattctgaHgactcttgMcattttagVta\n\ agaattHctHtcaDaaNtaacRggWatagttcgtSttgaDatcNgNagctagDgatcNtt\n\ KgttgtaDtctttRaaYStRatDtgMggactSttaDtagSaVtBDttgtDgccatcacaM\n\ attaaaMtNacaVcgSWcVaaDatcaHaatgaattaMtatccVtctBtaattgtWattat\n\ BRcWcaatgNNtactWYtDaKttaaatcactcagtRaaRgatggtKgcgccaaHgaggat\n\ StattYcaNMtcaBttacttatgagDaNtaMgaaWtgtttcttctaHtMNgttatctaWW\n\ atMtBtaaatagDVatgtBYtatcggcttaagacMRtaHScgatatYgRDtcattatSDa\n\ HggaaataNgaWSRRaaaBaatagBattaDctttgHWNttacaataaaaaaatacggttt\n\ gHgVtaHtWMttNtBtctagtMcgKMgHgYtataHaNagWtcaacYattaataYRgtaWK\n\ gaBctataaccgatttaHaNBRaRaMtccggtNgacMtctcatttgcaattcWgMactta\n\ caaDaaNtactWatVtttagccttMaatcagVaagtctVaaDaBtattaattaYtNaYtg\n\ gattaKtaKctYaMtattYgatattataatKtVgDcttatatNBtcgttgtStttttMag\n\ aggttaHYSttcKgtcKtDNtataagttataagSgttatDtRttattgttttSNggRtca\n\ aKMNatgaatattgtBWtaMacctgggYgaSgaagYataagattacgagaatBtggtRcV\n\ HtgYggaDgaYaKagWagctatagacgaaHgtWaNgacttHRatVaWacKYtgRVNgVcS\n\ gRWctacatcKSactctgWYtBggtataagcttNRttVtgRcaWaaatDMatYattaact\n\ ttcgaagRatSctgccttgcRKaccHtttSNVagtagHagBagttagaccaRtataBcca\n\ taatSHatRtcHagacBWatagcaMtacaRtgtgaaBatctKRtScttccaNaatcNgta\n\ atatWtcaMgactctBtWtaaNactHaaaaRctcgcatggctMcaaNtcagaaaaacaca\n\ gtggggWttRttagtaagaVctVMtcgaatcttcMaaaHcaHBttcgattatgtcaDagc\n\ YRtBtYcgacMgtDcagcgaNgttaataatagcagKYYtcgtaBtYctMaRtaRtDagaa\n\ aacacatgYaBttgattattcgaaNttBctSataaMataWRgaHtttccgtDgaYtatgg\n\ tDgHKgMtatttVtMtVagttaRatMattRagataaccctKctMtSttgaHagtcStcta\n\ tttccSagatgttccacgaggYNttHRacgattcDatatDcataaaatBBttatcgaHtN\n\ HaaatatDNaggctgaNcaaggagttBttMgRagVatBcRtaWgatgBtSgaKtcgHttt\n\ gaatcaaDaHttcSBgHcagtVaaSttDcagccgttNBtgttHagYtattctttRWaaVt\n\ SttcatatKaaRaaaNacaVtVctMtSDtDtRHRcgtaatgctcttaaatSacacaatcg\n\ HattcaWcttaaaatHaaatcNctWttaNMcMtaKctVtcctaagYgatgatcYaaaRac\n\ tctaRDaYagtaacgtDgaggaaatctcaaacatcaScttcKttNtaccatNtaNataca\n\ tttHaaDHgcaDatMWaaBttcRggctMaagctVYcacgatcaDttatYtaatcKatWat\n\ caatVYtNagatttgattgaYttttYgacttVtcKaRagaaaHVgDtaMatKYagagttN\n\ atWttaccNtYtcDWgSatgaRgtMatgKtcgacaagWtacttaagtcgKtgatccttNc\n\ ttatagMatHVggtagcgHctatagccctYttggtaattKNaacgaaYatatVctaataM\n\ aaaYtgVtcKaYtaataacagaatHcacVagatYWHttagaaSMaatWtYtgtaaagNaa\n\ acaVgaWtcacNWgataNttcaSagctMDaRttgNactaccgataMaaatgtttattDtc\n\ aagacgctDHYYatggttcaagccNctccttcMctttagacBtaaWtaWVHggaaaaNat\n\ ttaDtDtgctaaHHtMtatNtMtagtcatttgcaaaRatacagRHtatDNtgtDgaatVg\n\ tVNtcaaatYBMaaaagcaKgtgatgatMgWWMaHttttMgMagatDtataaattaacca\n\ actMtacataaattgRataatacgBtKtaataattRgtatDagDtcRDacctatRcagag\n\ cSHatNtcaScNtttggacNtaaggaccgtgKNttgttNcttgaaRgYgRtNtcagttBc\n\ ttttcHtKtgcttYaaNgYagtaaatgaatggWaMattBHtatctatSgtcYtgcHtaat\n\ tHgaaMtHcagaaSatggtatgccaHBtYtcNattWtgtNgctttaggtttgtWatNtgH\n\ tgcDttactttttttgcNtactKtWRaVcttcatagtgSNKaNccgaataaBttataata\n\ YtSagctttaaatSttggctaaKSaatRccgWHgagDttaaatcatgagMtcgagtVtaD\n\ ggaBtatttgDacataaacgtagYRagBWtgDStKDgatgaagttcattatttaKWcata\n\ aatWRgatataRgttRacaaNKttNtKagaaYaStaactScattattaacgatttaaatg\n\ DtaattagatHgaYataaactatggggatVHtgccgtNgatNYcaStRtagaccacWcaM\n\ tatRagHgVactYtWHtcttcatgatWgagaKggagtatgaWtDtVtNaNtcgYYgtaaa\n\ ctttaDtBactagtaDctatagtaatatttatatataacgHaaaRagKattSagttYtSt\n\ >THREE Homo sapiens frequency\n\ agagagacgatgaaaattaatcgtcaatacgctggcgaacactgagggggacccaatgct\n\ cttctcggtctaaaaaggaatgtgtcagaaattggtcagttcaaaagtagaccggatctt\n\ tgcggagaacaattcacggaacgtagcgttgggaaatatcctttctaccacacatcggat\n\ tttcgccctctcccattatttattgtgttctcacatagaattattgtttagacatccctc\n\ gttgtatggagagttgcccgagcgtaaaggcataatccatataccgccgggtgagtgacc\n\ tgaaattgtttttagttgggatttcgctatggattagcttacacgaagagattctaatgg\n\ tactataggataattataatgctgcgtggcgcagtacaccgttacaaacgtcgttcgcat\n\ atgtggctaacacggtgaaaatacctacatcgtatttgcaatttcggtcgtttcatagag\n\ cgcattgaattactcaaaaattatatatgttgattatttgattagactgcgtggaaagaa\n\ ggggtactcaagccatttgtaaaagctgcatctcgcttaagtttgagagcttacattagt\n\ ctatttcagtcttctaggaaatgtctgtgtgagtggttgtcgtccataggtcactggcat\n\ atgcgattcatgacatgctaaactaagaaagtagattactattaccggcatgcctaatgc\n\ gattgcactgctatgaaggtgcggacgtcgcgcccatgtagccctgataataccaatact\n\ tacatttggtcagcaattctgacattatacctagcacccataaatttactcagacttgag\n\ gacaggctcttggagtcgatcttctgtttgtatgcatgtgatcatatagatgaataagcg\n\ atgcgactagttagggcatagtatagatctgtgtatacagttcagctgaacgtccgcgag\n\ tggaagtacagctgagatctatcctaaaatgcaaccatatcgttcacacatgatatgaac\n\ ccagggggaaacattgagttcagttaaattggcagcgaatcccccaagaagaaggcggag\n\ tgacgttgaacgggcttatggtttttcagtacttcctccgtataagttgagcgaaatgta\n\ aacagaataatcgttgtgttaacaacattaaaatcgcggaatatgatgagaatacacagt\n\ gtgagcatttcacttgtaaaatatctttggtagaacttactttgctttaaatatgttaaa\n\ ccgatctaataatctacaaaacggtagattttgcctagcacattgcgtccttctctattc\n\ agatagaggcaatactcagaaggttttatccaaagcactgtgttgactaacctaagtttt\n\ agtctaataatcatgattgattataggtgccgtggactacatgactcgtccacaaataat\n\ acttagcagatcagcaattggccaagcacccgacttttatttaatggttgtgcaatagtc\n\ cagattcgtattcgggactctttcaaataatagtttcctggcatctaagtaagaaaagct\n\ cataaggaagcgatattatgacacgctcttccgccgctgttttgaaacttgagtattgct\n\ cgtccgaaattgagggtcacttcaaaatttactgagaagacgaagatcgactaaagttaa\n\ aatgctagtccacagttggtcaagttgaattcatccacgagttatatagctattttaatt\n\ tatagtcgagtgtacaaaaaacatccacaataagatttatcttagaataacaacccccgt\n\ atcatcgaaatcctccgttatggcctgactcctcgagcttatagcatttgtgctggcgct\n\ cttgccaggaacttgctcgcgaggtggtgacgagtgagatgatcagtttcattatgatga\n\ tacgattttatcgcgactagttaatcatcatagcaagtaaaatttgaattatgtcattat\n\ catgctccattaacaggttatttaattgatactgacgaaattttttcacaatgggttttc\n\ tagaatttaatatcagtaattgaagccttcataggggtcctactagtatcctacacgacg\n\ caggtccgcagtatcctggagggacgtgttactgattaaaagggtcaaaggaatgaaggc\n\ tcacaatgttacctgcttcaccatagtgagccgatgagttttacattagtactaaatccc\n\ aaatcatactttacgatgaggcttgctagcgctaaagagaatacatacaccaccacatag\n\ aattgttagcgatgatatcaaatagactcctggaagtgtcagggggaaactgttcaatat\n\ ttcgtccacaggactgaccaggcatggaaaagactgacgttggaaactataccatctcac\n\ gcccgacgcttcactaattgatgatccaaaaaatatagcccggattcctgattagcaaag\n\ ggttcacagagaaagatattatcgacgtatatcccaaaaaacagacgtaatgtgcatctt\n\ cgaatcgggatgaatacttgtatcataaaaatgtgacctctagtatacaggttaatgtta\n\ gtgatacacaatactcgtgggccatgggttctcaaataaaatgtaatattgcgtcgatca\n\ ctcacccacgtatttggtctaattatgttttatttagtgacaatccaatagataaccggt\n\ cctattaagggctatatttttagcgaccacgcgtttaaacaaaggattgtatgtagatgg\n\ taccagtttaattgccagtgggcaatcctaagcaaaatgagattctatcctaaagtttgg\n\ gcttgatataagatttcggatgtatgggttttataatcgttggagagctcaatcatgagc\n\ taatacatggatttcgctacctcaccgagagaccttgcatgaagaattctaaccaaaagt\n\ ttaataggccggattggattgagttaattaagaccttgttcagtcatagtaaaaaccctt\n\ aaattttaccgattgacaaagtgagcagtcgcaataccctatgcgaaacgcctcgatagt\n\ gactaggtatacaaggtttttgagttcctttgaaatagttaactaatttaaaattaatta\n\ acgacatggaaatcacagaacctaatgctttgtaggagttatttatgctgtttactgcct\n\ ctacaaccctaataaagcagtcctaagaatgaaacgcatcttttagttcagaaagtggta\n\ tccagggtggtcaatttaataaattcaacatcgggtctcaggatattcggtcatataatt\n\ tattaagggctcttcgagtcttactctgagtgaaattggaaacagtcatccttttcgttg\n\ tgaggcatcttacaccgctatcgatatacaatgcattccaccgcggtgtcccgtacacaa\n\ ggaaacttgttaccttggggatataagaaaactcacacgtctcattattaaactgagtac\n\ aatttttgcacgagaaagtaatgcaatacaatatgatgaaagccagctaatgaaaaggga\n\ tggaacgcacctcggatctgttgcactggattaaaatccgattatttttaaaaatattca\n\ gtgctagagcatatcaggtctacttttttatctggtatgtaaagcccacggagcgatagt\n\ gagatccttacgactcaacgaaaagttataacataactcccgttagccaaagcccaatcc\n\ cgattactgccctaccctaacgtctgccatctaaatatcgaacttgttatgatcaatgtg\n\ actacctcccaccctttccccttcatttgttccactggggataagctagcgttttcagaa\n\ tcaatgcaataagaatagccaattgtctcacttcatcagagctcttggcaattccaggcg\n\ ctacgtggttctggaatatattcatttttcaaatagtaatacgtttagtgttgctattgt\n\ ctacacgtttggatattacgttatgtgagcggacatcaatagttgtctaactctttagta\n\ agccagagatagcactcttagcgaatggataccatcttccataagtttagttaatagtcc\n\ gaaacaactgcttcgagcatatttgaacctccttgtaggcaaatagcctcttcaaagcaa\n\ tcttactaatagatagagtttgttttaagggactactagaaatgggacaatcttaatagt\n\ atgacctaaactgacatttaaagatatatccaggtggcaagcataaagatcattgcgcca\n\ cctccaccgtgggattacttatcagtcgatatcctatatgctaagtttgcgacggcagaa\n\ tacaaactaagctgagttgatgctaaccttacctatgataccccattggaccggttaaca\n\ gccctacttattccaaataaaagaacttttatgctgtagaagctattatagtgatgcctg\n\ gtaacttcagtatattaaaatgacacacatacgccatatagagctcctggaactttgaat\n\ aatgagcgaacttcgaagttgaagagcaagaaaccatatgtcacggttgcctaaagcccg\n\ gtaaccagacatgtgctatcattgatcattatcgaggttttcataaccttgacccattat\n\ cggctgtgcgcggacaagtacttaaatcactagtttcttcacctgcttatcggtaagaaa\n\ taaggttggcaaagaatcgcataagacggacgtagagccgcagcgttgtgcgagtccagg\n\ tgcatgcgcagcaataggattttaaattttgttccatttttaatttagccgtaaggatgt\n\ ccgtaaatgattgaaaattggattcaatctttgggcctatgctactggaacctgatcgac\n\ aaaatttcaaacatacgttaactccgaaagaccgtatttttgcggctagaatagtcagtc\n\ gcttggagccatataccttaccacttaaacgacgtgctcctgtagttgaaatataaacag\n\ aacacaaagactaccgatcatatcaactgaagatctttgtaactttgaggcgaagcaccc\n\ tcttcgagacaactaagagtaaagtaccgggcgccgcaaggagtcgattgggaccctaaa\n\ tcttgacgaattgctaagaggctcagagctaccactgtaatttctctagagcccataata\n\ aatgaacgatacatccgtaggtagcacctaagggattataatggaagccaaatgcagtta\n\ ataatattatatactggcgtacacgattcgacggatctctcacatagtgattcacgaccc\n\ ccccctttgattgacacagcgtcagcattttgcaagaacgatcttctgcatagggtgcgc\n\ caccgtaaggatgacgtcgaagctacaactgggtataatttaccatgcttccctgatgct\n\ gagtgcaatacactaagaatgagtttttaccccatatcaccagtatttgttctgttattg\n\ cgaagaaatggctatgctgagttggcgactaaagtcacccatcctttttattaggtaacc\n\ ccctcccttaaactaactgatttgctggagctgccctgcatacatatactttatcattta\n\ tggacgtccgtgacgcttattatccaccatagtcgatatgctacacggattcattaatgg\n\ atcgtaggagtttaagttatatttactaagatcggtctcggctactatcccgccttaccc\n\ ggcgctatttacggccatttttaatatattgacggtaattattcctatggtttcgaccgc\n\ acgtccttggacaagaaagaatggcaaaaaaaatgtaaaagaaaaaaaatattgagtccc\n\ taccatcatataaaaaatatgtgatgagtaacttgacgaaatgttagtggttattaaaga\n\ ctatctattacaccttttgttttctgtcgtagtatattaaagtctagaagccttacagga\n\ aaatcagggttatacagccgatactccgcagcatgaatcatcgaggaggtgtcctaccat\n\ cgcgccttgtaatcttgtctgtgtatactgtatttagaccttttatacaaagtaaatatc\n\ tcggctttatgtgattgggaggggcctactcaaacatgatgacttgacctaataatcact\n\ gtgcgggcgtcttatgactagctattccttgaaatccaccaccaaatggttaatatgtaa\n\ aaactttgacgatgaaacaaggtgaatgtgtagttactttgtgtaattagctgcgtcgag\n\ cattgcttgtaaaaccgtcaatcgcacacgttacttccataaaatttctacgaatacacc\n\ cttcttaaaaaaaacgtaggaattcacgagtttaacaaacgataactgtataaagtggaa\n\ gtccgaagaaagcagatgcccgaactactcgaagatgtttcgttttcttaaccatagggg\n\ cttcttaatggcccactacgcacattttgttcaagcccgagagggacatccccattacgg\n\ gagtattactaaaactgttccgtaatacgttcagcaagggatgaaaaaggccactgctca\n\ agttattgacgtgggagtattacatcggaagcctgaatcccacactatgatggtctgtac\n\ aggcctagggactgcgtctagacggtattaccggcttctaatcatacgatcgtgagtctt\n\ aacgggaagtaaggctcacacctaccccaaaccatttatctatgtaagtataaaattgtg\n\ cgtaagtgttcaaagtggacaataaagacgtggcaaaaacccccgcacataagccgcttt\n\ agatttcacaaataccaatgcggttaaaaacatccttgagtcgtacatacaccatactcg\n\ cgttaaacggatataacagaagataataaatccggatgtggagtcggtgtaactatagaa\n\ agccaagtgaaataatgcttaccagtcatttagctatacggctttcatttcatgtcaaga\n\ gggtggagtttgacctgtacagttgatatatcaccgatacttagaactcacctaaagcta\n\ aaattgctcgcagcgtgtaatccgcatattacaaacaatagatgggattcattatacata\n\ agacacgatgatctgctttttcaggttgcgagatgttgcctatcgtcaatcgagtcctgc\n\ cttacaccacttaaacaaaagtattgacagggaacctattttcgaggtattatatagtcc\n\ agcttgaatatcaatttgacagttaacctagtgaaaatcagtaagaggaaatacgccaca\n\ ttctccagtgaaattctacgggttatcgtctagtccaactatcaattataactcacgaga\n\ tataagtaaattctcgtacttggcctgatttttattatactttggatccttagtaaacag\n\ gaagggagaaaccttcaacgaaaaacactggattttgttttactctcaaagctcttatat\n\ gacggaaataccctgtcaagtcttaactttattactagactaatgaaatgggcttggggt\n\ ggccagaatcatagtacaatttagcggatacactattcggactttcctatcggctgtctg\n\ gttggataagtatggggactaataggctagacatacctatacttaaactatacaggcgtc\n\ atctatctctgcaactttggagttccctgatgttctcccgccctttgggttcacatcttc\n\ tataccgacacccctaataacgattagtttgtgggttagagtaaattaatacggttaata\n\ ttaatgtatcgttgaaaagctggtgtcgccaataaggtaaccggctaggcagagtatatg\n\ tcacgaagtataactaccctaatgataagctgtaggaataaaattaatgctgtctctaag\n\ cgaagagatatttccgactctgttttaatgacgaatctcattacttctgacttgcaaatg\n\ ttcaatatggcacggtttcacggcacctttgtgacgcatataatgaacttagaagattat\n\ aacgacggaactttatatgataatccgttacgattaaagaatctgttaaatatcataatg\n\ gcattcagttctagaccgtgcatcatggtaaacttactttctctgcatggcgacatacat\n\ ttcgctattcaaattcgcgtgtggttacacccactcgcacctttggaatattaagagaag\n\ atgatcagaaaatccattcgctcaatttttctgacgtacgtctaatttatcctaggagac\n\ aaatcgttttatgtctctcacatttttgaagaaaggttcgagagacaatactcaggtcct\n\ gaactgctagaagatactcggtggagcgtggcaacaatgaaaaactcgtgacataaatga\n\ atgatacttttccaagttcagttaagtgaatatgtttaacatacccggcttttcgatctt\n\ aagctgacgctggacgtgcgagtaatgtcagtctcttacatacactagtgactccaagtt\n\ tcgtcaaaaacgccccctcccttctcgagcccactcacgctatgtattgacgcgaacttg\n\ ttcgggatcagacttttcaggagttcggtcgcgtgtccctatgtgctaatatataagtta\n\ gatcgcattagatgctaatctgaatacttatagacgaccttcaacgagaacgggtaccac\n\ cttgaggctagagttaggtgtgaaacgacaggtagggacatataaaatttgagtgcggct\n\ ttagttaagggtttaattacctactcaaacatcacgctcgcgcccttcgtacgtaatcga\n\ ccatctagaggctaaggggactgtactaggtagtgattaatgatatcctagacgcacgtg\n\ ccttagatcttcagactctgatggtccgcgatcaccgtaattgtagtcctccaactcgat\n\ cactttgttggcgtcaaagaaattacgatatctaaatacttataatacaataaccaagga\n\ tgagaatgactcatcgcgttggagttatattgcttgaagttctatggaatgaaagcacgt\n\ tatctgccgtcccaatatctccagtgagctaattcattggacggtccactttgatcaatc\n\ cccgaggagatgttcggacactttagtctgtaacacttagcgttgagaccacgaacaatt\n\ gattactcagtcttgaaggtgttttccaaagttcattttaaataagactacgataggcct\n\ ttcctattgatataaactacccggctctgttgttcgtgtgagtcgtacttctctgtgttt\n\ ttctgattatagcaagattcgattcttagtgtaaacagcgatttttatttgacccgtcaa\n\ tgagaagcgcataggatctaagcaaaattatcaagttgtgccacaaggtaagatctttcc\n\ agttattgcaggtaggatgtatcccacgttgatagtatgaggtctgacgtcaactgtcta\n\ ggagagttgaccgcgtgcgggtacaccggatttgcatcgatgttgagaacgcagaactcc\n\ cactgtcgtggcggcgttcctgatatttagcaagaggcgttgataaagccctcatcatct\n\ agatctcgacctcatctgccctcttgctccatcattttctacacagactactttcctatc\n\ tacgttagtataattgctttctatcttagtatcatttagagcttctccgtcaacaggttc\n\ gtgctattaaagttagtacgaaagggacaacttgtagcaacgcatttaatcggttttcga\n\ ctacttcgcacaaaatcagataaagaagtttgtcattctattagacattgaattgcgcaa\n\ ttgacttgtaccacttatgatcgaacactgaatcaagactgtgattaactaaaatagaca\n\ agccactatatcaactaataaaaacgcccctggtggtcgaacatagttgactacaggata\n\ attaattggactggagccattacattctctacaatcgtatcacttcccaagtagacaact\n\ ttgaccttgtagtttcatgtacaaaaaaatgctttcgcaggagcacattggtagttcaat\n\ agtttcatgggaacctcttgagccgtcttctgtgggtgtgttcggatagtaggtactgat\n\ aaagtcgtgtcgctttcgatgagagggaattcaccggaaaacaccttggttaacaggata\n\ gtctatgtaaacttcgagacatgtttaagagttaccagcttaatccacggtgctctacta\n\ gtatcatcagctgtcttgcctcgcctagaaatatgcattctatcgttatcctatcaacgg\n\ ttgccgtactgagcagccttattgtggaagagtaatatataaatgtagtcttgtctttac\n\ gaagcagacgtaagtaataatgacttggaataccaaaactaaacatagtggattatcata\n\ ctcaagaactctccagataaataacagtttttacgatacgtcaccaatgagcttaaagat\n\ taggatcctcaaaactgatacaaacgctaattcatttgttattggatccagtatcagtta\n\ aactgaatggagtgaagattgtagaatgttgttctggcctcgcatggggtctaggtgata\n\ tacaatttctcatacttacacggtagtggaaatctgattctagcttcgtagctgactata\n\ ctcaaggaaccactgctcaaggtaggagactagttccgaccctacagtcaaagtggccga\n\ agcttaaactatagactagttgttaaatgctgatttcaagatatcatctatatacagttt\n\ ggacaattatgtgtgcgaaactaaaattcatgctattcagatggatttcacttatgcctt\n\ agaaacagatattgcccgagctcaatcaacagttttagccggaaacaatcgaagcatagg\n\ gacaatgtatcttttcctaaattgccatgtgcagatttctgagtgtcacgaagcgcataa\n\ tagaatcttgtgttgcctcaactcgttgaaaagtttaaaacaatcgcagcagtctttttg\n\ gggtctactgtgtgtttgcaaaataactgaaagaaacgcttgaacaactctgaagtagct\n\ cgagtactcattaaagtgtaacacattagtgaatatcggccaatgaaccaaacgcttccc\n\ ggtacgctatctctctcatcgggaggcgatgtgcaggttatctacgaaagcatcccttta\n\ cgttgagagtgtcgatgcatgaacctcattgtaacaatagcccagcaaattctcatacgt\n\ gcctcagggtccgggcgtactcctccatggaagggcgcgcatctagtgttataccaactc\n\ gctttttaactactatgctgtagttctacaggcatagtggccagtattttctaacttctc\n\ tggatagatgctctcactcctcatccatcacggcttcagtttacgtcttacttgcttgtt\n\ cagcaacggatggaggcattaagtatcttcactgttccctaaaattgctgttcaatatca\n\ aagtaaggacgatacagggaaagctcaagcacactcattgaatactgccccagttgcaac\n\ ctcacttaatctgacaaaaataatgactactctaagtgttgcggaagcagtctcttccac\n\ gagcttgtctgtatcacttcgtataggcatgtaactcgatagacacgaacaccgagtgag\n\ aaactatattcttgcttccgtgtgtgtgacaccaggtaattgatgcggatataagctgga\n\ gatcactcacgcccacacaaggcgctgctacctctttattccaatgtgtaagaatttgct\n\ aacttcatttctagaccgcagctttgcggtcataatttcacggtacggacccttgggtta\n\ gagacttgataacacacttcgcagtttccaccgcgcacatgttttagtggcttctaacat\n\ agaatttttgttgtgacataaagagtgcgtgggagacttgcccgaccgttaagccataat\n\ caattgaaagccccgtgagtcacatctaattggttgtactgcgcatttagctatccttta\n\ gctgactcgaagagattcgattcctaatataggttaattagatggctgccgcgcgaagta\n\ aaacgtgaaaaacgtagtgcgcagatctgcataactcgcgcttaattacttatgagtagt\n\ tccaagttcgctacgttatgagagagattggaattaagcaaatatgttttatggtgattt\n\ tgggatgagaaggactgctaagtacggctactaaacaaatttctaaaaccgccatctacc\n\ ttatcttggagacatttaagttgtatatgtcactagtctagcttttgtctgtgggacgcg\n\ ttctcggaatgagggaaatgcaagagccgattcatcaaatgcttatctaagaaagtagtg\n\ gactattacaccaagcacgaatgccagggaactgctttcttgctcaggacctcgcgacaa\n\ ggtaccccgcataagtcctagaattacatttggtcagcaatgctgacatttgaccgtgaa\n\ aacataattttaatcagaaggcagctcacccgcttgctctagatcttatctttgtatgaa\n\ tgtcagaatttactgcaatatccgttccgaatagtgagggcttagtatagttctctgtat\n\ acaggtcacatcaaactccccctgtcctagtacagctctgagctttaattaattgcatac\n\ atttccttcaatcatcagatgaaaacaccgcgaatcatgctcttctcgtatagggcaaga\n\ gaagcaacaaacaactagcccgactcacgttcatccgccgtatccttgttcagttcttac\n\ tccgtattaggtcagcgaaatctaatcagaataatcggtcgcgtatcaaaattaaaatcc\n\ cgcttgaggttgacaattaaaacgctgagcagttatcggctattagatagtggggtgaaa\n\ gtaattggctggaattatgttaaaacgtgatattaagctaaaatacgctacttgttgccg\n\ acctaattcagtcattcgatattcagttagagccaagaataacaagcttgtataaattga\n\ acggggtgcactaaacgatgtgttactctaatattcagcttggagtatacctgaaggcga\n\ attcatgtatcggccaataataagacgttgaagatcacaatttggactagcaaaagaagg\n\ tgatttatgcgtggggattgagtccactgtacgagtacggtctctggaaaattataggtt\n\ cagggaatataaggaagtaaagataattaccaagagatttttggtatcgctatgacccag\n\ aggtgttctaacgtctgttttgatccgcagaatttctgcctcaatgcatatttgacggac\n\ ttgaactagagcctctaaagttaaatggcgacgcaactgttcctaaacttcaattattac\n\ tactctttttttcctagggtattgtagaggccagtggacaaaataaatcaaatttaagat\n\ gtttcggacattaacatcccccgtagcatagaaatcatcagttatccaatctctcatcga\n\ gcttttacaatttctgctggcgctatggacagcatatgccgcgagacctccgcaagactc\n\ acttgatcactgtaagtatcttcattagaggttagagcctatagttaagctgctgaccta\n\ gtaaaattggtattttctaattttattgctcaagttaaaggttagtgaagggataatgac\n\ gttatttttgaacaatgggttgtattcaattttatatcacgaatggaacccttcattccc\n\ ggcataatactagacgacacgaacaagctccgatctatcagccaggcacgtgttaaggtt\n\ taattccggcaaaccaatgaagcatcaaaaggtgacctgatgcaacttagggtcacgatg\n\ agtttttcaggactacttattacctattaataagttaacatgagccttcataccccgtaa\n\ gacaatacatactccaccaattagaattctgagccatcttatctttttgtatcatcgaag\n\ ggtatggccgaataggttaattagttactcctaacgtctctacaggcatgcatttgacgc\n\ accttcgaaaatagtcaatctctcgccacacgcgtctagtatgcagcatcaaaaatatag\n\ tccacggtttccggattaccaaacgcggcaaagagaaacattgtatcgacggagataact\n\ taatacagaaggaaggggcatcttcgaatacggatgaataattctatctgtttattctga\n\ catcttgttttcaggttaatcttacgcattcaaatgacgcctgccccatgcgtgcgcaat\n\ tattttctaatattgacgagagcaatctcactccttttgggtctatttatgttttattga\n\ ggcacaagcctatacagaacaggtactattaaggccgtgagtgtgagactcaaaccgtgg\n\ aaacaaaggatgggttgttcttggtacaagttttagtgcatgtgggcaatccttaccaaa\n\ atcagatgctatccttaactttgggctgcatttaagatggcggttggaggcctgtgagaa\n\ tcctgcgtgtcatctttaatgaccgaattcatccatgtagattcagatcacacactcatt\n\ ccttgatgttgtctaaacaaaagttgttgtggacgcattggagggagttaagtaacaact\n\ tgggatcgcatacttataaaaattatatgttaaactttcacaaacgctgaagtccaaagt\n\ aactagcccaaacgcctcgagagtcactaggtattaatggtgtttgagttcctgtgaaat\n\ agtgttcgaaggtaaaatttatgtaccaaatcgaaagaacacttaataaggcttgcttgc\n\ acggaggtatgatgtttactgactctacaaccctaattttccagtacgtacattcattcc\n\ aataggttagttctcaaagtgctatacaggctcctcaattgatgatatgcttcagccgct\n\ ctatggatattagctcattttatttaggaagcccgcttagaggcttactatgagggaaat\n\ gccaaaatgtcatacttttcggtgtgtcccatatgacaccgctttacatagaatttgaat\n\ taaaacgcgctctcccgttcactaccatacttggtaccgtgcgcatattacatatagata\n\ taggatcattttttaaagctgtactaggtttgatcgacaatcttatgctatactatatga\n\ tgtaaccctcataatcaataccgatcgtacgatcctagcataggtggcaagcgattttat\n\ gccgattattgtgttaaatagtctgtgagtgtgattatcagggctacgttggtagagggg\n\ ttgtatagacctcgcacacattgtgacatacttaacaatatacgaaaactgatataataa\n\ atccccttacccaaacaccaatcccgttgaatcaactaccataacgtctcccatataaat\n\ tgcctacttgtttgcataaatctgaatacataacaccattgcaccttcttgtgttccaat\n\ cccgttaagattgccttgtcagatgatatgcaagaacaatagcatttgctagcaattatt\n\ aacagctcttcgaattgcctccacataacgcgggagggtatattttaatttggcaaatac\n\ taagtactgttggcgtcatatgctattaacggttggatattaagttatgtcagccgtaag\n\ caagagtgggcgaaatattttgttacccagtgagagcactcttagagtttggatacaata\n\ ggccatatgttgacttaagaggacgtaactacgccgtacaccattgttcaaccgacttct\n\ tggcaaatagaatcgtattagcaatcttaagaatagagacacgttcgtgttagggtatac\n\ tacaaatccgaaaatcttaagaggatcacctaaactgaaatttatacatatttcaacgtg\n\ gatagatttaacataattcagccacctccaacctgggagtaattttcagtagatttacta\n\ gatgattagtggcccaacgcacttgactatataagatctggggatcctaacctgacctat\n\ gagacaaaattggaaacgttaacagcccttatgtgtacaaagaaaagtaagttgttgctg\n\ ttcaacagatgatagtcatgacgcgtaacttcactatagtaaattgaaacaaatacgcaa\n\ tttagacagaatggtacggtcatgaatgacagtaattcgaagtgctagaccaacttaaaa\n\ taggtaaacgtgcccgaaaccccccttaacagaaagctgctatcatggtgcagtatcgac\n\ gtgttcagaaacttgtaacttttgagcaggtccgagcacatggaagtatatcacgtgttt\n\ ctgaaccggcttatccctaagatatatccgtcgcaaactttcgatttagtcccacgtaga\n\ gcccaagcgttgtgcgactccacgtgcatgcccagaaatacgagtttaaatttggttaca\n\ tggttaattttgaccgaagcatcgcactttatgattgataattggattcaatatgtcgcc\n\ ctatgcgaatgcaacatgatccacaatttggctataagacgtttaatccgtatcacactt\n\ tgtttgcggctagtatagtaacgcccgtgcaccaagagtcagtaacaattataagtactc\n\ cgcaggtacttcaaatataaaaactaatcaaacacgacccatatgatcatctgaagatat\n\ ttggaactttctcgacaaccaccctcgtactcaatacttacactaatcgacaggcacacg\n\ caacgtgtacagtcgcaccatattgagtcaagatttgcttagtggcgatgagcgtacacg\n\ cttatttctctagtcacaattagttatctacgagacatcacgagggagcaaataagcgat\n\ gttatggctacacataggcacgtatgaatatgatataagccagttaaacagtcgaaccat\n\ cgagcaaattctcatgcaccaacccacacgttgaggcacaaagagtaagctgtttgaatg\n\ taacttcttctgctgagcgggccccaacgtaaggatcaactagaagagaaaactcggtat\n\ tagtttaaatgcgtcacggagcatgagtgcatttcactaagaatgtctgtgtaaccaata\n\ taacatctatttgttatctgattgcctacttatggctttgcggtcgtggcgactaatgtc\n\ tccaatccttttgaggtcggtaccaactccctttaaattacgctgtgcaggctcatgcac\n\ tgcatacatatacggtagcaggtagggacctcacgcacccttattataatcaatagtagt\n\ tatcagtcaacgaggcaggaatgctgaggtcgaggtgttggtatattttctatgtgccgt\n\ ctaggcgactatcacgcattaccaggcgagatttaagccaattttgaatatagtcaacgt\n\ aatttttactatgggttccaccgaaacgccttgcacaactaagaatcccataaaatatcg\n\ atatcaaataaaagattgtgtcaataccttcatatatattttttcggttgactaacgtga\n\ actaaggttaggggttttgtatgtctatataggaaacagtttcttttctgtcctacttta\n\ gtaaagtcttcaagccttactccaaaatcacggtgattaagccgttactcagcagcatga\n\ ttctgcctgctcgggtcctaaaatccagccttgtaagagtcgctgtgtattagctaggga\n\ gacctttgttaaaaaggatatatcgcggcgggatgtgagtgcgtggcgcatactcaatct\n\ tcagctcgtgtcattataatatctctcccccacgcttttcactagatatgccgtgtaagc\n\ aaacaccttatgcttaatttcgaaaatattggtacttgaaaaaagctgtaggggtactta\n\ atgtctggtaggagatcaggagagaattgagtgtaaaaccgtaaagccctcacctgactt\n\ catgtaaatggcttagaagactccatgatttaataaatactacgaaggaaagactggatc\n\ taaagataactctagtaaggccaactcccttcaatgctgttgccagttataatccaagag\n\ ctgtccttttctgaaccatagcggcttctgaagcgaactagaagcaaagttggttctagc\n\ cagacagccacataccctgtacgggtgtattactaaaactggtccggtattagttcacca\n\ agggaggaattaggcaaaggatctaggtatgcaagtcggagtattacatccctaccctga\n\ atccatcaataggttcctctgtactggccttcgcaatgagtattcaaggttgtacagccg\n\ tataataataagatagtgactatgaacgggaagtaacccgctcaccttccccaaaacatt\n\ gttatatctaagtattaaagtctgccgtagtgttaatactcgaaaataaacaactggcaa\n\ attacaccgcacttaagccgcttttgatttatatttttccaatgcgcttttaaaaataat\n\ tcagtcctacatactaattaagacccttaaacggagatatcacaagttaagttttaacca\n\ tctcgactaggtggaactatagatacccaactcaatttatcattacctgtaatgttccta\n\ gaaggattgcatttcatgtcaagacggtggagtttcacagcgaaacttcagtgtgaacag\n\ attctgagaaatcacctaaacctattagtcagagcacccggttagaaccagttgtcaaaa\n\ aatagagcggttgcatgagacagaagtaacgatgagatccgttgtaacgttgagacatct\n\ ggcctatcgtcaatacagtcctcccttaaaaatatttttaaatactaggcaaacccaaca\n\ taggttagtcctatgtgatacgccacatggtatatcattttgtaacgttacctagggata\n\ atcaggaagtggaattacgcaaaagtagacagtgaaatgcttagggttatagtctagtcc\n\ aaagataaaggataaagcacgtcagagaactatattagccgaatgggaatcattgttagg\n\ agactgtggatcatgtctaaaaagcaacgcagaaacagtcatcgaaaaaatctcgttttt\n\ gtttgaatctaaaagagctttgatgaccgatagtacctgtatactagttactgtattacg\n\ tgtctaatgatttcggattggggtccccagaatcagacgtcattgtagacgattcaagtt\n\ taccaatttaatttcccagctctccttggagaactatcgccaataattgcagtcactttc\n\ cttttctgaaacgataaagccgtcagagttctctgcaacgttggacttacctgaggttct\n\ aacccactttcggttctaatagtagttaacgacacaacgaataacctttactgtggggct\n\ ttcacgatattttttcgcttattattaatggttacgtcataagctggtgtccaaattaag\n\ gttaccggcttcgcagagtagttgtatccaagtataacttccctaatcataagatcgagg\n\ tagaaaattaatgctgtctctaaccgaacagatatgtcccactatgtggtatggacgttg\n\ ctaattacttctgaagggaaattggtcattatggatacgtgtctaccatcaggtcggacg\n\ cagatatggttctgtcttcagttgatccaccgttctttataggataataactgacgatta\n\ aagattatggtaaatagattaagccaattctcttcttgtcagtgaagcatccttaactga\n\ cttgctctgcagcccctcatacatttagctattcaaagtaccggctcgtttcaaactctc\n\ ccacctttggaagaggttgtcaacttgataagtatatcatttacagcattttttcggacg\n\ tacctctaatgtttcattgcagaaaattagttttttctatcgcacattttgcaagtaacg\n\ ttagagacacaattatctgcgaatgaactgctagatctgacgaccgggagcctcgcaaat\n\ atcaaaaaagactgacatatatcaaggagtcgttgacaagtgctggtaagtcaattggtt\n\ tatctgtcccggcgtttcgatcttaagctgaccatgcacggcagagtaatgtcactctcg\n\ ttcttacaagtctgtctccaagggtcggcaaaaaagacccctccattctcgagcccactc\n\ acgatatgtagggacgacaacttgtgcggcttatgaattgtctggactgcgggcgagggt\n\ ccatatctccgaagttagaagggacatacctttagatgataagatcaattcttattgacg\n\ aaattcatccacaacggggaacaacttcaccctagacttacgtctgaaaagacacctagc\n\ gtcttataaaaggtcagtgccccgtttcgtaaggctggaattacctacgcaaacttaaac\n\ ctcgcgcccttccttacgtatcgacaagatagaggctatcgcgaatgtactacggaggca\n\ tgaatcatatactagaaccaagtgcctgtgatattaacaagatgatccgacgcgagcacc\n\ gtaattctaggcataaaactccagcaatttgggggccgaaaacaaatgacgttagctaat\n\ taattatatgacatgatcaaaggaggtcaatcacgcatcgagttcgacgtatattcattg\n\ aacttcgtgcgtttgaaagaaacttttatgaaggcaaaattgatcctgtctcctatttca\n\ tgcgtacctcctagttgataattccccgagcagtggttaggacacttttgtcggtatcaa\n\ gttccggtctcaaaacgtaaaattctgtaatctgtatggatggtctgtgaattagttaat\n\ ttttatgaagtcgtcgagacgcagttcctattgatttattctaaacggagatgtgcttcg\n\ tgggactcggaagtagatctgtgtttatgattattgctactttagatgctgactgttaac\n\ tccgtgttgtttttcaaccgtatatcacaaccgaattggatagaacctatagtttcaagt\n\ tctgccacaaggtatcatatttacagttagtgctggttgcttctttcaaacgtggtgagt\n\ ttgtgctatcacgtcaacggtagagctcagtggaccgagtgcgcgttcaaccctgttcca\n\ gagagggtgtgatagcacatataccacgctcgtcgaggcgttcatgatagtttgcaagag\n\ ccggtgttaaacacatattattattgttatccaactaatcggacctatgcataaagcatt\n\ gtctaaacagaataattgcctatatacggtagttttagtgatttatatcttagtatcagt\n\ tagagcttcgaactcttcaggttcctcatatttaacgttcttcgaaagcgaaaacttcta\n\ caaacgaatgtaagcggttttccaagtagtacctataaatcacagaaagatctgtctcag\n\ tatagttgaaatggtattcagctagtgacgtgtaccaattatcatagttcactcaagcaa\n\ gacgctcattaacgaatatagacaagacactatatcatataataaaaaagaacatggtgc\n\ tcgaacatagttgaattcaccatattgaaggggaatgctgacatgtaattcgctactaga\n\ cgatcaattccctacttgtcaaagttgaactggtacgttcttggaattaaatatgattgc\n\ gctggaccaaattgcgacttcttgagtttcagggcaaacgattgagccggaggatgtccg\n\ tctcttacctttcttgcttatgataaacgacggtccctgtacatcactgggaattctcag\n\ caaaaataattgggtaaatcgagactcgatgtattcggccacaaaggtgttagacgttaa\n\ agattattcaacggggcgataataggatcataaccggtatgcaagcgcattgaaagagcc\n\ atgagatccttatccgataaacgctgcacggtatgtgcagccttattgtcgatcacgaat\n\ ttataaatgtagtctgggctgtaagttgaagacctaagttataatgaagtgcaataccaa\n\ atcgattcatagtggattatcagactcaagatatctcctgataaattacagttgttaaga\n\ tacggataaaatgagatttaagattagcagcctctaatctgtttcaatcccgttggaatg\n\ tggtatgcgatcaaggttaagttaaaatcaagcctgtcttcagtcttgattcttgttctg\n\ ccatcgcatgcggtctacgtgagttaatatgtagcttacgttctagcttgtgctaatctg\n\ agtatagattcgtagaggaatattatcaagcttccacgcctcaacgtacgtgtattggtc\n\ acacaagacactaaaagtggaagtagcgtaaactatagtctagttgttaaatgctcagtt\n\ cttgttatattcgatatactcttggctaatttatgtctgagtatataaaattaatgatat\n\ taacttgcatttcacggatcccttagaaaaagattttgaccgagcgcattataaacggtt\n\ acaccgaatcaatagaagcatacccaatagctttctttgaatttattgcctgcgcaactt\n\ ggctgactctctagatccgaataattctatatggtcgtgacgaaactagttcattactgt\n\ ttaaaatgccaacatgtcttttgggccgataatggctctttgcaaaattactcaatgata\n\ cgattgatcaaagcggtagttgctagtggtagcatgtaagtctatcaaatgtctgattat\n\ ccgaaaatcttccaaaagagtccacgtaccatatctatctcatagcgacgcgaggggaac\n\ cttatctaactatcattccatttaccgggtgactctcgatgcaggatccgattgggataa\n\ attgcccagaaatggctcattcctgactaagggtaaggccgttctcagcaagggaacccc\n\ gcgaatctaggcttataccatctagattgttaactacttgcctgtagttctacagccata\n\ ctggacagttgtttctaaatgatcgggattcatgctagcactcctctgaatgcaccgcgt\n\ aagtttaactattacgtccgtgggcagataaggatggaggctgtatgtatcttaactgtt\n\ acctaatatggctggtaattatcaaagtaaggaccttaatgccatagcgctagcaatcgc\n\ tttgtatactgaccatgtgccaacctctcttaatctgtaaaatataatgtcttagctaac\n\ tgtggacgatcatgtctctgcctagagcttcgctgtatcaattcctatagccagcgtact\n\ agtgacacaacaacaccgtgtgagaaaagatattagtccttacgtctgtctctctacagc\n\ ttattgatgaggattgaacatggacatatagctccccctcaaaagcagatgctacctctt\n\ tattccattctcgaacatttgccgaacttaatttcgacaaacctgaggtcacgtcttaat\n\ ttatcggtaacgtcacgtccctttgagactggataaatatattaccaggggccaacgagc\n\ aattgttggaggcgcttctataatacaaggtgtcttgtcaaagaaagacggcgtgcgtct\n\ cgtgcaactcacttaaccaatattaatgtgaaacccccctctctcacatcttatgcggtg\n\ tactgccctggtacatttcctgtacaggactccaacagtgtagattcctaagatagctgt\n\ tggagttgcctcacgccagatcgaaaaactgaataaactagtgagctgagctgcagaaat\n\ accgcttaattacttatgactagttcaaagggacctacgtgatgtcagacattgcaagga\n\ agaaattaggtttgtgcgtcattttggctggactagcactccttacttcccctactattc\n\ aaatgtcgtaaacagcatgagacaggatcgtgctgacatttaaggtctattgggaacgag\n\ gctacctttggtcgcgcgctcgcgttctccgaatgaccgaaatgcatgagcacagtatgc\n\ aattgcttatagatctaaggtctggtcgttgaaaccaagcacgtaggcctgggaaatcag\n\ ttcttcctcagcaactacacaaaagcgtccaagcattagtacttgtagtaaatgtccgaa\n\ cctatgcgctcatttgaaagtcaaaaaatatttttaagcagtaggcacctaacccgattc\n\ ctctacttagtagctttctttgattctcagaattgactgcaatatcactgcacaattctg\n\ tgccattactagacttctctgtattaacgtctcatcttactaacactcgcctaggacaca\n\ tctgagagtgaagtatttcaatacatttactgaaatcttcagttctaaaatccccgaata\n\ aggctcttatcggtttggccaacacaagaaaaaaacttcttgcaccactcaccttcatac\n\ gcaggagcctggggaacttagtaataactatttcggcagacaaagcttataacaagttgc\n\ cggcgcgtataatatttaaaagaccccttgagctgctcaattaaaacgctcacctggtat\n\ aggctattagatagtgccgtcttagtaaggggcgggaattatcggataaactgatatttt\n\ gataaaataaccgacttgttcacgacataagtcactaaggagattttatctttctccaaa\n\ gtatatcttccttggataatttcaaagcgctgcaatttaagttctgttactagtttatgc\n\ tgctgggaggtgaccggaaggcgtagtaatctagaggcaaattataagaagttcatcata\n\ tcattttcgactacaaaaacaaggtgttgtatgccggcgcattgtgtaaactggacgagt\n\ accctagatggaaaattatacgttaagccaagatttcgatgtaatgataattacctacac\n\ atttttgctatccataggaacaagagctgttctataggctcgtggcatacgaacatttgc\n\ tgccgctatgaatattggaagctcttcaactacagactctattcttaattgccgtcgaaa\n\ atgggccgaatcggctattattaatactcggtttttccgaggggattgttgtcgacagtc\n\ gtaattattattaatattgatgttggtgaggtcatttaaatacaaccttgcagacaatga\n\ ataagggatccaatctctcatactccttttacaattgctcatgcccctatgcaaacctta\n\ tgccgccacacctccgcaactctctcttctgaactgtaagtagcttcattactggtttga\n\ gactatactgaagctgatgacattctaaaatggctattttcgaatgtgattcataatgtt\n\ tatcgtttgggatggcagaatcacgttatttttgatatagcccgggtattctattgtata\n\ gaacgtatgctacaagtcattccccgaagaagactagaagtaaacaacatgcgaccatcg\n\ ttaagccacgcaaggctgtagctttatttcccgataacctatcttccataaatagcggac\n\ agcaggatactgacgctcaacatcagtggttatggtctaatttttaacttttaataaggt\n\ aacttcagcaggcatacacagtaactctttaatttataatcaaattagaagtctgacact\n\ tcttatatttttctatcatccaacgcgatcgcccattagcttattgtgttactaataacg\n\ tatctaaaccaatccttttcaagctactgcctatattgtcaatatatacaaacaacagga\n\ tagtaggctgcttaaaaaatattgtcaaccgtgtacgctttacaatacccggaaatcaca\n\ aactttgtagacaacgagtgaaatttatacactacgaagggccagcgtacaagacccatg\n\ aattaggcgatatgtttattctgacatattggtttatccttaatctgtcgctgtaaaatg\n\ aagccgcccccatccctgcgaattttttttcgaagattcacgactgaaatataaatacgt\n\ ttggctatatttatgttggagggaggcaatagcctttactgttaaccgaagatttagcca\n\ gtgagtgtgacactaaaacactggaataaatgcaggcgttcttctgggtaaaaggtttag\n\ tcaatctcgcctataagttcatatagctctggatataattatctggcccatgcatttatc\n\ atggcgcttggtgccctgtgtgaagccggcctctcatattgaaggtccgaagtattccat\n\ gtacattaagatcactctctcattcatgcatcttggcttaacaaatctggttgtccaagc\n\ tttccaggcacgtatggtacaaattcggatcgaatacttataaaaatgatatgttaaact\n\ gtctaaaacgctcatctacaaagtaaagtgcactaaccaatagagtctcaagaccgtgta\n\ atgctggtgcactgaatgtgtaatacggttagaagggattagttatgttacaaatccatt\n\ gaaaacttaagaagcattgcgtgctcggagggtgcatcttttatcaagagactaacatta\n\ ttttcaacgacgtacatgctttacaatagggtacttatcaaacgccgagaaacgcgccta\n\ tagtgatgttatgattatgacccgatatccattggaccgaattttatgtaggttcccagc\n\ gtactcgcgtaatatctcggtattgccataatgtaatacttgtcggtctctcccagatga\n\ aaaagcgttacagagtatttcaatgaaaaacagcgcgcaacgtcaatacctttaggggta\n\ acggccgctgatttcatatagatatacgataagttggtatagctctactaggtggcatcc\n\ acaatcgttgcatttactatagctggttacaatcataatctataccgttccttacatact\n\ accatagcgggatagcgtttttttgccgttgattgggtttaagaggatgtcagtctcatt\n\ atatccgattcggtgggagagccgttgttttcaaatcgcacactttgtgacataatgtac\n\ aagataacaaaactgatataagatataaactgtcaatatcaccttgacacttgaatcaaa\n\ gtaaattaactcgcaaatataatttgactaattgggtgcagatttctcaattaataaaaa\n\ aatggcaccggatgggcttacaagccccttatcattcacttgtatcatgatttccaagaa\n\ caatagaatttgctagcaagtatgaacagagattcgaattgcatccacagtacgccggag\n\ cgtttattttaatgtggatatgacgatgtactgttggcggcatttgctagtaaccggtcc\n\ ttatttacgtagcgcacacgtaagcatgtctgggagaaatatggtggtacaatctcagag\n\ aaagattacagtttggtttaaataggacttatcgggtcggaagtggaacttaataagcag\n\ tacacaattgggcaacagacgtcttgcctattacaataggattacaatgcgttagatttc\n\ agacacgttcgtgtttggctattcgtcaattccctaaatagttagacgatcaactattat\n\ caaagtgattctttgttcatcctccattcatgtaacagatggcacactacgcataacgcc\n\ gaggaattttaacgagatttaagagagcagttcgggcacaacccacttgactttataaca\n\ gctcggcagcataaacggtaatatgtgacaaatttccaaacgttataagaacgtatgtgt\n\ acttagaaaactaagtggttcatgttcaacagatgtgacgcagcaagcctaacttatcta\n\ ttggttttgctataaaagaacaaagttacacagaatcctaagggcttgtttcacacttat\n\ gcctagtgcttcaccatcttaaaatagcgaaaccggcacgaatcaaaccttaaaacaatg\n\ cgcagatattggtgatggtgactccgggtatgataatggtaactgttgaccagcgcccac\n\ ctcatcgaagtatagaaagtggttaggataaggatgagaccgaacttatttccggccata\n\ actttagattttctacctagtacacaacatcagggcggacacgaaaccgccatcacatca\n\ tataccaggtttaatttgcttaatgggggaagtgtcaacgaaccttcgaactttagcagg\n\ catatggccattatatatggccccagagcagaatgctacagcagacaaaatttggattta\n\ tgtagtttaatacctatcaaacttggtgtgaccatacttgtctaacgacagtgcacaaag\n\ tgtaagttacaattattactactcagcagcttctgcaatgataaaatcttatcatacacg\n\ tcacatatgataatatctacttagggggaacgggctccacaacctacatagtactcaata\n\ cttacactattcgacaggcacaccaaacctgtacagtcccaaaagattgagtcaactttg\n\ cagtactgcagatcacagtaatagcttagttagcgagtcaaaattagttttctacgagac\n\ tgcacgaccgtgcaaatttccgatgtgttggctacaaatagcaacgtatgaatttgtttg\n\ aagccacgtaaactgtacaaccttagagataagtctcaggctactaaaaacacgttgtgg\n\ cactaacaggatcatggttgattcttacttattcggctgaccggcccaataagtaacctt\n\ caactagaacagaataatcgggagtagtttaattcagtcaaggtgcaggtctcattgtaa\n\ ctaacaagctctgtgtaaccaagttaaaatcgttttcttagcggattccctacttatgga\n\ tttgagctcgtccacaatattcgatacaagaagtttgtggtccgtaacaacgaaatttta\n\ attacgctgtgcagcctcatccaaggaattaatagaaggttgatggtaggctccgaacgc\n\ tccatgattataatcaagtggactgtgcagtaaacgaggaaggtatcctgacgtcgtggt\n\ gttcgtttttgttatttgtgccctatacgagtagataaaccatgaacagcacagtgtgaa\n\ cccatggttgattttaggctaccttatttttaatttccgttacacagaaacgaattccac\n\ aactaacatgccattaatttttcgatatcttataaaagatggtcgaaattcattcattta\n\ ttttttttcggttctcgaaagtcaactaagctgtcgcgttttgtttctctttagaggtaa\n\ aagtggctttgatctcctacgtttggatactagtcaaccattactccatttgatccgtga\n\ gtatcacctgtctaacatccagcattatgactcctcggcgaagaaaagacacacttctta\n\ gagtcgatgtgtattagctagggacacagttgtttaatacgatagtgagcccagggaggg\n\ cagtgcgtcccccagtagatttattcagctagtgtaagtataagatatctcacccacgag\n\ gttcaagtgatatgcagtcttagaataatacttatcctgaatttcgatattatgggtact\n\ tcaataatccgctagcgctactttatgtctcgttggacagcaggacacatggcagtctta\n\ aacactaaagacatcacctgaatgaatgtaatgggattacaagaatcaatgaggtattat\n\ atacgacgtaggaaactctggatatatacagtaatctagttacgccatcgcacttcattc\n\ ctctggaaacttagaagacatcagctgtacgtggaggaaccagacccccgtatgtagcca\n\ aatagaaccaaagttgcttatacaaacacacccaatgacaatggaccgctggagttcgta\n\ aactcggaacgtagtactgcacaaacccagcatttagcaataggagctacgtatgcaact\n\ cccacgtggtaataccttcaagctatcaatatataggtgcctagctaatcgcattcgcaa\n\ gcagtattcaagcttgtaaaccagtataataattacagaggctctatgaaacccaacttt\n\ ccagctaaaagtcccaattaaatggttatttcgtacttttaaagtcgcccgttctgttat\n\ tacgcgaattgattctactccaaaattaaacacaaattatcaaccgtttcatttatattt\n\ gtcaatgcagctgtttaaaataaggctctactaaattataattaagacacttattaccag\n\ atttctctagttaagtttgaaccagctcgactaccgcgaaagatacattcccttctctat\n\ ttttcagttcatctatgggtcagagaagcattgaatttattctattcaccctcgtcgttc\n\ acagcgaatcgtcagtgtgatcagtgtatgagaaatatcctaaaccgtttagtcagacca\n\ cacgcttagaacaagtggtctaaaaagactgccctggaaggagtaagaagtatacagctg\n\ atccggtgtatccttcagtcatctgccctatactaattacacgacgcaaggaaaaatagg\n\ tttattttctaggcaaacccttcataggtgactccgatgtgttacgaatcatgcttgaga\n\ atgtgctatcgttaccgacggataataacgatctccaatgaaccaaatgtagaatgtcta\n\ ttgattacccttttactattcgacttagagataggagatagaacctcagtgtactttttt\n\ agccgaatgggaatctttgggaggtgaatggccataaggtcgtaaatccaaccctcttaa\n\ agtcttccatattatatcgttgttcgtggaatcgataacagatttgttgacccatagtaa\n\ atgtatactagtttatgttgtaagtgtagattgttttccgattgccgtccaaactttatg\n\ tcgtaattgtagaccagtaaagttgaccaaggtaagtgcccagcgatcctgcgagatcga\n\ tcgccaatttttccagtcactgtaagtgtaggtttagataaagccgtatgagttatatca\n\ taagggcctcggaaagcagcttcgaaccaaagttcccttataatagtagtttaactataa\n\ aagtatatactggtctgtcgccctttcacgatttgttttaccggtttatgaagcgttacg\n\ tcattagagcggctccaatttaaggttaacggcttccatgtgtagttgtatacaaggata\n\ acttaaagtatctgttcagcgagctagttaagttatcctcgatagaacacaactcagagg\n\ tcccaagatcgggtttgcaacttgctaatttattctcaaggcaaattgggaattatcgat\n\ acctgtataccataaggtcgctcgatgtgatgcttatgtcttctggtgatcctaccttag\n\ ttagtgctgattaacggaacattaatgtttatcgttttgagatttagccaattctctgat\n\ tctaactcaagatgccttatctgacgtgctatgcagcccctaagtattttacattgtaat\n\ aggacacgctcctttaaaactcgccaaaaggtcgttgtggttctctactggttaactata\n\ taatttacagctttgttgagctagttcctctttggtttaagtcctcaatattagttggtt\n\ cgagcgataagttggctagttaccttagtcactatattagatccgaatgttatgcttcat\n\ ctgaagaccgccaccctccaaaatttcttttaagactcacttattgcaaggtgtaggtga\n\ attcggctcgtttctcaagtggtgtatctgtacacgagtttccatattttcatcaacagc\n\ caccgcacacttatgtcactctaggtattaaaagtcgctctacaaggggacgcaattaag\n\ aaacagacatgctagtcaaaaataaacatagcgaggcaccactaattcggccgcttatca\n\ atgggatgctctgcgcgagacgcgccagagctcagtagttagttcggacatacatttact\n\ tcagatgatcaattagttttctacaaatgcttactctaccccgaaaaaagtcaccagact\n\ cttacgtctctttagtatccttccgtcttatataaggtcagtcccccgtttcggtaccct\n\ ggaatttactaagaataatgaaacagcccccaaggacgtacgtttacaaatgatagacca\n\ gatcgcctagcttattccgacgcatgttgcatagaattgaaccaacggaatgtgagagta\n\ actagatgagccgaccacagcacccgtttgcgtcgcagaatacgcctgatagttcggcca\n\ cgaaatcatatgtcctttgagtattaagtatttgtaatgatcaatcgagctcaagcaagc\n\ ttacacttcctcggatattcagggaacttagtgcctttgaaagatacgttgatcaacgaa\n\ aaattgataatggctcatatggaatgcctacctcatagtgctgaattaacacagcactgc\n\ ggacctaacttttcgaggtttcaagttcacgtctcaaaacctaataggctggaatatgta\n\ gggatcctcggtgaatttgtgattgggtttgttgtagtactgaccaagtgaatattcttt\n\ ttttctaaaagcagatctgctgccgggcactacgaaggagatctctgtgtatcattattg\n\ cttcttgacatgatgactcttaaatcactgtgggtgtgcaaaacgatagcacaacccaat\n\ tcgatagtacatattgttgatacttcgcactaaaccgttcatatttaaaggttgtgctcc\n\ ttccttcgttaaatactggtgacttggtcctatctactattagctagacctctggggaac\n\ cacgcccccgtaaaacctgtgcaagagagggggtcatacatcttagacatcgcgcctcca\n\ ccagggaagcattgggtgattgaccaggtgtgtaacaaatatgattattcttatactaat\n\ attagcaaagatgcataatgatttgtattaaatgtataattgaattgataagggtctttt\n\ agtcagtgatagagtagtataaggtagacattagaactcttaaccggacgcagatttttc\n\ ggtcttagtaagccaattagtcgacaaaacaaggtaagagcggttactagtagtacctat\n\ aatgcactgaatcttcggtcgaagtatagttctaatgctatgcagattgtgacggcgaca\n\ aatgttcagacttatatcatgaaacaagctcttgtaagtattgacaaatgaaaagattga\n\ atatttttaaatacaaaatgcgcctacttattaggggaattaaccagattgaaggccaat\n\ cctcacatgtaatgagataatagacgataaatgaaattcttgtaatagttgaactgctac\n\ gtgatgggtattatatatgattgagatcctccaattgccgacgtcttgtcttgatgccca\n\ aaagattgtcaacgaggagctccctcgcgtacctgtcgtccgtatcataaacgacgcgac\n\ atgtacagcactccgaagtataagcaataataatgcgggtaatccagactagatcttttc\n\ ggactcaatgcggtttcacggtaaacatgattaataccggagagtagtcgagcttatcag\n\ cgatgcaagcgaattcattgtgccaggagatacgttgcagataaaaccggcaacgtatgt\n\ caacaagttttggcgatctcgttgtttgtattcgacgaggcgcgggaacttcaagaacta\n\ tcgtatattcaagtccattaccttttagtttcagactggtggagctgactaaagttatat\n\ catcattttgtacactggtttagttaacgataatttcagatttaacatgaccagacgata\n\ atcgctgtatatccagttggaatgtggtttgccagaaaggttaacttataatcaagcctc\n\ tcttcagtcttgattcgtcgtatcccatccattgcgctatacctcagtgtatttggagct\n\ gtagttataccgtgtgctaagatcagtagacatgacgagagcaatattatctaccttaca\n\ agcatcaacggacgtctagtcggaacaaaagactctaaaactcgaacttcaggttaatat\n\ actatagttctgtattcagcagttattcttatattcgatattatcttgcctattggatgt\n\ ctgactttagtatattaatcatagtatctgccatgtaaaggtgccagtactaaatctgtt\n\ tcacagtgcgaattataaacggttacaaccattaaagacaacaagaccctatagctttat\n\ ttgaattttgtcaatgcgcaacttggagctcgcgatacatcccaattagtctatagggtc\n\ gggacgattctacggcatttctggttataatgacaacatggattgtggcccgagaatcgc\n\ tctttcattaattaagcaatcattacagtcttataagcgctacttccgagtggtagcagg\n\ taactcgatataaggtcgcatgagccgaatagcttaaaaaacaggccaccgaacattgat\n\ agagaataccgaccacagcgcaacctttgattactttcattaaattgtacggctcactcg\n\ acatcaagcttaagattgcgataatgtgaactcaaatggatcagtactgaagaaccgtaa\n\ cccacttcgcagaaagcgtacccagagaagatacgctgttacaatatacagggtgaaatt\n\ attgcctgttcttcgtaaccatttcgccaaacttggttagaaatgatagccattcatgat\n\ agaaataagctgaatgataccagtatctttaactatgtagtcagggggaagataacgatg\n\ gtccatgtatgtttctgatatgtgacagtattggccgcgtaatttgctaacgaagctact\n\ taatgcctttgagcttcatatagatttctttaatcaaaatcggcaaaaagatagtatgag\n\ ctataatatatgctagtagagaactctggaccatcatctatatgaatactgattcgagcg\n\ tgcaattactttagcctgcgtactactgactctacaaaacactctgagataagtttgtag\n\ tcagtaagtcgctctctataaaccttttggatgaccattgtacagccacttatagatccc\n\ aataaatagcacaggagacagagtttttcaatgctcgatcatttgccgatagtattttcg\n\ tctaacctcagggcacctattatttgatacctaacctaacggccctttcacaatggagaa\n\ atatatgacatcgggacaaacacaaatggtgggtggccaggagatatgacatggtggcgt\n\ ctctaagaaacacggactccctctaggcaaactcacgtaaccaattttaatgtcaaacaa\n\ aacgctcgaaaagattttgccgtgtaatgacctggtacattgactggtcaggaatacatc\n\ actgtagttgccgtagtgtcctgttggtgttccatcaagacacatcgtataacgcaattt\n\ acgacggacatcagatcaagttatacagattatttaagtatcacgtgtgcattgggacat\n\ aagggatctcacacatgccttggaacatttttgctttgtgccgctttttcgctgcactac\n\ caatccttacttaccagtatattcaaaggtcgttaacagaatgagaaaggttagggctct\n\ aagttatcgtcgattgggatagacgagacatttgcgagcgccctccacggatacgaatct\n\ cccatatcaatgtgaactggatgctatgcagtttagttcttacgtctcctagtggtaaaa\n\ atcaaagtagcactcgcatagcagttattcagaacctaatacacaaaaccgtcaaacatt\n\ ttctaattctaggtatgggccgatcataggagctaaggtgaaactcataaatgttttgtt\n\ agatctagcatcctaaaaagatgcatatactgagtagctggcgtgcattctctcaattgt\n\ atcctttttaactgaactagtcggtcccatttcgtgactgagatctattaaccgataaga\n\ ttaataacactcgcattcgtatcagctcagagtgaagtttttcaataatttgactgatat\n\ attaacttctaaaataaccctttaagcctcggatccgtttcccaatcacatcaaaaattc\n\ ttattccaactatctacggattaacaacgtgcatggggatcgtagtaagaacttgttccg\n\ atcactttgagtatatcaagttgacggcccggttattattgaatagaaacattcacctgc\n\ taaattaaataccgcacatcggatacccgatttcagagggccgtcttactaagggcaggc\n\ tttgttcggtttaactgagatgttcattattttacagtatgcttcaactaatatgtaacg\n\ aaggacagtggatctgtctccatagtagatcttcagtcgtgaatttcataccgctcctat\n\ ttaagttcgcgttcgagttgttgatcatggcacgtgaaagcaacccctagtattctagac\n\ gaaaattttttctagttcatctgataatttgccaattcaaaaacaaccgctggtttcccg\n\ gcgcattctctaaaatggaagtcgaacctagagccattatttgtcggtaacccatgagtt\n\ ccttcttttcagaagttaatacactgtggtcctatacagaggaaaaacagcggttatata\n\ cgatcgtggcataacaacattggatcaagatagcaatttggctacctattctaattctca\n\ ctagattcggtattccactacaatatcggcagattaggattggatgaataatcggtgttt\n\ aagtccggttgcgtctccaatctcctaatttttattaatattgatcttggtgacctattg\n\ taaataaaaacttcaagactttgaataacggtgaaaagatagaagactcatttgaaaatg\n\ gatcatccacagatccaaacattagcaagacactaatccccaactagctattctgatcgc\n\ gatcgtgctgcagtactcctgtcacaatagtctgttcatgatctaattctttttgggctt\n\ tgttcgatggtgattcagaatctttatccggtcgcttccctgtagctactttgtggggat\n\ attgcccggggattatagggttgagatcgtttcctaaaagtatttaaaccaagtagactt\n\ caactaaactacatcagaacatcgtgaagacaccatacgcggtacctttatttaccgata\n\ acatttcttcaagaaataccggtaagcagcataatgaccctaaacagctcggggtatcgt\n\ cgtagttttaaattttatttaggttactgctcaaggaataaaaactaactatttaattta\n\ taataatattacaaggctcacactgattagatttgtctataagacttcgcgatcccccat\n\ taccggattgtcttaagaataaactagataaaccatgcattttctagataaggcctttag\n\ tctaattagatacaaaaaacacgatagttgcatccttaatttattgtgtcaaacctggaa\n\ ccttttaattacccgcaaatcactttatgtcgagactacctctgaaatttattatctacc\n\ taccgcatgaggacttgaaccatcttgtaggagttatgtttattagctaagattcgttta\n\ tcctgtagcggtccatgtatattcaacaagcaaaaagcactcagaattgtttttagttga\n\ gtcaagactgatatataaataagtttccctagttttttcgtggtgggacgatattgaatt\n\ gaatcttaaccgaagagtttcccactctgtcgcacaataatacacgccaatatttccagc\n\ cctgcttatgccttaatcggttactcaatctcccattgaagttcattttgatctgcatag\n\ aagtttcgggcccagccttttttctgccaccttcctccaagctctgtagacgcactctaa\n\ gattgatgctcacatgtattaattctacattaacataaatatataagtcatgcatcttcg\n\ agtaaaatatctggttctccaacatgtcctggcacgtatcgttataatgcccatacatgt\n\ agtattaaaatgattgggttaactggatattaagatcatcgaaattgtaaagtcaaatta\n\ acaatactgtctcaagaccgtgtattcctcgtgctcggaagggctattacgcttacttcc\n\ gttttggtatcttaatatgactttcaaaaattaagttgcagtgagtcctacctgcgtgca\n\ tcggttagcaagagtataaaagttgtttaaacgaactacttgctttacaataccggtcgt\n\ atatatcgccgtgaatccagaagattgtcttctttggattatcaaccgagatcctgtgga\n\ ccgatgttttgggaccttcacagaggactccaggtagagctcgcttttgcattaatctaa\n\ gaattgtacctctctaaaagatctaaaacagtgaatgtgtatttcatggaaaaacacaga\n\ gaaacgtaaattactttaggccgaaaggcacatgagttattatacatatacgagatggtg\n\ gtatacatcgaattcggggcatacactatagttgcattgtatttagctgctttaaataat\n\ atgatattaccttccttacataagacattaccggcataccctggttttcaacttgtgggg\n\ ctttttgacgatcgcactctcatttgatccgagtagggcggtgacccctgcttttcaaat\n\ acaaaaatttcgctatgaaggtaatagattacttttcgctgttatgatagaaacggtaaa\n\ tttaaaattgaaacttctagaaaagtaaagtaacgagaaatgattttgtgaataatgcgg\n\ tcatgattgcgcaagtaagaaaaaaaggcaaaaggatgcgcggaatagaaacttatcagt\n\ cacgggtatcttgatttcattcttcttgtcaattgccgacataggatgaaatcagattcc\n\ aatgcaatacacagtaacccccacccttgattgtaatgtcgatttgaagttgtacgcgtc\n\ gacgaagtggatagtatacgggccttttgtacggtgcgatcaactatgaatctcggcgag\n\ ttagatggtcgtacaatctcacacatagaggtcacttgcctgtaatgacgaattttcggc\n\ taggtactcgaactttattagaagtaaaaatgtgggcaaaagaaggattccattttacaa\n\ gacgattacaatgagttacatgtctctcaacgtagtctttccctagtagtctttgaacta\n\ tttaggtactccagaaaattttagcaaagggtttctgtgtgaatccgccattcatgttta\n\ tgatggaacaataagaataacgccctcgtatgttatcgacagtgaagtcagcagttcggc\n\ caaaaacatattcaatttagtacagatccccagaagttaagctaagtgctctaaaatggc\n\ ctaaacggttatcaaagtaggtctaattactatactaacgggtgcatcgtaataactgct\n\ gtcgatgcaacactatatgatagtgtcgttttgctatatatgtacaatgtgacaaagaag\n\ ccttagcgattcttgcaaacttaggacttcggattctcaatcttaaatgtccgaaaacgc\n\ aaagattcaaaaatttaatctatgagcagatatgcctgatggtgactacgcgtatgttaa\n\ ggctaaatgttgacaaccgcacacataatcgaactattgatagtcgggagcataaccagg\n\ tgaacgtactttgttcacgacatttattgacatgttctaaatacgtctcaaaatcacggc\n\ gcactagaaaacgcaatcaaatcattgtcctggtttaagggccgtaatgccggtagtgtc\n\ aaacttcatgagaactttagctggcttttggccagtatttagggaccaagagcactagcc\n\ ttaagctgaatattttgccatttatctactgttataactttaaaacttggtggcaccaga\n\ cttgtcgatacacacgcatcaatctgtaacgtaaaaggtttactaagaacaagcgtagga\n\ attgagtttatattatatttaaactaaaagatgatattagcttctgagggcgatagggct\n\ ccaaatcataaagaggaatatattattacacgattagaaacccacaacatacctcgaatc\n\ gcccaaaagtttgacgaaacttggcagtactccacatctcagtaatacagttgggagagt\n\ ctcaaatgttgttttattactcaatgaaccaccctcataatttcactgctgttccattaa\n\ atttgcaaacgatcatttgctttgaagaaacgtaaaatcgacaaaattacagataagtag\n\ atgcataataaaaaaaactgctcgctataacacgatcatcgtgcattcttacttaggagc\n\ atcacccgcacaataacgtaccttaaactacaacactattagaccgagtactgtaattca\n\ cgaaagctcaagctcgcattgtaaagaacttgctctctcgtaaaatgtgataatagtttg\n\ cggagaggattcaattattttccattgcacctactccactagattcgataaaagaaggtg\n\ gtcctcccttaaaaagaaatgttaagtaacatcggaaccataagcaaagcatgtaagtga\n\ accgtcatccttccctaagaaacataaaggtttttaataatgtcgactgtgaactataac\n\ tgcatcctttcctgacctactccggttccttgttgttatttctgaacgagaccagtagat\n\ aaacaatgtaaaccacagtgggtaccaatggtgcatgtgacgctaccgttgttttaagtg\n\ cccgtacaaacataagaagtcataatcttacttgaaattaattttgccttttattttttt\n\ tcaggctcgaaattaatgatttgttttttttgaccttctagttacgctaatatgcggtcg\n\ cctgtggtttctattgagtcctataacgggatgggatctaatacgtttggttactagtaa\n\ acaaggtataaatttgataccggagtatcaactgtataacatcaagctttatgactcata\n\ cgcgaagtaatgacacaaggctttcaggagatcgcgagtacagagccactaaggggtgta\n\ ttacgatagtgacaccaccgagcgcactcactccccaagtagatttatgatcctacgcta\n\ agtattagatatataaccaaagaggttctagtcagtgcaactcttagaataataattagc\n\ cggttttgcctttttaggcctaatgcaatattcagctagcccttatgtatctcgcgttcc\n\ acagcaccactcatggcacgcgtttaaactaatcaaatataatctatgaatgttatgcca\n\ gtacttgaataaatcaggttttttataagtccttgcatactctcgttatatactgttaga\n\ gtcttaccccatagaaattctttcatctgcaaacttagaagaattctcagctacggggag\n\ cataaagtccccaggatgttgacaaatacaacaaatgtggcttatacaaacactccatat\n\ gaaaatcgaaccctcgtggtagttttagccgaaccttgtacggataaatccctccatttt\n\ ccaatagcagatacctatcctactacctcgtggtattaaattaaagcttgaaatatagag\n\ ctgcatagcttatccaattcccaagcacgagtctaccgtcgtaaccacgatttgatttac\n\ agacgctagagcaaacccatctttaaacatataagtaaaaattaaagggtgagtgcgtac\n\ gtgtttactagcaacttcgcttattaagacaattgtttataagccataattaaaaacata\n\ tgttcaacaggttcattgatatttgtaattgcacaggtttttaataaggatctacgtaag\n\ tataatgaacaaactttttaccagagttatattctgtactttgaaaatgctcctctaccg\n\ ccttagagactttcaattagattttttgcagttaatctatgcgtaagtgaaccatgcaag\n\ ggatgcgattcaaccgcctcgtgctaaccctatcgtctgtctcataactgtaggtctaat\n\ ataattttcagttttcgaacacataaccctttgaaaatctgctatttaatgtctcacctg\n\ catgcactatcttctatactgctcagaacggctatacgtcactatgctccaagtgacgat\n\ ttaaacgaagcaaggaataataggtttattttagtgcaaaacaattaagtgcggactacg\n\ tgctctttacaataagccttgtgattgggctataggttaagtcccatattaacgatctcc\n\ aatgtacaaaatcgacaatcgctttgcattacccggttactagtcgaattacagatagct\n\ gttagatactcactctaattttggacaacaatcccaatcttggggtcgtctatcgcctga\n\ agctcgtaaatccttccatcttaaacgattacatattatagacttgttcggggtagagat\n\ atcacagttgtgcaaacattgtaaatcgatactagtttatgttggtagtctagttgcttt\n\ taccattccccgaaaaacttgatctactatttcgacaacagtaaacttgaactaggtaag\n\ tgaaaacagagaatgcctcatagtgccactatttgtccactatatgtaagtgtagcttta\n\ cataatccactatgactgagatcattacggcctaggaaagcagcgtagaaaaaaagggcc\n\ cggatattacgactgtaactataaaactagttactggtagcgcgccatgtatagatttgt\n\ tttaccggttgtggttgcgttaacgaatttcagccgcgaaaattgatccgttaaccagtc\n\ catctcgacttctataaaacgataaagtaaagttgatgttcagcctccttcttatggttg\n\ catcgagagtacactactcagtgggaaatagatcggggttcctacttcagattgtattat\n\ ctaggcaattgccgattgtgccatacctggataaaataagctacctacatgtgatgctta\n\ tctattatcgtcatactaccttagggtgtcctgttgaacgctacattaatctttagccgt\n\ ttgagatgttccaatggataggagtctaacgcatgatgaagtttaggaaggcagagcatc\n\ ccactaagtatgtgacagtgtatttcgaaacgagacgttataaatagaaaaaaggtcctt\n\ ctggttctattctgctgaactattgaatggaaagattggttgacctacgtactatttgct\n\ tgaagtcatcaatttgacggggtgagagacatatggtgcatactttacggactctatatt\n\ ttagatcagaagcttagcagtcttctctacaccccctcacgacataattgcttttaagaa\n\ tctatgtttgattcctctacgggaattcggatccgttcgcatgtgcggtttatctaaacc\n\ aggggacatatgttcagctaaagcatacgaacactttgctaactagacgtatgtatagta\n\ gctataaatcccgacgatatttacaaaaagaaatgagactcaaatatatacatagcgacc\n\ ctacacttattcgcaccctgatctaggcgatcctagcacccacacccgaaagtgagcact\n\ agtgtcttccgtattaaatttactgcagttgagattttagttgtctactaaggattactc\n\ taacccgtaataaggatcaagactcggtactagctttactatcattccctatgtgttttc\n\ ctaactcacaagggtacgtaccagcctatgtaattacaataatgataaagacacaaagga\n\ agtaactttacaaatgagtctccagttacactagcttagtccctcccatcttgctttgaa\n\ gtctaaatacgcaatctctgaggatatacagcagaagaacactcataacgttggagtcca\n\ agaattagactcatagggcccccaacatttaatatgtactgtgagtttgaaggtgttcta\n\ ttgttaattcctgctcttgatacatgacacgtactccgtgtttaaggcttcggactgact\n\ ttctttcataagttgagcaacgaaaatttcagaatcgataagttggattcactaactaat\n\ acggctgattgaaaactccactccggacctatatggtcgacctttatacgtaaccgatat\n\ aaaacttataggctggtatatcgagccttcctagcgcaatttcggatggggtttcttcta\n\ ctactcaacaacggaatagtctttgtttagtaaaccagagctcaggacgcccaatacgta\n\ ggagagcgctgtggagcatgtgtcattatggactggagcactcttaaatcactctgcgtg\n\ tgctaaacgatagatcataacatgtcctgagtaaattttcttgatacgtcgcaatatacc\n\ gttattagttaaacgttctcatccgtcatgcgtgaaatacggctgtcgtgctcagatata\n\ ctattagcgactcatctcgcctaacacgcacacgtataaactcggaatgactgccgctct\n\ tacatattagaaatacagactacaccacggaagcattgggtcattctcaaccgctgtata\n\ aaagatgattagtcttataataagattaccaaagaggcagaatcatgggtagtaaatcta\n\ ttattcaagtgattaccgtcgtgtaggcagggagtgaggacgagatggtactcaggacaa\n\ atattaaccggacgaagtggtttacgtcgtactttcactattagtagtaaatacaaggta\n\ acaccggggaatagtactaaatataatgatatctatcttcgggagaacgagtcgtctatt\n\ gctttgaacattctcaaggcgtaaaatgtgctgacttatagcatgatacaaccgattgtt\n\ acttttgtctattcaaaagattgaatagttttttatacaaaagccgcatacttatgacgg\n\ ctagtatacagtttcatcccctagcatcaatgctatggacagtattgaacttataggaaa\n\ ttcttctaatagggcaaatccgtcgtgatgcctattttttttcagtcacatcctcaaatg\n\ gcactagtattgtcgggatcccattaacaggctcaaccacgagctcacgcgaggacatgt\n\ agtccgtatctttaacgaagcgacagcgacagaactcccatggataaccaattataaggc\n\ ccgtaatcctctagacatcgtttaccaataaatccgctttctccgtaatcatgttgaata\n\ ccccagagtagtccagatgataaccgatgaaacacaagtctttctcaatgcacttacggt\n\ gaacttattaccgccaacgtagctcatcaaggttgcgacatctagttgtgtgtttgcgac\n\ gagcccagcgaacttcatcaactttcgtatattcaacgccttgtaattttactttaagac\n\ gcctggtgatgtagattcttagataatcagtttgttatcggctgtactttaccataattt\n\ cacaggtttcaggtcaagaagattatagctgtatatacagttccatgctcggtgcacaga\n\ aacgtgatcggataataatcaatcgcttatgtcgtctttaggcgtatccaatacatgccc\n\ cgataccgcagtgtatttcgacatgtaggtataccgtcgcatttgagctcgagtcaggac\n\ gtcagctagattagattccttaatagaatataccgacctctagtccgaactaaactatag\n\ ataacgccaacttcaggttaattgtctagtcgtctgtttgcagatgggattcttagatga\n\ gtgagtatcggccatattggttcgagcactttagtttttgatgcataggatatgcaatgt\n\ atagctgaaagtactttatctgtttcaaactcacattgattaaaccggtaaacctttaaa\n\ gactacaagaaaatattcagtgagggcaattttgtcaatcacaatcttccagctagagat\n\ acttcacaatttgtcttgaggctacgcaacattagacggattttcgcgttttattgaaat\n\ aatcgaggggcccaagagtatccatagttcattttgtaagatttctttacaggcttatta\n\ cagcttcttcagactcctacatgcttacgagttatatgctagcatgtgaacaatagatta\n\ atatacaggaaaacgtacattgagagagatgaccctacacagcgcaaccgttgagtactt\n\ tcattaaagggtaacgctctcgagacagcatccttaagatggccttattgtcaaatcatt\n\ tgcagaagtacgcaagatccctaaccaacgtagaagaatccctacaaacacatgagacgc\n\ ggtgaaaatagacagggtgttagtattcaatcttcggagtatcaatttcgccaatcttgg\n\ tgagaaagcataccctttcttcagagaaagaagatcaatcataacactatctttaacgag\n\ gtacgcacgcgcatcattacctgcctccatggatctttaggatagcggaaagtattggca\n\ gcgtattgtgatttcgttcctactttatcaatttcacattcatatacatgtcttttatca\n\ aaatcgccaataagataggatgagctatattagatgctagtagagttcgcgccaacatca\n\ tcgataggaatactcaggacagcgtgataggacttttcaatccctaatactctctataat\n\ tataactctctcttaagtttggaggcagtaacgcgctctatataatcagtttgctgcacc\n\ attcttcagcctctgatacatacaaataaattccacagcagtaagagggtttaattgaga\n\ catcttgggaacttaggattttactctaacatcaccgaaacgattattggataccgtacc\n\ taaacgaactttctcaaggcagtaatataggacatccgcaataacacaaatgctgcctcc\n\ ccaggagttatgtcttcctggaggctatatcttacacccactcactataggcaaactaaa\n\ gtttaaatgttgattgtctaaaaaaaagatagataagagttggccggcgtagcacatgcg\n\ aaagtgaatcgtaagctataattctctggacttgaagttctgtcctgttcctctgcaaga\n\ aacaaacttcctttaaagctatttacgacgcacatctcagcaagttataaacatgttgga\n\ agtttctagtcggaattcccaaagaacggatctatctaatgcattcctacatttttcctg\n\ tctgccgatggtgccatcctattcaaagaatttcttaaaagtagattaaatgggactttt\n\ aacaatgagtaaccttacgcctctaagggttcctcgagtgccatacaccagtcaggtccg\n\ agccacatacacggagaacattctaacatagcattctcaactcgatcatttgcaggttac\n\ ttctttcctatcctagtgctaaaaatcatacttgcaatcccatagcacggattaagaacc\n\ taagaaacaattcagtaaaacatgttcgaattcttggtatgggaacatcattgcagctat\n\ ggtctaacgcattaatgtttgggtacatcttccatcatataaacaggaagagtctgacga\n\ cagggagtgcttgcgatcatgtctatcattgtgaaatcaaattgtagctcacatgtcgtc\n\ tatgagagcgtgtatccgataagatttagaaaaatagaagtcgtataagatctcactgaa\n\ cttttgaatgaatgtgaagcatatatgatctgctttaataaaactttatccataggatac\n\ gtttccaaatcaattcaataattattagtcaaaatagataaggatgaacaacctgaaggc\n\ cgatcggacgtagaaagtggtcccatcactttgagttgatattgttgaaccacacgttat\n\ tatggttttcaaacagtctcaggatattgtatatacagataatccgataccagttgtctg\n\ acgcccctcttacgtaccccaccctttgtgacgtttaaagcagttgttcagtattttaaa\n\ ctaggcggcaactaatttggaaagaagcacagtggatatgtctaaattcttgttattcag\n\ gcctgaatttaatacaccgcatagttaacttcgcggtagagttgttcatcatgcctcctc\n\ taagctaccacttctatgatacaccaatagttgttctacggaatctgataattggccaag\n\ tcataaacttccgctgcgttcaacccccttgctcgaatatccaactcgaaaagacagcct\n\ tttggtgtccggaacaaatcagttacttcttttctgatgttaattctctgtggtcagata\n\ cagaccaaaaactccgcggatttaccatcctccaagaacaaatttgcatcaacatagcat\n\ tttggctacatattctaagtctcaatagtttaggttttcaactacattatcccaacatta\n\ ggattggaggaataatagctgggtaagtccccttgcgtctacaatcgactattttttatg\n\ aatatgcttctgccgcacctatggttattaaaaaagtcatgactttgaagaaccctgaaa\n\ agatagatgaatcaggtgtaatggcagcagccaaagagcatataattagcaacactctaa\n\ gaacattatagatatgatgatagcgatcgtcatgatgttatccggtcacaatagtagctt\n\ catcagctaattcgttttgccagtggtgacttgcgctggaagaatcgttatacggtccct\n\ tccctcttgatacggtgggggcttattcaaccgcgtggattgggttgtcatacttgcatt\n\ aaacgatgtaaaccatctagtagtcaactatactaaatcacaaaatagtgatcaatacat\n\ acccgcttcatggttttaaccatttaattgattaaagatattccgctaagaaccattatc\n\ tacctaaactgatcgccgtatcctagtagtttgaaatttgatgtaccgtaatgatcaacg\n\ aagtaaaacgttatattgtatgtagaataataggtcttggagctaaatgatgtgattggt\n\ agtgaagacttacccttacaactttaccggtttctcggaagaatatactagagaatcaat\n\ gcatgggctacataagcactttagtctaatgagataaaaaatacacgagtcttccatcat\n\ gaattttttgtcgaaaaactcgaacctggtaatttaaaccatatatctttatgtcgtcaa\n\ taactctcatatgttttatataacttcccaatcacgacttgtaactgcttgttcgactga\n\ gctgtttgagctatgaggccgggatccggttgagctacatctatttgctacaagaaaaat\n\ gaaagcacatttgttgggagttctggctacactcatagagaaataagtggcccgagtggg\n\ tgcggcctgcctccatattcaagtgtatcttaaaccaagtggttccaacgctcgcgctaa\n\ agaattaaagcctttatttcctccacggagtagcccgtaatccggttcgaaagagaccat\n\ tgaagttaattttcatatccagtgaagtttaggcacaagcatgtgttctgccacatgcct\n\ caaagcgctcttcaaccaagatatgattcatcctaacttcgatgaatgcgtctgtaacat\n\ aaatatagaaggaatgattcggcgagttaattttcgccttctccaacatggcatccctac\n\ gttcgttataaggaccatacatgtaggttttaaaggtttgcggttaatcgatatttacat\n\ catagaaattctatagtcaaatttacaagactctagatactcactcgttgcagccggcta\n\ ggaagcgctttgtaccttacttcccttttcgttgcgtaatatgaatttcatatagtaagt\n\ tcaaggcactcatacctccgtgaagagggtagatagactattaaagttgtttaatagtac\n\ gtattgatggaaatgacccgtaggagatttaccactcaatccacaagattcgctgctgtg\n\ cattatcaaaacagtgcatgtcgaaacatgggttgggtccttcaaacacgaatccaggta\n\ gagatacctttgcaattttt\n"; dnaInput = dnaInput + dnaInput + dnaInput; var ilen, clen, seqs = [ /agggtaaa|tttaccct/ig, /[cgt]gggtaaa|tttaccc[acg]/ig, /a[act]ggtaaa|tttacc[agt]t/ig, /ag[act]gtaaa|tttac[agt]ct/ig, /agg[act]taaa|ttta[agt]cct/ig, /aggg[acg]aaa|ttt[cgt]ccct/ig, /agggt[cgt]aa|tt[acg]accct/ig, /agggta[cgt]a|t[acg]taccct/ig, /agggtaa[cgt]|[acg]ttaccct/ig], subs = { B: '(c|g|t)', D: '(a|g|t)', H: '(a|c|t)', K: '(g|t)', M: '(a|c)', N: '(a|c|g|t)', R: '(a|g)', S: '(c|t)', V: '(a|c|g)', W: '(a|t)', Y: '(c|t)' } ilen = dnaInput.length; // There is no in-place substitution dnaInput = dnaInput.replace(/>.*\n|\n/g,"") clen = dnaInput.length var dnaOutputString = ''; for(i in seqs) dnaOutputString += seqs[i].source + " " + (dnaInput.match(seqs[i]) || []).length + "\n"; // match returns null if no matches, so replace with empty for(k in subs) dnaInput = dnaInput.replace(k, subs[k], "g") // search string, replacement string, flags assertEq(dnaOutputString, "agggtaaa|tttaccct 0\n[cgt]gggtaaa|tttaccc[acg] 9\na[act]ggtaaa|tttacc[agt]t 27\nag[act]gtaaa|tttac[agt]ct 24\nagg[act]taaa|ttta[agt]cct 30\naggg[acg]aaa|ttt[cgt]ccct 9\nagggt[cgt]aa|tt[acg]accct 12\nagggta[cgt]a|t[acg]taccct 9\nagggtaa[cgt]|[acg]ttaccct 15\n") mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/sunspider/check-string-fasta.js0000644000175000017500000000404311545150464025227 0ustar chr1schr1s// The Great Computer Language Shootout // http://shootout.alioth.debian.org // // Contributed by Ian Osgood var last = 42, A = 3877, C = 29573, M = 139968; function rand(max) { last = (last * A + C) % M; return max * last / M; } var ALU = "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" + "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" + "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" + "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" + "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" + "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" + "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"; var IUB = { a:0.27, c:0.12, g:0.12, t:0.27, B:0.02, D:0.02, H:0.02, K:0.02, M:0.02, N:0.02, R:0.02, S:0.02, V:0.02, W:0.02, Y:0.02 } var HomoSap = { a: 0.3029549426680, c: 0.1979883004921, g: 0.1975473066391, t: 0.3015094502008 } function makeCumulative(table) { var last = null; for (var c in table) { if (last) table[c] += table[last]; last = c; } } function fastaRepeat(n, seq) { var seqi = 0, lenOut = 60; while (n>0) { if (n0) { if (n= 0x7f) { validates = false; break; } } if (!validates) continue; var url = "http://example.com/tag/" + tag.replace(" ", "").toLowerCase(); var popularity = tagInfo[i].popularity; var color = 'rgb(' + Math.floor(255 * (popularity - 12) / 20) + ', 0, 255)'; output += ' ' + tag + ' \n'; } output += ''; output.replace(" ", " "); return output; } var tagcloud = makeTagCloud(tagInfo); tagInfo = null; // The result string embeds floating-point numbers, which can vary a bit on different platforms, // so we truncate them a bit before comparing. var tagcloud_norm = tagcloud.replace(/([0-9.]+)px/g, function(str, p1) { return p1.substr(0, 10) + 'px' }) assertEq(tagcloud_norm.length, 295906) mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/v8-v5/check-crypto.js0000644000175000017500000014010511545150464023016 0ustar chr1schr1s/* * Copyright (c) 2003-2005 Tom Wu * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * In addition, the following condition applies: * * All redistributions must retain an intact copy of this copyright notice * and disclaimer. */ // The code has been adapted for use as a benchmark by Google. //var Crypto = new BenchmarkSuite('Crypto', 203037, [ // new Benchmark("Encrypt", encrypt), // new Benchmark("Decrypt", decrypt) //]); // Basic JavaScript BN library - subset useful for RSA encryption. // Bits per digit var dbits; var BI_DB; var BI_DM; var BI_DV; var BI_FP; var BI_FV; var BI_F1; var BI_F2; // JavaScript engine analysis var canary = 0xdeadbeefcafe; var j_lm = ((canary&0xffffff)==0xefcafe); // This is the best random number generator available to mankind ;) var MyMath = { curr: 0, random: function() { this.curr = this.curr + 1; return this.curr; }, }; // (public) Constructor function BigInteger(a,b,c) { this.array = new Array(); if(a != null) if("number" == typeof a) this.fromNumber(a,b,c); else if(b == null && "string" != typeof a) this.fromString(a,256); else this.fromString(a,b); } // return new, unset BigInteger function nbi() { return new BigInteger(null); } // am: Compute w_j += (x*this_i), propagate carries, // c is initial carry, returns final carry. // c < 3*dvalue, x < 2*dvalue, this_i < dvalue // We need to select the fastest one that works in this environment. // am1: use a single mult and divide to get the high bits, // max digit bits should be 26 because // max internal value = 2*dvalue^2-2*dvalue (< 2^53) function am1(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; while(--n >= 0) { var v = x*this_array[i++]+w_array[j]+c; c = Math.floor(v/0x4000000); w_array[j++] = v&0x3ffffff; } return c; } // am2 avoids a big mult-and-extract completely. // Max digit bits should be <= 30 because we do bitwise ops // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) function am2(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; var xl = x&0x7fff, xh = x>>15; while(--n >= 0) { var l = this_array[i]&0x7fff; var h = this_array[i++]>>15; var m = xh*l+h*xl; l = xl*l+((m&0x7fff)<<15)+w_array[j]+(c&0x3fffffff); c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); w_array[j++] = l&0x3fffffff; } return c; } // Alternately, set max digit bits to 28 since some // browsers slow down when dealing with 32-bit numbers. function am3(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; var xl = x&0x3fff, xh = x>>14; while(--n >= 0) { var l = this_array[i]&0x3fff; var h = this_array[i++]>>14; var m = xh*l+h*xl; l = xl*l+((m&0x3fff)<<14)+w_array[j]+c; c = (l>>28)+(m>>14)+xh*h; w_array[j++] = l&0xfffffff; } return c; } // This is tailored to VMs with 2-bit tagging. It makes sure // that all the computations stay within the 29 bits available. function am4(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; var xl = x&0x1fff, xh = x>>13; while(--n >= 0) { var l = this_array[i]&0x1fff; var h = this_array[i++]>>13; var m = xh*l+h*xl; l = xl*l+((m&0x1fff)<<13)+w_array[j]+c; c = (l>>26)+(m>>13)+xh*h; w_array[j++] = l&0x3ffffff; } return c; } // am3/28 is best for SM, Rhino, but am4/26 is best for v8. // Kestrel (Opera 9.5) gets its best result with am4/26. // IE7 does 9% better with am3/28 than with am4/26. // Firefox (SM) gets 10% faster with am3/28 than with am4/26. setupEngine = function(fn, bits) { BigInteger.prototype.am = fn; dbits = bits; BI_DB = dbits; BI_DM = ((1<= 0; --i) r_array[i] = this_array[i]; r.t = this.t; r.s = this.s; } // (protected) set from integer value x, -DV <= x < DV function bnpFromInt(x) { var this_array = this.array; this.t = 1; this.s = (x<0)?-1:0; if(x > 0) this_array[0] = x; else if(x < -1) this_array[0] = x+DV; else this.t = 0; } // return bigint initialized to value function nbv(i) { var r = nbi(); r.fromInt(i); return r; } // (protected) set from string and radix function bnpFromString(s,b) { var this_array = this.array; var k; if(b == 16) k = 4; else if(b == 8) k = 3; else if(b == 256) k = 8; // byte array else if(b == 2) k = 1; else if(b == 32) k = 5; else if(b == 4) k = 2; else { this.fromRadix(s,b); return; } this.t = 0; this.s = 0; var i = s.length, mi = false, sh = 0; while(--i >= 0) { var x = (k==8)?s[i]&0xff:intAt(s,i); if(x < 0) { if(s.charAt(i) == "-") mi = true; continue; } mi = false; if(sh == 0) this_array[this.t++] = x; else if(sh+k > BI_DB) { this_array[this.t-1] |= (x&((1<<(BI_DB-sh))-1))<>(BI_DB-sh)); } else this_array[this.t-1] |= x<= BI_DB) sh -= BI_DB; } if(k == 8 && (s[0]&0x80) != 0) { this.s = -1; if(sh > 0) this_array[this.t-1] |= ((1<<(BI_DB-sh))-1)< 0 && this_array[this.t-1] == c) --this.t; } // (public) return string representation in given radix function bnToString(b) { var this_array = this.array; if(this.s < 0) return "-"+this.negate().toString(b); var k; if(b == 16) k = 4; else if(b == 8) k = 3; else if(b == 2) k = 1; else if(b == 32) k = 5; else if(b == 4) k = 2; else return this.toRadix(b); var km = (1< 0) { if(p < BI_DB && (d = this_array[i]>>p) > 0) { m = true; r = int2char(d); } while(i >= 0) { if(p < k) { d = (this_array[i]&((1<>(p+=BI_DB-k); } else { d = (this_array[i]>>(p-=k))&km; if(p <= 0) { p += BI_DB; --i; } } if(d > 0) m = true; if(m) r += int2char(d); } } return m?r:"0"; } // (public) -this function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } // (public) |this| function bnAbs() { return (this.s<0)?this.negate():this; } // (public) return + if this > a, - if this < a, 0 if equal function bnCompareTo(a) { var this_array = this.array; var a_array = a.array; var r = this.s-a.s; if(r != 0) return r; var i = this.t; r = i-a.t; if(r != 0) return r; while(--i >= 0) if((r=this_array[i]-a_array[i]) != 0) return r; return 0; } // returns bit length of the integer x function nbits(x) { var r = 1, t; if((t=x>>>16) != 0) { x = t; r += 16; } if((t=x>>8) != 0) { x = t; r += 8; } if((t=x>>4) != 0) { x = t; r += 4; } if((t=x>>2) != 0) { x = t; r += 2; } if((t=x>>1) != 0) { x = t; r += 1; } return r; } // (public) return the number of bits in "this" function bnBitLength() { var this_array = this.array; if(this.t <= 0) return 0; return BI_DB*(this.t-1)+nbits(this_array[this.t-1]^(this.s&BI_DM)); } // (protected) r = this << n*DB function bnpDLShiftTo(n,r) { var this_array = this.array; var r_array = r.array; var i; for(i = this.t-1; i >= 0; --i) r_array[i+n] = this_array[i]; for(i = n-1; i >= 0; --i) r_array[i] = 0; r.t = this.t+n; r.s = this.s; } // (protected) r = this >> n*DB function bnpDRShiftTo(n,r) { var this_array = this.array; var r_array = r.array; for(var i = n; i < this.t; ++i) r_array[i-n] = this_array[i]; r.t = Math.max(this.t-n,0); r.s = this.s; } // (protected) r = this << n function bnpLShiftTo(n,r) { var this_array = this.array; var r_array = r.array; var bs = n%BI_DB; var cbs = BI_DB-bs; var bm = (1<= 0; --i) { r_array[i+ds+1] = (this_array[i]>>cbs)|c; c = (this_array[i]&bm)<= 0; --i) r_array[i] = 0; r_array[ds] = c; r.t = this.t+ds+1; r.s = this.s; r.clamp(); } // (protected) r = this >> n function bnpRShiftTo(n,r) { var this_array = this.array; var r_array = r.array; r.s = this.s; var ds = Math.floor(n/BI_DB); if(ds >= this.t) { r.t = 0; return; } var bs = n%BI_DB; var cbs = BI_DB-bs; var bm = (1<>bs; for(var i = ds+1; i < this.t; ++i) { r_array[i-ds-1] |= (this_array[i]&bm)<>bs; } if(bs > 0) r_array[this.t-ds-1] |= (this.s&bm)<>= BI_DB; } if(a.t < this.t) { c -= a.s; while(i < this.t) { c += this_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } c += this.s; } else { c += this.s; while(i < a.t) { c -= a_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } c -= a.s; } r.s = (c<0)?-1:0; if(c < -1) r_array[i++] = BI_DV+c; else if(c > 0) r_array[i++] = c; r.t = i; r.clamp(); } // (protected) r = this * a, r != this,a (HAC 14.12) // "this" should be the larger one if appropriate. function bnpMultiplyTo(a,r) { var this_array = this.array; var r_array = r.array; var x = this.abs(), y = a.abs(); var y_array = y.array; var i = x.t; r.t = i+y.t; while(--i >= 0) r_array[i] = 0; for(i = 0; i < y.t; ++i) r_array[i+x.t] = x.am(0,y_array[i],r,i,0,x.t); r.s = 0; r.clamp(); if(this.s != a.s) BigInteger.ZERO.subTo(r,r); } // (protected) r = this^2, r != this (HAC 14.16) function bnpSquareTo(r) { var x = this.abs(); var x_array = x.array; var r_array = r.array; var i = r.t = 2*x.t; while(--i >= 0) r_array[i] = 0; for(i = 0; i < x.t-1; ++i) { var c = x.am(i,x_array[i],r,2*i,0,1); if((r_array[i+x.t]+=x.am(i+1,2*x_array[i],r,2*i+1,c,x.t-i-1)) >= BI_DV) { r_array[i+x.t] -= BI_DV; r_array[i+x.t+1] = 1; } } if(r.t > 0) r_array[r.t-1] += x.am(i,x_array[i],r,2*i,0,1); r.s = 0; r.clamp(); } // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) // r != q, this != m. q or r may be null. function bnpDivRemTo(m,q,r) { var pm = m.abs(); if(pm.t <= 0) return; var pt = this.abs(); if(pt.t < pm.t) { if(q != null) q.fromInt(0); if(r != null) this.copyTo(r); return; } if(r == null) r = nbi(); var y = nbi(), ts = this.s, ms = m.s; var pm_array = pm.array; var nsh = BI_DB-nbits(pm_array[pm.t-1]); // normalize modulus if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } else { pm.copyTo(y); pt.copyTo(r); } var ys = y.t; var y_array = y.array; var y0 = y_array[ys-1]; if(y0 == 0) return; var yt = y0*(1<1)?y_array[ys-2]>>BI_F2:0); var d1 = BI_FV/yt, d2 = (1<= 0) { r_array[r.t++] = 1; r.subTo(t,r); } BigInteger.ONE.dlShiftTo(ys,t); t.subTo(y,y); // "negative" y so we can replace sub with am later while(y.t < ys) y_array[y.t++] = 0; while(--j >= 0) { // Estimate quotient digit var qd = (r_array[--i]==y0)?BI_DM:Math.floor(r_array[i]*d1+(r_array[i-1]+e)*d2); if((r_array[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out y.dlShiftTo(j,t); r.subTo(t,r); while(r_array[i] < --qd) r.subTo(t,r); } } if(q != null) { r.drShiftTo(ys,q); if(ts != ms) BigInteger.ZERO.subTo(q,q); } r.t = ys; r.clamp(); if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder if(ts < 0) BigInteger.ZERO.subTo(r,r); } // (public) this mod a function bnMod(a) { var r = nbi(); this.abs().divRemTo(a,null,r); if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); return r; } // Modular reduction using "classic" algorithm function Classic(m) { this.m = m; } function cConvert(x) { if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); else return x; } function cRevert(x) { return x; } function cReduce(x) { x.divRemTo(this.m,null,x); } function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } Classic.prototype.convert = cConvert; Classic.prototype.revert = cRevert; Classic.prototype.reduce = cReduce; Classic.prototype.mulTo = cMulTo; Classic.prototype.sqrTo = cSqrTo; // (protected) return "-1/this % 2^DB"; useful for Mont. reduction // justification: // xy == 1 (mod m) // xy = 1+km // xy(2-xy) = (1+km)(1-km) // x[y(2-xy)] = 1-k^2m^2 // x[y(2-xy)] == 1 (mod m^2) // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. // JS multiply "overflows" differently from C/C++, so care is needed here. function bnpInvDigit() { var this_array = this.array; if(this.t < 1) return 0; var x = this_array[0]; if((x&1) == 0) return 0; var y = x&3; // y == 1/x mod 2^2 y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 // last step - calculate inverse mod DV directly; // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints y = (y*(2-x*y%BI_DV))%BI_DV; // y == 1/x mod 2^dbits // we really want the negative inverse, and -DV < y < DV return (y>0)?BI_DV-y:-y; } // Montgomery reduction function Montgomery(m) { this.m = m; this.mp = m.invDigit(); this.mpl = this.mp&0x7fff; this.mph = this.mp>>15; this.um = (1<<(BI_DB-15))-1; this.mt2 = 2*m.t; } // xR mod m function montConvert(x) { var r = nbi(); x.abs().dlShiftTo(this.m.t,r); r.divRemTo(this.m,null,r); if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); return r; } // x/R mod m function montRevert(x) { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } // x = x/R mod m (HAC 14.32) function montReduce(x) { var x_array = x.array; while(x.t <= this.mt2) // pad x so am has enough room later x_array[x.t++] = 0; for(var i = 0; i < this.m.t; ++i) { // faster way of calculating u0 = x[i]*mp mod DV var j = x_array[i]&0x7fff; var u0 = (j*this.mpl+(((j*this.mph+(x_array[i]>>15)*this.mpl)&this.um)<<15))&BI_DM; // use am to combine the multiply-shift-add into one call j = i+this.m.t; x_array[j] += this.m.am(0,u0,x,i,0,this.m.t); // propagate carry while(x_array[j] >= BI_DV) { x_array[j] -= BI_DV; x_array[++j]++; } } x.clamp(); x.drShiftTo(this.m.t,x); if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); } // r = "x^2/R mod m"; x != r function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } // r = "xy/R mod m"; x,y != r function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } Montgomery.prototype.convert = montConvert; Montgomery.prototype.revert = montRevert; Montgomery.prototype.reduce = montReduce; Montgomery.prototype.mulTo = montMulTo; Montgomery.prototype.sqrTo = montSqrTo; // (protected) true iff this is even function bnpIsEven() { var this_array = this.array; return ((this.t>0)?(this_array[0]&1):this.s) == 0; } // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) function bnpExp(e,z) { if(e > 0xffffffff || e < 1) return BigInteger.ONE; var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; g.copyTo(r); while(--i >= 0) { z.sqrTo(r,r2); if((e&(1< 0) z.mulTo(r2,g,r); else { var t = r; r = r2; r2 = t; } } return z.revert(r); } // (public) this^e % m, 0 <= e < 2^32 function bnModPowInt(e,m) { var z; if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); return this.exp(e,z); } // protected BigInteger.prototype.copyTo = bnpCopyTo; BigInteger.prototype.fromInt = bnpFromInt; BigInteger.prototype.fromString = bnpFromString; BigInteger.prototype.clamp = bnpClamp; BigInteger.prototype.dlShiftTo = bnpDLShiftTo; BigInteger.prototype.drShiftTo = bnpDRShiftTo; BigInteger.prototype.lShiftTo = bnpLShiftTo; BigInteger.prototype.rShiftTo = bnpRShiftTo; BigInteger.prototype.subTo = bnpSubTo; BigInteger.prototype.multiplyTo = bnpMultiplyTo; BigInteger.prototype.squareTo = bnpSquareTo; BigInteger.prototype.divRemTo = bnpDivRemTo; BigInteger.prototype.invDigit = bnpInvDigit; BigInteger.prototype.isEven = bnpIsEven; BigInteger.prototype.exp = bnpExp; // public BigInteger.prototype.toString = bnToString; BigInteger.prototype.negate = bnNegate; BigInteger.prototype.abs = bnAbs; BigInteger.prototype.compareTo = bnCompareTo; BigInteger.prototype.bitLength = bnBitLength; BigInteger.prototype.mod = bnMod; BigInteger.prototype.modPowInt = bnModPowInt; // "constants" BigInteger.ZERO = nbv(0); BigInteger.ONE = nbv(1); // Copyright (c) 2005 Tom Wu // All Rights Reserved. // See "LICENSE" for details. // Extended JavaScript BN functions, required for RSA private ops. // (public) function bnClone() { var r = nbi(); this.copyTo(r); return r; } // (public) return value as integer function bnIntValue() { var this_array = this.array; if(this.s < 0) { if(this.t == 1) return this_array[0]-BI_DV; else if(this.t == 0) return -1; } else if(this.t == 1) return this_array[0]; else if(this.t == 0) return 0; // assumes 16 < DB < 32 return ((this_array[1]&((1<<(32-BI_DB))-1))<>24; } // (public) return value as short (assumes DB>=16) function bnShortValue() { var this_array = this.array; return (this.t==0)?this.s:(this_array[0]<<16)>>16; } // (protected) return x s.t. r^x < DV function bnpChunkSize(r) { return Math.floor(Math.LN2*BI_DB/Math.log(r)); } // (public) 0 if this == 0, 1 if this > 0 function bnSigNum() { var this_array = this.array; if(this.s < 0) return -1; else if(this.t <= 0 || (this.t == 1 && this_array[0] <= 0)) return 0; else return 1; } // (protected) convert to radix string function bnpToRadix(b) { if(b == null) b = 10; if(this.signum() == 0 || b < 2 || b > 36) return "0"; var cs = this.chunkSize(b); var a = Math.pow(b,cs); var d = nbv(a), y = nbi(), z = nbi(), r = ""; this.divRemTo(d,y,z); while(y.signum() > 0) { r = (a+z.intValue()).toString(b).substr(1) + r; y.divRemTo(d,y,z); } return z.intValue().toString(b) + r; } // (protected) convert from radix string function bnpFromRadix(s,b) { this.fromInt(0); if(b == null) b = 10; var cs = this.chunkSize(b); var d = Math.pow(b,cs), mi = false, j = 0, w = 0; for(var i = 0; i < s.length; ++i) { var x = intAt(s,i); if(x < 0) { if(s.charAt(i) == "-" && this.signum() == 0) mi = true; continue; } w = b*w+x; if(++j >= cs) { this.dMultiply(d); this.dAddOffset(w,0); j = 0; w = 0; } } if(j > 0) { this.dMultiply(Math.pow(b,j)); this.dAddOffset(w,0); } if(mi) BigInteger.ZERO.subTo(this,this); } // (protected) alternate constructor function bnpFromNumber(a,b,c) { if("number" == typeof b) { // new BigInteger(int,int,RNG) if(a < 2) this.fromInt(1); else { this.fromNumber(a,c); if(!this.testBit(a-1)) // force MSB set this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); if(this.isEven()) this.dAddOffset(1,0); // force odd while(!this.isProbablePrime(b)) { this.dAddOffset(2,0); if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); } } } else { // new BigInteger(int,RNG) var x = new Array(), t = a&7; x.length = (a>>3)+1; b.nextBytes(x); if(t > 0) x[0] &= ((1< 0) { if(p < BI_DB && (d = this_array[i]>>p) != (this.s&BI_DM)>>p) r[k++] = d|(this.s<<(BI_DB-p)); while(i >= 0) { if(p < 8) { d = (this_array[i]&((1<>(p+=BI_DB-8); } else { d = (this_array[i]>>(p-=8))&0xff; if(p <= 0) { p += BI_DB; --i; } } if((d&0x80) != 0) d |= -256; if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; if(k > 0 || d != this.s) r[k++] = d; } } return r; } function bnEquals(a) { return(this.compareTo(a)==0); } function bnMin(a) { return(this.compareTo(a)<0)?this:a; } function bnMax(a) { return(this.compareTo(a)>0)?this:a; } // (protected) r = this op a (bitwise) function bnpBitwiseTo(a,op,r) { var this_array = this.array; var a_array = a.array; var r_array = r.array; var i, f, m = Math.min(a.t,this.t); for(i = 0; i < m; ++i) r_array[i] = op(this_array[i],a_array[i]); if(a.t < this.t) { f = a.s&BI_DM; for(i = m; i < this.t; ++i) r_array[i] = op(this_array[i],f); r.t = this.t; } else { f = this.s&BI_DM; for(i = m; i < a.t; ++i) r_array[i] = op(f,a_array[i]); r.t = a.t; } r.s = op(this.s,a.s); r.clamp(); } // (public) this & a function op_and(x,y) { return x&y; } function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } // (public) this | a function op_or(x,y) { return x|y; } function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } // (public) this ^ a function op_xor(x,y) { return x^y; } function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } // (public) this & ~a function op_andnot(x,y) { return x&~y; } function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } // (public) ~this function bnNot() { var this_array = this.array; var r = nbi(); var r_array = r.array; for(var i = 0; i < this.t; ++i) r_array[i] = BI_DM&~this_array[i]; r.t = this.t; r.s = ~this.s; return r; } // (public) this << n function bnShiftLeft(n) { var r = nbi(); if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); return r; } // (public) this >> n function bnShiftRight(n) { var r = nbi(); if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); return r; } // return index of lowest 1-bit in x, x < 2^31 function lbit(x) { if(x == 0) return -1; var r = 0; if((x&0xffff) == 0) { x >>= 16; r += 16; } if((x&0xff) == 0) { x >>= 8; r += 8; } if((x&0xf) == 0) { x >>= 4; r += 4; } if((x&3) == 0) { x >>= 2; r += 2; } if((x&1) == 0) ++r; return r; } // (public) returns index of lowest 1-bit (or -1 if none) function bnGetLowestSetBit() { var this_array = this.array; for(var i = 0; i < this.t; ++i) if(this_array[i] != 0) return i*BI_DB+lbit(this_array[i]); if(this.s < 0) return this.t*BI_DB; return -1; } // return number of 1 bits in x function cbit(x) { var r = 0; while(x != 0) { x &= x-1; ++r; } return r; } // (public) return number of set bits function bnBitCount() { var r = 0, x = this.s&BI_DM; for(var i = 0; i < this.t; ++i) r += cbit(this_array[i]^x); return r; } // (public) true iff nth bit is set function bnTestBit(n) { var this_array = this.array; var j = Math.floor(n/BI_DB); if(j >= this.t) return(this.s!=0); return((this_array[j]&(1<<(n%BI_DB)))!=0); } // (protected) this op (1<>= BI_DB; } if(a.t < this.t) { c += a.s; while(i < this.t) { c += this_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } c += this.s; } else { c += this.s; while(i < a.t) { c += a_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } c += a.s; } r.s = (c<0)?-1:0; if(c > 0) r_array[i++] = c; else if(c < -1) r_array[i++] = BI_DV+c; r.t = i; r.clamp(); } // (public) this + a function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } // (public) this - a function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } // (public) this * a function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } // (public) this / a function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } // (public) this % a function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } // (public) [this/a,this%a] function bnDivideAndRemainder(a) { var q = nbi(), r = nbi(); this.divRemTo(a,q,r); return new Array(q,r); } // (protected) this *= n, this >= 0, 1 < n < DV function bnpDMultiply(n) { var this_array = this.array; this_array[this.t] = this.am(0,n-1,this,0,0,this.t); ++this.t; this.clamp(); } // (protected) this += n << w words, this >= 0 function bnpDAddOffset(n,w) { var this_array = this.array; while(this.t <= w) this_array[this.t++] = 0; this_array[w] += n; while(this_array[w] >= BI_DV) { this_array[w] -= BI_DV; if(++w >= this.t) this_array[this.t++] = 0; ++this_array[w]; } } // A "null" reducer function NullExp() {} function nNop(x) { return x; } function nMulTo(x,y,r) { x.multiplyTo(y,r); } function nSqrTo(x,r) { x.squareTo(r); } NullExp.prototype.convert = nNop; NullExp.prototype.revert = nNop; NullExp.prototype.mulTo = nMulTo; NullExp.prototype.sqrTo = nSqrTo; // (public) this^e function bnPow(e) { return this.exp(e,new NullExp()); } // (protected) r = lower n words of "this * a", a.t <= n // "this" should be the larger one if appropriate. function bnpMultiplyLowerTo(a,n,r) { var r_array = r.array; var a_array = a.array; var i = Math.min(this.t+a.t,n); r.s = 0; // assumes a,this >= 0 r.t = i; while(i > 0) r_array[--i] = 0; var j; for(j = r.t-this.t; i < j; ++i) r_array[i+this.t] = this.am(0,a_array[i],r,i,0,this.t); for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a_array[i],r,i,0,n-i); r.clamp(); } // (protected) r = "this * a" without lower n words, n > 0 // "this" should be the larger one if appropriate. function bnpMultiplyUpperTo(a,n,r) { var r_array = r.array; var a_array = a.array; --n; var i = r.t = this.t+a.t-n; r.s = 0; // assumes a,this >= 0 while(--i >= 0) r_array[i] = 0; for(i = Math.max(n-this.t,0); i < a.t; ++i) r_array[this.t+i-n] = this.am(n-i,a_array[i],r,0,0,this.t+i-n); r.clamp(); r.drShiftTo(1,r); } // Barrett modular reduction function Barrett(m) { // setup Barrett this.r2 = nbi(); this.q3 = nbi(); BigInteger.ONE.dlShiftTo(2*m.t,this.r2); this.mu = this.r2.divide(m); this.m = m; } function barrettConvert(x) { if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); else if(x.compareTo(this.m) < 0) return x; else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } } function barrettRevert(x) { return x; } // x = x mod m (HAC 14.42) function barrettReduce(x) { x.drShiftTo(this.m.t-1,this.r2); if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); x.subTo(this.r2,x); while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); } // r = x^2 mod m; x != r function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } // r = x*y mod m; x,y != r function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } Barrett.prototype.convert = barrettConvert; Barrett.prototype.revert = barrettRevert; Barrett.prototype.reduce = barrettReduce; Barrett.prototype.mulTo = barrettMulTo; Barrett.prototype.sqrTo = barrettSqrTo; // (public) this^e % m (HAC 14.85) function bnModPow(e,m) { var e_array = e.array; var i = e.bitLength(), k, r = nbv(1), z; if(i <= 0) return r; else if(i < 18) k = 1; else if(i < 48) k = 3; else if(i < 144) k = 4; else if(i < 768) k = 5; else k = 6; if(i < 8) z = new Classic(m); else if(m.isEven()) z = new Barrett(m); else z = new Montgomery(m); // precomputation var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { var g2 = nbi(); z.sqrTo(g[1],g2); while(n <= km) { g[n] = nbi(); z.mulTo(g2,g[n-2],g[n]); n += 2; } } var j = e.t-1, w, is1 = true, r2 = nbi(), t; i = nbits(e_array[j])-1; while(j >= 0) { if(i >= k1) w = (e_array[j]>>(i-k1))&km; else { w = (e_array[j]&((1<<(i+1))-1))<<(k1-i); if(j > 0) w |= e_array[j-1]>>(BI_DB+i-k1); } n = k; while((w&1) == 0) { w >>= 1; --n; } if((i -= n) < 0) { i += BI_DB; --j; } if(is1) { // ret == 1, don't bother squaring or multiplying it g[w].copyTo(r); is1 = false; } else { while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } z.mulTo(r2,g[w],r); } while(j >= 0 && (e_array[j]&(1< 0) { x.rShiftTo(g,x); y.rShiftTo(g,y); } while(x.signum() > 0) { if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); if(x.compareTo(y) >= 0) { x.subTo(y,x); x.rShiftTo(1,x); } else { y.subTo(x,y); y.rShiftTo(1,y); } } if(g > 0) y.lShiftTo(g,y); return y; } // (protected) this % n, n < 2^26 function bnpModInt(n) { var this_array = this.array; if(n <= 0) return 0; var d = BI_DV%n, r = (this.s<0)?n-1:0; if(this.t > 0) if(d == 0) r = this_array[0]%n; else for(var i = this.t-1; i >= 0; --i) r = (d*r+this_array[i])%n; return r; } // (public) 1/this % m (HAC 14.61) function bnModInverse(m) { var ac = m.isEven(); if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; var u = m.clone(), v = this.clone(); var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); while(u.signum() != 0) { while(u.isEven()) { u.rShiftTo(1,u); if(ac) { if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } a.rShiftTo(1,a); } else if(!b.isEven()) b.subTo(m,b); b.rShiftTo(1,b); } while(v.isEven()) { v.rShiftTo(1,v); if(ac) { if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } c.rShiftTo(1,c); } else if(!d.isEven()) d.subTo(m,d); d.rShiftTo(1,d); } if(u.compareTo(v) >= 0) { u.subTo(v,u); if(ac) a.subTo(c,a); b.subTo(d,b); } else { v.subTo(u,v); if(ac) c.subTo(a,c); d.subTo(b,d); } } if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; if(d.compareTo(m) >= 0) return d.subtract(m); if(d.signum() < 0) d.addTo(m,d); else return d; if(d.signum() < 0) return d.add(m); else return d; } var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509]; var lplim = (1<<26)/lowprimes[lowprimes.length-1]; // (public) test primality with certainty >= 1-.5^t function bnIsProbablePrime(t) { var i, x = this.abs(); var x_array = x.array; if(x.t == 1 && x_array[0] <= lowprimes[lowprimes.length-1]) { for(i = 0; i < lowprimes.length; ++i) if(x_array[0] == lowprimes[i]) return true; return false; } if(x.isEven()) return false; i = 1; while(i < lowprimes.length) { var m = lowprimes[i], j = i+1; while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; m = x.modInt(m); while(i < j) if(m%lowprimes[i++] == 0) return false; } return x.millerRabin(t); } // (protected) true if probably prime (HAC 4.24, Miller-Rabin) function bnpMillerRabin(t) { var n1 = this.subtract(BigInteger.ONE); var k = n1.getLowestSetBit(); if(k <= 0) return false; var r = n1.shiftRight(k); t = (t+1)>>1; if(t > lowprimes.length) t = lowprimes.length; var a = nbi(); for(var i = 0; i < t; ++i) { a.fromInt(lowprimes[i]); var y = a.modPow(r,this); if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { var j = 1; while(j++ < k && y.compareTo(n1) != 0) { y = y.modPowInt(2,this); if(y.compareTo(BigInteger.ONE) == 0) return false; } if(y.compareTo(n1) != 0) return false; } } return true; } // protected BigInteger.prototype.chunkSize = bnpChunkSize; BigInteger.prototype.toRadix = bnpToRadix; BigInteger.prototype.fromRadix = bnpFromRadix; BigInteger.prototype.fromNumber = bnpFromNumber; BigInteger.prototype.bitwiseTo = bnpBitwiseTo; BigInteger.prototype.changeBit = bnpChangeBit; BigInteger.prototype.addTo = bnpAddTo; BigInteger.prototype.dMultiply = bnpDMultiply; BigInteger.prototype.dAddOffset = bnpDAddOffset; BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; BigInteger.prototype.modInt = bnpModInt; BigInteger.prototype.millerRabin = bnpMillerRabin; // public BigInteger.prototype.clone = bnClone; BigInteger.prototype.intValue = bnIntValue; BigInteger.prototype.byteValue = bnByteValue; BigInteger.prototype.shortValue = bnShortValue; BigInteger.prototype.signum = bnSigNum; BigInteger.prototype.toByteArray = bnToByteArray; BigInteger.prototype.equals = bnEquals; BigInteger.prototype.min = bnMin; BigInteger.prototype.max = bnMax; BigInteger.prototype.and = bnAnd; BigInteger.prototype.or = bnOr; BigInteger.prototype.xor = bnXor; BigInteger.prototype.andNot = bnAndNot; BigInteger.prototype.not = bnNot; BigInteger.prototype.shiftLeft = bnShiftLeft; BigInteger.prototype.shiftRight = bnShiftRight; BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; BigInteger.prototype.bitCount = bnBitCount; BigInteger.prototype.testBit = bnTestBit; BigInteger.prototype.setBit = bnSetBit; BigInteger.prototype.clearBit = bnClearBit; BigInteger.prototype.flipBit = bnFlipBit; BigInteger.prototype.add = bnAdd; BigInteger.prototype.subtract = bnSubtract; BigInteger.prototype.multiply = bnMultiply; BigInteger.prototype.divide = bnDivide; BigInteger.prototype.remainder = bnRemainder; BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; BigInteger.prototype.modPow = bnModPow; BigInteger.prototype.modInverse = bnModInverse; BigInteger.prototype.pow = bnPow; BigInteger.prototype.gcd = bnGCD; BigInteger.prototype.isProbablePrime = bnIsProbablePrime; // BigInteger interfaces not implemented in jsbn: // BigInteger(int signum, byte[] magnitude) // double doubleValue() // float floatValue() // int hashCode() // long longValue() // static BigInteger valueOf(long val) // prng4.js - uses Arcfour as a PRNG function Arcfour() { this.i = 0; this.j = 0; this.S = new Array(); } // Initialize arcfour context from key, an array of ints, each from [0..255] function ARC4init(key) { var i, j, t; for(i = 0; i < 256; ++i) this.S[i] = i; j = 0; for(i = 0; i < 256; ++i) { j = (j + this.S[i] + key[i % key.length]) & 255; t = this.S[i]; this.S[i] = this.S[j]; this.S[j] = t; } this.i = 0; this.j = 0; } function ARC4next() { var t; this.i = (this.i + 1) & 255; this.j = (this.j + this.S[this.i]) & 255; t = this.S[this.i]; this.S[this.i] = this.S[this.j]; this.S[this.j] = t; return this.S[(t + this.S[this.i]) & 255]; } Arcfour.prototype.init = ARC4init; Arcfour.prototype.next = ARC4next; // Plug in your RNG constructor here function prng_newstate() { return new Arcfour(); } // Pool size must be a multiple of 4 and greater than 32. // An array of bytes the size of the pool will be passed to init() var rng_psize = 256; // Random number generator - requires a PRNG backend, e.g. prng4.js // For best results, put code like // // in your main HTML document. var rng_state; var rng_pool; var rng_pptr; // Mix in a 32-bit integer into the pool function rng_seed_int(x) { rng_pool[rng_pptr++] ^= x & 255; rng_pool[rng_pptr++] ^= (x >> 8) & 255; rng_pool[rng_pptr++] ^= (x >> 16) & 255; rng_pool[rng_pptr++] ^= (x >> 24) & 255; if(rng_pptr >= rng_psize) rng_pptr -= rng_psize; } // Mix in the current time (w/milliseconds) into the pool function rng_seed_time() { // Use pre-computed date to avoid making the benchmark // results dependent on the current date. rng_seed_int(1122926989487); } // Initialize the pool with junk if needed. if(rng_pool == null) { rng_pool = new Array(); rng_pptr = 0; var t; while(rng_pptr < rng_psize) { // extract some randomness from Math.random() t = Math.floor(65536 * MyMath.random()); rng_pool[rng_pptr++] = t >>> 8; rng_pool[rng_pptr++] = t & 255; } rng_pptr = 0; rng_seed_time(); //rng_seed_int(window.screenX); //rng_seed_int(window.screenY); } function rng_get_byte() { if(rng_state == null) { rng_seed_time(); rng_state = prng_newstate(); rng_state.init(rng_pool); for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) rng_pool[rng_pptr] = 0; rng_pptr = 0; //rng_pool = null; } // TODO: allow reseeding after first request return rng_state.next(); } function rng_get_bytes(ba) { var i; for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); } function SecureRandom() {} SecureRandom.prototype.nextBytes = rng_get_bytes; // Depends on jsbn.js and rng.js // convert a (hex) string to a bignum object function parseBigInt(str,r) { return new BigInteger(str,r); } function linebrk(s,n) { var ret = ""; var i = 0; while(i + n < s.length) { ret += s.substring(i,i+n) + "\n"; i += n; } return ret + s.substring(i,s.length); } function byte2Hex(b) { if(b < 0x10) return "0" + b.toString(16); else return b.toString(16); } // PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint function pkcs1pad2(s,n) { if(n < s.length + 11) { alert("Message too long for RSA"); return null; } var ba = new Array(); var i = s.length - 1; while(i >= 0 && n > 0) ba[--n] = s.charCodeAt(i--); ba[--n] = 0; var rng = new SecureRandom(); var x = new Array(); while(n > 2) { // random non-zero pad x[0] = 0; while(x[0] == 0) rng.nextBytes(x); ba[--n] = x[0]; } ba[--n] = 2; ba[--n] = 0; return new BigInteger(ba); } // "empty" RSA key constructor function RSAKey() { this.n = null; this.e = 0; this.d = null; this.p = null; this.q = null; this.dmp1 = null; this.dmq1 = null; this.coeff = null; } // Set the public key fields N and e from hex strings function RSASetPublic(N,E) { if(N != null && E != null && N.length > 0 && E.length > 0) { this.n = parseBigInt(N,16); this.e = parseInt(E,16); } else alert("Invalid RSA public key"); } // Perform raw public operation on "x": return x^e (mod n) function RSADoPublic(x) { return x.modPowInt(this.e, this.n); } // Return the PKCS#1 RSA encryption of "text" as an even-length hex string function RSAEncrypt(text) { var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3); if(m == null) return null; var c = this.doPublic(m); if(c == null) return null; var h = c.toString(16); if((h.length & 1) == 0) return h; else return "0" + h; } // Return the PKCS#1 RSA encryption of "text" as a Base64-encoded string //function RSAEncryptB64(text) { // var h = this.encrypt(text); // if(h) return hex2b64(h); else return null; //} // protected RSAKey.prototype.doPublic = RSADoPublic; // public RSAKey.prototype.setPublic = RSASetPublic; RSAKey.prototype.encrypt = RSAEncrypt; //RSAKey.prototype.encrypt_b64 = RSAEncryptB64; // Depends on rsa.js and jsbn2.js // Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext function pkcs1unpad2(d,n) { var b = d.toByteArray(); var i = 0; while(i < b.length && b[i] == 0) ++i; if(b.length-i != n-1 || b[i] != 2) return null; ++i; while(b[i] != 0) if(++i >= b.length) return null; var ret = ""; while(++i < b.length) ret += String.fromCharCode(b[i]); return ret; } // Set the private key fields N, e, and d from hex strings function RSASetPrivate(N,E,D) { if(N != null && E != null && N.length > 0 && E.length > 0) { this.n = parseBigInt(N,16); this.e = parseInt(E,16); this.d = parseBigInt(D,16); } else alert("Invalid RSA private key"); } // Set the private key fields N, e, d and CRT params from hex strings function RSASetPrivateEx(N,E,D,P,Q,DP,DQ,C) { if(N != null && E != null && N.length > 0 && E.length > 0) { this.n = parseBigInt(N,16); this.e = parseInt(E,16); this.d = parseBigInt(D,16); this.p = parseBigInt(P,16); this.q = parseBigInt(Q,16); this.dmp1 = parseBigInt(DP,16); this.dmq1 = parseBigInt(DQ,16); this.coeff = parseBigInt(C,16); } else alert("Invalid RSA private key"); } // Generate a new random private key B bits long, using public expt E function RSAGenerate(B,E) { var rng = new SecureRandom(); var qs = B>>1; this.e = parseInt(E,16); var ee = new BigInteger(E,16); for(;;) { for(;;) { this.p = new BigInteger(B-qs,1,rng); if(this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) break; } for(;;) { this.q = new BigInteger(qs,1,rng); if(this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) break; } if(this.p.compareTo(this.q) <= 0) { var t = this.p; this.p = this.q; this.q = t; } var p1 = this.p.subtract(BigInteger.ONE); var q1 = this.q.subtract(BigInteger.ONE); var phi = p1.multiply(q1); if(phi.gcd(ee).compareTo(BigInteger.ONE) == 0) { this.n = this.p.multiply(this.q); this.d = ee.modInverse(phi); this.dmp1 = this.d.mod(p1); this.dmq1 = this.d.mod(q1); this.coeff = this.q.modInverse(this.p); break; } } } // Perform raw private operation on "x": return x^d (mod n) function RSADoPrivate(x) { if(this.p == null || this.q == null) return x.modPow(this.d, this.n); // TODO: re-calculate any missing CRT params var xp = x.mod(this.p).modPow(this.dmp1, this.p); var xq = x.mod(this.q).modPow(this.dmq1, this.q); while(xp.compareTo(xq) < 0) xp = xp.add(this.p); return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq); } // Return the PKCS#1 RSA decryption of "ctext". // "ctext" is an even-length hex string and the output is a plain string. function RSADecrypt(ctext) { var c = parseBigInt(ctext, 16); var m = this.doPrivate(c); if(m == null) return null; return pkcs1unpad2(m, (this.n.bitLength()+7)>>3); } // Return the PKCS#1 RSA decryption of "ctext". // "ctext" is a Base64-encoded string and the output is a plain string. //function RSAB64Decrypt(ctext) { // var h = b64tohex(ctext); // if(h) return this.decrypt(h); else return null; //} // protected RSAKey.prototype.doPrivate = RSADoPrivate; // public RSAKey.prototype.setPrivate = RSASetPrivate; RSAKey.prototype.setPrivateEx = RSASetPrivateEx; RSAKey.prototype.generate = RSAGenerate; RSAKey.prototype.decrypt = RSADecrypt; //RSAKey.prototype.b64_decrypt = RSAB64Decrypt; nValue="a5261939975948bb7a58dffe5ff54e65f0498f9175f5a09288810b8975871e99af3b5dd94057b0fc07535f5f97444504fa35169d461d0d30cf0192e307727c065168c788771c561a9400fb49175e9e6aa4e23fe11af69e9412dd23b0cb6684c4c2429bce139e848ab26d0829073351f4acd36074eafd036a5eb83359d2a698d3"; eValue="10001"; dValue="8e9912f6d3645894e8d38cb58c0db81ff516cf4c7e5a14c7f1eddb1459d2cded4d8d293fc97aee6aefb861859c8b6a3d1dfe710463e1f9ddc72048c09751971c4a580aa51eb523357a3cc48d31cfad1d4a165066ed92d4748fb6571211da5cb14bc11b6e2df7c1a559e6d5ac1cd5c94703a22891464fba23d0d965086277a161"; pValue="d090ce58a92c75233a6486cb0a9209bf3583b64f540c76f5294bb97d285eed33aec220bde14b2417951178ac152ceab6da7090905b478195498b352048f15e7d"; qValue="cab575dc652bb66df15a0359609d51d1db184750c00c6698b90ef3465c99655103edbf0d54c56aec0ce3c4d22592338092a126a0cc49f65a4a30d222b411e58f"; dmp1Value="1a24bca8e273df2f0e47c199bbf678604e7df7215480c77c8db39f49b000ce2cf7500038acfff5433b7d582a01f1826e6f4d42e1c57f5e1fef7b12aabc59fd25"; dmq1Value="3d06982efbbe47339e1f6d36b1216b8a741d410b0c662f54f7118b27b9a4ec9d914337eb39841d8666f3034408cf94f5b62f11c402fc994fe15a05493150d9fd"; coeffValue="3a3e731acd8960b7ff9eb81a7ff93bd1cfa74cbd56987db58b4594fb09c09084db1734c8143f98b602b981aaa9243ca28deb69b5b280ee8dcee0fd2625e53250"; setupEngine(am3, 28); // So that v8 understands assertEq() if (assertEq == undefined) { function assertEq(to_check, expected) { if ( to_check !== expected ) { print( "Error: Assertion failed: got \"" + to_check + "\", expected \"" + expected + "\"" ); } } } function check_correctness(text, hash) { var RSA = new RSAKey(); RSA.setPublic(nValue, eValue); RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue); var encrypted = RSA.encrypt(text); var decrypted = RSA.decrypt(encrypted); assertEq( encrypted, hash ); assertEq( decrypted, text ); } // All 'correct' hashes here come from v8's javascript shell built off of tag 2.3.4 check_correctness("Hello! I am some text.", "142b19b40fee712ab9468be296447d38c7dfe81a7850f11ae6aa21e49396a4e90bd6ba4aa385105e15960a59f95447dfad89671da6e08ed42229939583753be84d07558abb4feee4d46a92fd31d962679a1a5f4bf0fb7af414b9a756e18df7e6d1e96971cc66769f3b27d61ad932f2211373e0de388dc040557d4c3c3fe74320"); check_correctness("PLEASE ENCRYPT ME. I AM TEXT. I AM DIEING TO BE ENCRYPTED. OH WHY WONT YOU ENCRYPT ME!?", "490c1fae87d7046296e4b34b357912a72cb7c38c0da3198f1ac3aad3489662ce02663ec5ea1be58ae73a275f3096b16c491f3520ebf822df6c65cc95e28be1cc0a4454dfba3fdd402c3a9de0db2f308989bfc1a7fada0dd680db76d24b2d96bd6b7e7d7e7f962deb953038bae06092f7bb9bcb40bba4ec92e040df32f98e035e"); check_correctness("x","46c1b7cf202171b1b588e9ecf250e768dcf3b300490e859d508f708e702ef799bc496b9fac7634d60a82644653c5fd25b808393b234567116b8890d5f119c7c74dae7c97c8e40ba78ca2dc3e3d78ce859a7fa3815f42c27d0607eafc3940896abb6019cc28b2ff875531ed581a6351728a8df0d607b7c2c26265bf3dddbe4f84"); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/v8-v5/check-deltablue.js0000644000175000017500000006177111545150464023452 0ustar chr1schr1s// Copyright 2008 the V8 project authors. All rights reserved. // Copyright 1996 John Maloney and Mario Wolczko. // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // This implementation of the DeltaBlue benchmark is derived // from the Smalltalk implementation by John Maloney and Mario // Wolczko. Some parts have been translated directly, whereas // others have been modified more aggresively to make it feel // more like a JavaScript program. //var DeltaBlue = new BenchmarkSuite('DeltaBlue', 71104, [ // new Benchmark('DeltaBlue', deltaBlue) //]); /** * A JavaScript implementation of the DeltaBlue constrain-solving * algorithm, as described in: * * "The DeltaBlue Algorithm: An Incremental Constraint Hierarchy Solver" * Bjorn N. Freeman-Benson and John Maloney * January 1990 Communications of the ACM, * also available as University of Washington TR 89-08-06. * * Beware: this benchmark is written in a grotesque style where * the constraint model is built by side-effects from constructors. * I've kept it this way to avoid deviating too much from the original * implementation. */ function alert(msg) { print(msg); assertEq(false, true); } /* --- O b j e c t M o d e l --- */ Object.prototype.inheritsFrom = function (shuper) { function Inheriter() { } Inheriter.prototype = shuper.prototype; this.prototype = new Inheriter(); this.superConstructor = shuper; } function OrderedCollection() { this.elms = new Array(); } OrderedCollection.prototype.add = function (elm) { this.elms.push(elm); } OrderedCollection.prototype.at = function (index) { return this.elms[index]; } OrderedCollection.prototype.size = function () { return this.elms.length; } OrderedCollection.prototype.removeFirst = function () { return this.elms.pop(); } OrderedCollection.prototype.remove = function (elm) { var index = 0, skipped = 0; for (var i = 0; i < this.elms.length; i++) { var value = this.elms[i]; if (value != elm) { this.elms[index] = value; index++; } else { skipped++; } } for (var i = 0; i < skipped; i++) this.elms.pop(); } /* --- * * S t r e n g t h * --- */ /** * Strengths are used to measure the relative importance of constraints. * New strengths may be inserted in the strength hierarchy without * disrupting current constraints. Strengths cannot be created outside * this class, so pointer comparison can be used for value comparison. */ function Strength(strengthValue, name) { this.strengthValue = strengthValue; this.name = name; } Strength.stronger = function (s1, s2) { return s1.strengthValue < s2.strengthValue; } Strength.weaker = function (s1, s2) { return s1.strengthValue > s2.strengthValue; } Strength.weakestOf = function (s1, s2) { return this.weaker(s1, s2) ? s1 : s2; } Strength.strongest = function (s1, s2) { return this.stronger(s1, s2) ? s1 : s2; } Strength.prototype.nextWeaker = function () { switch (this.strengthValue) { case 0: return Strength.WEAKEST; case 1: return Strength.WEAK_DEFAULT; case 2: return Strength.NORMAL; case 3: return Strength.STRONG_DEFAULT; case 4: return Strength.PREFERRED; case 5: return Strength.REQUIRED; } } // Strength constants. Strength.REQUIRED = new Strength(0, "required"); Strength.STONG_PREFERRED = new Strength(1, "strongPreferred"); Strength.PREFERRED = new Strength(2, "preferred"); Strength.STRONG_DEFAULT = new Strength(3, "strongDefault"); Strength.NORMAL = new Strength(4, "normal"); Strength.WEAK_DEFAULT = new Strength(5, "weakDefault"); Strength.WEAKEST = new Strength(6, "weakest"); /* --- * * C o n s t r a i n t * --- */ /** * An abstract class representing a system-maintainable relationship * (or "constraint") between a set of variables. A constraint supplies * a strength instance variable; concrete subclasses provide a means * of storing the constrained variables and other information required * to represent a constraint. */ function Constraint(strength) { this.strength = strength; } /** * Activate this constraint and attempt to satisfy it. */ Constraint.prototype.addConstraint = function () { this.addToGraph(); planner.incrementalAdd(this); } /** * Attempt to find a way to enforce this constraint. If successful, * record the solution, perhaps modifying the current dataflow * graph. Answer the constraint that this constraint overrides, if * there is one, or nil, if there isn't. * Assume: I am not already satisfied. */ Constraint.prototype.satisfy = function (mark) { this.chooseMethod(mark); if (!this.isSatisfied()) { if (this.strength == Strength.REQUIRED) alert("Could not satisfy a required constraint!"); return null; } this.markInputs(mark); var out = this.output(); var overridden = out.determinedBy; if (overridden != null) overridden.markUnsatisfied(); out.determinedBy = this; if (!planner.addPropagate(this, mark)) alert("Cycle encountered"); out.mark = mark; return overridden; } Constraint.prototype.destroyConstraint = function () { if (this.isSatisfied()) planner.incrementalRemove(this); else this.removeFromGraph(); } /** * Normal constraints are not input constraints. An input constraint * is one that depends on external state, such as the mouse, the * keybord, a clock, or some arbitraty piece of imperative code. */ Constraint.prototype.isInput = function () { return false; } /* --- * * U n a r y C o n s t r a i n t * --- */ /** * Abstract superclass for constraints having a single possible output * variable. */ function UnaryConstraint(v, strength) { UnaryConstraint.superConstructor.call(this, strength); this.myOutput = v; this.satisfied = false; this.addConstraint(); } UnaryConstraint.inheritsFrom(Constraint); /** * Adds this constraint to the constraint graph */ UnaryConstraint.prototype.addToGraph = function () { this.myOutput.addConstraint(this); this.satisfied = false; } /** * Decides if this constraint can be satisfied and records that * decision. */ UnaryConstraint.prototype.chooseMethod = function (mark) { this.satisfied = (this.myOutput.mark != mark) && Strength.stronger(this.strength, this.myOutput.walkStrength); } /** * Returns true if this constraint is satisfied in the current solution. */ UnaryConstraint.prototype.isSatisfied = function () { return this.satisfied; } UnaryConstraint.prototype.markInputs = function (mark) { // has no inputs } /** * Returns the current output variable. */ UnaryConstraint.prototype.output = function () { return this.myOutput; } /** * Calculate the walkabout strength, the stay flag, and, if it is * 'stay', the value for the current output of this constraint. Assume * this constraint is satisfied. */ UnaryConstraint.prototype.recalculate = function () { this.myOutput.walkStrength = this.strength; this.myOutput.stay = !this.isInput(); if (this.myOutput.stay) this.execute(); // Stay optimization } /** * Records that this constraint is unsatisfied */ UnaryConstraint.prototype.markUnsatisfied = function () { this.satisfied = false; } UnaryConstraint.prototype.inputsKnown = function () { return true; } UnaryConstraint.prototype.removeFromGraph = function () { if (this.myOutput != null) this.myOutput.removeConstraint(this); this.satisfied = false; } /* --- * * S t a y C o n s t r a i n t * --- */ /** * Variables that should, with some level of preference, stay the same. * Planners may exploit the fact that instances, if satisfied, will not * change their output during plan execution. This is called "stay * optimization". */ function StayConstraint(v, str) { StayConstraint.superConstructor.call(this, v, str); } StayConstraint.inheritsFrom(UnaryConstraint); StayConstraint.prototype.execute = function () { // Stay constraints do nothing } /* --- * * E d i t C o n s t r a i n t * --- */ /** * A unary input constraint used to mark a variable that the client * wishes to change. */ function EditConstraint(v, str) { EditConstraint.superConstructor.call(this, v, str); } EditConstraint.inheritsFrom(UnaryConstraint); /** * Edits indicate that a variable is to be changed by imperative code. */ EditConstraint.prototype.isInput = function () { return true; } EditConstraint.prototype.execute = function () { // Edit constraints do nothing } /* --- * * B i n a r y C o n s t r a i n t * --- */ var Direction = new Object(); Direction.NONE = 0; Direction.FORWARD = 1; Direction.BACKWARD = -1; /** * Abstract superclass for constraints having two possible output * variables. */ function BinaryConstraint(var1, var2, strength) { BinaryConstraint.superConstructor.call(this, strength); this.v1 = var1; this.v2 = var2; this.direction = Direction.NONE; this.addConstraint(); } BinaryConstraint.inheritsFrom(Constraint); /** * Decides if this constratint can be satisfied and which way it * should flow based on the relative strength of the variables related, * and record that decision. */ BinaryConstraint.prototype.chooseMethod = function (mark) { if (this.v1.mark == mark) { this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v2.walkStrength)) ? Direction.FORWARD : Direction.NONE; } if (this.v2.mark == mark) { this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v1.walkStrength)) ? Direction.BACKWARD : Direction.NONE; } if (Strength.weaker(this.v1.walkStrength, this.v2.walkStrength)) { this.direction = Strength.stronger(this.strength, this.v1.walkStrength) ? Direction.BACKWARD : Direction.NONE; } else { this.direction = Strength.stronger(this.strength, this.v2.walkStrength) ? Direction.FORWARD : Direction.BACKWARD } } /** * Add this constraint to the constraint graph */ BinaryConstraint.prototype.addToGraph = function () { this.v1.addConstraint(this); this.v2.addConstraint(this); this.direction = Direction.NONE; } /** * Answer true if this constraint is satisfied in the current solution. */ BinaryConstraint.prototype.isSatisfied = function () { return this.direction != Direction.NONE; } /** * Mark the input variable with the given mark. */ BinaryConstraint.prototype.markInputs = function (mark) { this.input().mark = mark; } /** * Returns the current input variable */ BinaryConstraint.prototype.input = function () { return (this.direction == Direction.FORWARD) ? this.v1 : this.v2; } /** * Returns the current output variable */ BinaryConstraint.prototype.output = function () { return (this.direction == Direction.FORWARD) ? this.v2 : this.v1; } /** * Calculate the walkabout strength, the stay flag, and, if it is * 'stay', the value for the current output of this * constraint. Assume this constraint is satisfied. */ BinaryConstraint.prototype.recalculate = function () { var ihn = this.input(), out = this.output(); out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength); out.stay = ihn.stay; if (out.stay) this.execute(); } /** * Record the fact that this constraint is unsatisfied. */ BinaryConstraint.prototype.markUnsatisfied = function () { this.direction = Direction.NONE; } BinaryConstraint.prototype.inputsKnown = function (mark) { var i = this.input(); return i.mark == mark || i.stay || i.determinedBy == null; } BinaryConstraint.prototype.removeFromGraph = function () { if (this.v1 != null) this.v1.removeConstraint(this); if (this.v2 != null) this.v2.removeConstraint(this); this.direction = Direction.NONE; } /* --- * * S c a l e C o n s t r a i n t * --- */ /** * Relates two variables by the linear scaling relationship: "v2 = * (v1 * scale) + offset". Either v1 or v2 may be changed to maintain * this relationship but the scale factor and offset are considered * read-only. */ function ScaleConstraint(src, scale, offset, dest, strength) { this.direction = Direction.NONE; this.scale = scale; this.offset = offset; ScaleConstraint.superConstructor.call(this, src, dest, strength); } ScaleConstraint.inheritsFrom(BinaryConstraint); /** * Adds this constraint to the constraint graph. */ ScaleConstraint.prototype.addToGraph = function () { ScaleConstraint.superConstructor.prototype.addToGraph.call(this); this.scale.addConstraint(this); this.offset.addConstraint(this); } ScaleConstraint.prototype.removeFromGraph = function () { ScaleConstraint.superConstructor.prototype.removeFromGraph.call(this); if (this.scale != null) this.scale.removeConstraint(this); if (this.offset != null) this.offset.removeConstraint(this); } ScaleConstraint.prototype.markInputs = function (mark) { ScaleConstraint.superConstructor.prototype.markInputs.call(this, mark); this.scale.mark = this.offset.mark = mark; } /** * Enforce this constraint. Assume that it is satisfied. */ ScaleConstraint.prototype.execute = function () { if (this.direction == Direction.FORWARD) { this.v2.value = this.v1.value * this.scale.value + this.offset.value; } else { this.v1.value = (this.v2.value - this.offset.value) / this.scale.value; } } /** * Calculate the walkabout strength, the stay flag, and, if it is * 'stay', the value for the current output of this constraint. Assume * this constraint is satisfied. */ ScaleConstraint.prototype.recalculate = function () { var ihn = this.input(), out = this.output(); out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength); out.stay = ihn.stay && this.scale.stay && this.offset.stay; if (out.stay) this.execute(); } /* --- * * E q u a l i t y C o n s t r a i n t * --- */ /** * Constrains two variables to have the same value. */ function EqualityConstraint(var1, var2, strength) { EqualityConstraint.superConstructor.call(this, var1, var2, strength); } EqualityConstraint.inheritsFrom(BinaryConstraint); /** * Enforce this constraint. Assume that it is satisfied. */ EqualityConstraint.prototype.execute = function () { this.output().value = this.input().value; } /* --- * * V a r i a b l e * --- */ /** * A constrained variable. In addition to its value, it maintain the * structure of the constraint graph, the current dataflow graph, and * various parameters of interest to the DeltaBlue incremental * constraint solver. **/ function Variable(name, initialValue) { this.value = initialValue || 0; this.constraints = new OrderedCollection(); this.determinedBy = null; this.mark = 0; this.walkStrength = Strength.WEAKEST; this.stay = true; this.name = name; } /** * Add the given constraint to the set of all constraints that refer * this variable. */ Variable.prototype.addConstraint = function (c) { this.constraints.add(c); } /** * Removes all traces of c from this variable. */ Variable.prototype.removeConstraint = function (c) { this.constraints.remove(c); if (this.determinedBy == c) this.determinedBy = null; } /* --- * * P l a n n e r * --- */ /** * The DeltaBlue planner */ function Planner() { this.currentMark = 0; } /** * Attempt to satisfy the given constraint and, if successful, * incrementally update the dataflow graph. Details: If satifying * the constraint is successful, it may override a weaker constraint * on its output. The algorithm attempts to resatisfy that * constraint using some other method. This process is repeated * until either a) it reaches a variable that was not previously * determined by any constraint or b) it reaches a constraint that * is too weak to be satisfied using any of its methods. The * variables of constraints that have been processed are marked with * a unique mark value so that we know where we've been. This allows * the algorithm to avoid getting into an infinite loop even if the * constraint graph has an inadvertent cycle. */ Planner.prototype.incrementalAdd = function (c) { var mark = this.newMark(); var overridden = c.satisfy(mark); while (overridden != null) overridden = overridden.satisfy(mark); } /** * Entry point for retracting a constraint. Remove the given * constraint and incrementally update the dataflow graph. * Details: Retracting the given constraint may allow some currently * unsatisfiable downstream constraint to be satisfied. We therefore collect * a list of unsatisfied downstream constraints and attempt to * satisfy each one in turn. This list is traversed by constraint * strength, strongest first, as a heuristic for avoiding * unnecessarily adding and then overriding weak constraints. * Assume: c is satisfied. */ Planner.prototype.incrementalRemove = function (c) { var out = c.output(); c.markUnsatisfied(); c.removeFromGraph(); var unsatisfied = this.removePropagateFrom(out); var strength = Strength.REQUIRED; do { for (var i = 0; i < unsatisfied.size(); i++) { var u = unsatisfied.at(i); if (u.strength == strength) this.incrementalAdd(u); } strength = strength.nextWeaker(); } while (strength != Strength.WEAKEST); } /** * Select a previously unused mark value. */ Planner.prototype.newMark = function () { return ++this.currentMark; } /** * Extract a plan for resatisfaction starting from the given source * constraints, usually a set of input constraints. This method * assumes that stay optimization is desired; the plan will contain * only constraints whose output variables are not stay. Constraints * that do no computation, such as stay and edit constraints, are * not included in the plan. * Details: The outputs of a constraint are marked when it is added * to the plan under construction. A constraint may be appended to * the plan when all its input variables are known. A variable is * known if either a) the variable is marked (indicating that has * been computed by a constraint appearing earlier in the plan), b) * the variable is 'stay' (i.e. it is a constant at plan execution * time), or c) the variable is not determined by any * constraint. The last provision is for past states of history * variables, which are not stay but which are also not computed by * any constraint. * Assume: sources are all satisfied. */ Planner.prototype.makePlan = function (sources) { var mark = this.newMark(); var plan = new Plan(); var todo = sources; while (todo.size() > 0) { var c = todo.removeFirst(); if (c.output().mark != mark && c.inputsKnown(mark)) { plan.addConstraint(c); c.output().mark = mark; this.addConstraintsConsumingTo(c.output(), todo); } } return plan; } /** * Extract a plan for resatisfying starting from the output of the * given constraints, usually a set of input constraints. */ Planner.prototype.extractPlanFromConstraints = function (constraints) { var sources = new OrderedCollection(); for (var i = 0; i < constraints.size(); i++) { var c = constraints.at(i); if (c.isInput() && c.isSatisfied()) // not in plan already and eligible for inclusion sources.add(c); } return this.makePlan(sources); } /** * Recompute the walkabout strengths and stay flags of all variables * downstream of the given constraint and recompute the actual * values of all variables whose stay flag is true. If a cycle is * detected, remove the given constraint and answer * false. Otherwise, answer true. * Details: Cycles are detected when a marked variable is * encountered downstream of the given constraint. The sender is * assumed to have marked the inputs of the given constraint with * the given mark. Thus, encountering a marked node downstream of * the output constraint means that there is a path from the * constraint's output to one of its inputs. */ Planner.prototype.addPropagate = function (c, mark) { var todo = new OrderedCollection(); todo.add(c); while (todo.size() > 0) { var d = todo.removeFirst(); if (d.output().mark == mark) { this.incrementalRemove(c); return false; } d.recalculate(); this.addConstraintsConsumingTo(d.output(), todo); } return true; } /** * Update the walkabout strengths and stay flags of all variables * downstream of the given constraint. Answer a collection of * unsatisfied constraints sorted in order of decreasing strength. */ Planner.prototype.removePropagateFrom = function (out) { out.determinedBy = null; out.walkStrength = Strength.WEAKEST; out.stay = true; var unsatisfied = new OrderedCollection(); var todo = new OrderedCollection(); todo.add(out); while (todo.size() > 0) { var v = todo.removeFirst(); for (var i = 0; i < v.constraints.size(); i++) { var c = v.constraints.at(i); if (!c.isSatisfied()) unsatisfied.add(c); } var determining = v.determinedBy; for (var i = 0; i < v.constraints.size(); i++) { var next = v.constraints.at(i); if (next != determining && next.isSatisfied()) { next.recalculate(); todo.add(next.output()); } } } return unsatisfied; } Planner.prototype.addConstraintsConsumingTo = function (v, coll) { var determining = v.determinedBy; var cc = v.constraints; for (var i = 0; i < cc.size(); i++) { var c = cc.at(i); if (c != determining && c.isSatisfied()) coll.add(c); } } /* --- * * P l a n * --- */ /** * A Plan is an ordered list of constraints to be executed in sequence * to resatisfy all currently satisfiable constraints in the face of * one or more changing inputs. */ function Plan() { this.v = new OrderedCollection(); } Plan.prototype.addConstraint = function (c) { this.v.add(c); } Plan.prototype.size = function () { return this.v.size(); } Plan.prototype.constraintAt = function (index) { return this.v.at(index); } Plan.prototype.execute = function () { for (var i = 0; i < this.size(); i++) { var c = this.constraintAt(i); c.execute(); } } /* --- * * M a i n * --- */ /** * This is the standard DeltaBlue benchmark. A long chain of equality * constraints is constructed with a stay constraint on one end. An * edit constraint is then added to the opposite end and the time is * measured for adding and removing this constraint, and extracting * and executing a constraint satisfaction plan. There are two cases. * In case 1, the added constraint is stronger than the stay * constraint and values must propagate down the entire length of the * chain. In case 2, the added constraint is weaker than the stay * constraint so it cannot be accomodated. The cost in this case is, * of course, very low. Typical situations lie somewhere between these * two extremes. */ function chainTest(n) { planner = new Planner(); var prev = null, first = null, last = null; // Build chain of n equality constraints for (var i = 0; i <= n; i++) { var name = "v" + i; var v = new Variable(name); if (prev != null) new EqualityConstraint(prev, v, Strength.REQUIRED); if (i == 0) first = v; if (i == n) last = v; prev = v; } new StayConstraint(last, Strength.STRONG_DEFAULT); var edit = new EditConstraint(first, Strength.PREFERRED); var edits = new OrderedCollection(); edits.add(edit); var plan = planner.extractPlanFromConstraints(edits); for (var i = 0; i < 100; i++) { first.value = i; plan.execute(); assertEq(last.value, i); } } /** * This test constructs a two sets of variables related to each * other by a simple linear transformation (scale and offset). The * time is measured to change a variable on either side of the * mapping and to change the scale and offset factors. */ function projectionTest(n) { planner = new Planner(); var scale = new Variable("scale", 10); var offset = new Variable("offset", 1000); var src = null, dst = null; var dests = new OrderedCollection(); for (var i = 0; i < n; i++) { src = new Variable("src" + i, i); dst = new Variable("dst" + i, i); dests.add(dst); new StayConstraint(src, Strength.NORMAL); new ScaleConstraint(src, scale, offset, dst, Strength.REQUIRED); } change(src, 17); assertEq(dst.value, 1170); change(dst, 1050); assertEq(src.value, 5); change(scale, 5); for (var i = 0; i < n - 1; i++) { assertEq(dests.at(i).value, i * 5 + 1000); } change(offset, 2000); for (var i = 0; i < n - 1; i++) { assertEq(dests.at(i).value, i * 5 + 2000); } } function change(v, newValue) { var edit = new EditConstraint(v, Strength.PREFERRED); var edits = new OrderedCollection(); edits.add(edit); var plan = planner.extractPlanFromConstraints(edits); for (var i = 0; i < 10; i++) { v.value = newValue; plan.execute(); } edit.destroyConstraint(); } // Global variable holding the current planner. var planner = null; function deltaBlue() { chainTest(100); projectionTest(100); } deltaBlue(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/v8-v5/check-earley-boyer.js0000644000175000017500000057601111545150464024106 0ustar chr1schr1s// This file is automatically generated by scheme2js, except for the // benchmark harness code at the beginning and end of the file. //var EarleyBoyer = new BenchmarkSuite('EarleyBoyer', 765819, [ // new Benchmark("Earley", function () { BgL_earleyzd2benchmarkzd2(); }), // new Benchmark("Boyer", function () { BgL_nboyerzd2benchmarkzd2(); }) //]); /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /* * To use write/prints/... the default-output port has to be set first. * Simply setting SC_DEFAULT_OUT and SC_ERROR_OUT to the desired values * should do the trick. * In the following example the std-out and error-port are redirected to * a DIV. function initRuntime() { function escapeHTML(s) { var tmp = s; tmp = tmp.replace(/&/g, "&"); tmp = tmp.replace(//g, ">"); tmp = tmp.replace(/ /g, " "); tmp = tmp.replace(/\n/g, "
"); tmp = tmp.replace(/\t/g, "    "); return tmp; } document.write("
"); SC_DEFAULT_OUT = new sc_GenericOutputPort( function(s) { var stdout = document.getElementById('stdout'); stdout.innerHTML = stdout.innerHTML + escapeHTML(s); }); SC_ERROR_OUT = SC_DEFAULT_OUT; } */ function sc_print_debug() { sc_print.apply(null, arguments); } /*** META ((export *js*)) */ var sc_JS_GLOBALS = this; var __sc_LINE=-1; var __sc_FILE=""; /*** META ((export #t)) */ function sc_alert() { var len = arguments.length; var s = ""; var i; for( i = 0; i < len; i++ ) { s += sc_toDisplayString(arguments[ i ]); } return alert( s ); } /*** META ((export #t)) */ function sc_typeof( x ) { return typeof x; } /*** META ((export #t)) */ function sc_error() { var a = [sc_jsstring2symbol("*error*")]; for (var i = 0; i < arguments.length; i++) { a[i+1] = arguments[i]; } throw a; } /*** META ((export #t) (peephole (prefix "throw "))) */ function sc_raise(obj) { throw obj; } /*** META ((export with-handler-lambda)) */ function sc_withHandlerLambda(handler, body) { try { return body(); } catch(e) { if (!e._internalException) return handler(e); else throw e; } } var sc_properties = new Object(); /*** META ((export #t)) */ function sc_putpropBang(sym, key, val) { var ht = sc_properties[sym]; if (!ht) { ht = new Object(); sc_properties[sym] = ht; } ht[key] = val; } /*** META ((export #t)) */ function sc_getprop(sym, key) { var ht = sc_properties[sym]; if (ht) { if (key in ht) return ht[key]; else return false; } else return false; } /*** META ((export #t)) */ function sc_rempropBang(sym, key) { var ht = sc_properties[sym]; if (ht) delete ht[key]; } /*** META ((export #t)) */ function sc_any2String(o) { return jsstring2string(sc_toDisplayString(o)); } /*** META ((export #t) (peephole (infix 2 2 "===")) (type bool)) */ function sc_isEqv(o1, o2) { return (o1 === o2); } /*** META ((export #t) (peephole (infix 2 2 "===")) (type bool)) */ function sc_isEq(o1, o2) { return (o1 === o2); } /*** META ((export #t) (type bool)) */ function sc_isNumber(n) { return (typeof n === "number"); } /*** META ((export #t) (type bool)) */ function sc_isComplex(n) { return sc_isNumber(n); } /*** META ((export #t) (type bool)) */ function sc_isReal(n) { return sc_isNumber(n); } /*** META ((export #t) (type bool)) */ function sc_isRational(n) { return sc_isReal(n); } /*** META ((export #t) (type bool)) */ function sc_isInteger(n) { return (parseInt(n) === n); } /*** META ((export #t) (type bool) (peephole (postfix ", false"))) */ // we don't have exact numbers... function sc_isExact(n) { return false; } /*** META ((export #t) (peephole (postfix ", true")) (type bool)) */ function sc_isInexact(n) { return true; } /*** META ((export = =fx =fl) (type bool) (peephole (infix 2 2 "==="))) */ function sc_equal(x) { for (var i = 1; i < arguments.length; i++) if (x !== arguments[i]) return false; return true; } /*** META ((export < = arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export > >fx >fl) (type bool) (peephole (infix 2 2 ">"))) */ function sc_greater(x, y) { for (var i = 1; i < arguments.length; i++) { if (x <= arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export <= <=fx <=fl) (type bool) (peephole (infix 2 2 "<="))) */ function sc_lessEqual(x, y) { for (var i = 1; i < arguments.length; i++) { if (x > arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export >= >=fl >=fx) (type bool) (peephole (infix 2 2 ">="))) */ function sc_greaterEqual(x, y) { for (var i = 1; i < arguments.length; i++) { if (x < arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export #t) (type bool) (peephole (postfix "=== 0"))) */ function sc_isZero(x) { return (x === 0); } /*** META ((export #t) (type bool) (peephole (postfix "> 0"))) */ function sc_isPositive(x) { return (x > 0); } /*** META ((export #t) (type bool) (peephole (postfix "< 0"))) */ function sc_isNegative(x) { return (x < 0); } /*** META ((export #t) (type bool) (peephole (postfix "%2===1"))) */ function sc_isOdd(x) { return (x % 2 === 1); } /*** META ((export #t) (type bool) (peephole (postfix "%2===0"))) */ function sc_isEven(x) { return (x % 2 === 0); } /*** META ((export #t)) */ var sc_max = Math.max; /*** META ((export #t)) */ var sc_min = Math.min; /*** META ((export + +fx +fl) (peephole (infix 0 #f "+" "0"))) */ function sc_plus() { var sum = 0; for (var i = 0; i < arguments.length; i++) sum += arguments[i]; return sum; } /*** META ((export * *fx *fl) (peephole (infix 0 #f "*" "1"))) */ function sc_multi() { var product = 1; for (var i = 0; i < arguments.length; i++) product *= arguments[i]; return product; } /*** META ((export - -fx -fl) (peephole (minus))) */ function sc_minus(x) { if (arguments.length === 1) return -x; else { var res = x; for (var i = 1; i < arguments.length; i++) res -= arguments[i]; return res; } } /*** META ((export / /fl) (peephole (div))) */ function sc_div(x) { if (arguments.length === 1) return 1/x; else { var res = x; for (var i = 1; i < arguments.length; i++) res /= arguments[i]; return res; } } /*** META ((export #t)) */ var sc_abs = Math.abs; /*** META ((export quotient /fx) (peephole (hole 2 "parseInt(" x "/" y ")"))) */ function sc_quotient(x, y) { return parseInt(x / y); } /*** META ((export #t) (peephole (infix 2 2 "%"))) */ function sc_remainder(x, y) { return x % y; } /*** META ((export #t) (peephole (modulo))) */ function sc_modulo(x, y) { var remainder = x % y; // if they don't have the same sign if ((remainder * y) < 0) return remainder + y; else return remainder; } function sc_euclid_gcd(a, b) { var temp; if (a === 0) return b; if (b === 0) return a; if (a < 0) {a = -a;}; if (b < 0) {b = -b;}; if (b > a) {temp = a; a = b; b = temp;}; while (true) { a %= b; if(a === 0) {return b;}; b %= a; if(b === 0) {return a;}; }; return b; } /*** META ((export #t)) */ function sc_gcd() { var gcd = 0; for (var i = 0; i < arguments.length; i++) gcd = sc_euclid_gcd(gcd, arguments[i]); return gcd; } /*** META ((export #t)) */ function sc_lcm() { var lcm = 1; for (var i = 0; i < arguments.length; i++) { var f = Math.round(arguments[i] / sc_euclid_gcd(arguments[i], lcm)); lcm *= Math.abs(f); } return lcm; } // LIMITATION: numerator and denominator don't make sense in floating point world. //var SC_MAX_DECIMALS = 1000000 // // function sc_numerator(x) { // var rounded = Math.round(x * SC_MAX_DECIMALS); // return Math.round(rounded / sc_euclid_gcd(rounded, SC_MAX_DECIMALS)); // } // function sc_denominator(x) { // var rounded = Math.round(x * SC_MAX_DECIMALS); // return Math.round(SC_MAX_DECIMALS / sc_euclid_gcd(rounded, SC_MAX_DECIMALS)); // } /*** META ((export #t)) */ var sc_floor = Math.floor; /*** META ((export #t)) */ var sc_ceiling = Math.ceil; /*** META ((export #t)) */ var sc_truncate = parseInt; /*** META ((export #t)) */ var sc_round = Math.round; // LIMITATION: sc_rationalize doesn't make sense in a floating point world. /*** META ((export #t)) */ var sc_exp = Math.exp; /*** META ((export #t)) */ var sc_log = Math.log; /*** META ((export #t)) */ var sc_sin = Math.sin; /*** META ((export #t)) */ var sc_cos = Math.cos; /*** META ((export #t)) */ var sc_tan = Math.tan; /*** META ((export #t)) */ var sc_asin = Math.asin; /*** META ((export #t)) */ var sc_acos = Math.acos; /*** META ((export #t)) */ var sc_atan = Math.atan; /*** META ((export #t)) */ var sc_sqrt = Math.sqrt; /*** META ((export #t)) */ var sc_expt = Math.pow; // LIMITATION: we don't have complex numbers. // LIMITATION: the following functions are hence not implemented. // LIMITATION: make-rectangular, make-polar, real-part, imag-part, magnitude, angle // LIMITATION: 2 argument atan /*** META ((export #t) (peephole (id))) */ function sc_exact2inexact(x) { return x; } /*** META ((export #t) (peephole (id))) */ function sc_inexact2exact(x) { return x; } function sc_number2jsstring(x, radix) { if (radix) return x.toString(radix); else return x.toString(); } function sc_jsstring2number(s, radix) { if (s === "") return false; if (radix) { var t = parseInt(s, radix); if (!t && t !== 0) return false; // verify that each char is in range. (parseInt ignores leading // white and trailing chars) var allowedChars = "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix+1); if ((new RegExp("^["+allowedChars+"]*$", "i")).test(s)) return t; else return false; } else { var t = +s; // does not ignore trailing chars. if (!t && t !== 0) return false; // simply verify that first char is not whitespace. var c = s.charAt(0); // if +c is 0, but the char is not "0", then we have a whitespace. if (+c === 0 && c !== "0") return false; return t; } } /*** META ((export #t) (type bool) (peephole (not))) */ function sc_not(b) { return b === false; } /*** META ((export #t) (type bool)) */ function sc_isBoolean(b) { return (b === true) || (b === false); } function sc_Pair(car, cdr) { this.car = car; this.cdr = cdr; } sc_Pair.prototype.toString = function() { return sc_toDisplayString(this); }; sc_Pair.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) { var current = this; var res = "("; while(true) { res += writeOrDisplay(current.car); if (sc_isPair(current.cdr)) { res += " "; current = current.cdr; } else if (current.cdr !== null) { res += " . " + writeOrDisplay(current.cdr); break; } else // current.cdr == null break; } res += ")"; return res; }; sc_Pair.prototype.sc_toDisplayString = function() { return this.sc_toWriteOrDisplayString(sc_toDisplayString); }; sc_Pair.prototype.sc_toWriteString = function() { return this.sc_toWriteOrDisplayString(sc_toWriteString); }; // sc_Pair.prototype.sc_toWriteCircleString in IO.js /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_Pair"))) */ function sc_isPair(p) { return (p instanceof sc_Pair); } function sc_isPairEqual(p1, p2, comp) { return (comp(p1.car, p2.car) && comp(p1.cdr, p2.cdr)); } /*** META ((export #t) (peephole (hole 2 "new sc_Pair(" car ", " cdr ")"))) */ function sc_cons(car, cdr) { return new sc_Pair(car, cdr); } /*** META ((export cons*)) */ function sc_consStar() { var res = arguments[arguments.length - 1]; for (var i = arguments.length-2; i >= 0; i--) res = new sc_Pair(arguments[i], res); return res; } /*** META ((export #t) (peephole (postfix ".car"))) */ function sc_car(p) { return p.car; } /*** META ((export #t) (peephole (postfix ".cdr"))) */ function sc_cdr(p) { return p.cdr; } /*** META ((export #t) (peephole (hole 2 p ".car = " val))) */ function sc_setCarBang(p, val) { p.car = val; } /*** META ((export #t) (peephole (hole 2 p ".cdr = " val))) */ function sc_setCdrBang(p, val) { p.cdr = val; } /*** META ((export #t) (peephole (postfix ".car.car"))) */ function sc_caar(p) { return p.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.car"))) */ function sc_cadr(p) { return p.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.cdr"))) */ function sc_cdar(p) { return p.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr"))) */ function sc_cddr(p) { return p.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".car.car.car"))) */ function sc_caaar(p) { return p.car.car.car; } /*** META ((export #t) (peephole (postfix ".car.cdr.car"))) */ function sc_cadar(p) { return p.car.cdr.car; } /*** META ((export #t) (peephole (postfix ".cdr.car.car"))) */ function sc_caadr(p) { return p.cdr.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.car"))) */ function sc_caddr(p) { return p.cdr.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.car.cdr"))) */ function sc_cdaar(p) { return p.car.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.car.cdr"))) */ function sc_cdadr(p) { return p.cdr.car.cdr; } /*** META ((export #t) (peephole (postfix ".car.cdr.cdr"))) */ function sc_cddar(p) { return p.car.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr"))) */ function sc_cdddr(p) { return p.cdr.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".car.car.car.car"))) */ function sc_caaaar(p) { return p.car.car.car.car; } /*** META ((export #t) (peephole (postfix ".car.cdr.car.car"))) */ function sc_caadar(p) { return p.car.cdr.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.car.car.car"))) */ function sc_caaadr(p) { return p.cdr.car.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.car.car"))) */ function sc_caaddr(p) { return p.cdr.cdr.car.car; } /*** META ((export #t) (peephole (postfix ".car.car.car.cdr"))) */ function sc_cdaaar(p) { return p.car.car.car.cdr; } /*** META ((export #t) (peephole (postfix ".car.cdr.car.cdr"))) */ function sc_cdadar(p) { return p.car.cdr.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.car.car.cdr"))) */ function sc_cdaadr(p) { return p.cdr.car.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.car.cdr"))) */ function sc_cdaddr(p) { return p.cdr.cdr.car.cdr; } /*** META ((export #t) (peephole (postfix ".car.car.cdr.car"))) */ function sc_cadaar(p) { return p.car.car.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.cdr.cdr.car"))) */ function sc_caddar(p) { return p.car.cdr.cdr.car; } /*** META ((export #t) (peephole (postfix ".cdr.car.cdr.car"))) */ function sc_cadadr(p) { return p.cdr.car.cdr.car; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr.car"))) */ function sc_cadddr(p) { return p.cdr.cdr.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.car.cdr.cdr"))) */ function sc_cddaar(p) { return p.car.car.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".car.cdr.cdr.cdr"))) */ function sc_cdddar(p) { return p.car.cdr.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.car.cdr.cdr"))) */ function sc_cddadr(p) { return p.cdr.car.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr.cdr"))) */ function sc_cddddr(p) { return p.cdr.cdr.cdr.cdr; } /*** META ((export #t)) */ function sc_lastPair(l) { if (!sc_isPair(l)) sc_error("sc_lastPair: pair expected"); var res = l; var cdr = l.cdr; while (sc_isPair(cdr)) { res = cdr; cdr = res.cdr; } return res; } /*** META ((export #t) (type bool) (peephole (postfix " === null"))) */ function sc_isNull(o) { return (o === null); } /*** META ((export #t) (type bool)) */ function sc_isList(o) { var rabbit; var turtle; var rabbit = o; var turtle = o; while (true) { if (rabbit === null || (rabbit instanceof sc_Pair && rabbit.cdr === null)) return true; // end of list else if ((rabbit instanceof sc_Pair) && (rabbit.cdr instanceof sc_Pair)) { rabbit = rabbit.cdr.cdr; turtle = turtle.cdr; if (rabbit === turtle) return false; // cycle } else return false; // not pair } } /*** META ((export #t)) */ function sc_list() { var res = null; var a = arguments; for (var i = a.length-1; i >= 0; i--) res = new sc_Pair(a[i], res); return res; } /*** META ((export #t)) */ function sc_iota(num, init) { var res = null; if (!init) init = 0; for (var i = num - 1; i >= 0; i--) res = new sc_Pair(i + init, res); return res; } /*** META ((export #t)) */ function sc_makeList(nbEls, fill) { var res = null; for (var i = 0; i < nbEls; i++) res = new sc_Pair(fill, res); return res; } /*** META ((export #t)) */ function sc_length(l) { var res = 0; while (l !== null) { res++; l = l.cdr; } return res; } /*** META ((export #t)) */ function sc_remq(o, l) { var dummy = { cdr : null }; var tail = dummy; while (l !== null) { if (l.car !== o) { tail.cdr = sc_cons(l.car, null); tail = tail.cdr; } l = l.cdr; } return dummy.cdr; } /*** META ((export #t)) */ function sc_remqBang(o, l) { var dummy = { cdr : null }; var tail = dummy; var needsAssig = true; while (l !== null) { if (l.car === o) { needsAssig = true; } else { if (needsAssig) { tail.cdr = l; needsAssig = false; } tail = l; } l = l.cdr; } tail.cdr = null; return dummy.cdr; } /*** META ((export #t)) */ function sc_delete(o, l) { var dummy = { cdr : null }; var tail = dummy; while (l !== null) { if (!sc_isEqual(l.car, o)) { tail.cdr = sc_cons(l.car, null); tail = tail.cdr; } l = l.cdr; } return dummy.cdr; } /*** META ((export #t)) */ function sc_deleteBang(o, l) { var dummy = { cdr : null }; var tail = dummy; var needsAssig = true; while (l !== null) { if (sc_isEqual(l.car, o)) { needsAssig = true; } else { if (needsAssig) { tail.cdr = l; needsAssig = false; } tail = l; } l = l.cdr; } tail.cdr = null; return dummy.cdr; } function sc_reverseAppendBang(l1, l2) { var res = l2; while (l1 !== null) { var tmp = res; res = l1; l1 = l1.cdr; res.cdr = tmp; } return res; } function sc_dualAppend(l1, l2) { if (l1 === null) return l2; if (l2 === null) return l1; var rev = sc_reverse(l1); return sc_reverseAppendBang(rev, l2); } /*** META ((export #t)) */ function sc_append() { if (arguments.length === 0) return null; var res = arguments[arguments.length - 1]; for (var i = arguments.length - 2; i >= 0; i--) res = sc_dualAppend(arguments[i], res); return res; } function sc_dualAppendBang(l1, l2) { if (l1 === null) return l2; if (l2 === null) return l1; var tmp = l1; while (tmp.cdr !== null) tmp=tmp.cdr; tmp.cdr = l2; return l1; } /*** META ((export #t)) */ function sc_appendBang() { var res = null; for (var i = 0; i < arguments.length; i++) res = sc_dualAppendBang(res, arguments[i]); return res; } /*** META ((export #t)) */ function sc_reverse(l1) { var res = null; while (l1 !== null) { res = sc_cons(l1.car, res); l1 = l1.cdr; } return res; } /*** META ((export #t)) */ function sc_reverseBang(l) { return sc_reverseAppendBang(l, null); } /*** META ((export #t)) */ function sc_listTail(l, k) { var res = l; for (var i = 0; i < k; i++) { res = res.cdr; } return res; } /*** META ((export #t)) */ function sc_listRef(l, k) { return sc_listTail(l, k).car; } /* // unoptimized generic versions function sc_memX(o, l, comp) { while (l != null) { if (comp(l.car, o)) return l; l = l.cdr; } return false; } function sc_memq(o, l) { return sc_memX(o, l, sc_isEq); } function sc_memv(o, l) { return sc_memX(o, l, sc_isEqv); } function sc_member(o, l) { return sc_memX(o, l, sc_isEqual); } */ /* optimized versions */ /*** META ((export #t)) */ function sc_memq(o, l) { while (l !== null) { if (l.car === o) return l; l = l.cdr; } return false; } /*** META ((export #t)) */ function sc_memv(o, l) { while (l !== null) { if (l.car === o) return l; l = l.cdr; } return false; } /*** META ((export #t)) */ function sc_member(o, l) { while (l !== null) { if (sc_isEqual(l.car,o)) return l; l = l.cdr; } return false; } /* // generic unoptimized versions function sc_assX(o, al, comp) { while (al != null) { if (comp(al.car.car, o)) return al.car; al = al.cdr; } return false; } function sc_assq(o, al) { return sc_assX(o, al, sc_isEq); } function sc_assv(o, al) { return sc_assX(o, al, sc_isEqv); } function sc_assoc(o, al) { return sc_assX(o, al, sc_isEqual); } */ // optimized versions /*** META ((export #t)) */ function sc_assq(o, al) { while (al !== null) { if (al.car.car === o) return al.car; al = al.cdr; } return false; } /*** META ((export #t)) */ function sc_assv(o, al) { while (al !== null) { if (al.car.car === o) return al.car; al = al.cdr; } return false; } /*** META ((export #t)) */ function sc_assoc(o, al) { while (al !== null) { if (sc_isEqual(al.car.car, o)) return al.car; al = al.cdr; } return false; } /* can be used for mutable strings and characters */ function sc_isCharStringEqual(cs1, cs2) { return cs1.val === cs2.val; } function sc_isCharStringLess(cs1, cs2) { return cs1.val < cs2.val; } function sc_isCharStringGreater(cs1, cs2) { return cs1.val > cs2.val; } function sc_isCharStringLessEqual(cs1, cs2) { return cs1.val <= cs2.val; } function sc_isCharStringGreaterEqual(cs1, cs2) { return cs1.val >= cs2.val; } function sc_isCharStringCIEqual(cs1, cs2) { return cs1.val.toLowerCase() === cs2.val.toLowerCase(); } function sc_isCharStringCILess(cs1, cs2) { return cs1.val.toLowerCase() < cs2.val.toLowerCase(); } function sc_isCharStringCIGreater(cs1, cs2) { return cs1.val.toLowerCase() > cs2.val.toLowerCase(); } function sc_isCharStringCILessEqual(cs1, cs2) { return cs1.val.toLowerCase() <= cs2.val.toLowerCase(); } function sc_isCharStringCIGreaterEqual(cs1, cs2) { return cs1.val.toLowerCase() >= cs2.val.toLowerCase(); } function sc_Char(c) { var cached = sc_Char.lazy[c]; if (cached) return cached; this.val = c; sc_Char.lazy[c] = this; // add return, so FF does not complain. return undefined; } sc_Char.lazy = new Object(); // thanks to Eric sc_Char.char2readable = { "\000": "#\\null", "\007": "#\\bell", "\010": "#\\backspace", "\011": "#\\tab", "\012": "#\\newline", "\014": "#\\page", "\015": "#\\return", "\033": "#\\escape", "\040": "#\\space", "\177": "#\\delete", /* poeticless names */ "\001": "#\\soh", "\002": "#\\stx", "\003": "#\\etx", "\004": "#\\eot", "\005": "#\\enq", "\006": "#\\ack", "\013": "#\\vt", "\016": "#\\so", "\017": "#\\si", "\020": "#\\dle", "\021": "#\\dc1", "\022": "#\\dc2", "\023": "#\\dc3", "\024": "#\\dc4", "\025": "#\\nak", "\026": "#\\syn", "\027": "#\\etb", "\030": "#\\can", "\031": "#\\em", "\032": "#\\sub", "\033": "#\\esc", "\034": "#\\fs", "\035": "#\\gs", "\036": "#\\rs", "\037": "#\\us"}; sc_Char.readable2char = { "null": "\000", "bell": "\007", "backspace": "\010", "tab": "\011", "newline": "\012", "page": "\014", "return": "\015", "escape": "\033", "space": "\040", "delete": "\000", "soh": "\001", "stx": "\002", "etx": "\003", "eot": "\004", "enq": "\005", "ack": "\006", "bel": "\007", "bs": "\010", "ht": "\011", "nl": "\012", "vt": "\013", "np": "\014", "cr": "\015", "so": "\016", "si": "\017", "dle": "\020", "dc1": "\021", "dc2": "\022", "dc3": "\023", "dc4": "\024", "nak": "\025", "syn": "\026", "etb": "\027", "can": "\030", "em": "\031", "sub": "\032", "esc": "\033", "fs": "\034", "gs": "\035", "rs": "\036", "us": "\037", "sp": "\040", "del": "\177"}; sc_Char.prototype.toString = function() { return this.val; }; // sc_toDisplayString == toString sc_Char.prototype.sc_toWriteString = function() { var entry = sc_Char.char2readable[this.val]; if (entry) return entry; else return "#\\" + this.val; }; /*** META ((export #t) (type bool) (peephole (postfix "instanceof sc_Char"))) */ function sc_isChar(c) { return (c instanceof sc_Char); } /*** META ((export char=?) (type bool) (peephole (hole 2 c1 ".val === " c2 ".val"))) */ var sc_isCharEqual = sc_isCharStringEqual; /*** META ((export char?) (type bool) (peephole (hole 2 c1 ".val > " c2 ".val"))) */ var sc_isCharGreater = sc_isCharStringGreater; /*** META ((export char<=?) (type bool) (peephole (hole 2 c1 ".val <= " c2 ".val"))) */ var sc_isCharLessEqual = sc_isCharStringLessEqual; /*** META ((export char>=?) (type bool) (peephole (hole 2 c1 ".val >= " c2 ".val"))) */ var sc_isCharGreaterEqual = sc_isCharStringGreaterEqual; /*** META ((export char-ci=?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() === " c2 ".val.toLowerCase()"))) */ var sc_isCharCIEqual = sc_isCharStringCIEqual; /*** META ((export char-ci?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() > " c2 ".val.toLowerCase()"))) */ var sc_isCharCIGreater = sc_isCharStringCIGreater; /*** META ((export char-ci<=?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() <= " c2 ".val.toLowerCase()"))) */ var sc_isCharCILessEqual = sc_isCharStringCILessEqual; /*** META ((export char-ci>=?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() >= " c2 ".val.toLowerCase()"))) */ var sc_isCharCIGreaterEqual = sc_isCharStringCIGreaterEqual; var SC_NUMBER_CLASS = "0123456789"; var SC_WHITESPACE_CLASS = ' \r\n\t\f'; var SC_LOWER_CLASS = 'abcdefghijklmnopqrstuvwxyz'; var SC_UPPER_CLASS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; function sc_isCharOfClass(c, cl) { return (cl.indexOf(c) != -1); } /*** META ((export #t) (type bool)) */ function sc_isCharAlphabetic(c) { return sc_isCharOfClass(c.val, SC_LOWER_CLASS) || sc_isCharOfClass(c.val, SC_UPPER_CLASS); } /*** META ((export #t) (type bool) (peephole (hole 1 "SC_NUMBER_CLASS.indexOf(" c ".val) != -1"))) */ function sc_isCharNumeric(c) { return sc_isCharOfClass(c.val, SC_NUMBER_CLASS); } /*** META ((export #t) (type bool)) */ function sc_isCharWhitespace(c) { var tmp = c.val; return tmp === " " || tmp === "\r" || tmp === "\n" || tmp === "\t" || tmp === "\f"; } /*** META ((export #t) (type bool) (peephole (hole 1 "SC_UPPER_CLASS.indexOf(" c ".val) != -1"))) */ function sc_isCharUpperCase(c) { return sc_isCharOfClass(c.val, SC_UPPER_CLASS); } /*** META ((export #t) (type bool) (peephole (hole 1 "SC_LOWER_CLASS.indexOf(" c ".val) != -1"))) */ function sc_isCharLowerCase(c) { return sc_isCharOfClass(c.val, SC_LOWER_CLASS); } /*** META ((export #t) (peephole (postfix ".val.charCodeAt(0)"))) */ function sc_char2integer(c) { return c.val.charCodeAt(0); } /*** META ((export #t) (peephole (hole 1 "new sc_Char(String.fromCharCode(" n "))"))) */ function sc_integer2char(n) { return new sc_Char(String.fromCharCode(n)); } /*** META ((export #t) (peephole (hole 1 "new sc_Char(" c ".val.toUpperCase())"))) */ function sc_charUpcase(c) { return new sc_Char(c.val.toUpperCase()); } /*** META ((export #t) (peephole (hole 1 "new sc_Char(" c ".val.toLowerCase())"))) */ function sc_charDowncase(c) { return new sc_Char(c.val.toLowerCase()); } function sc_makeJSStringOfLength(k, c) { var fill; if (c === undefined) fill = " "; else fill = c; var res = ""; var len = 1; // every round doubles the size of fill. while (k >= len) { if (k & len) res = res.concat(fill); fill = fill.concat(fill); len *= 2; } return res; } function sc_makejsString(k, c) { var fill; if (c) fill = c.val; else fill = " "; return sc_makeJSStringOfLength(k, fill); } function sc_jsstring2list(s) { var res = null; for (var i = s.length - 1; i >= 0; i--) res = sc_cons(new sc_Char(s.charAt(i)), res); return res; } function sc_list2jsstring(l) { var a = new Array(); while(l !== null) { a.push(l.car.val); l = l.cdr; } return "".concat.apply("", a); } var sc_Vector = Array; sc_Vector.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) { if (this.length === 0) return "#()"; var res = "#(" + writeOrDisplay(this[0]); for (var i = 1; i < this.length; i++) res += " " + writeOrDisplay(this[i]); res += ")"; return res; }; sc_Vector.prototype.sc_toDisplayString = function() { return this.sc_toWriteOrDisplayString(sc_toDisplayString); }; sc_Vector.prototype.sc_toWriteString = function() { return this.sc_toWriteOrDisplayString(sc_toWriteString); }; /*** META ((export vector? array?) (type bool) (peephole (postfix " instanceof sc_Vector"))) */ function sc_isVector(v) { return (v instanceof sc_Vector); } // only applies to vectors function sc_isVectorEqual(v1, v2, comp) { if (v1.length !== v2.length) return false; for (var i = 0; i < v1.length; i++) if (!comp(v1[i], v2[i])) return false; return true; } /*** META ((export make-vector make-array)) */ function sc_makeVector(size, fill) { var a = new sc_Vector(size); if (fill !== undefined) sc_vectorFillBang(a, fill); return a; } /*** META ((export vector array) (peephole (vector))) */ function sc_vector() { var a = new sc_Vector(); for (var i = 0; i < arguments.length; i++) a.push(arguments[i]); return a; } /*** META ((export vector-length array-length) (peephole (postfix ".length"))) */ function sc_vectorLength(v) { return v.length; } /*** META ((export vector-ref array-ref) (peephole (hole 2 v "[" pos "]"))) */ function sc_vectorRef(v, pos) { return v[pos]; } /*** META ((export vector-set! array-set!) (peephole (hole 3 v "[" pos "] = " val))) */ function sc_vectorSetBang(v, pos, val) { v[pos] = val; } /*** META ((export vector->list array->list)) */ function sc_vector2list(a) { var res = null; for (var i = a.length-1; i >= 0; i--) res = sc_cons(a[i], res); return res; } /*** META ((export list->vector list->array)) */ function sc_list2vector(l) { var a = new sc_Vector(); while(l !== null) { a.push(l.car); l = l.cdr; } return a; } /*** META ((export vector-fill! array-fill!)) */ function sc_vectorFillBang(a, fill) { for (var i = 0; i < a.length; i++) a[i] = fill; } /*** META ((export #t)) */ function sc_copyVector(a, len) { if (len <= a.length) return a.slice(0, len); else { var tmp = a.concat(); tmp.length = len; return tmp; } } /*** META ((export #t) (peephole (hole 3 a ".slice(" start "," end ")"))) */ function sc_vectorCopy(a, start, end) { return a.slice(start, end); } /*** META ((export #t)) */ function sc_vectorCopyBang(target, tstart, source, sstart, send) { if (!sstart) sstart = 0; if (!send) send = source.length; // if target == source we don't want to overwrite not yet copied elements. if (tstart <= sstart) { for (var i = tstart, j = sstart; j < send; i++, j++) { target[i] = source[j]; } } else { var diff = send - sstart; for (var i = tstart + diff - 1, j = send - 1; j >= sstart; i--, j--) { target[i] = source[j]; } } return target; } /*** META ((export #t) (type bool) (peephole (hole 1 "typeof " o " === 'function'"))) */ function sc_isProcedure(o) { return (typeof o === "function"); } /*** META ((export #t)) */ function sc_apply(proc) { var args = new Array(); // first part of arguments are not in list-form. for (var i = 1; i < arguments.length - 1; i++) args.push(arguments[i]); var l = arguments[arguments.length - 1]; while (l !== null) { args.push(l.car); l = l.cdr; } return proc.apply(null, args); } /*** META ((export #t)) */ function sc_map(proc, l1) { if (l1 === undefined) return null; // else var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); var revres = null; while (l1 !== null) { for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } revres = sc_cons(proc.apply(null, applyArgs), revres); } return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_mapBang(proc, l1) { if (l1 === undefined) return null; // else var l1_orig = l1; var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); while (l1 !== null) { var tmp = l1; for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } tmp.car = proc.apply(null, applyArgs); } return l1_orig; } /*** META ((export #t)) */ function sc_forEach(proc, l1) { if (l1 === undefined) return undefined; // else var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); while (l1 !== null) { for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } proc.apply(null, applyArgs); } // add return so FF does not complain. return undefined; } /*** META ((export #t)) */ function sc_filter(proc, l1) { var dummy = { cdr : null }; var tail = dummy; while (l1 !== null) { if (proc(l1.car) !== false) { tail.cdr = sc_cons(l1.car, null); tail = tail.cdr; } l1 = l1.cdr; } return dummy.cdr; } /*** META ((export #t)) */ function sc_filterBang(proc, l1) { var head = sc_cons("dummy", l1); var it = head; var next = l1; while (next !== null) { if (proc(next.car) !== false) { it.cdr = next it = next; } next = next.cdr; } it.cdr = null; return head.cdr; } function sc_filterMap1(proc, l1) { var revres = null; while (l1 !== null) { var tmp = proc(l1.car) if (tmp !== false) revres = sc_cons(tmp, revres); l1 = l1.cdr; } return sc_reverseAppendBang(revres, null); } function sc_filterMap2(proc, l1, l2) { var revres = null; while (l1 !== null) { var tmp = proc(l1.car, l2.car); if(tmp !== false) revres = sc_cons(tmp, revres); l1 = l1.cdr; l2 = l2.cdr } return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_filterMap(proc, l1, l2, l3) { if (l2 === undefined) return sc_filterMap1(proc, l1); else if (l3 === undefined) return sc_filterMap2(proc, l1, l2); // else var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); var revres = null; while (l1 !== null) { for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } var tmp = proc.apply(null, applyArgs); if(tmp !== false) revres = sc_cons(tmp, revres); } return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_any(proc, l) { var revres = null; while (l !== null) { var tmp = proc(l.car); if(tmp !== false) return tmp; l = l.cdr; } return false; } /*** META ((export any?) (peephole (hole 2 "sc_any(" proc "," l ") !== false"))) */ function sc_anyPred(proc, l) { return sc_any(proc, l)!== false; } /*** META ((export #t)) */ function sc_every(proc, l) { var revres = null; var tmp = true; while (l !== null) { tmp = proc(l.car); if (tmp === false) return false; l = l.cdr; } return tmp; } /*** META ((export every?) (peephole (hole 2 "sc_every(" proc "," l ") !== false"))) */ function sc_everyPred(proc, l) { var tmp = sc_every(proc, l); if (tmp !== false) return true; return false; } /*** META ((export #t) (peephole (postfix "()"))) */ function sc_force(o) { return o(); } /*** META ((export #t)) */ function sc_makePromise(proc) { var isResultReady = false; var result = undefined; return function() { if (!isResultReady) { var tmp = proc(); if (!isResultReady) { isResultReady = true; result = tmp; } } return result; }; } function sc_Values(values) { this.values = values; } /*** META ((export #t) (peephole (values))) */ function sc_values() { if (arguments.length === 1) return arguments[0]; else return new sc_Values(arguments); } /*** META ((export #t)) */ function sc_callWithValues(producer, consumer) { var produced = producer(); if (produced instanceof sc_Values) return consumer.apply(null, produced.values); else return consumer(produced); } /*** META ((export #t)) */ function sc_dynamicWind(before, thunk, after) { before(); try { var res = thunk(); return res; } finally { after(); } } // TODO: eval/scheme-report-environment/null-environment/interaction-environment // LIMITATION: 'load' doesn't exist without files. // LIMITATION: transcript-on/transcript-off doesn't exist without files. function sc_Struct(name) { this.name = name; } sc_Struct.prototype.sc_toDisplayString = function() { return "#"; }; sc_Struct.prototype.sc_toWriteString = sc_Struct.prototype.sc_toDisplayString; /*** META ((export #t) (peephole (hole 1 "new sc_Struct(" name ")"))) */ function sc_makeStruct(name) { return new sc_Struct(name); } /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_Struct"))) */ function sc_isStruct(o) { return (o instanceof sc_Struct); } /*** META ((export #t) (type bool) (peephole (hole 2 "(" 1 " instanceof sc_Struct) && ( " 1 ".name === " 0 ")"))) */ function sc_isStructNamed(name, s) { return ((s instanceof sc_Struct) && (s.name === name)); } /*** META ((export struct-field) (peephole (hole 3 0 "[" 2 "]"))) */ function sc_getStructField(s, name, field) { return s[field]; } /*** META ((export struct-field-set!) (peephole (hole 4 0 "[" 2 "] = " 3))) */ function sc_setStructFieldBang(s, name, field, val) { s[field] = val; } /*** META ((export #t) (peephole (prefix "~"))) */ function sc_bitNot(x) { return ~x; } /*** META ((export #t) (peephole (infix 2 2 "&"))) */ function sc_bitAnd(x, y) { return x & y; } /*** META ((export #t) (peephole (infix 2 2 "|"))) */ function sc_bitOr(x, y) { return x | y; } /*** META ((export #t) (peephole (infix 2 2 "^"))) */ function sc_bitXor(x, y) { return x ^ y; } /*** META ((export #t) (peephole (infix 2 2 "<<"))) */ function sc_bitLsh(x, y) { return x << y; } /*** META ((export #t) (peephole (infix 2 2 ">>"))) */ function sc_bitRsh(x, y) { return x >> y; } /*** META ((export #t) (peephole (infix 2 2 ">>>"))) */ function sc_bitUrsh(x, y) { return x >>> y; } /*** META ((export js-field js-property) (peephole (hole 2 o "[" field "]"))) */ function sc_jsField(o, field) { return o[field]; } /*** META ((export js-field-set! js-property-set!) (peephole (hole 3 o "[" field "] = " val))) */ function sc_setJsFieldBang(o, field, val) { return o[field] = val; } /*** META ((export js-field-delete! js-property-delete!) (peephole (hole 2 "delete" o "[" field "]"))) */ function sc_deleteJsFieldBang(o, field) { delete o[field]; } /*** META ((export #t) (peephole (jsCall))) */ function sc_jsCall(o, fun) { var args = new Array(); for (var i = 2; i < arguments.length; i++) args[i-2] = arguments[i]; return fun.apply(o, args); } /*** META ((export #t) (peephole (jsMethodCall))) */ function sc_jsMethodCall(o, field) { var args = new Array(); for (var i = 2; i < arguments.length; i++) args[i-2] = arguments[i]; return o[field].apply(o, args); } /*** META ((export new js-new) (peephole (jsNew))) */ function sc_jsNew(c) { var evalStr = "new c("; evalStr +=arguments.length > 1? "arguments[1]": ""; for (var i = 2; i < arguments.length; i++) evalStr += ", arguments[" + i + "]"; evalStr +=")"; return eval(evalStr); } // ======================== RegExp ==================== /*** META ((export #t)) */ function sc_pregexp(re) { return new RegExp(sc_string2jsstring(re)); } /*** META ((export #t)) */ function sc_pregexpMatch(re, s) { var reg = (re instanceof RegExp) ? re : sc_pregexp(re); var tmp = reg.exec(sc_string2jsstring(s)); if (tmp == null) return false; var res = null; for (var i = tmp.length-1; i >= 0; i--) { if (tmp[i] !== null) { res = sc_cons(sc_jsstring2string(tmp[i]), res); } else { res = sc_cons(false, res); } } return res; } /*** META ((export #t)) */ function sc_pregexpReplace(re, s1, s2) { var reg; var jss1 = sc_string2jsstring(s1); var jss2 = sc_string2jsstring(s2); if (re instanceof RegExp) { if (re.global) reg = re; else reg = new RegExp(re.source); } else { reg = new RegExp(sc_string2jsstring(re)); } return jss1.replace(reg, jss2); } /*** META ((export pregexp-replace*)) */ function sc_pregexpReplaceAll(re, s1, s2) { var reg; var jss1 = sc_string2jsstring(s1); var jss2 = sc_string2jsstring(s2); if (re instanceof RegExp) { if (re.global) reg = re; else reg = new RegExp(re.source, "g"); } else { reg = new RegExp(sc_string2jsstring(re), "g"); } return jss1.replace(reg, jss2); } /*** META ((export #t)) */ function sc_pregexpSplit(re, s) { var reg = ((re instanceof RegExp) ? re : new RegExp(sc_string2jsstring(re))); var jss = sc_string2jsstring(s); var tmp = jss.split(reg); if (tmp == null) return false; return sc_vector2list(tmp); } /* =========================================================================== */ /* Other library stuff */ /* =========================================================================== */ /*** META ((export #t) (peephole (hole 1 "Math.floor(Math.random()*" 'n ")"))) */ function sc_random(n) { return Math.floor(Math.random()*n); } /*** META ((export current-date) (peephole (hole 0 "new Date()"))) */ function sc_currentDate() { return new Date(); } function sc_Hashtable() { } sc_Hashtable.prototype.toString = function() { return "#{%hashtable}"; }; // sc_toWriteString == sc_toDisplayString == toString function sc_HashtableElement(key, val) { this.key = key; this.val = val; } /*** META ((export #t) (peephole (hole 0 "new sc_Hashtable()"))) */ function sc_makeHashtable() { return new sc_Hashtable(); } /*** META ((export #t)) */ function sc_hashtablePutBang(ht, key, val) { var hash = sc_hash(key); ht[hash] = new sc_HashtableElement(key, val); } /*** META ((export #t)) */ function sc_hashtableGet(ht, key) { var hash = sc_hash(key); if (hash in ht) return ht[hash].val; else return false; } /*** META ((export #t)) */ function sc_hashtableForEach(ht, f) { for (var v in ht) { if (ht[v] instanceof sc_HashtableElement) f(ht[v].key, ht[v].val); } } /*** META ((export hashtable-contains?) (peephole (hole 2 "sc_hash(" 1 ") in " 0))) */ function sc_hashtableContains(ht, key) { var hash = sc_hash(key); if (hash in ht) return true; else return false; } var SC_HASH_COUNTER = 0; function sc_hash(o) { if (o === null) return "null"; else if (o === undefined) return "undefined"; else if (o === true) return "true"; else if (o === false) return "false"; else if (typeof o === "number") return "num-" + o; else if (typeof o === "string") return "jsstr-" + o; else if (o.sc_getHash) return o.sc_getHash(); else return sc_counterHash.call(o); } function sc_counterHash() { if (!this.sc_hash) { this.sc_hash = "hash-" + SC_HASH_COUNTER; SC_HASH_COUNTER++; } return this.sc_hash; } function sc_Trampoline(args, maxTailCalls) { this['__trampoline return__'] = true; this.args = args; this.MAX_TAIL_CALLs = maxTailCalls; } // TODO: call/cc stuff sc_Trampoline.prototype.restart = function() { var o = this; while (true) { // set both globals. SC_TAIL_OBJECT.calls = o.MAX_TAIL_CALLs-1; var fun = o.args.callee; var res = fun.apply(SC_TAIL_OBJECT, o.args); if (res instanceof sc_Trampoline) o = res; else return res; } } /*** META ((export bind-exit-lambda)) */ function sc_bindExitLambda(proc) { var escape_obj = new sc_BindExitException(); var escape = function(res) { escape_obj.res = res; throw escape_obj; }; try { return proc(escape); } catch(e) { if (e === escape_obj) { return e.res; } throw e; } } function sc_BindExitException() { this._internalException = true; } var SC_SCM2JS_GLOBALS = new Object(); // default tail-call depth. // normally the program should set it again. but just in case... var SC_TAIL_OBJECT = new Object(); SC_SCM2JS_GLOBALS.TAIL_OBJECT = SC_TAIL_OBJECT; // ======================== I/O ======================= /*------------------------------------------------------------------*/ function sc_EOF() { } var SC_EOF_OBJECT = new sc_EOF(); function sc_Port() { } /* --------------- Input ports -------------------------------------*/ function sc_InputPort() { } sc_InputPort.prototype = new sc_Port(); sc_InputPort.prototype.peekChar = function() { if (!("peeked" in this)) this.peeked = this.getNextChar(); return this.peeked; } sc_InputPort.prototype.readChar = function() { var tmp = this.peekChar(); delete this.peeked; return tmp; } sc_InputPort.prototype.isCharReady = function() { return true; } sc_InputPort.prototype.close = function() { // do nothing } /* .............. String port ..........................*/ function sc_ErrorInputPort() { }; sc_ErrorInputPort.prototype = new sc_InputPort(); sc_ErrorInputPort.prototype.getNextChar = function() { throw "can't read from error-port."; }; sc_ErrorInputPort.prototype.isCharReady = function() { return false; }; /* .............. String port ..........................*/ function sc_StringInputPort(jsStr) { // we are going to do some charAts on the str. // instead of recreating all the time a String-object, we // create one in the beginning. (not sure, if this is really an optim) this.str = new String(jsStr); this.pos = 0; } sc_StringInputPort.prototype = new sc_InputPort(); sc_StringInputPort.prototype.getNextChar = function() { if (this.pos >= this.str.length) return SC_EOF_OBJECT; return this.str.charAt(this.pos++); }; /* ------------- Read and other lib-funs -------------------------------*/ function sc_Token(type, val, pos) { this.type = type; this.val = val; this.pos = pos; } sc_Token.EOF = 0/*EOF*/; sc_Token.OPEN_PAR = 1/*OPEN_PAR*/; sc_Token.CLOSE_PAR = 2/*CLOSE_PAR*/; sc_Token.OPEN_BRACE = 3/*OPEN_BRACE*/; sc_Token.CLOSE_BRACE = 4/*CLOSE_BRACE*/; sc_Token.OPEN_BRACKET = 5/*OPEN_BRACKET*/; sc_Token.CLOSE_BRACKET = 6/*CLOSE_BRACKET*/; sc_Token.WHITESPACE = 7/*WHITESPACE*/; sc_Token.QUOTE = 8/*QUOTE*/; sc_Token.ID = 9/*ID*/; sc_Token.DOT = 10/*DOT*/; sc_Token.STRING = 11/*STRING*/; sc_Token.NUMBER = 12/*NUMBER*/; sc_Token.ERROR = 13/*ERROR*/; sc_Token.VECTOR_BEGIN = 14/*VECTOR_BEGIN*/; sc_Token.TRUE = 15/*TRUE*/; sc_Token.FALSE = 16/*FALSE*/; sc_Token.UNSPECIFIED = 17/*UNSPECIFIED*/; sc_Token.REFERENCE = 18/*REFERENCE*/; sc_Token.STORE = 19/*STORE*/; sc_Token.CHAR = 20/*CHAR*/; var SC_ID_CLASS = SC_LOWER_CLASS + SC_UPPER_CLASS + "!$%*+-./:<=>?@^_~"; function sc_Tokenizer(port) { this.port = port; } sc_Tokenizer.prototype.peekToken = function() { if (this.peeked) return this.peeked; var newToken = this.nextToken(); this.peeked = newToken; return newToken; }; sc_Tokenizer.prototype.readToken = function() { var tmp = this.peekToken(); delete this.peeked; return tmp; }; sc_Tokenizer.prototype.nextToken = function() { var port = this.port; function isNumberChar(c) { return (c >= "0" && c <= "9"); }; function isIdOrNumberChar(c) { return SC_ID_CLASS.indexOf(c) != -1 || // ID-char (c >= "0" && c <= "9"); } function isWhitespace(c) { return c === " " || c === "\r" || c === "\n" || c === "\t" || c === "\f"; }; function isWhitespaceOrEOF(c) { return isWhitespace(c) || c === SC_EOF_OBJECT; }; function readString() { res = ""; while (true) { var c = port.readChar(); switch (c) { case '"': return new sc_Token(11/*STRING*/, res); case "\\": var tmp = port.readChar(); switch (tmp) { case '0': res += "\0"; break; case 'a': res += "\a"; break; case 'b': res += "\b"; break; case 'f': res += "\f"; break; case 'n': res += "\n"; break; case 'r': res += "\r"; break; case 't': res += "\t"; break; case 'v': res += "\v"; break; case '"': res += '"'; break; case '\\': res += '\\'; break; case 'x': /* hexa-number */ var nb = 0; while (true) { var hexC = port.peekChar(); if (hexC >= '0' && hexC <= '9') { port.readChar(); nb = nb * 16 + hexC.charCodeAt(0) - '0'.charCodeAt(0); } else if (hexC >= 'a' && hexC <= 'f') { port.readChar(); nb = nb * 16 + hexC.charCodeAt(0) - 'a'.charCodeAt(0); } else if (hexC >= 'A' && hexC <= 'F') { port.readChar(); nb = nb * 16 + hexC.charCodeAt(0) - 'A'.charCodeAt(0); } else { // next char isn't part of hex. res += String.fromCharCode(nb); break; } } break; default: if (tmp === SC_EOF_OBJECT) { return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res); } res += tmp; } break; default: if (c === SC_EOF_OBJECT) { return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res); } res += c; } } }; function readIdOrNumber(firstChar) { var res = firstChar; while (isIdOrNumberChar(port.peekChar())) res += port.readChar(); if (isNaN(res)) return new sc_Token(9/*ID*/, res); else return new sc_Token(12/*NUMBER*/, res - 0); }; function skipWhitespaceAndComments() { var done = false; while (!done) { done = true; while (isWhitespace(port.peekChar())) port.readChar(); if (port.peekChar() === ';') { port.readChar(); done = false; while (true) { curChar = port.readChar(); if (curChar === SC_EOF_OBJECT || curChar === '\n') break; } } } }; function readDot() { if (isWhitespace(port.peekChar())) return new sc_Token(10/*DOT*/); else return readIdOrNumber("."); }; function readSharp() { var c = port.readChar(); if (isWhitespace(c)) return new sc_Token(13/*ERROR*/, "bad #-pattern0."); // reference if (isNumberChar(c)) { var nb = c - 0; while (isNumberChar(port.peekChar())) nb = nb*10 + (port.readChar() - 0); switch (port.readChar()) { case '#': return new sc_Token(18/*REFERENCE*/, nb); case '=': return new sc_Token(19/*STORE*/, nb); default: return new sc_Token(13/*ERROR*/, "bad #-pattern1." + nb); } } if (c === "(") return new sc_Token(14/*VECTOR_BEGIN*/); if (c === "\\") { // character var tmp = "" while (!isWhitespaceOrEOF(port.peekChar())) tmp += port.readChar(); switch (tmp.length) { case 0: // it's escaping a whitespace char: if (sc_isEOFObject(port.peekChar)) return new sc_Token(13/*ERROR*/, "bad #-pattern2."); else return new sc_Token(20/*CHAR*/, port.readChar()); case 1: return new sc_Token(20/*CHAR*/, tmp); default: var entry = sc_Char.readable2char[tmp.toLowerCase()]; if (entry) return new sc_Token(20/*CHAR*/, entry); else return new sc_Token(13/*ERROR*/, "unknown character description: #\\" + tmp); } } // some constants (#t, #f, #unspecified) var res; var needing; switch (c) { case 't': res = new sc_Token(15/*TRUE*/, true); needing = ""; break; case 'f': res = new sc_Token(16/*FALSE*/, false); needing = ""; break; case 'u': res = new sc_Token(17/*UNSPECIFIED*/, undefined); needing = "nspecified"; break; default: return new sc_Token(13/*ERROR*/, "bad #-pattern3: " + c); } while(true) { c = port.peekChar(); if ((isWhitespaceOrEOF(c) || c === ')') && needing == "") return res; else if (isWhitespace(c) || needing == "") return new sc_Token(13/*ERROR*/, "bad #-pattern4 " + c + " " + needing); else if (needing.charAt(0) == c) { port.readChar(); // consume needing = needing.slice(1); } else return new sc_Token(13/*ERROR*/, "bad #-pattern5"); } }; skipWhitespaceAndComments(); var curChar = port.readChar(); if (curChar === SC_EOF_OBJECT) return new sc_Token(0/*EOF*/, curChar); switch (curChar) { case " ": case "\n": case "\t": return readWhitespace(); case "(": return new sc_Token(1/*OPEN_PAR*/); case ")": return new sc_Token(2/*CLOSE_PAR*/); case "{": return new sc_Token(3/*OPEN_BRACE*/); case "}": return new sc_Token(4/*CLOSE_BRACE*/); case "[": return new sc_Token(5/*OPEN_BRACKET*/); case "]": return new sc_Token(6/*CLOSE_BRACKET*/); case "'": return new sc_Token(8/*QUOTE*/); case "#": return readSharp(); case ".": return readDot(); case '"': return readString(); default: if (isIdOrNumberChar(curChar)) return readIdOrNumber(curChar); throw "unexpected character: " + curChar; } }; function sc_Reader(tokenizer) { this.tokenizer = tokenizer; this.backref = new Array(); } sc_Reader.prototype.read = function() { function readList(listBeginType) { function matchesPeer(open, close) { return open === 1/*OPEN_PAR*/ && close === 2/*CLOSE_PAR*/ || open === 3/*OPEN_BRACE*/ && close === 4/*CLOSE_BRACE*/ || open === 5/*OPEN_BRACKET*/ && close === 6/*CLOSE_BRACKET*/; }; var res = null; while (true) { var token = tokenizer.peekToken(); switch (token.type) { case 2/*CLOSE_PAR*/: case 4/*CLOSE_BRACE*/: case 6/*CLOSE_BRACKET*/: if (matchesPeer(listBeginType, token.type)) { tokenizer.readToken(); // consume token return sc_reverseBang(res); } else throw "closing par doesn't match: " + listBeginType + " " + listEndType; case 0/*EOF*/: throw "unexpected end of file"; case 10/*DOT*/: tokenizer.readToken(); // consume token var cdr = this.read(); var par = tokenizer.readToken(); if (!matchesPeer(listBeginType, par.type)) throw "closing par doesn't match: " + listBeginType + " " + par.type; else return sc_reverseAppendBang(res, cdr); default: res = sc_cons(this.read(), res); } } }; function readQuote() { return sc_cons("quote", sc_cons(this.read(), null)); }; function readVector() { // opening-parenthesis is already consumed var a = new Array(); while (true) { var token = tokenizer.peekToken(); switch (token.type) { case 2/*CLOSE_PAR*/: tokenizer.readToken(); return a; default: a.push(this.read()); } } }; function storeRefence(nb) { var tmp = this.read(); this.backref[nb] = tmp; return tmp; }; function readReference(nb) { if (nb in this.backref) return this.backref[nb]; else throw "bad reference: " + nb; }; var tokenizer = this.tokenizer; var token = tokenizer.readToken(); // handle error if (token.type === 13/*ERROR*/) throw token.val; switch (token.type) { case 1/*OPEN_PAR*/: case 3/*OPEN_BRACE*/: case 5/*OPEN_BRACKET*/: return readList.call(this, token.type); case 8/*QUOTE*/: return readQuote.call(this); case 11/*STRING*/: return sc_jsstring2string(token.val); case 20/*CHAR*/: return new sc_Char(token.val); case 14/*VECTOR_BEGIN*/: return readVector.call(this); case 18/*REFERENCE*/: return readReference.call(this, token.val); case 19/*STORE*/: return storeRefence.call(this, token.val); case 9/*ID*/: return sc_jsstring2symbol(token.val); case 0/*EOF*/: case 12/*NUMBER*/: case 15/*TRUE*/: case 16/*FALSE*/: case 17/*UNSPECIFIED*/: return token.val; default: throw "unexpected token " + token.type + " " + token.val; } }; /*** META ((export #t)) */ function sc_read(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... var reader = new sc_Reader(new sc_Tokenizer(port)); return reader.read(); } /*** META ((export #t)) */ function sc_readChar(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... var t = port.readChar(); return t === SC_EOF_OBJECT? t: new sc_Char(t); } /*** META ((export #t)) */ function sc_peekChar(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... var t = port.peekChar(); return t === SC_EOF_OBJECT? t: new sc_Char(t); } /*** META ((export #t) (type bool)) */ function sc_isCharReady(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... return port.isCharReady(); } /*** META ((export #t) (peephole (postfix ".close()"))) */ function sc_closeInputPort(p) { return p.close(); } /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_InputPort"))) */ function sc_isInputPort(o) { return (o instanceof sc_InputPort); } /*** META ((export eof-object?) (type bool) (peephole (postfix " === SC_EOF_OBJECT"))) */ function sc_isEOFObject(o) { return o === SC_EOF_OBJECT; } /*** META ((export #t) (peephole (hole 0 "SC_DEFAULT_IN"))) */ function sc_currentInputPort() { return SC_DEFAULT_IN; } /* ------------ file operations are not supported -----------*/ /*** META ((export #t)) */ function sc_callWithInputFile(s, proc) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_callWithOutputFile(s, proc) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_withInputFromFile(s, thunk) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_withOutputToFile(s, thunk) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_openInputFile(s) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_openOutputFile(s) { throw "can't open " + s; } /* ----------------------------------------------------------------------------*/ /*** META ((export #t)) */ function sc_basename(p) { var i = p.lastIndexOf('/'); if(i >= 0) return p.substring(i + 1, p.length); else return ''; } /*** META ((export #t)) */ function sc_dirname(p) { var i = p.lastIndexOf('/'); if(i >= 0) return p.substring(0, i); else return ''; } /* ----------------------------------------------------------------------------*/ /*** META ((export #t)) */ function sc_withInputFromPort(p, thunk) { try { var tmp = SC_DEFAULT_IN; // THREAD: shared var. SC_DEFAULT_IN = p; return thunk(); } finally { SC_DEFAULT_IN = tmp; } } /*** META ((export #t)) */ function sc_withInputFromString(s, thunk) { return sc_withInputFromPort(new sc_StringInputPort(sc_string2jsstring(s)), thunk); } /*** META ((export #t)) */ function sc_withOutputToPort(p, thunk) { try { var tmp = SC_DEFAULT_OUT; // THREAD: shared var. SC_DEFAULT_OUT = p; return thunk(); } finally { SC_DEFAULT_OUT = tmp; } } /*** META ((export #t)) */ function sc_withOutputToString(thunk) { var p = new sc_StringOutputPort(); sc_withOutputToPort(p, thunk); return p.close(); } /*** META ((export #t)) */ function sc_withOutputToProcedure(proc, thunk) { var t = function(s) { proc(sc_jsstring2string(s)); }; return sc_withOutputToPort(new sc_GenericOutputPort(t), thunk); } /*** META ((export #t) (peephole (hole 0 "new sc_StringOutputPort()"))) */ function sc_openOutputString() { return new sc_StringOutputPort(); } /*** META ((export #t)) */ function sc_openInputString(str) { return new sc_StringInputPort(sc_string2jsstring(str)); } /* ----------------------------------------------------------------------------*/ function sc_OutputPort() { } sc_OutputPort.prototype = new sc_Port(); sc_OutputPort.prototype.appendJSString = function(obj) { /* do nothing */ } sc_OutputPort.prototype.close = function() { /* do nothing */ } function sc_StringOutputPort() { this.res = ""; } sc_StringOutputPort.prototype = new sc_OutputPort(); sc_StringOutputPort.prototype.appendJSString = function(s) { this.res += s; } sc_StringOutputPort.prototype.close = function() { return sc_jsstring2string(this.res); } /*** META ((export #t)) */ function sc_getOutputString(sp) { return sc_jsstring2string(sp.res); } function sc_ErrorOutputPort() { } sc_ErrorOutputPort.prototype = new sc_OutputPort(); sc_ErrorOutputPort.prototype.appendJSString = function(s) { throw "don't write on ErrorPort!"; } sc_ErrorOutputPort.prototype.close = function() { /* do nothing */ } function sc_GenericOutputPort(appendJSString, close) { this.appendJSString = appendJSString; if (close) this.close = close; } sc_GenericOutputPort.prototype = new sc_OutputPort(); /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_OutputPort"))) */ function sc_isOutputPort(o) { return (o instanceof sc_OutputPort); } /*** META ((export #t) (peephole (postfix ".close()"))) */ function sc_closeOutputPort(p) { return p.close(); } /* ------------------ write ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_write(o, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(sc_toWriteString(o)); } function sc_toWriteString(o) { if (o === null) return "()"; else if (o === true) return "#t"; else if (o === false) return "#f"; else if (o === undefined) return "#unspecified"; else if (typeof o === 'function') return "#"; else if (o.sc_toWriteString) return o.sc_toWriteString(); else return o.toString(); } function sc_escapeWriteString(s) { var res = ""; var j = 0; for (i = 0; i < s.length; i++) { switch (s.charAt(i)) { case "\0": res += s.substring(j, i) + "\\0"; j = i + 1; break; case "\b": res += s.substring(j, i) + "\\b"; j = i + 1; break; case "\f": res += s.substring(j, i) + "\\f"; j = i + 1; break; case "\n": res += s.substring(j, i) + "\\n"; j = i + 1; break; case "\r": res += s.substring(j, i) + "\\r"; j = i + 1; break; case "\t": res += s.substring(j, i) + "\\t"; j = i + 1; break; case "\v": res += s.substring(j, i) + "\\v"; j = i + 1; break; case '"': res += s.substring(j, i) + '\\"'; j = i + 1; break; case "\\": res += s.substring(j, i) + "\\\\"; j = i + 1; break; default: var c = s.charAt(i); if ("\a" !== "a" && c == "\a") { res += s.substring(j, i) + "\\a"; j = i + 1; continue; } if ("\v" !== "v" && c == "\v") { res += s.substring(j, i) + "\\v"; j = i + 1; continue; } //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) { // CARE: Manuel is this OK with HOP? if (s.charAt(i) < ' ') { /* non printable character and special chars */ res += s.substring(j, i) + "\\x" + s.charCodeAt(i).toString(16); j = i + 1; } // else just let i increase... } } res += s.substring(j, i); return res; } /* ------------------ display ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_display(o, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(sc_toDisplayString(o)); } function sc_toDisplayString(o) { if (o === null) return "()"; else if (o === true) return "#t"; else if (o === false) return "#f"; else if (o === undefined) return "#unspecified"; else if (typeof o === 'function') return "#"; else if (o.sc_toDisplayString) return o.sc_toDisplayString(); else return o.toString(); } /* ------------------ newline ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_newline(p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString("\n"); } /* ------------------ write-char ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_writeChar(c, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(c.val); } /* ------------------ write-circle ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_writeCircle(o, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(sc_toWriteCircleString(o)); } function sc_toWriteCircleString(o) { var symb = sc_gensym("writeCircle"); var nbPointer = new Object(); nbPointer.nb = 0; sc_prepWriteCircle(o, symb, nbPointer); return sc_genToWriteCircleString(o, symb); } function sc_prepWriteCircle(o, symb, nbPointer) { // TODO sc_Struct if (o instanceof sc_Pair || o instanceof sc_Vector) { if (o[symb] !== undefined) { // not the first visit. o[symb]++; // unless there is already a number, assign one. if (!o[symb + "nb"]) o[symb + "nb"] = nbPointer.nb++; return; } o[symb] = 0; if (o instanceof sc_Pair) { sc_prepWriteCircle(o.car, symb, nbPointer); sc_prepWriteCircle(o.cdr, symb, nbPointer); } else { for (var i = 0; i < o.length; i++) sc_prepWriteCircle(o[i], symb, nbPointer); } } } function sc_genToWriteCircleString(o, symb) { if (!(o instanceof sc_Pair || o instanceof sc_Vector)) return sc_toWriteString(o); return o.sc_toWriteCircleString(symb); } sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) { if (this[symb + "use"]) { // use-flag is set. Just use it. var nb = this[symb + "nb"]; if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } if (inList) return '. #' + nb + '#'; else return '#' + nb + '#'; } if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } var res = ""; if (this[symb] !== undefined) { // implies > 0 this[symb + "use"] = true; if (inList) res += '. #' + this[symb + "nb"] + '='; else res += '#' + this[symb + "nb"] + '='; inList = false; } if (!inList) res += "("; // print car res += sc_genToWriteCircleString(this.car, symb); if (sc_isPair(this.cdr)) { res += " " + this.cdr.sc_toWriteCircleString(symb, true); } else if (this.cdr !== null) { res += " . " + sc_genToWriteCircleString(this.cdr, symb); } if (!inList) res += ")"; return res; }; sc_Vector.prototype.sc_toWriteCircleString = function(symb) { if (this[symb + "use"]) { // use-flag is set. Just use it. var nb = this[symb + "nb"]; if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } return '#' + nb + '#'; } if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } var res = ""; if (this[symb] !== undefined) { // implies > 0 this[symb + "use"] = true; res += '#' + this[symb + "nb"] + '='; } res += "#("; for (var i = 0; i < this.length; i++) { res += sc_genToWriteCircleString(this[i], symb); if (i < this.length - 1) res += " "; } res += ")"; return res; }; /* ------------------ print ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_print(s) { if (arguments.length === 1) { sc_display(s); sc_newline(); } else { for (var i = 0; i < arguments.length; i++) sc_display(arguments[i]); sc_newline(); } } /* ------------------ format ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_format(s, args) { var len = s.length; var p = new sc_StringOutputPort(); var i = 0, j = 1; while( i < len ) { var i2 = s.indexOf("~", i); if (i2 == -1) { p.appendJSString( s.substring( i, len ) ); return p.close(); } else { if (i2 > i) { if (i2 == (len - 1)) { p.appendJSString(s.substring(i, len)); return p.close(); } else { p.appendJSString(s.substring(i, i2)); i = i2; } } switch(s.charCodeAt(i2 + 1)) { case 65: case 97: // a sc_display(arguments[j], p); i += 2; j++; break; case 83: case 115: // s sc_write(arguments[j], p); i += 2; j++; break; case 86: case 118: // v sc_display(arguments[j], p); p.appendJSString("\n"); i += 2; j++; break; case 67: case 99: // c p.appendJSString(String.fromCharCode(arguments[j])); i += 2; j++; break; case 88: case 120: // x p.appendJSString(arguments[j].toString(6)); i += 2; j++; break; case 79: case 111: // o p.appendJSString(arguments[j].toString(8)); i += 2; j++; break; case 66: case 98: // b p.appendJSString(arguments[j].toString(2)); i += 2; j++; break; case 37: case 110: // %, n p.appendJSString("\n"); i += 2; break; case 114: // r p.appendJSString("\r"); i += 2; break; case 126: // ~ p.appendJSString("~"); i += 2; break; default: sc_error( "format: illegal ~" + String.fromCharCode(s.charCodeAt(i2 + 1)) + " sequence" ); return ""; } } } return p.close(); } /* ------------------ global ports ---------------------------------------------------*/ var SC_DEFAULT_IN = new sc_ErrorInputPort(); var SC_DEFAULT_OUT = new sc_ErrorOutputPort(); var SC_ERROR_OUT = new sc_ErrorOutputPort(); var sc_SYMBOL_PREFIX = "\u1E9C"; var sc_KEYWORD_PREFIX = "\u1E9D"; /*** META ((export #t) (peephole (id))) */ function sc_jsstring2string(s) { return s; } /*** META ((export #t) (peephole (prefix "'\\u1E9C' +"))) */ function sc_jsstring2symbol(s) { return sc_SYMBOL_PREFIX + s; } /*** META ((export #t) (peephole (id))) */ function sc_string2jsstring(s) { return s; } /*** META ((export #t) (peephole (symbol2jsstring_immutable))) */ function sc_symbol2jsstring(s) { return s.slice(1); } /*** META ((export #t) (peephole (postfix ".slice(1)"))) */ function sc_keyword2jsstring(k) { return k.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9D' +"))) */ function sc_jsstring2keyword(s) { return sc_KEYWORD_PREFIX + s; } /*** META ((export #t) (type bool)) */ function sc_isKeyword(s) { return (typeof s === "string") && (s.charAt(0) === sc_KEYWORD_PREFIX); } /*** META ((export #t)) */ var sc_gensym = function() { var counter = 1000; return function(sym) { counter++; if (!sym) sym = sc_SYMBOL_PREFIX; return sym + "s" + counter + "~" + "^sC-GeNsYm "; }; }(); /*** META ((export #t) (type bool)) */ function sc_isEqual(o1, o2) { return ((o1 === o2) || (sc_isPair(o1) && sc_isPair(o2) && sc_isPairEqual(o1, o2, sc_isEqual)) || (sc_isVector(o1) && sc_isVector(o2) && sc_isVectorEqual(o1, o2, sc_isEqual))); } /*** META ((export number->symbol integer->symbol)) */ function sc_number2symbol(x, radix) { return sc_SYMBOL_PREFIX + sc_number2jsstring(x, radix); } /*** META ((export number->string integer->string)) */ var sc_number2string = sc_number2jsstring; /*** META ((export #t)) */ function sc_symbol2number(s, radix) { return sc_jsstring2number(s.slice(1), radix); } /*** META ((export #t)) */ var sc_string2number = sc_jsstring2number; /*** META ((export #t) (peephole (prefix "+" s))) ;; peephole will only apply if no radix is given. */ function sc_string2integer(s, radix) { if (!radix) return +s; return parseInt(s, radix); } /*** META ((export #t) (peephole (prefix "+"))) */ function sc_string2real(s) { return +s; } /*** META ((export #t) (type bool)) */ function sc_isSymbol(s) { return (typeof s === "string") && (s.charAt(0) === sc_SYMBOL_PREFIX); } /*** META ((export #t) (peephole (symbol2string_immutable))) */ function sc_symbol2string(s) { return s.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9C' +"))) */ function sc_string2symbol(s) { return sc_SYMBOL_PREFIX + s; } /*** META ((export symbol-append) (peephole (symbolAppend_immutable))) */ function sc_symbolAppend() { var res = sc_SYMBOL_PREFIX; for (var i = 0; i < arguments.length; i++) res += arguments[i].slice(1); return res; } /*** META ((export #t) (peephole (postfix ".val"))) */ function sc_char2string(c) { return c.val; } /*** META ((export #t) (peephole (hole 1 "'\\u1E9C' + " c ".val"))) */ function sc_char2symbol(c) { return sc_SYMBOL_PREFIX + c.val; } /*** META ((export #t) (type bool)) */ function sc_isString(s) { return (typeof s === "string") && (s.charAt(0) !== sc_SYMBOL_PREFIX); } /*** META ((export #t)) */ var sc_makeString = sc_makejsString; /*** META ((export #t)) */ function sc_string() { for (var i = 0; i < arguments.length; i++) arguments[i] = arguments[i].val; return "".concat.apply("", arguments); } /*** META ((export #t) (peephole (postfix ".length"))) */ function sc_stringLength(s) { return s.length; } /*** META ((export #t)) */ function sc_stringRef(s, k) { return new sc_Char(s.charAt(k)); } /* there's no stringSet in the immutable version function sc_stringSet(s, k, c) */ /*** META ((export string=?) (type bool) (peephole (hole 2 str1 " === " str2))) */ function sc_isStringEqual(s1, s2) { return s1 === s2; } /*** META ((export string?) (type bool) (peephole (hole 2 str1 " > " str2))) */ function sc_isStringGreater(s1, s2) { return s1 > s2; } /*** META ((export string<=?) (type bool) (peephole (hole 2 str1 " <= " str2))) */ function sc_isStringLessEqual(s1, s2) { return s1 <= s2; } /*** META ((export string>=?) (type bool) (peephole (hole 2 str1 " >= " str2))) */ function sc_isStringGreaterEqual(s1, s2) { return s1 >= s2; } /*** META ((export string-ci=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() === " str2 ".toLowerCase()"))) */ function sc_isStringCIEqual(s1, s2) { return s1.toLowerCase() === s2.toLowerCase(); } /*** META ((export string-ci?) (type bool) (peephole (hole 2 str1 ".toLowerCase() > " str2 ".toLowerCase()"))) */ function sc_isStringCIGreater(s1, s2) { return s1.toLowerCase() > s2.toLowerCase(); } /*** META ((export string-ci<=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() <= " str2 ".toLowerCase()"))) */ function sc_isStringCILessEqual(s1, s2) { return s1.toLowerCase() <= s2.toLowerCase(); } /*** META ((export string-ci>=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() >= " str2 ".toLowerCase()"))) */ function sc_isStringCIGreaterEqual(s1, s2) { return s1.toLowerCase() >= s2.toLowerCase(); } /*** META ((export #t) (peephole (hole 3 s ".substring(" start ", " end ")"))) */ function sc_substring(s, start, end) { return s.substring(start, end); } /*** META ((export #t)) */ function sc_isSubstring_at(s1, s2, i) { return s2 == s1.substring(i, i+ s2.length); } /*** META ((export #t) (peephole (infix 0 #f "+" "''"))) */ function sc_stringAppend() { return "".concat.apply("", arguments); } /*** META ((export #t)) */ var sc_string2list = sc_jsstring2list; /*** META ((export #t)) */ var sc_list2string = sc_list2jsstring; /*** META ((export #t) (peephole (id))) */ function sc_stringCopy(s) { return s; } /* there's no string-fill in the immutable version function sc_stringFill(s, c) */ /*** META ((export #t) (peephole (postfix ".slice(1)"))) */ function sc_keyword2string(o) { return o.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9D' +"))) */ function sc_string2keyword(o) { return sc_KEYWORD_PREFIX + o; } String.prototype.sc_toDisplayString = function() { if (this.charAt(0) === sc_SYMBOL_PREFIX) // TODO: care for symbols with spaces (escape-chars symbols). return this.slice(1); else if (this.charAt(0) === sc_KEYWORD_PREFIX) return ":" + this.slice(1); else return this.toString(); }; String.prototype.sc_toWriteString = function() { if (this.charAt(0) === sc_SYMBOL_PREFIX) // TODO: care for symbols with spaces (escape-chars symbols). return this.slice(1); else if (this.charAt(0) === sc_KEYWORD_PREFIX) return ":" + this.slice(1); else return '"' + sc_escapeWriteString(this) + '"'; }; /* Exported Variables */ var BgL_testzd2boyerzd2; var BgL_nboyerzd2benchmarkzd2; var BgL_setupzd2boyerzd2; /* End Exports */ var translate_term_nboyer; var translate_args_nboyer; var untranslate_term_nboyer; var BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer; var BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer; var translate_alist_nboyer; var apply_subst_nboyer; var apply_subst_lst_nboyer; var tautologyp_nboyer; var if_constructor_nboyer; var rewrite_count_nboyer; var rewrite_nboyer; var rewrite_args_nboyer; var unify_subst_nboyer; var one_way_unify1_nboyer; var false_term_nboyer; var true_term_nboyer; var trans_of_implies1_nboyer; var is_term_equal_nboyer; var is_term_member_nboyer; var const_nboyer; var sc_const_3_nboyer; var sc_const_4_nboyer; { (sc_const_4_nboyer = (new sc_Pair("\u1E9Cimplies",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cu",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cw",null)))))),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cw",null)))))),null))))))); (sc_const_3_nboyer = sc_list((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccompile",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Ccodegen",(new sc_Pair((new sc_Pair("\u1E9Coptimize",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreaterp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clesseqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cboolean",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ciff",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceven1",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Codd",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccountps-",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccountps-loop",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfact-",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfact-loop",(new sc_Pair("\u1E9Ci",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdivides",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-true",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-false",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctautology-checker",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctautologyp",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfalsify",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfalsify1",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime1",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair("\u1E9Cp",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))))),(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cc",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cplus-fringe",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair("\u1E9Cenvrn",null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmc-flatten",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cintersect",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Ck",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ck",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Csort-lp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus1",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Ci",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cbase",null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cj",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cj",(new sc_Pair((1),null)))))),null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Ci",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cw",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cz",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnlistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csamefringe",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cz",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cw",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair(sc_list("\u1E9Cand", (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Ca",null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cb",null)))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cl",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cl",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdsort",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx1",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx2",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx3",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx4",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx5",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx6",(new sc_Pair("\u1E9Cx7",null)))))),null)))))),null)))))),null)))))),null)))))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((6),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx7",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cy",(new sc_Pair((2),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csigma",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Ci",null)))),null)))))),(new sc_Pair((2),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cz",null)))),null)))))),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Ca",null)))),null)))),(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Cb",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair("\u1E9Cz",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cassignedp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair((new sc_Pair("\u1E9Cset",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cval",(new sc_Pair("\u1E9Cmem",null)))))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair("\u1E9Cval",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cmem",null)))))),null)))))))),null)))))))); (const_nboyer = (new sc_Pair((new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))))),null))))))))))); BgL_nboyerzd2benchmarkzd2 = function() { var args = null; for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { args = sc_cons(arguments[sc_tmp], args); } var n; return ((n = ((args === null)?(0):(args.car))), (BgL_setupzd2boyerzd2()), (BgL_runzd2benchmarkzd2(("nboyer"+(sc_number2string(n))), (1), function() { return (BgL_testzd2boyerzd2(n)); }, function(rewrites) { if ((sc_isNumber(rewrites))) switch (n) { case (0): assertEq(rewrites, 95024); return true; break; case (1): assertEq(rewrites, 591777); return true; break; case (2): assertEq(rewrites, 1813975); return true; break; case (3): assertEq(rewrites, 5375678); return true; break; case (4): assertEq(rewrites, 16445406); return true; break; case (5): assertEq(rewrites, 51507739); return true; break; default: return true; break; } else return false; }))); }; BgL_setupzd2boyerzd2 = function() { return true; }; BgL_testzd2boyerzd2 = function() { return true; }; translate_term_nboyer = function(term) { var lst; return (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((translate_term_nboyer((lst.car))), (translate_args_nboyer((lst.cdr)))))))))); }; translate_args_nboyer = function(lst) { var sc_lst_5; var term; return ((lst === null)?null:(new sc_Pair(((term = (lst.car)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))), ((sc_lst_5 = (lst.cdr)), ((sc_lst_5 === null)?null:(new sc_Pair((translate_term_nboyer((sc_lst_5.car))), (translate_args_nboyer((sc_lst_5.cdr)))))))))); }; untranslate_term_nboyer = function(term) { var optrOpnd; var tail1131; var L1127; var falseHead1130; var symbol_record; if (!(term instanceof sc_Pair)) return term; else { (falseHead1130 = (new sc_Pair(null, null))); (L1127 = (term.cdr)); (tail1131 = falseHead1130); while (!(L1127 === null)) { { (tail1131.cdr = (new sc_Pair((untranslate_term_nboyer((L1127.car))), null))); (tail1131 = (tail1131.cdr)); (L1127 = (L1127.cdr)); } } (optrOpnd = (falseHead1130.cdr)); return (new sc_Pair(((symbol_record = (term.car)), (symbol_record[(0)])), optrOpnd)); } }; BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function(sym) { var r; var x; return ((x = (sc_assq(sym, BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), ((x!== false)?(x.cdr):((r = [sym, null]), (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = (new sc_Pair((new sc_Pair(sym, r)), BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), r))); }; (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null); translate_alist_nboyer = function(alist) { var sc_alist_6; var term; return ((alist === null)?null:(new sc_Pair((new sc_Pair((alist.car.car), ((term = (alist.car.cdr)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))))), ((sc_alist_6 = (alist.cdr)), ((sc_alist_6 === null)?null:(new sc_Pair((new sc_Pair((sc_alist_6.car.car), (translate_term_nboyer((sc_alist_6.car.cdr))))), (translate_alist_nboyer((sc_alist_6.cdr)))))))))); }; apply_subst_nboyer = function(alist, term) { var lst; var temp_temp; return (!(term instanceof sc_Pair)?((temp_temp = (sc_assq(term, alist))), ((temp_temp!== false)?(temp_temp.cdr):term)):(new sc_Pair((term.car), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), (apply_subst_lst_nboyer(alist, (lst.cdr)))))))))); }; apply_subst_lst_nboyer = function(alist, lst) { var sc_lst_7; return ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), ((sc_lst_7 = (lst.cdr)), ((sc_lst_7 === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (sc_lst_7.car))), (apply_subst_lst_nboyer(alist, (sc_lst_7.cdr)))))))))); }; tautologyp_nboyer = function(sc_x_11, true_lst, false_lst) { var tmp1125; var x; var tmp1126; var sc_x_8; var sc_tmp1125_9; var sc_tmp1126_10; var sc_x_11; var true_lst; var false_lst; while (true) { if ((((sc_tmp1126_10 = (is_term_equal_nboyer(sc_x_11, true_term_nboyer))), ((sc_tmp1126_10!== false)?sc_tmp1126_10:(is_term_member_nboyer(sc_x_11, true_lst))))!== false)) return true; else if ((((sc_tmp1125_9 = (is_term_equal_nboyer(sc_x_11, false_term_nboyer))), ((sc_tmp1125_9!== false)?sc_tmp1125_9:(is_term_member_nboyer(sc_x_11, false_lst))))!== false)) return false; else if (!(sc_x_11 instanceof sc_Pair)) return false; else if (((sc_x_11.car)===if_constructor_nboyer)) if ((((sc_x_8 = (sc_x_11.cdr.car)), (tmp1126 = (is_term_equal_nboyer(sc_x_8, true_term_nboyer))), ((tmp1126!== false)?tmp1126:(is_term_member_nboyer(sc_x_8, true_lst))))!== false)) (sc_x_11 = (sc_x_11.cdr.cdr.car)); else if ((((x = (sc_x_11.cdr.car)), (tmp1125 = (is_term_equal_nboyer(x, false_term_nboyer))), ((tmp1125!== false)?tmp1125:(is_term_member_nboyer(x, false_lst))))!== false)) (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car)); else if (((tautologyp_nboyer((sc_x_11.cdr.cdr.car), (new sc_Pair((sc_x_11.cdr.car), true_lst)), false_lst))!== false)) { (false_lst = (new sc_Pair((sc_x_11.cdr.car), false_lst))); (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car)); } else return false; else return false; } }; (if_constructor_nboyer = "\u1E9C*"); (rewrite_count_nboyer = (0)); rewrite_nboyer = function(term) { var term2; var sc_term_12; var lst; var symbol_record; var sc_lst_13; { (++rewrite_count_nboyer); if (!(term instanceof sc_Pair)) return term; else { (sc_term_12 = (new sc_Pair((term.car), ((sc_lst_13 = (term.cdr)), ((sc_lst_13 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_13.car))), (rewrite_args_nboyer((sc_lst_13.cdr)))))))))); (lst = ((symbol_record = (term.car)), (symbol_record[(1)]))); while (true) { if ((lst === null)) return sc_term_12; else if ((((term2 = ((lst.car).cdr.car)), (unify_subst_nboyer = null), (one_way_unify1_nboyer(sc_term_12, term2)))!== false)) return (rewrite_nboyer((apply_subst_nboyer(unify_subst_nboyer, ((lst.car).cdr.cdr.car))))); else (lst = (lst.cdr)); } } } }; rewrite_args_nboyer = function(lst) { var sc_lst_14; return ((lst === null)?null:(new sc_Pair((rewrite_nboyer((lst.car))), ((sc_lst_14 = (lst.cdr)), ((sc_lst_14 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_14.car))), (rewrite_args_nboyer((sc_lst_14.cdr)))))))))); }; (unify_subst_nboyer = "\u1E9C*"); one_way_unify1_nboyer = function(term1, term2) { var lst1; var lst2; var temp_temp; if (!(term2 instanceof sc_Pair)) { (temp_temp = (sc_assq(term2, unify_subst_nboyer))); if ((temp_temp!== false)) return (is_term_equal_nboyer(term1, (temp_temp.cdr))); else if ((sc_isNumber(term2))) return (sc_isEqual(term1, term2)); else { (unify_subst_nboyer = (new sc_Pair((new sc_Pair(term2, term1)), unify_subst_nboyer))); return true; } } else if (!(term1 instanceof sc_Pair)) return false; else if (((term1.car)===(term2.car))) { (lst1 = (term1.cdr)); (lst2 = (term2.cdr)); while (true) { if ((lst1 === null)) return (lst2 === null); else if ((lst2 === null)) return false; else if (((one_way_unify1_nboyer((lst1.car), (lst2.car)))!== false)) { (lst1 = (lst1.cdr)); (lst2 = (lst2.cdr)); } else return false; } } else return false; }; (false_term_nboyer = "\u1E9C*"); (true_term_nboyer = "\u1E9C*"); trans_of_implies1_nboyer = function(n) { var sc_n_15; return ((sc_isEqual(n, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (n-(1)), n)), ((sc_n_15 = (n-(1))), ((sc_isEqual(sc_n_15, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (sc_n_15-(1)), sc_n_15)), (trans_of_implies1_nboyer((sc_n_15-(1))))))))))); }; is_term_equal_nboyer = function(x, y) { var lst1; var lst2; var r2; var r1; if ((x instanceof sc_Pair)) if ((y instanceof sc_Pair)) if ((((r1 = (x.car)), (r2 = (y.car)), (r1===r2))!== false)) { (lst1 = (x.cdr)); (lst2 = (y.cdr)); while (true) { if ((lst1 === null)) return (lst2 === null); else if ((lst2 === null)) return false; else if (((is_term_equal_nboyer((lst1.car), (lst2.car)))!== false)) { (lst1 = (lst1.cdr)); (lst2 = (lst2.cdr)); } else return false; } } else return false; else return false; else return (sc_isEqual(x, y)); }; is_term_member_nboyer = function(x, lst) { var x; var lst; while (true) { if ((lst === null)) return false; else if (((is_term_equal_nboyer(x, (lst.car)))!== false)) return true; else (lst = (lst.cdr)); } }; BgL_setupzd2boyerzd2 = function() { var symbol_record; var value; var BgL_sc_symbolzd2record_16zd2; var sym; var sc_sym_17; var term; var lst; var sc_term_18; var sc_term_19; { (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null); (if_constructor_nboyer = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif"))); (false_term_nboyer = ((sc_term_19 = (new sc_Pair("\u1E9Cf",null))), (!(sc_term_19 instanceof sc_Pair)?sc_term_19:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_19.car))), (translate_args_nboyer((sc_term_19.cdr)))))))); (true_term_nboyer = ((sc_term_18 = (new sc_Pair("\u1E9Ct",null))), (!(sc_term_18 instanceof sc_Pair)?sc_term_18:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_18.car))), (translate_args_nboyer((sc_term_18.cdr)))))))); (lst = sc_const_3_nboyer); while (!(lst === null)) { { (term = (lst.car)); if (((term instanceof sc_Pair)&&(((term.car)==="\u1E9Cequal")&&((term.cdr.car) instanceof sc_Pair)))) { (sc_sym_17 = ((term.cdr.car).car)); (value = (new sc_Pair((!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr)))))), ((sym = ((term.cdr.car).car)), (BgL_sc_symbolzd2record_16zd2 = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sym))), (BgL_sc_symbolzd2record_16zd2[(1)]))))); (symbol_record = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17))); (symbol_record[(1)] = value); } else (sc_error("ADD-LEMMA did not like term: ", term)); (lst = (lst.cdr)); } } return true; } }; BgL_testzd2boyerzd2 = function(n) { var optrOpnd; var term; var sc_n_20; var answer; var sc_term_21; var sc_term_22; { (rewrite_count_nboyer = (0)); (term = sc_const_4_nboyer); (sc_n_20 = n); while (!(sc_n_20=== 0)) { { (term = (sc_list("\u1E9Cor", term, (new sc_Pair("\u1E9Cf",null))))); (--sc_n_20); } } (sc_term_22 = term); if (!(sc_term_22 instanceof sc_Pair)) (optrOpnd = sc_term_22); else (optrOpnd = (new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_22.car))), (translate_args_nboyer((sc_term_22.cdr)))))); (sc_term_21 = (apply_subst_nboyer(((const_nboyer === null)?null:(new sc_Pair((new sc_Pair((const_nboyer.car.car), (translate_term_nboyer((const_nboyer.car.cdr))))), (translate_alist_nboyer((const_nboyer.cdr)))))), optrOpnd))); (answer = (tautologyp_nboyer((rewrite_nboyer(sc_term_21)), null, null))); (sc_write(rewrite_count_nboyer)); (sc_display(" rewrites")); (sc_newline()); if ((answer!== false)) return rewrite_count_nboyer; else return false; } }; } /* Exported Variables */ var BgL_parsezd2ze3nbzd2treesze3; var BgL_earleyzd2benchmarkzd2; var BgL_parsezd2ze3parsedzf3zc2; var test; var BgL_parsezd2ze3treesz31; var BgL_makezd2parserzd2; /* End Exports */ var const_earley; { (const_earley = (new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair((new sc_Pair("\u1E9Ca",null)),(new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair("\u1E9Cs",null)))),null)))))),null))); BgL_makezd2parserzd2 = function(grammar, lexer) { var i; var parser_descr; var def_loop; var nb_nts; var names; var steps; var predictors; var enders; var starters; var nts; var sc_names_1; var sc_steps_2; var sc_predictors_3; var sc_enders_4; var sc_starters_5; var nb_confs; var BgL_sc_defzd2loop_6zd2; var BgL_sc_nbzd2nts_7zd2; var sc_nts_8; var BgL_sc_defzd2loop_9zd2; var ind; { ind = function(nt, sc_nts_10) { var i; { (i = ((sc_nts_10.length)-(1))); while (true) { if ((i>=(0))) if ((sc_isEqual((sc_nts_10[i]), nt))) return i; else (--i); else return false; } } }; (sc_nts_8 = ((BgL_sc_defzd2loop_9zd2 = function(defs, sc_nts_11) { var rule_loop; var head; var def; return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, sc_nts_12) { var nt; var l; var sc_nts_13; var rule; if ((rules instanceof sc_Pair)) { (rule = (rules.car)); (l = rule); (sc_nts_13 = sc_nts_12); while ((l instanceof sc_Pair)) { { (nt = (l.car)); (l = (l.cdr)); (sc_nts_13 = (((sc_member(nt, sc_nts_13))!== false)?sc_nts_13:(new sc_Pair(nt, sc_nts_13)))); } } return (rule_loop((rules.cdr), sc_nts_13)); } else return (BgL_sc_defzd2loop_9zd2((defs.cdr), sc_nts_12)); }), (rule_loop((def.cdr), (((sc_member(head, sc_nts_11))!== false)?sc_nts_11:(new sc_Pair(head, sc_nts_11)))))):(sc_list2vector((sc_reverse(sc_nts_11))))); }), (BgL_sc_defzd2loop_9zd2(grammar, null)))); (BgL_sc_nbzd2nts_7zd2 = (sc_nts_8.length)); (nb_confs = (((BgL_sc_defzd2loop_6zd2 = function(defs, BgL_sc_nbzd2confs_14zd2) { var rule_loop; var def; return ((defs instanceof sc_Pair)?((def = (defs.car)), (rule_loop = function(rules, BgL_sc_nbzd2confs_15zd2) { var l; var BgL_sc_nbzd2confs_16zd2; var rule; if ((rules instanceof sc_Pair)) { (rule = (rules.car)); (l = rule); (BgL_sc_nbzd2confs_16zd2 = BgL_sc_nbzd2confs_15zd2); while ((l instanceof sc_Pair)) { { (l = (l.cdr)); (++BgL_sc_nbzd2confs_16zd2); } } return (rule_loop((rules.cdr), (BgL_sc_nbzd2confs_16zd2+(1)))); } else return (BgL_sc_defzd2loop_6zd2((defs.cdr), BgL_sc_nbzd2confs_15zd2)); }), (rule_loop((def.cdr), BgL_sc_nbzd2confs_14zd2))):BgL_sc_nbzd2confs_14zd2); }), (BgL_sc_defzd2loop_6zd2(grammar, (0))))+BgL_sc_nbzd2nts_7zd2)); (sc_starters_5 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); (sc_enders_4 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); (sc_predictors_3 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); (sc_steps_2 = (sc_makeVector(nb_confs, false))); (sc_names_1 = (sc_makeVector(nb_confs, false))); (nts = sc_nts_8); (starters = sc_starters_5); (enders = sc_enders_4); (predictors = sc_predictors_3); (steps = sc_steps_2); (names = sc_names_1); (nb_nts = (sc_nts_8.length)); (i = (nb_nts-(1))); while ((i>=(0))) { { (sc_steps_2[i] = (i-nb_nts)); (sc_names_1[i] = (sc_list((sc_nts_8[i]), (0)))); (sc_enders_4[i] = (sc_list(i))); (--i); } } def_loop = function(defs, conf) { var rule_loop; var head; var def; return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, conf, rule_num) { var i; var sc_i_17; var nt; var l; var sc_conf_18; var sc_i_19; var rule; if ((rules instanceof sc_Pair)) { (rule = (rules.car)); (names[conf] = (sc_list(head, rule_num))); (sc_i_19 = (ind(head, nts))); (starters[sc_i_19] = (new sc_Pair(conf, (starters[sc_i_19])))); (l = rule); (sc_conf_18 = conf); while ((l instanceof sc_Pair)) { { (nt = (l.car)); (steps[sc_conf_18] = (ind(nt, nts))); (sc_i_17 = (ind(nt, nts))); (predictors[sc_i_17] = (new sc_Pair(sc_conf_18, (predictors[sc_i_17])))); (l = (l.cdr)); (++sc_conf_18); } } (steps[sc_conf_18] = ((ind(head, nts))-nb_nts)); (i = (ind(head, nts))); (enders[i] = (new sc_Pair(sc_conf_18, (enders[i])))); return (rule_loop((rules.cdr), (sc_conf_18+(1)), (rule_num+(1)))); } else return (def_loop((defs.cdr), conf)); }), (rule_loop((def.cdr), conf, (1)))):undefined); }; (def_loop(grammar, (sc_nts_8.length))); (parser_descr = [lexer, sc_nts_8, sc_starters_5, sc_enders_4, sc_predictors_3, sc_steps_2, sc_names_1]); return function(input) { var optrOpnd; var sc_optrOpnd_20; var sc_optrOpnd_21; var sc_optrOpnd_22; var loop1; var BgL_sc_stateza2_23za2; var toks; var BgL_sc_nbzd2nts_24zd2; var sc_steps_25; var sc_enders_26; var state_num; var BgL_sc_statesza2_27za2; var states; var i; var conf; var l; var tok_nts; var sc_i_28; var sc_i_29; var l1; var l2; var tok; var tail1129; var L1125; var goal_enders; var BgL_sc_statesza2_30za2; var BgL_sc_nbzd2nts_31zd2; var BgL_sc_nbzd2confs_32zd2; var nb_toks; var goal_starters; var sc_states_33; var BgL_sc_nbzd2confs_34zd2; var BgL_sc_nbzd2toks_35zd2; var sc_toks_36; var falseHead1128; var sc_names_37; var sc_steps_38; var sc_predictors_39; var sc_enders_40; var sc_starters_41; var sc_nts_42; var lexer; var sc_ind_43; var make_states; var BgL_sc_confzd2setzd2getza2_44za2; var conf_set_merge_new_bang; var conf_set_adjoin; var BgL_sc_confzd2setzd2adjoinza2_45za2; var BgL_sc_confzd2setzd2adjoinza2za2_46z00; var conf_set_union; var forw; var is_parsed; var deriv_trees; var BgL_sc_derivzd2treesza2_47z70; var nb_deriv_trees; var BgL_sc_nbzd2derivzd2treesza2_48za2; { sc_ind_43 = function(nt, sc_nts_49) { var i; { (i = ((sc_nts_49.length)-(1))); while (true) { if ((i>=(0))) if ((sc_isEqual((sc_nts_49[i]), nt))) return i; else (--i); else return false; } } }; make_states = function(BgL_sc_nbzd2toks_50zd2, BgL_sc_nbzd2confs_51zd2) { var v; var i; var sc_states_52; { (sc_states_52 = (sc_makeVector((BgL_sc_nbzd2toks_50zd2+(1)), false))); (i = BgL_sc_nbzd2toks_50zd2); while ((i>=(0))) { { (v = (sc_makeVector((BgL_sc_nbzd2confs_51zd2+(1)), false))); (v[(0)] = (-1)); (sc_states_52[i] = v); (--i); } } return sc_states_52; } }; BgL_sc_confzd2setzd2getza2_44za2 = function(state, BgL_sc_statezd2num_53zd2, sc_conf_54) { var conf_set; var BgL_sc_confzd2set_55zd2; return ((BgL_sc_confzd2set_55zd2 = (state[(sc_conf_54+(1))])), ((BgL_sc_confzd2set_55zd2!== false)?BgL_sc_confzd2set_55zd2:((conf_set = (sc_makeVector((BgL_sc_statezd2num_53zd2+(6)), false))), (conf_set[(1)] = (-3)), (conf_set[(2)] = (-1)), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1)), (state[(sc_conf_54+(1))] = conf_set), conf_set))); }; conf_set_merge_new_bang = function(conf_set) { return ((conf_set[((conf_set[(1)])+(5))] = (conf_set[(4)])), (conf_set[(1)] = (conf_set[(3)])), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1))); }; conf_set_adjoin = function(state, conf_set, sc_conf_56, i) { var tail; return ((tail = (conf_set[(3)])), (conf_set[(i+(5))] = (-1)), (conf_set[(tail+(5))] = i), (conf_set[(3)] = i), ((tail<(0))?((conf_set[(0)] = (state[(0)])), (state[(0)] = sc_conf_56)):undefined)); }; BgL_sc_confzd2setzd2adjoinza2_45za2 = function(sc_states_57, BgL_sc_statezd2num_58zd2, l, i) { var conf_set; var sc_conf_59; var l1; var state; { (state = (sc_states_57[BgL_sc_statezd2num_58zd2])); (l1 = l); while ((l1 instanceof sc_Pair)) { { (sc_conf_59 = (l1.car)); (conf_set = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_58zd2, sc_conf_59))); if (((conf_set[(i+(5))])=== false)) { (conf_set_adjoin(state, conf_set, sc_conf_59, i)); (l1 = (l1.cdr)); } else (l1 = (l1.cdr)); } } return undefined; } }; BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function(sc_states_60, BgL_sc_statesza2_61za2, BgL_sc_statezd2num_62zd2, sc_conf_63, i) { var BgL_sc_confzd2setza2_64z70; var BgL_sc_stateza2_65za2; var conf_set; var state; return ((state = (sc_states_60[BgL_sc_statezd2num_62zd2])), ((((conf_set = (state[(sc_conf_63+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)?((BgL_sc_stateza2_65za2 = (BgL_sc_statesza2_61za2[BgL_sc_statezd2num_62zd2])), (BgL_sc_confzd2setza2_64z70 = (BgL_sc_confzd2setzd2getza2_44za2(BgL_sc_stateza2_65za2, BgL_sc_statezd2num_62zd2, sc_conf_63))), (((BgL_sc_confzd2setza2_64z70[(i+(5))])=== false)?(conf_set_adjoin(BgL_sc_stateza2_65za2, BgL_sc_confzd2setza2_64z70, sc_conf_63, i)):undefined), true):false)); }; conf_set_union = function(state, conf_set, sc_conf_66, other_set) { var i; { (i = (other_set[(2)])); while ((i>=(0))) { if (((conf_set[(i+(5))])=== false)) { (conf_set_adjoin(state, conf_set, sc_conf_66, i)); (i = (other_set[(i+(5))])); } else (i = (other_set[(i+(5))])); } return undefined; } }; forw = function(sc_states_67, BgL_sc_statezd2num_68zd2, sc_starters_69, sc_enders_70, sc_predictors_71, sc_steps_72, sc_nts_73) { var next_set; var next; var conf_set; var ender; var l; var starter_set; var starter; var sc_l_74; var sc_loop1_75; var head; var BgL_sc_confzd2set_76zd2; var BgL_sc_statezd2num_77zd2; var state; var sc_states_78; var preds; var BgL_sc_confzd2set_79zd2; var step; var sc_conf_80; var BgL_sc_nbzd2nts_81zd2; var sc_state_82; { (sc_state_82 = (sc_states_67[BgL_sc_statezd2num_68zd2])); (BgL_sc_nbzd2nts_81zd2 = (sc_nts_73.length)); while (true) { { (sc_conf_80 = (sc_state_82[(0)])); if ((sc_conf_80>=(0))) { (step = (sc_steps_72[sc_conf_80])); (BgL_sc_confzd2set_79zd2 = (sc_state_82[(sc_conf_80+(1))])); (head = (BgL_sc_confzd2set_79zd2[(4)])); (sc_state_82[(0)] = (BgL_sc_confzd2set_79zd2[(0)])); (conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2)); if ((step>=(0))) { (sc_l_74 = (sc_starters_69[step])); while ((sc_l_74 instanceof sc_Pair)) { { (starter = (sc_l_74.car)); (starter_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, starter))); if (((starter_set[(BgL_sc_statezd2num_68zd2+(5))])=== false)) { (conf_set_adjoin(sc_state_82, starter_set, starter, BgL_sc_statezd2num_68zd2)); (sc_l_74 = (sc_l_74.cdr)); } else (sc_l_74 = (sc_l_74.cdr)); } } (l = (sc_enders_70[step])); while ((l instanceof sc_Pair)) { { (ender = (l.car)); if ((((conf_set = (sc_state_82[(ender+(1))])), ((conf_set!== false)?(conf_set[(BgL_sc_statezd2num_68zd2+(5))]):false))!== false)) { (next = (sc_conf_80+(1))); (next_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, next))); (conf_set_union(sc_state_82, next_set, next, BgL_sc_confzd2set_79zd2)); (l = (l.cdr)); } else (l = (l.cdr)); } } } else { (preds = (sc_predictors_71[(step+BgL_sc_nbzd2nts_81zd2)])); (sc_states_78 = sc_states_67); (state = sc_state_82); (BgL_sc_statezd2num_77zd2 = BgL_sc_statezd2num_68zd2); (BgL_sc_confzd2set_76zd2 = BgL_sc_confzd2set_79zd2); sc_loop1_75 = function(l) { var sc_state_83; var BgL_sc_nextzd2set_84zd2; var sc_next_85; var pred_set; var i; var pred; if ((l instanceof sc_Pair)) { (pred = (l.car)); (i = head); while ((i>=(0))) { { (pred_set = ((sc_state_83 = (sc_states_78[i])), (sc_state_83[(pred+(1))]))); if ((pred_set!== false)) { (sc_next_85 = (pred+(1))); (BgL_sc_nextzd2set_84zd2 = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_77zd2, sc_next_85))); (conf_set_union(state, BgL_sc_nextzd2set_84zd2, sc_next_85, pred_set)); } (i = (BgL_sc_confzd2set_76zd2[(i+(5))])); } } return (sc_loop1_75((l.cdr))); } else return undefined; }; (sc_loop1_75(preds)); } } else return undefined; } } } }; is_parsed = function(nt, i, j, sc_nts_86, sc_enders_87, sc_states_88) { var conf_set; var state; var sc_conf_89; var l; var BgL_sc_ntza2_90za2; { (BgL_sc_ntza2_90za2 = (sc_ind_43(nt, sc_nts_86))); if ((BgL_sc_ntza2_90za2!== false)) { (sc_nts_86.length); (l = (sc_enders_87[BgL_sc_ntza2_90za2])); while (true) { if ((l instanceof sc_Pair)) { (sc_conf_89 = (l.car)); if ((((state = (sc_states_88[j])), (conf_set = (state[(sc_conf_89+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) return true; else (l = (l.cdr)); } else return false; } } else return false; } }; deriv_trees = function(sc_conf_91, i, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2) { var sc_loop1_98; var prev; var name; return ((name = (sc_names_94[sc_conf_91])), ((name!== false)?((sc_conf_91=(0))) if (((k>=i)&&(((sc_state_99 = (sc_states_96[k])), (conf_set = (sc_state_99[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))) { (prev_trees = (deriv_trees(prev, i, k, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2))); (ender_trees = (deriv_trees(ender, k, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2))); loop3 = function(l3, l2) { var l4; var sc_l2_100; var ender_tree; if ((l3 instanceof sc_Pair)) { (ender_tree = (sc_list((l3.car)))); (l4 = prev_trees); (sc_l2_100 = l2); while ((l4 instanceof sc_Pair)) { { (sc_l2_100 = (new sc_Pair((sc_append((l4.car), ender_tree)), sc_l2_100))); (l4 = (l4.cdr)); } } return (loop3((l3.cdr), sc_l2_100)); } else return (loop2((ender_set[(k+(5))]), l2)); }; return (loop3(ender_trees, l2)); } else (k = (ender_set[(k+(5))])); else return (sc_loop1_98((l1.cdr), l2)); } }; return (loop2((ender_set[(2)]), l2)); } else (l1 = (l1.cdr)); } else return l2; } }), (sc_loop1_98((sc_enders_92[(sc_steps_93[prev])]), null))))); }; BgL_sc_derivzd2treesza2_47z70 = function(nt, i, j, sc_nts_101, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106) { var conf_set; var state; var sc_conf_107; var l; var trees; var BgL_sc_nbzd2nts_108zd2; var BgL_sc_ntza2_109za2; { (BgL_sc_ntza2_109za2 = (sc_ind_43(nt, sc_nts_101))); if ((BgL_sc_ntza2_109za2!== false)) { (BgL_sc_nbzd2nts_108zd2 = (sc_nts_101.length)); (l = (sc_enders_102[BgL_sc_ntza2_109za2])); (trees = null); while ((l instanceof sc_Pair)) { { (sc_conf_107 = (l.car)); if ((((state = (sc_states_106[j])), (conf_set = (state[(sc_conf_107+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) { (l = (l.cdr)); (trees = (sc_append((deriv_trees(sc_conf_107, i, j, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106, BgL_sc_nbzd2nts_108zd2)), trees))); } else (l = (l.cdr)); } } return trees; } else return false; } }; nb_deriv_trees = function(sc_conf_110, i, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2) { var sc_loop1_116; var tmp1124; var prev; return ((prev = (sc_conf_110-(1))), ((((tmp1124 = (sc_conf_110=(0))) { if (((k>=i)&&(((state = (sc_states_114[k])), (conf_set = (state[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))) { (nb_prev_trees = (nb_deriv_trees(prev, i, k, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2))); (nb_ender_trees = (nb_deriv_trees(ender, k, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2))); (k = (ender_set[(k+(5))])); (n +=(nb_prev_trees*nb_ender_trees)); } else (k = (ender_set[(k+(5))])); } return (sc_loop1_116((l.cdr), n)); } else (l = (l.cdr)); } else return sc_n_118; } }), (sc_loop1_116((sc_enders_111[(sc_steps_112[prev])]), (0)))))); }; BgL_sc_nbzd2derivzd2treesza2_48za2 = function(nt, i, j, sc_nts_119, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123) { var conf_set; var state; var sc_conf_124; var l; var nb_trees; var BgL_sc_nbzd2nts_125zd2; var BgL_sc_ntza2_126za2; { (BgL_sc_ntza2_126za2 = (sc_ind_43(nt, sc_nts_119))); if ((BgL_sc_ntza2_126za2!== false)) { (BgL_sc_nbzd2nts_125zd2 = (sc_nts_119.length)); (l = (sc_enders_120[BgL_sc_ntza2_126za2])); (nb_trees = (0)); while ((l instanceof sc_Pair)) { { (sc_conf_124 = (l.car)); if ((((state = (sc_states_123[j])), (conf_set = (state[(sc_conf_124+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) { (l = (l.cdr)); (nb_trees = ((nb_deriv_trees(sc_conf_124, i, j, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123, BgL_sc_nbzd2nts_125zd2))+nb_trees)); } else (l = (l.cdr)); } } return nb_trees; } else return false; } }; (lexer = (parser_descr[(0)])); (sc_nts_42 = (parser_descr[(1)])); (sc_starters_41 = (parser_descr[(2)])); (sc_enders_40 = (parser_descr[(3)])); (sc_predictors_39 = (parser_descr[(4)])); (sc_steps_38 = (parser_descr[(5)])); (sc_names_37 = (parser_descr[(6)])); (falseHead1128 = (new sc_Pair(null, null))); (L1125 = (lexer(input))); (tail1129 = falseHead1128); while (!(L1125 === null)) { { (tok = (L1125.car)); (l1 = (tok.cdr)); (l2 = null); while ((l1 instanceof sc_Pair)) { { (sc_i_29 = (sc_ind_43((l1.car), sc_nts_42))); if ((sc_i_29!== false)) { (l1 = (l1.cdr)); (l2 = (new sc_Pair(sc_i_29, l2))); } else (l1 = (l1.cdr)); } } (sc_optrOpnd_22 = (new sc_Pair((tok.car), (sc_reverse(l2))))); (sc_optrOpnd_21 = (new sc_Pair(sc_optrOpnd_22, null))); (tail1129.cdr = sc_optrOpnd_21); (tail1129 = (tail1129.cdr)); (L1125 = (L1125.cdr)); } } (sc_optrOpnd_20 = (falseHead1128.cdr)); (sc_toks_36 = (sc_list2vector(sc_optrOpnd_20))); (BgL_sc_nbzd2toks_35zd2 = (sc_toks_36.length)); (BgL_sc_nbzd2confs_34zd2 = (sc_steps_38.length)); (sc_states_33 = (make_states(BgL_sc_nbzd2toks_35zd2, BgL_sc_nbzd2confs_34zd2))); (goal_starters = (sc_starters_41[(0)])); (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33, (0), goal_starters, (0))); (forw(sc_states_33, (0), sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_nts_42)); (sc_i_28 = (0)); while ((sc_i_28=(0))) { { (states = sc_states_33); (BgL_sc_statesza2_27za2 = BgL_sc_statesza2_30za2); (state_num = i); (sc_enders_26 = sc_enders_40); (sc_steps_25 = sc_steps_38); (BgL_sc_nbzd2nts_24zd2 = BgL_sc_nbzd2nts_31zd2); (toks = sc_toks_36); (BgL_sc_stateza2_23za2 = (BgL_sc_statesza2_30za2[i])); loop1 = function() { var sc_loop1_127; var prev; var BgL_sc_statesza2_128za2; var sc_states_129; var j; var i; var sc_i_130; var head; var conf_set; var sc_conf_131; { (sc_conf_131 = (BgL_sc_stateza2_23za2[(0)])); if ((sc_conf_131>=(0))) { (conf_set = (BgL_sc_stateza2_23za2[(sc_conf_131+(1))])); (head = (conf_set[(4)])); (BgL_sc_stateza2_23za2[(0)] = (conf_set[(0)])); (conf_set_merge_new_bang(conf_set)); (sc_i_130 = head); while ((sc_i_130>=(0))) { { (i = sc_i_130); (j = state_num); (sc_states_129 = states); (BgL_sc_statesza2_128za2 = BgL_sc_statesza2_27za2); (prev = (sc_conf_131-(1))); if (((sc_conf_131>=BgL_sc_nbzd2nts_24zd2)&&((sc_steps_25[prev])>=(0)))) { sc_loop1_127 = function(l) { var k; var ender_set; var state; var ender; var l; while (true) { if ((l instanceof sc_Pair)) { (ender = (l.car)); (ender_set = ((state = (sc_states_129[j])), (state[(ender+(1))]))); if ((ender_set!== false)) { (k = (ender_set[(2)])); while ((k>=(0))) { { if ((k>=i)) if (((BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, k, prev, i))!== false)) (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, j, ender, k)); (k = (ender_set[(k+(5))])); } } return (sc_loop1_127((l.cdr))); } else (l = (l.cdr)); } else return undefined; } }; (sc_loop1_127((sc_enders_26[(sc_steps_25[prev])]))); } (sc_i_130 = (conf_set[(sc_i_130+(5))])); } } return (loop1()); } else return undefined; } }; (loop1()); (--i); } } (optrOpnd = BgL_sc_statesza2_30za2); return [sc_nts_42, sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_names_37, sc_toks_36, optrOpnd, is_parsed, BgL_sc_derivzd2treesza2_47z70, BgL_sc_nbzd2derivzd2treesza2_48za2]; } }; } }; BgL_parsezd2ze3parsedzf3zc2 = function(parse, nt, i, j) { var is_parsed; var states; var enders; var nts; return ((nts = (parse[(0)])), (enders = (parse[(2)])), (states = (parse[(7)])), (is_parsed = (parse[(8)])), (is_parsed(nt, i, j, nts, enders, states))); }; BgL_parsezd2ze3treesz31 = function(parse, nt, i, j) { var BgL_sc_derivzd2treesza2_132z70; var states; var toks; var names; var steps; var enders; var nts; return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (names = (parse[(5)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_derivzd2treesza2_132z70 = (parse[(9)])), (BgL_sc_derivzd2treesza2_132z70(nt, i, j, nts, enders, steps, names, toks, states))); }; BgL_parsezd2ze3nbzd2treesze3 = function(parse, nt, i, j) { var BgL_sc_nbzd2derivzd2treesza2_133za2; var states; var toks; var steps; var enders; var nts; return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_nbzd2derivzd2treesza2_133za2 = (parse[(10)])), (BgL_sc_nbzd2derivzd2treesza2_133za2(nt, i, j, nts, enders, steps, toks, states))); }; test = function(k) { var x; var p; return ((p = (BgL_makezd2parserzd2(const_earley, function(l) { var sc_x_134; var tail1134; var L1130; var falseHead1133; { (falseHead1133 = (new sc_Pair(null, null))); (tail1134 = falseHead1133); (L1130 = l); while (!(L1130 === null)) { { (tail1134.cdr = (new sc_Pair(((sc_x_134 = (L1130.car)), (sc_list(sc_x_134, sc_x_134))), null))); (tail1134 = (tail1134.cdr)); (L1130 = (L1130.cdr)); } } return (falseHead1133.cdr); } }))), (x = (p((sc_vector2list((sc_makeVector(k, "\u1E9Ca"))))))), (sc_length((BgL_parsezd2ze3treesz31(x, "\u1E9Cs", (0), k))))); }; BgL_earleyzd2benchmarkzd2 = function() { var args = null; for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { args = sc_cons(arguments[sc_tmp], args); } var k; return ((k = ((args === null)?(7):(args.car))), (BgL_runzd2benchmarkzd2("earley", (1), function() { return (test(k)); }, function(result) { return ((sc_display(result)), (sc_newline()), result == 132); }))); }; } /************* END OF GENERATED CODE *************/ // Invoke this function to run a benchmark. // The first argument is a string identifying the benchmark. // The second argument is the number of times to run the benchmark. // The third argument is a function that runs the benchmark. // The fourth argument is a unary function that warns if the result // returned by the benchmark is incorrect. // // Example: // RunBenchmark("new Array()", // 1, // function () { new Array(1000000); } // function (v) { // return (v instanceof Array) && (v.length == 1000000); // }); SC_DEFAULT_OUT = new sc_GenericOutputPort(function(s) {}); SC_ERROR_OUT = SC_DEFAULT_OUT; function RunBenchmark(name, count, run, warn) { for (var n = 0; n < count; ++n) { result = run(); if (!warn(result)) { throw new Error("Earley or Boyer did incorrect number of rewrites"); } } } var BgL_runzd2benchmarkzd2 = RunBenchmark; (function () { BgL_earleyzd2benchmarkzd2(); })(); (function () { BgL_nboyerzd2benchmarkzd2(); })(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/v8-v5/check-raytrace.js0000644000175000017500000007031211545150464023312 0ustar chr1schr1s// The ray tracer code in this file is written by Adam Burmister. It // is available in its original form from: // // http://labs.flog.nz.co/raytracer/ // // It has been modified slightly by Google to work as a standalone // benchmark, but the all the computational code remains // untouched. This file also contains a copy of parts of the Prototype // JavaScript framework which is used by the ray tracer. //var RayTrace = new BenchmarkSuite('RayTrace', 932666, [ // new Benchmark('RayTrace', renderScene) //]); // Variable used to hold a number that can be used to verify that // the scene was ray traced correctly. var checkNumber; // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ // The following is a copy of parts of the Prototype JavaScript library: // Prototype JavaScript framework, version 1.5.0 // (c) 2005-2007 Sam Stephenson // // Prototype is freely distributable under the terms of an MIT-style license. // For details, see the Prototype web site: http://prototype.conio.net/ var Class = { create: function() { return function() { this.initialize.apply(this, arguments); } } }; Object.extend = function(destination, source) { for (var property in source) { destination[property] = source[property]; } return destination; }; // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ // The rest of this file is the actual ray tracer written by Adam // Burmister. It's a concatenation of the following files: // // flog/color.js // flog/light.js // flog/vector.js // flog/ray.js // flog/scene.js // flog/material/basematerial.js // flog/material/solid.js // flog/material/chessboard.js // flog/shape/baseshape.js // flog/shape/sphere.js // flog/shape/plane.js // flog/intersectioninfo.js // flog/camera.js // flog/background.js // flog/engine.js /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Color = Class.create(); Flog.RayTracer.Color.prototype = { red : 0.0, green : 0.0, blue : 0.0, initialize : function(r, g, b) { if(!r) r = 0.0; if(!g) g = 0.0; if(!b) b = 0.0; this.red = r; this.green = g; this.blue = b; }, add : function(c1, c2){ var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red + c2.red; result.green = c1.green + c2.green; result.blue = c1.blue + c2.blue; return result; }, addScalar: function(c1, s){ var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red + s; result.green = c1.green + s; result.blue = c1.blue + s; result.limit(); return result; }, subtract: function(c1, c2){ var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red - c2.red; result.green = c1.green - c2.green; result.blue = c1.blue - c2.blue; return result; }, multiply : function(c1, c2) { var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red * c2.red; result.green = c1.green * c2.green; result.blue = c1.blue * c2.blue; return result; }, multiplyScalar : function(c1, f) { var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red * f; result.green = c1.green * f; result.blue = c1.blue * f; return result; }, divideFactor : function(c1, f) { var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red / f; result.green = c1.green / f; result.blue = c1.blue / f; return result; }, limit: function(){ this.red = (this.red > 0.0) ? ( (this.red > 1.0) ? 1.0 : this.red ) : 0.0; this.green = (this.green > 0.0) ? ( (this.green > 1.0) ? 1.0 : this.green ) : 0.0; this.blue = (this.blue > 0.0) ? ( (this.blue > 1.0) ? 1.0 : this.blue ) : 0.0; }, distance : function(color) { var d = Math.abs(this.red - color.red) + Math.abs(this.green - color.green) + Math.abs(this.blue - color.blue); return d; }, blend: function(c1, c2, w){ var result = new Flog.RayTracer.Color(0,0,0); result = Flog.RayTracer.Color.prototype.add( Flog.RayTracer.Color.prototype.multiplyScalar(c1, 1 - w), Flog.RayTracer.Color.prototype.multiplyScalar(c2, w) ); return result; }, brightness : function() { var r = Math.floor(this.red*255); var g = Math.floor(this.green*255); var b = Math.floor(this.blue*255); return (r * 77 + g * 150 + b * 29) >> 8; }, toString : function () { var r = Math.floor(this.red*255); var g = Math.floor(this.green*255); var b = Math.floor(this.blue*255); return "rgb("+ r +","+ g +","+ b +")"; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Light = Class.create(); Flog.RayTracer.Light.prototype = { position: null, color: null, intensity: 10.0, initialize : function(pos, color, intensity) { this.position = pos; this.color = color; this.intensity = (intensity ? intensity : 10.0); }, getIntensity: function(distance){ if(distance >= intensity) return 0; return Math.pow((intensity - distance) / strength, 0.2); }, toString : function () { return 'Light [' + this.position.x + ',' + this.position.y + ',' + this.position.z + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Vector = Class.create(); Flog.RayTracer.Vector.prototype = { x : 0.0, y : 0.0, z : 0.0, initialize : function(x, y, z) { this.x = (x ? x : 0); this.y = (y ? y : 0); this.z = (z ? z : 0); }, copy: function(vector){ this.x = vector.x; this.y = vector.y; this.z = vector.z; }, normalize : function() { var m = this.magnitude(); return new Flog.RayTracer.Vector(this.x / m, this.y / m, this.z / m); }, magnitude : function() { return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z)); }, cross : function(w) { return new Flog.RayTracer.Vector( -this.z * w.y + this.y * w.z, this.z * w.x - this.x * w.z, -this.y * w.x + this.x * w.y); }, dot : function(w) { return this.x * w.x + this.y * w.y + this.z * w.z; }, add : function(v, w) { return new Flog.RayTracer.Vector(w.x + v.x, w.y + v.y, w.z + v.z); }, subtract : function(v, w) { if(!w || !v) throw 'Vectors must be defined [' + v + ',' + w + ']'; return new Flog.RayTracer.Vector(v.x - w.x, v.y - w.y, v.z - w.z); }, multiplyVector : function(v, w) { return new Flog.RayTracer.Vector(v.x * w.x, v.y * w.y, v.z * w.z); }, multiplyScalar : function(v, w) { return new Flog.RayTracer.Vector(v.x * w, v.y * w, v.z * w); }, toString : function () { return 'Vector [' + this.x + ',' + this.y + ',' + this.z + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Ray = Class.create(); Flog.RayTracer.Ray.prototype = { position : null, direction : null, initialize : function(pos, dir) { this.position = pos; this.direction = dir; }, toString : function () { return 'Ray [' + this.position + ',' + this.direction + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Scene = Class.create(); Flog.RayTracer.Scene.prototype = { camera : null, shapes : [], lights : [], background : null, initialize : function() { this.camera = new Flog.RayTracer.Camera( new Flog.RayTracer.Vector(0,0,-5), new Flog.RayTracer.Vector(0,0,1), new Flog.RayTracer.Vector(0,1,0) ); this.shapes = new Array(); this.lights = new Array(); this.background = new Flog.RayTracer.Background(new Flog.RayTracer.Color(0,0,0.5), 0.2); } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Material) == 'undefined') Flog.RayTracer.Material = {}; Flog.RayTracer.Material.BaseMaterial = Class.create(); Flog.RayTracer.Material.BaseMaterial.prototype = { gloss: 2.0, // [0...infinity] 0 = matt transparency: 0.0, // 0=opaque reflection: 0.0, // [0...infinity] 0 = no reflection refraction: 0.50, hasTexture: false, initialize : function() { }, getColor: function(u, v){ }, wrapUp: function(t){ t = t % 2.0; if(t < -1) t += 2.0; if(t >= 1) t -= 2.0; return t; }, toString : function () { return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Material.Solid = Class.create(); Flog.RayTracer.Material.Solid.prototype = Object.extend( new Flog.RayTracer.Material.BaseMaterial(), { initialize : function(color, reflection, refraction, transparency, gloss) { this.color = color; this.reflection = reflection; this.transparency = transparency; this.gloss = gloss; this.hasTexture = false; }, getColor: function(u, v){ return this.color; }, toString : function () { return 'SolidMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } ); /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Material.Chessboard = Class.create(); Flog.RayTracer.Material.Chessboard.prototype = Object.extend( new Flog.RayTracer.Material.BaseMaterial(), { colorEven: null, colorOdd: null, density: 0.5, initialize : function(colorEven, colorOdd, reflection, transparency, gloss, density) { this.colorEven = colorEven; this.colorOdd = colorOdd; this.reflection = reflection; this.transparency = transparency; this.gloss = gloss; this.density = density; this.hasTexture = true; }, getColor: function(u, v){ var t = this.wrapUp(u * this.density) * this.wrapUp(v * this.density); if(t < 0.0) return this.colorEven; else return this.colorOdd; }, toString : function () { return 'ChessMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } ); /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.BaseShape = Class.create(); Flog.RayTracer.Shape.BaseShape.prototype = { position: null, material: null, initialize : function() { this.position = new Vector(0,0,0); this.material = new Flog.RayTracer.Material.SolidMaterial( new Flog.RayTracer.Color(1,0,1), 0, 0, 0 ); }, toString : function () { return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.Sphere = Class.create(); Flog.RayTracer.Shape.Sphere.prototype = { initialize : function(pos, radius, material) { this.radius = radius; this.position = pos; this.material = material; }, intersect: function(ray){ var info = new Flog.RayTracer.IntersectionInfo(); info.shape = this; var dst = Flog.RayTracer.Vector.prototype.subtract(ray.position, this.position); var B = dst.dot(ray.direction); var C = dst.dot(dst) - (this.radius * this.radius); var D = (B * B) - C; if(D > 0){ // intersection! info.isHit = true; info.distance = (-B) - Math.sqrt(D); info.position = Flog.RayTracer.Vector.prototype.add( ray.position, Flog.RayTracer.Vector.prototype.multiplyScalar( ray.direction, info.distance ) ); info.normal = Flog.RayTracer.Vector.prototype.subtract( info.position, this.position ).normalize(); info.color = this.material.getColor(0,0); } else { info.isHit = false; } return info; }, toString : function () { return 'Sphere [position=' + this.position + ', radius=' + this.radius + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.Plane = Class.create(); Flog.RayTracer.Shape.Plane.prototype = { d: 0.0, initialize : function(pos, d, material) { this.position = pos; this.d = d; this.material = material; }, intersect: function(ray){ var info = new Flog.RayTracer.IntersectionInfo(); var Vd = this.position.dot(ray.direction); if(Vd == 0) return info; // no intersection var t = -(this.position.dot(ray.position) + this.d) / Vd; if(t <= 0) return info; info.shape = this; info.isHit = true; info.position = Flog.RayTracer.Vector.prototype.add( ray.position, Flog.RayTracer.Vector.prototype.multiplyScalar( ray.direction, t ) ); info.normal = this.position; info.distance = t; if(this.material.hasTexture){ var vU = new Flog.RayTracer.Vector(this.position.y, this.position.z, -this.position.x); var vV = vU.cross(this.position); var u = info.position.dot(vU); var v = info.position.dot(vV); info.color = this.material.getColor(u,v); } else { info.color = this.material.getColor(0,0); } return info; }, toString : function () { return 'Plane [' + this.position + ', d=' + this.d + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.IntersectionInfo = Class.create(); Flog.RayTracer.IntersectionInfo.prototype = { isHit: false, hitCount: 0, shape: null, position: null, normal: null, color: null, distance: null, initialize : function() { this.color = new Flog.RayTracer.Color(0,0,0); }, toString : function () { return 'Intersection [' + this.position + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Camera = Class.create(); Flog.RayTracer.Camera.prototype = { position: null, lookAt: null, equator: null, up: null, screen: null, initialize : function(pos, lookAt, up) { this.position = pos; this.lookAt = lookAt; this.up = up; this.equator = lookAt.normalize().cross(this.up); this.screen = Flog.RayTracer.Vector.prototype.add(this.position, this.lookAt); }, getRay: function(vx, vy){ var pos = Flog.RayTracer.Vector.prototype.subtract( this.screen, Flog.RayTracer.Vector.prototype.subtract( Flog.RayTracer.Vector.prototype.multiplyScalar(this.equator, vx), Flog.RayTracer.Vector.prototype.multiplyScalar(this.up, vy) ) ); pos.y = pos.y * -1; var dir = Flog.RayTracer.Vector.prototype.subtract( pos, this.position ); var ray = new Flog.RayTracer.Ray(pos, dir.normalize()); return ray; }, toString : function () { return 'Ray []'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Background = Class.create(); Flog.RayTracer.Background.prototype = { color : null, ambience : 0.0, initialize : function(color, ambience) { this.color = color; this.ambience = ambience; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Engine = Class.create(); Flog.RayTracer.Engine.prototype = { canvas: null, /* 2d context we can render to */ initialize: function(options){ this.options = Object.extend({ canvasHeight: 100, canvasWidth: 100, pixelWidth: 2, pixelHeight: 2, renderDiffuse: false, renderShadows: false, renderHighlights: false, renderReflections: false, rayDepth: 2 }, options || {}); this.options.canvasHeight /= this.options.pixelHeight; this.options.canvasWidth /= this.options.pixelWidth; /* TODO: dynamically include other scripts */ }, setPixel: function(x, y, color){ var pxW, pxH; pxW = this.options.pixelWidth; pxH = this.options.pixelHeight; if (this.canvas) { this.canvas.fillStyle = color.toString(); this.canvas.fillRect (x * pxW, y * pxH, pxW, pxH); } else { if (x === y) { checkNumber += color.brightness(); } // print(x * pxW, y * pxH, pxW, pxH); } }, renderScene: function(scene, canvas){ checkNumber = 0; /* Get canvas */ if (canvas) { this.canvas = canvas.getContext("2d"); } else { this.canvas = null; } var canvasHeight = this.options.canvasHeight; var canvasWidth = this.options.canvasWidth; for(var y=0; y < canvasHeight; y++){ for(var x=0; x < canvasWidth; x++){ var yp = y * 1.0 / canvasHeight * 2 - 1; var xp = x * 1.0 / canvasWidth * 2 - 1; var ray = scene.camera.getRay(xp, yp); var color = this.getPixelColor(ray, scene); this.setPixel(x, y, color); } } assertEq(checkNumber, 2321); }, getPixelColor: function(ray, scene){ var info = this.testIntersection(ray, scene, null); if(info.isHit){ var color = this.rayTrace(info, ray, scene, 0); return color; } return scene.background.color; }, testIntersection: function(ray, scene, exclude){ var hits = 0; var best = new Flog.RayTracer.IntersectionInfo(); best.distance = 2000; for(var i=0; i= 0 && info.distance < best.distance){ best = info; hits++; } } } best.hitCount = hits; return best; }, getReflectionRay: function(P,N,V){ var c1 = -N.dot(V); var R1 = Flog.RayTracer.Vector.prototype.add( Flog.RayTracer.Vector.prototype.multiplyScalar(N, 2*c1), V ); return new Flog.RayTracer.Ray(P, R1); }, rayTrace: function(info, ray, scene, depth){ // Calc ambient var color = Flog.RayTracer.Color.prototype.multiplyScalar(info.color, scene.background.ambience); var oldColor = color; var shininess = Math.pow(10, info.shape.material.gloss + 1); for(var i=0; i 0.0){ color = Flog.RayTracer.Color.prototype.add( color, Flog.RayTracer.Color.prototype.multiply( info.color, Flog.RayTracer.Color.prototype.multiplyScalar( light.color, L ) ) ); } } // The greater the depth the more accurate the colours, but // this is exponentially (!) expensive if(depth <= this.options.rayDepth){ // calculate reflection ray if(this.options.renderReflections && info.shape.material.reflection > 0) { var reflectionRay = this.getReflectionRay(info.position, info.normal, ray.direction); var refl = this.testIntersection(reflectionRay, scene, info.shape); if (refl.isHit && refl.distance > 0){ refl.color = this.rayTrace(refl, reflectionRay, scene, depth + 1); } else { refl.color = scene.background.color; } color = Flog.RayTracer.Color.prototype.blend( color, refl.color, info.shape.material.reflection ); } // Refraction /* TODO */ } /* Render shadows and highlights */ var shadowInfo = new Flog.RayTracer.IntersectionInfo(); if(this.options.renderShadows){ var shadowRay = new Flog.RayTracer.Ray(info.position, v); shadowInfo = this.testIntersection(shadowRay, scene, info.shape); if(shadowInfo.isHit && shadowInfo.shape != info.shape /*&& shadowInfo.shape.type != 'PLANE'*/){ var vA = Flog.RayTracer.Color.prototype.multiplyScalar(color, 0.5); var dB = (0.5 * Math.pow(shadowInfo.shape.material.transparency, 0.5)); color = Flog.RayTracer.Color.prototype.addScalar(vA,dB); } } // Phong specular highlights if(this.options.renderHighlights && !shadowInfo.isHit && info.shape.material.gloss > 0){ var Lv = Flog.RayTracer.Vector.prototype.subtract( info.shape.position, light.position ).normalize(); var E = Flog.RayTracer.Vector.prototype.subtract( scene.camera.position, info.shape.position ).normalize(); var H = Flog.RayTracer.Vector.prototype.subtract( E, Lv ).normalize(); var glossWeight = Math.pow(Math.max(info.normal.dot(H), 0), shininess); color = Flog.RayTracer.Color.prototype.add( Flog.RayTracer.Color.prototype.multiplyScalar(light.color, glossWeight), color ); } } color.limit(); return color; } }; function renderScene(){ var scene = new Flog.RayTracer.Scene(); scene.camera = new Flog.RayTracer.Camera( new Flog.RayTracer.Vector(0, 0, -15), new Flog.RayTracer.Vector(-0.2, 0, 5), new Flog.RayTracer.Vector(0, 1, 0) ); scene.background = new Flog.RayTracer.Background( new Flog.RayTracer.Color(0.5, 0.5, 0.5), 0.4 ); var sphere = new Flog.RayTracer.Shape.Sphere( new Flog.RayTracer.Vector(-1.5, 1.5, 2), 1.5, new Flog.RayTracer.Material.Solid( new Flog.RayTracer.Color(0,0.5,0.5), 0.3, 0.0, 0.0, 2.0 ) ); var sphere1 = new Flog.RayTracer.Shape.Sphere( new Flog.RayTracer.Vector(1, 0.25, 1), 0.5, new Flog.RayTracer.Material.Solid( new Flog.RayTracer.Color(0.9,0.9,0.9), 0.1, 0.0, 0.0, 1.5 ) ); var plane = new Flog.RayTracer.Shape.Plane( new Flog.RayTracer.Vector(0.1, 0.9, -0.5).normalize(), 1.2, new Flog.RayTracer.Material.Chessboard( new Flog.RayTracer.Color(1,1,1), new Flog.RayTracer.Color(0,0,0), 0.2, 0.0, 1.0, 0.7 ) ); scene.shapes.push(plane); scene.shapes.push(sphere); scene.shapes.push(sphere1); var light = new Flog.RayTracer.Light( new Flog.RayTracer.Vector(5, 10, -1), new Flog.RayTracer.Color(0.8, 0.8, 0.8) ); var light1 = new Flog.RayTracer.Light( new Flog.RayTracer.Vector(-3, 5, -15), new Flog.RayTracer.Color(0.8, 0.8, 0.8), 100 ); scene.lights.push(light); scene.lights.push(light1); var imageWidth = 100; // $F('imageWidth'); var imageHeight = 100; // $F('imageHeight'); var pixelSize = "5,5".split(','); // $F('pixelSize').split(','); var renderDiffuse = true; // $F('renderDiffuse'); var renderShadows = true; // $F('renderShadows'); var renderHighlights = true; // $F('renderHighlights'); var renderReflections = true; // $F('renderReflections'); var rayDepth = 2;//$F('rayDepth'); var raytracer = new Flog.RayTracer.Engine( { canvasWidth: imageWidth, canvasHeight: imageHeight, pixelWidth: pixelSize[0], pixelHeight: pixelSize[1], "renderDiffuse": renderDiffuse, "renderHighlights": renderHighlights, "renderShadows": renderShadows, "renderReflections": renderReflections, "rayDepth": rayDepth } ); raytracer.renderScene(scene, null, 0); } renderScene(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/v8-v5/check-regexp.js0000644000175000017500000031616211545150464023000 0ustar chr1schr1s// Copyright 2009 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Automatically generated on 2009-01-30. // This benchmark is generated by loading 50 of the most popular pages // on the web and logging all regexp operations performed. Each // operation is given a weight that is calculated from an estimate of // the popularity of the pages where it occurs and the number of times // it is executed while loading each page. Finally the literal // letters in the data are encoded using ROT13 in a way that does not // affect how the regexps match their input. //var RegRxp = new BenchmarkSuite('RegExp', 995230, [ // new Benchmark("RegExp", runRegExpBenchmark) //]); function runRegExpBenchmark() { var re0 = /^ba/; var re1 = /(((\w+):\/\/)([^\/:]*)(:(\d+))?)?([^#?]*)(\?([^#]*))?(#(.*))?/; var re2 = /^\s*|\s*$/g; var re3 = /\bQBZPbageby_cynprubyqre\b/; var re4 = /,/; var re5 = /\bQBZPbageby_cynprubyqre\b/g; var re6 = /^[\s\xa0]+|[\s\xa0]+$/g; var re7 = /(\d*)(\D*)/g; var re8 = /=/; var re9 = /(^|\s)lhv\-h(\s|$)/; var str0 = 'Zbmvyyn/5.0 (Jvaqbjf; H; Jvaqbjf AG 5.1; ra-HF) NccyrJroXvg/528.9 (XUGZY, yvxr Trpxb) Puebzr/2.0.157.0 Fnsnev/528.9'; var re10 = /\#/g; var re11 = /\./g; var re12 = /'/g; var re13 = /\?[\w\W]*(sevraqvq|punaaryvq|tebhcvq)=([^\&\?#]*)/i; var str1 = 'Fubpxjnir Synfu 9.0 e115'; var re14 = /\s+/g; var re15 = /^\s*(\S*(\s+\S+)*)\s*$/; var re16 = /(-[a-z])/i; function runBlock0() { for (var i = 0; i < 6511; i++) { re0.exec('pyvpx'); } for (var i = 0; i < 1844; i++) { re1.exec('uggc://jjj.snprobbx.pbz/ybtva.cuc'); } for (var i = 0; i < 739; i++) { 'QBZPbageby_cynprubyqre'.replace(re2, ''); } for (var i = 0; i < 598; i++) { re1.exec('uggc://jjj.snprobbx.pbz/'); } for (var i = 0; i < 454; i++) { re1.exec('uggc://jjj.snprobbx.pbz/fepu.cuc'); } for (var i = 0; i < 352; i++) { /qqqq|qqq|qq|q|ZZZZ|ZZZ|ZZ|Z|llll|ll|l|uu|u|UU|U|zz|z|ff|f|gg|g|sss|ss|s|mmm|mm|m/g.exec('qqqq, ZZZ q, llll'); } for (var i = 0; i < 312; i++) { re3.exec('vachggrkg QBZPbageby_cynprubyqre'); } for (var i = 0; i < 282; i++) { re4.exec('/ZlFcnprUbzrcntr/Vaqrk-FvgrUbzr,10000000'); } for (var i = 0; i < 177; i++) { 'vachggrkg'.replace(re5, ''); } for (var i = 0; i < 170; i++) { '528.9'.replace(re6, ''); re7.exec('528'); } for (var i = 0; i < 156; i++) { re8.exec('VCPhygher=ra-HF'); re8.exec('CersreerqPhygher=ra-HF'); } for (var i = 0; i < 144; i++) { re0.exec('xrlcerff'); } for (var i = 0; i < 139; i++) { '521'.replace(re6, ''); re7.exec('521'); re9.exec(''); /JroXvg\/(\S+)/.exec(str0); } for (var i = 0; i < 137; i++) { 'qvi .so_zrah'.replace(re10, ''); 'qvi .so_zrah'.replace(/\[/g, ''); 'qvi.so_zrah'.replace(re11, ''); } for (var i = 0; i < 117; i++) { 'uvqqra_ryrz'.replace(re2, ''); } for (var i = 0; i < 95; i++) { /(?:^|;)\s*sevraqfgre_ynat=([^;]*)/.exec('sevraqfgre_naba=nvq%3Qn6ss9p85n868ro9s059pn854735956o3%26ers%3Q%26df%3Q%26vpgl%3QHF'); } for (var i = 0; i < 93; i++) { 'uggc://ubzr.zlfcnpr.pbz/vaqrk.psz'.replace(re12, ''); re13.exec('uggc://ubzr.zlfcnpr.pbz/vaqrk.psz'); } for (var i = 0; i < 92; i++) { str1.replace(/([a-zA-Z]|\s)+/, ''); } for (var i = 0; i < 85; i++) { 'svefg'.replace(re14, ''); 'svefg'.replace(re15, ''); 'uggc://cebsvyr.zlfcnpr.pbz/vaqrk.psz'.replace(re12, ''); 'ynfg'.replace(re14, ''); 'ynfg'.replace(re15, ''); re16.exec('qvfcynl'); re13.exec('uggc://cebsvyr.zlfcnpr.pbz/vaqrk.psz'); } } var re17 = /(^|[^\\])\"\\\/Qngr\((-?[0-9]+)\)\\\/\"/g; var str2 = '{"anzr":"","ahzoreSbezng":{"PheeraplQrpvznyQvtvgf":2,"PheeraplQrpvznyFrcnengbe":".","VfErnqBayl":gehr,"PheeraplTebhcFvmrf":[3],"AhzoreTebhcFvmrf":[3],"CrepragTebhcFvmrf":[3],"PheeraplTebhcFrcnengbe":",","PheeraplFlzoby":"\xa4","AnAFlzoby":"AnA","PheeraplArtngvirCnggrea":0,"AhzoreArtngvirCnggrea":1,"CrepragCbfvgvirCnggrea":0,"CrepragArtngvirCnggrea":0,"ArtngvirVasvavglFlzoby":"-Vasvavgl","ArtngvirFvta":"-","AhzoreQrpvznyQvtvgf":2,"AhzoreQrpvznyFrcnengbe":".","AhzoreTebhcFrcnengbe":",","PheeraplCbfvgvirCnggrea":0,"CbfvgvirVasvavglFlzoby":"Vasvavgl","CbfvgvirFvta":"+","CrepragQrpvznyQvtvgf":2,"CrepragQrpvznyFrcnengbe":".","CrepragTebhcFrcnengbe":",","CrepragFlzoby":"%","CreZvyyrFlzoby":"\u2030","AngvirQvtvgf":["0","1","2","3","4","5","6","7","8","9"],"QvtvgFhofgvghgvba":1},"qngrGvzrSbezng":{"NZQrfvtangbe":"NZ","Pnyraqne":{"ZvaFhccbegrqQngrGvzr":"@-62135568000000@","ZnkFhccbegrqQngrGvzr":"@253402300799999@","NytbevguzGlcr":1,"PnyraqneGlcr":1,"Renf":[1],"GjbQvtvgLrneZnk":2029,"VfErnqBayl":gehr},"QngrFrcnengbe":"/","SvefgQnlBsJrrx":0,"PnyraqneJrrxEhyr":0,"ShyyQngrGvzrCnggrea":"qqqq, qq ZZZZ llll UU:zz:ff","YbatQngrCnggrea":"qqqq, qq ZZZZ llll","YbatGvzrCnggrea":"UU:zz:ff","ZbaguQnlCnggrea":"ZZZZ qq","CZQrfvtangbe":"CZ","ESP1123Cnggrea":"qqq, qq ZZZ llll UU\':\'zz\':\'ff \'TZG\'","FubegQngrCnggrea":"ZZ/qq/llll","FubegGvzrCnggrea":"UU:zz","FbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq\'G\'UU\':\'zz\':\'ff","GvzrFrcnengbe":":","HavirefnyFbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq UU\':\'zz\':\'ff\'M\'","LrneZbaguCnggrea":"llll ZZZZ","NooerivngrqQnlAnzrf":["Fha","Zba","Ghr","Jrq","Guh","Sev","Fng"],"FubegrfgQnlAnzrf":["Fh","Zb","Gh","Jr","Gu","Se","Fn"],"QnlAnzrf":["Fhaqnl","Zbaqnl","Ghrfqnl","Jrqarfqnl","Guhefqnl","Sevqnl","Fngheqnl"],"NooerivngrqZbaguAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""],"VfErnqBayl":gehr,"AngvirPnyraqneAnzr":"Tertbevna Pnyraqne","NooerivngrqZbaguTravgvirAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguTravgvirAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""]}}'; var str3 = '{"anzr":"ra-HF","ahzoreSbezng":{"PheeraplQrpvznyQvtvgf":2,"PheeraplQrpvznyFrcnengbe":".","VfErnqBayl":snyfr,"PheeraplTebhcFvmrf":[3],"AhzoreTebhcFvmrf":[3],"CrepragTebhcFvmrf":[3],"PheeraplTebhcFrcnengbe":",","PheeraplFlzoby":"$","AnAFlzoby":"AnA","PheeraplArtngvirCnggrea":0,"AhzoreArtngvirCnggrea":1,"CrepragCbfvgvirCnggrea":0,"CrepragArtngvirCnggrea":0,"ArtngvirVasvavglFlzoby":"-Vasvavgl","ArtngvirFvta":"-","AhzoreQrpvznyQvtvgf":2,"AhzoreQrpvznyFrcnengbe":".","AhzoreTebhcFrcnengbe":",","PheeraplCbfvgvirCnggrea":0,"CbfvgvirVasvavglFlzoby":"Vasvavgl","CbfvgvirFvta":"+","CrepragQrpvznyQvtvgf":2,"CrepragQrpvznyFrcnengbe":".","CrepragTebhcFrcnengbe":",","CrepragFlzoby":"%","CreZvyyrFlzoby":"\u2030","AngvirQvtvgf":["0","1","2","3","4","5","6","7","8","9"],"QvtvgFhofgvghgvba":1},"qngrGvzrSbezng":{"NZQrfvtangbe":"NZ","Pnyraqne":{"ZvaFhccbegrqQngrGvzr":"@-62135568000000@","ZnkFhccbegrqQngrGvzr":"@253402300799999@","NytbevguzGlcr":1,"PnyraqneGlcr":1,"Renf":[1],"GjbQvtvgLrneZnk":2029,"VfErnqBayl":snyfr},"QngrFrcnengbe":"/","SvefgQnlBsJrrx":0,"PnyraqneJrrxEhyr":0,"ShyyQngrGvzrCnggrea":"qqqq, ZZZZ qq, llll u:zz:ff gg","YbatQngrCnggrea":"qqqq, ZZZZ qq, llll","YbatGvzrCnggrea":"u:zz:ff gg","ZbaguQnlCnggrea":"ZZZZ qq","CZQrfvtangbe":"CZ","ESP1123Cnggrea":"qqq, qq ZZZ llll UU\':\'zz\':\'ff \'TZG\'","FubegQngrCnggrea":"Z/q/llll","FubegGvzrCnggrea":"u:zz gg","FbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq\'G\'UU\':\'zz\':\'ff","GvzrFrcnengbe":":","HavirefnyFbegnoyrQngrGvzrCnggrea":"llll\'-\'ZZ\'-\'qq UU\':\'zz\':\'ff\'M\'","LrneZbaguCnggrea":"ZZZZ, llll","NooerivngrqQnlAnzrf":["Fha","Zba","Ghr","Jrq","Guh","Sev","Fng"],"FubegrfgQnlAnzrf":["Fh","Zb","Gh","Jr","Gu","Se","Fn"],"QnlAnzrf":["Fhaqnl","Zbaqnl","Ghrfqnl","Jrqarfqnl","Guhefqnl","Sevqnl","Fngheqnl"],"NooerivngrqZbaguAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""],"VfErnqBayl":snyfr,"AngvirPnyraqneAnzr":"Tertbevna Pnyraqne","NooerivngrqZbaguTravgvirAnzrf":["Wna","Sro","Zne","Nce","Znl","Wha","Why","Nht","Frc","Bpg","Abi","Qrp",""],"ZbaguTravgvirAnzrf":["Wnahnel","Sroehnel","Znepu","Ncevy","Znl","Whar","Whyl","Nhthfg","Frcgrzore","Bpgbore","Abirzore","Qrprzore",""]}}'; var str4 = 'HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str5 = 'HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; var re18 = /^\s+|\s+$/g; var str6 = 'uggc://jjj.snprobbx.pbz/vaqrk.cuc'; var re19 = /(?:^|\s+)ba(?:\s+|$)/; var re20 = /[+, ]/; var re21 = /ybnqrq|pbzcyrgr/; var str7 = ';;jvaqbj.IjPurpxZbhfrCbfvgvbaNQ_VQ=shapgvba(r){vs(!r)ine r=jvaqbj.rirag;ine c=-1;vs(d1)c=d1.EbyybssCnary;ine bo=IjTrgBow("IjCnayNQ_VQ_"+c);vs(bo&&bo.fglyr.ivfvovyvgl=="ivfvoyr"){ine fns=IjFns?8:0;ine pheK=r.pyvragK+IjBOFpe("U")+fns,pheL=r.pyvragL+IjBOFpe("I")+fns;ine y=IjBOEC(NQ_VQ,bo,"Y"),g=IjBOEC(NQ_VQ,bo,"G");ine e=y+d1.Cnaryf[c].Jvqgu,o=g+d1.Cnaryf[c].Urvtug;vs((pheKe)||(pheLo)){vs(jvaqbj.IjBaEbyybssNQ_VQ)IjBaEbyybssNQ_VQ(c);ryfr IjPybfrNq(NQ_VQ,c,gehr,"");}ryfr erghea;}IjPnapryZbhfrYvfgrareNQ_VQ();};;jvaqbj.IjFrgEbyybssCnaryNQ_VQ=shapgvba(c){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;c=IjTc(NQ_VQ,c);vs(d1&&d1.EbyybssCnary>-1)IjPnapryZbhfrYvfgrareNQ_VQ();vs(d1)d1.EbyybssCnary=c;gel{vs(q.nqqRiragYvfgrare)q.nqqRiragYvfgrare(z,s,snyfr);ryfr vs(q.nggnpuRirag)q.nggnpuRirag("ba"+z,s);}pngpu(r){}};;jvaqbj.IjPnapryZbhfrYvfgrareNQ_VQ=shapgvba(){ine z="zbhfrzbir",q=qbphzrag,s=IjPurpxZbhfrCbfvgvbaNQ_VQ;vs(d1)d1.EbyybssCnary=-1;gel{vs(q.erzbirRiragYvfgrare)q.erzbirRiragYvfgrare(z,s,snyfr);ryfr vs(q.qrgnpuRirag)q.qrgnpuRirag("ba"+z,s);}pngpu(r){}};;d1.IjTc=d2(n,c){ine nq=d1;vs(vfAnA(c)){sbe(ine v=0;v0){vs(nq.FzV.yratgu>0)nq.FzV+="/";nq.FzV+=vh[v];nq.FtZ[nq.FtZ.yratgu]=snyfr;}}};;d1.IjYvzvg0=d2(n,f){ine nq=d1,vh=f.fcyvg("/");sbe(ine v=0;v0){vs(nq.OvC.yratgu>0)nq.OvC+="/";nq.OvC+=vh[v];}}};;d1.IjRVST=d2(n,c){jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]=IjTrgBow("IjCnayNQ_VQ_"+c+"_Bow");vs(jvaqbj["IjCnayNQ_VQ_"+c+"_Bow"]==ahyy)frgGvzrbhg("IjRVST(NQ_VQ,"+c+")",d1.rvsg);};;d1.IjNavzSHC=d2(n,c){ine nq=d1;vs(c>nq.Cnaryf.yratgu)erghea;ine cna=nq.Cnaryf[c],nn=gehr,on=gehr,yn=gehr,en=gehr,cn=nq.Cnaryf[0],sf=nq.ShF,j=cn.Jvqgu,u=cn.Urvtug;vs(j=="100%"){j=sf;en=snyfr;yn=snyfr;}vs(u=="100%"){u=sf;nn=snyfr;on=snyfr;}vs(cn.YnY=="Y")yn=snyfr;vs(cn.YnY=="E")en=snyfr;vs(cn.GnY=="G")nn=snyfr;vs(cn.GnY=="O")on=snyfr;ine k=0,l=0;fjvgpu(nq.NshP%8){pnfr 0:oernx;pnfr 1:vs(nn)l=-sf;oernx;pnfr 2:k=j-sf;oernx;pnfr 3:vs(en)k=j;oernx;pnfr 4:k=j-sf;l=u-sf;oernx;pnfr 5:k=j-sf;vs(on)l=u;oernx;pnfr 6:l=u-sf;oernx;pnfr 7:vs(yn)k=-sf;l=u-sf;oernx;}vs(nq.NshP++ 0)||(nethzragf.yratgu==3&&bG>0))){pyrneGvzrbhg(cay.UgU);cay.UgU=frgGvzrbhg(cay.UvqrNpgvba,(nethzragf.yratgu==3?bG:cay.UvqrGvzrbhgInyhr));}};;d1.IjErfrgGvzrbhg=d2(n,c,bG){c=IjTc(n,c);IjPnapryGvzrbhg(n,c);riny("IjFgnegGvzrbhg(NQ_VQ,c"+(nethzragf.yratgu==3?",bG":"")+")");};;d1.IjErfrgNyyGvzrbhgf=d2(n){sbe(ine c=0;c]/g; var str15 = 'FrffvbaQQS2=s6r4579npn4rn2135s904r0s75pp1o5334p6s6pospo12696; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669316860113296&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzs-aowb_80=44132r503660'; var str16 = 'FrffvbaQQS2=s6r4579npn4rn2135s904r0s75pp1o5334p6s6pospo12696; AFP_zp_dfctwzs-aowb_80=44132r503660; __hgzm=144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.965867047679498800.1231363638.1231363638.1231363638.1; __hgzo=144631658.0.10.1231363638; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669316860113296&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str17 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231363621014&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231363621014&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyr.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=348699119.1231363624&tn_fvq=1231363624&tn_uvq=895511034&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; var str18 = 'uggc://jjj.yrobapbva.se/yv'; var str19 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669316860113296&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str20 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669316860113296&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; function runBlock3() { for (var i = 0; i < 27; i++) { 'e115'.replace(/[A-Za-z]/g, ''); } for (var i = 0; i < 23; i++) { 'qvfcynl'.replace(re27, ''); 'cbfvgvba'.replace(re27, ''); } for (var i = 0; i < 22; i++) { 'unaqyr'.replace(re14, ''); 'unaqyr'.replace(re15, ''); 'yvar'.replace(re14, ''); 'yvar'.replace(re15, ''); 'cnerag puebzr6 fvatyr1 gno'.replace(re14, ''); 'cnerag puebzr6 fvatyr1 gno'.replace(re15, ''); 'fyvqre'.replace(re14, ''); 'fyvqre'.replace(re15, ''); re28.exec(''); } for (var i = 0; i < 21; i++) { 'uggc://jjj.zlfcnpr.pbz/'.replace(re12, ''); re13.exec('uggc://jjj.zlfcnpr.pbz/'); } for (var i = 0; i < 20; i++) { 'cntrivrj'.replace(re29, ''); 'cntrivrj'.replace(re30, ''); re19.exec('ynfg'); re19.exec('ba svefg'); re8.exec('VC=74.125.75.3'); } for (var i = 0; i < 19; i++) { re31.exec('ra'); } for (var i = 0; i < 18; i++) { str10.split(re32); str11.split(re32); str12.replace(re33, ''); re8.exec('144631658.0.10.1231363570'); re8.exec('144631658.1231363570.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re8.exec('144631658.3426875219718084000.1231363570.1231363570.1231363570.1'); re8.exec(str13); re8.exec(str14); re8.exec('__hgzn=144631658.3426875219718084000.1231363570.1231363570.1231363570.1'); re8.exec('__hgzo=144631658.0.10.1231363570'); re8.exec('__hgzm=144631658.1231363570.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re34.exec(str10); re34.exec(str11); } for (var i = 0; i < 17; i++) { str0.match(/zfvr/gi); str0.match(/bcren/gi); str15.split(re32); str16.split(re32); 'ohggba'.replace(re14, ''); 'ohggba'.replace(re15, ''); 'puvyq p1 svefg sylbhg pybfrq'.replace(re14, ''); 'puvyq p1 svefg sylbhg pybfrq'.replace(re15, ''); 'pvgvrf'.replace(re14, ''); 'pvgvrf'.replace(re15, ''); 'pybfrq'.replace(re14, ''); 'pybfrq'.replace(re15, ''); 'qry'.replace(re14, ''); 'qry'.replace(re15, ''); 'uqy_zba'.replace(re14, ''); 'uqy_zba'.replace(re15, ''); str17.replace(re33, ''); str18.replace(/%3P/g, ''); str18.replace(/%3R/g, ''); str18.replace(/%3q/g, ''); str18.replace(re35, ''); 'yvaxyvfg16'.replace(re14, ''); 'yvaxyvfg16'.replace(re15, ''); 'zvahf'.replace(re14, ''); 'zvahf'.replace(re15, ''); 'bcra'.replace(re14, ''); 'bcra'.replace(re15, ''); 'cnerag puebzr5 fvatyr1 ps NU'.replace(re14, ''); 'cnerag puebzr5 fvatyr1 ps NU'.replace(re15, ''); 'cynlre'.replace(re14, ''); 'cynlre'.replace(re15, ''); 'cyhf'.replace(re14, ''); 'cyhf'.replace(re15, ''); 'cb_uqy'.replace(re14, ''); 'cb_uqy'.replace(re15, ''); 'hyJVzt'.replace(re14, ''); 'hyJVzt'.replace(re15, ''); re8.exec('144631658.0.10.1231363638'); re8.exec('144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re8.exec('144631658.965867047679498800.1231363638.1231363638.1231363638.1'); re8.exec('4413268q3660'); re8.exec('4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n'); re8.exec('SbeprqRkcvengvba=633669321699093060'); re8.exec('VC=74.125.75.20'); re8.exec(str19); re8.exec(str20); re8.exec('AFP_zp_tfwsbrg-aowb_80=4413268q3660'); re8.exec('FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n'); re8.exec('__hgzn=144631658.965867047679498800.1231363638.1231363638.1231363638.1'); re8.exec('__hgzo=144631658.0.10.1231363638'); re8.exec('__hgzm=144631658.1231363638.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re34.exec(str15); re34.exec(str16); } } var re36 = /uers|fep|fryrpgrq/; var re37 = /\s*([+>~\s])\s*([a-zA-Z#.*:\[])/g; var re38 = /^(\w+|\*)$/; var str21 = 'FrffvbaQQS2=s15q53p9n372sn76npr13o271n4s3p5r29p235746p908p58; ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669358527244818&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; var str22 = 'FrffvbaQQS2=s15q53p9n372sn76npr13o271n4s3p5r29p235746p908p58; __hgzm=144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.4127520630321984500.1231367822.1231367822.1231367822.1; __hgzo=144631658.0.10.1231367822; __hgzp=144631658; ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669358527244818&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str23 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231367803797&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367803797&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Szrffntvat.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1192552091.1231367807&tn_fvq=1231367807&tn_uvq=1155446857&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; var str24 = 'ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669358527244818&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str25 = 'ZFPhygher=VC=66.249.85.130&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669358527244818&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; var str26 = 'hy.ynat-fryrpgbe'; var re39 = /\\/g; var re40 = / /g; var re41 = /\/\xc4\/t/; var re42 = /\/\xd6\/t/; var re43 = /\/\xdc\/t/; var re44 = /\/\xdf\/t/; var re45 = /\/\xe4\/t/; var re46 = /\/\xf6\/t/; var re47 = /\/\xfc\/t/; var re48 = /\W/g; var re49 = /uers|fep|fglyr/; function runBlock4() { for (var i = 0; i < 16; i++) { ''.replace(/\*/g, ''); /\bnpgvir\b/.exec('npgvir'); /sversbk/i.exec(str0); re36.exec('glcr'); /zfvr/i.exec(str0); /bcren/i.exec(str0); } for (var i = 0; i < 15; i++) { str21.split(re32); str22.split(re32); 'uggc://ohyyrgvaf.zlfcnpr.pbz/vaqrk.psz'.replace(re12, ''); str23.replace(re33, ''); 'yv'.replace(re37, ''); 'yv'.replace(re18, ''); re8.exec('144631658.0.10.1231367822'); re8.exec('144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re8.exec('144631658.4127520630321984500.1231367822.1231367822.1231367822.1'); re8.exec(str24); re8.exec(str25); re8.exec('__hgzn=144631658.4127520630321984500.1231367822.1231367822.1231367822.1'); re8.exec('__hgzo=144631658.0.10.1231367822'); re8.exec('__hgzm=144631658.1231367822.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re34.exec(str21); re34.exec(str22); /\.([\w-]+)|\[(\w+)(?:([!*^$~|]?=)["']?(.*?)["']?)?\]|:([\w-]+)(?:\(["']?(.*?)?["']?\)|$)/g.exec(str26); re13.exec('uggc://ohyyrgvaf.zlfcnpr.pbz/vaqrk.psz'); re38.exec('yv'); } for (var i = 0; i < 14; i++) { ''.replace(re18, ''); '9.0 e115'.replace(/(\s+e|\s+o[0-9]+)/, ''); 'Funer guvf tnqtrg'.replace(//g, ''); 'Funer guvf tnqtrg'.replace(re39, ''); 'uggc://cebsvyrrqvg.zlfcnpr.pbz/vaqrk.psz'.replace(re12, ''); 'grnfre'.replace(re40, ''); 'grnfre'.replace(re41, ''); 'grnfre'.replace(re42, ''); 'grnfre'.replace(re43, ''); 'grnfre'.replace(re44, ''); 'grnfre'.replace(re45, ''); 'grnfre'.replace(re46, ''); 'grnfre'.replace(re47, ''); 'grnfre'.replace(re48, ''); re16.exec('znetva-gbc'); re16.exec('cbfvgvba'); re19.exec('gno1'); re9.exec('qz'); re9.exec('qg'); re9.exec('zbqobk'); re9.exec('zbqobkva'); re9.exec('zbqgvgyr'); re13.exec('uggc://cebsvyrrqvg.zlfcnpr.pbz/vaqrk.psz'); re26.exec('/vt/znvytnqtrg'); re49.exec('glcr'); } } var re50 = /(?:^|\s+)fryrpgrq(?:\s+|$)/; var re51 = /\&/g; var re52 = /\+/g; var re53 = /\?/g; var re54 = /\t/g; var re55 = /(\$\{nqiHey\})|(\$nqiHey\b)/g; var re56 = /(\$\{cngu\})|(\$cngu\b)/g; function runBlock5() { for (var i = 0; i < 13; i++) { 'purpx'.replace(re14, ''); 'purpx'.replace(re15, ''); 'pvgl'.replace(re14, ''); 'pvgl'.replace(re15, ''); 'qrpe fyvqrgrkg'.replace(re14, ''); 'qrpe fyvqrgrkg'.replace(re15, ''); 'svefg fryrpgrq'.replace(re14, ''); 'svefg fryrpgrq'.replace(re15, ''); 'uqy_rag'.replace(re14, ''); 'uqy_rag'.replace(re15, ''); 'vape fyvqrgrkg'.replace(re14, ''); 'vape fyvqrgrkg'.replace(re15, ''); 'vachggrkg QBZPbageby_cynprubyqre'.replace(re5, ''); 'cnerag puebzr6 fvatyr1 gno fryrpgrq'.replace(re14, ''); 'cnerag puebzr6 fvatyr1 gno fryrpgrq'.replace(re15, ''); 'cb_guz'.replace(re14, ''); 'cb_guz'.replace(re15, ''); 'fhozvg'.replace(re14, ''); 'fhozvg'.replace(re15, ''); re50.exec(''); /NccyrJroXvg\/([^\s]*)/.exec(str0); /XUGZY/.exec(str0); } for (var i = 0; i < 12; i++) { '${cebg}://${ubfg}${cngu}/${dz}'.replace(/(\$\{cebg\})|(\$cebg\b)/g, ''); '1'.replace(re40, ''); '1'.replace(re10, ''); '1'.replace(re51, ''); '1'.replace(re52, ''); '1'.replace(re53, ''); '1'.replace(re39, ''); '1'.replace(re54, ''); '9.0 e115'.replace(/^(.*)\..*$/, ''); '9.0 e115'.replace(/^.*e(.*)$/, ''); ''.replace(re55, ''); ''.replace(re55, ''); str1.replace(/^.*\s+(\S+\s+\S+$)/, ''); 'tzk%2Subzrcntr%2Sfgneg%2Sqr%2S'.replace(re30, ''); 'tzk'.replace(re30, ''); 'uggc://${ubfg}${cngu}/${dz}'.replace(/(\$\{ubfg\})|(\$ubfg\b)/g, ''); 'uggc://nqpyvrag.hvzfrei.arg${cngu}/${dz}'.replace(re56, ''); 'uggc://nqpyvrag.hvzfrei.arg/wf.at/${dz}'.replace(/(\$\{dz\})|(\$dz\b)/g, ''); 'frpgvba'.replace(re29, ''); 'frpgvba'.replace(re30, ''); 'fvgr'.replace(re29, ''); 'fvgr'.replace(re30, ''); 'fcrpvny'.replace(re29, ''); 'fcrpvny'.replace(re30, ''); re36.exec('anzr'); /e/.exec('9.0 e115'); } } var re57 = /##yv4##/gi; var re58 = /##yv16##/gi; var re59 = /##yv19##/gi; var str27 = '##yv4##Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.##yv16##Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; var str28 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.##yv16##Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; var str29 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.##yv19##Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; var str30 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl.##OE## ##OE## ##N##Yrnea zber##/N##'; var str31 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl. ##N##Yrnea zber##/N##'; var str32 = 'Cbjreshy Zvpebfbsg grpuabybtl urycf svtug fcnz naq vzcebir frphevgl.Trg zber qbar gunaxf gb terngre rnfr naq fcrrq.Ybgf bs fgbentr (5 TO) - zber pbby fghss ba gur jnl. Yrnea zber##/N##'; var str33 = 'Bar Jvaqbjf Yvir VQ trgf lbh vagb Ubgznvy, Zrffratre, Kobk YVIR \u2014 naq bgure cynprf lbh frr #~#argjbexybtb#~#'; var re60 = /(?:^|\s+)bss(?:\s+|$)/; var re61 = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/; var re62 = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; var str34 = '${1}://${2}${3}${4}${5}'; var str35 = ' O=6gnyg0g4znrrn&o=3&f=gc; Q=_lyu=K3bQZGSxnT4lZzD3OS9GNmV3ZGLkAQxRpTyxNmRlZmRmAmNkAQLRqTImqNZjOUEgpTjQnJ5xMKtgoN--; SCF=qy'; function runBlock6() { for (var i = 0; i < 11; i++) { str27.replace(/##yv0##/gi, ''); str27.replace(re57, ''); str28.replace(re58, ''); str29.replace(re59, ''); str30.replace(/##\/o##/gi, ''); str30.replace(/##\/v##/gi, ''); str30.replace(/##\/h##/gi, ''); str30.replace(/##o##/gi, ''); str30.replace(/##oe##/gi, ''); str30.replace(/##v##/gi, ''); str30.replace(/##h##/gi, ''); str31.replace(/##n##/gi, ''); str32.replace(/##\/n##/gi, ''); str33.replace(/#~#argjbexybtb#~#/g, ''); / Zbovyr\//.exec(str0); /##yv1##/gi.exec(str27); /##yv10##/gi.exec(str28); /##yv11##/gi.exec(str28); /##yv12##/gi.exec(str28); /##yv13##/gi.exec(str28); /##yv14##/gi.exec(str28); /##yv15##/gi.exec(str28); re58.exec(str28); /##yv17##/gi.exec(str29); /##yv18##/gi.exec(str29); re59.exec(str29); /##yv2##/gi.exec(str27); /##yv20##/gi.exec(str30); /##yv21##/gi.exec(str30); /##yv22##/gi.exec(str30); /##yv23##/gi.exec(str30); /##yv3##/gi.exec(str27); re57.exec(str27); /##yv5##/gi.exec(str28); /##yv6##/gi.exec(str28); /##yv7##/gi.exec(str28); /##yv8##/gi.exec(str28); /##yv9##/gi.exec(str28); re8.exec('473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29'); re8.exec('SbeprqRkcvengvba=633669325184628362'); re8.exec('FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29'); /AbxvnA[^\/]*/.exec(str0); } for (var i = 0; i < 10; i++) { ' bss'.replace(/(?:^|\s+)bss(?:\s+|$)/g, ''); str34.replace(/(\$\{0\})|(\$0\b)/g, ''); str34.replace(/(\$\{1\})|(\$1\b)/g, ''); str34.replace(/(\$\{pbzcyrgr\})|(\$pbzcyrgr\b)/g, ''); str34.replace(/(\$\{sentzrag\})|(\$sentzrag\b)/g, ''); str34.replace(/(\$\{ubfgcbeg\})|(\$ubfgcbeg\b)/g, ''); str34.replace(re56, ''); str34.replace(/(\$\{cebgbpby\})|(\$cebgbpby\b)/g, ''); str34.replace(/(\$\{dhrel\})|(\$dhrel\b)/g, ''); 'nqfvmr'.replace(re29, ''); 'nqfvmr'.replace(re30, ''); 'uggc://${2}${3}${4}${5}'.replace(/(\$\{2\})|(\$2\b)/g, ''); 'uggc://wf.hv-cbegny.qr${3}${4}${5}'.replace(/(\$\{3\})|(\$3\b)/g, ''); 'arjf'.replace(re40, ''); 'arjf'.replace(re41, ''); 'arjf'.replace(re42, ''); 'arjf'.replace(re43, ''); 'arjf'.replace(re44, ''); 'arjf'.replace(re45, ''); 'arjf'.replace(re46, ''); 'arjf'.replace(re47, ''); 'arjf'.replace(re48, ''); / PC=i=(\d+)&oe=(.)/.exec(str35); re60.exec(' '); re60.exec(' bss'); re60.exec(''); re19.exec(' '); re19.exec('svefg ba'); re19.exec('ynfg vtaber'); re19.exec('ba'); re9.exec('scnq so '); re9.exec('zrqvgobk'); re9.exec('hsgy'); re9.exec('lhv-h'); /Fnsnev|Xbadhrebe|XUGZY/gi.exec(str0); re61.exec('uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf'); re62.exec('#Ybtva_rznvy'); } } var re63 = /\{0\}/g; var str36 = 'FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n; ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669321699093060&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_tfwsbrg-aowb_80=4413268q3660'; var str37 = 'FrffvbaQQS2=4ss747o77904333q374or84qrr1s9r0nprp8r5q81534o94n; AFP_zp_tfwsbrg-aowb_80=4413268q3660; __hgzm=144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.2294274870215848400.1231364074.1231364074.1231364074.1; __hgzo=144631658.0.10.1231364074; __hgzp=144631658; ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669321699093060&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str38 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231364057761&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231364057761&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Ssevraqf.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1667363813.1231364061&tn_fvq=1231364061&tn_uvq=1917563877&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; var str39 = 'ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669321699093060&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str40 = 'ZFPhygher=VC=74.125.75.20&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669321699093060&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; function runBlock7() { for (var i = 0; i < 9; i++) { '0'.replace(re40, ''); '0'.replace(re10, ''); '0'.replace(re51, ''); '0'.replace(re52, ''); '0'.replace(re53, ''); '0'.replace(re39, ''); '0'.replace(re54, ''); 'Lrf'.replace(re40, ''); 'Lrf'.replace(re10, ''); 'Lrf'.replace(re51, ''); 'Lrf'.replace(re52, ''); 'Lrf'.replace(re53, ''); 'Lrf'.replace(re39, ''); 'Lrf'.replace(re54, ''); } for (var i = 0; i < 8; i++) { 'Pybfr {0}'.replace(re63, ''); 'Bcra {0}'.replace(re63, ''); str36.split(re32); str37.split(re32); 'puvyq p1 svefg gnournqref'.replace(re14, ''); 'puvyq p1 svefg gnournqref'.replace(re15, ''); 'uqy_fcb'.replace(re14, ''); 'uqy_fcb'.replace(re15, ''); 'uvag'.replace(re14, ''); 'uvag'.replace(re15, ''); str38.replace(re33, ''); 'yvfg'.replace(re14, ''); 'yvfg'.replace(re15, ''); 'at_bhgre'.replace(re30, ''); 'cnerag puebzr5 qbhoyr2 NU'.replace(re14, ''); 'cnerag puebzr5 qbhoyr2 NU'.replace(re15, ''); 'cnerag puebzr5 dhnq5 ps NU osyvax zbarl'.replace(re14, ''); 'cnerag puebzr5 dhnq5 ps NU osyvax zbarl'.replace(re15, ''); 'cnerag puebzr6 fvatyr1'.replace(re14, ''); 'cnerag puebzr6 fvatyr1'.replace(re15, ''); 'cb_qrs'.replace(re14, ''); 'cb_qrs'.replace(re15, ''); 'gnopbagrag'.replace(re14, ''); 'gnopbagrag'.replace(re15, ''); 'iv_svefg_gvzr'.replace(re30, ''); /(^|.)(ronl|qri-ehf3.wbg)(|fgberf|zbgbef|yvirnhpgvbaf|jvxv|rkcerff|punggre).(pbz(|.nh|.pa|.ux|.zl|.ft|.oe|.zk)|pb(.hx|.xe|.am)|pn|qr|se|vg|ay|or|ng|pu|vr|va|rf|cy|cu|fr)$/i.exec('cntrf.ronl.pbz'); re8.exec('144631658.0.10.1231364074'); re8.exec('144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re8.exec('144631658.2294274870215848400.1231364074.1231364074.1231364074.1'); re8.exec('4413241q3660'); re8.exec('SbeprqRkcvengvba=633669357391353591'); re8.exec(str39); re8.exec(str40); re8.exec('AFP_zp_kkk-gdzogv_80=4413241q3660'); re8.exec('FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7'); re8.exec('__hgzn=144631658.2294274870215848400.1231364074.1231364074.1231364074.1'); re8.exec('__hgzo=144631658.0.10.1231364074'); re8.exec('__hgzm=144631658.1231364074.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re8.exec('p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7'); re34.exec(str36); re34.exec(str37); } } var re64 = /\b[a-z]/g; var re65 = /^uggc:\/\//; var re66 = /(?:^|\s+)qvfnoyrq(?:\s+|$)/; var str41 = 'uggc://cebsvyr.zlfcnpr.pbz/Zbqhyrf/Nccyvpngvbaf/Cntrf/Pnainf.nfck'; function runBlock8() { for (var i = 0; i < 7; i++) { str1.match(/\d+/g); 'nsgre'.replace(re64, ''); 'orsber'.replace(re64, ''); 'obggbz'.replace(re64, ''); 'ohvygva_jrngure.kzy'.replace(re65, ''); 'ohggba'.replace(re37, ''); 'ohggba'.replace(re18, ''); 'qngrgvzr.kzy'.replace(re65, ''); 'uggc://eff.paa.pbz/eff/paa_gbcfgbevrf.eff'.replace(re65, ''); 'vachg'.replace(re37, ''); 'vachg'.replace(re18, ''); 'vafvqr'.replace(re64, ''); 'cbvagre'.replace(re27, ''); 'cbfvgvba'.replace(/[A-Z]/g, ''); 'gbc'.replace(re27, ''); 'gbc'.replace(re64, ''); 'hy'.replace(re37, ''); 'hy'.replace(re18, ''); str26.replace(re37, ''); str26.replace(re18, ''); 'lbhghor_vtbbtyr/i2/lbhghor.kzy'.replace(re65, ''); 'm-vaqrk'.replace(re27, ''); /#([\w-]+)/.exec(str26); re16.exec('urvtug'); re16.exec('znetvaGbc'); re16.exec('jvqgu'); re19.exec('gno0 svefg ba'); re19.exec('gno0 ba'); re19.exec('gno4 ynfg'); re19.exec('gno4'); re19.exec('gno5'); re19.exec('gno6'); re19.exec('gno7'); re19.exec('gno8'); /NqborNVE\/([^\s]*)/.exec(str0); /NccyrJroXvg\/([^ ]*)/.exec(str0); /XUGZY/gi.exec(str0); /^(?:obql|ugzy)$/i.exec('YV'); re38.exec('ohggba'); re38.exec('vachg'); re38.exec('hy'); re38.exec(str26); /^(\w+|\*)/.exec(str26); /znp|jva|yvahk/i.exec('Jva32'); /eton?\([\d\s,]+\)/.exec('fgngvp'); } for (var i = 0; i < 6; i++) { ''.replace(/\r/g, ''); '/'.replace(re40, ''); '/'.replace(re10, ''); '/'.replace(re51, ''); '/'.replace(re52, ''); '/'.replace(re53, ''); '/'.replace(re39, ''); '/'.replace(re54, ''); 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/{0}?[NDO]&{1}&{2}&[NDR]'.replace(re63, ''); str41.replace(re12, ''); 'uggc://jjj.snprobbx.pbz/fepu.cuc'.replace(re23, ''); 'freivpr'.replace(re40, ''); 'freivpr'.replace(re41, ''); 'freivpr'.replace(re42, ''); 'freivpr'.replace(re43, ''); 'freivpr'.replace(re44, ''); 'freivpr'.replace(re45, ''); 'freivpr'.replace(re46, ''); 'freivpr'.replace(re47, ''); 'freivpr'.replace(re48, ''); /((ZFVR\s+([6-9]|\d\d)\.))/.exec(str0); re66.exec(''); re50.exec('fryrpgrq'); re8.exec('8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn'); re8.exec('SbeprqRkcvengvba=633669340386893867'); re8.exec('VC=74.125.75.17'); re8.exec('FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn'); /Xbadhrebe|Fnsnev|XUGZY/.exec(str0); re13.exec(str41); re49.exec('unfsbphf'); } } var re67 = /zrah_byq/g; var str42 = 'FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669325184628362&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; var str43 = 'FrffvbaQQS2=473qq1rs0n2r70q9qo1pq48n021s9468ron90nps048p4p29; __hgzm=144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.3931862196947939300.1231364380.1231364380.1231364380.1; __hgzo=144631658.0.10.1231364380; __hgzp=144631658; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669325184628362&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str44 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_vzntrf_wf&qg=1231364373088&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231364373088&punaary=svz_zlfcnpr_hfre-ivrj-pbzzragf%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Spbzzrag.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1158737789.1231364375&tn_fvq=1231364375&tn_uvq=415520832&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; var str45 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669325184628362&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str46 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669325184628362&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; var re68 = /^([#.]?)((?:[\w\u0128-\uffff*_-]|\\.)*)/; var re69 = /\{1\}/g; var re70 = /\s+/; var re71 = /(\$\{4\})|(\$4\b)/g; var re72 = /(\$\{5\})|(\$5\b)/g; var re73 = /\{2\}/g; var re74 = /[^+>] [^+>]/; var re75 = /\bucpyv\s*=\s*([^;]*)/i; var re76 = /\bucuvqr\s*=\s*([^;]*)/i; var re77 = /\bucfie\s*=\s*([^;]*)/i; var re78 = /\bhfucjrn\s*=\s*([^;]*)/i; var re79 = /\bmvc\s*=\s*([^;]*)/i; var re80 = /^((?:[\w\u0128-\uffff*_-]|\\.)+)(#)((?:[\w\u0128-\uffff*_-]|\\.)+)/; var re81 = /^([>+~])\s*(\w*)/i; var re82 = /^>\s*((?:[\w\u0128-\uffff*_-]|\\.)+)/; var re83 = /^[\s[]?shapgvba/; var re84 = /v\/g.tvs#(.*)/i; var str47 = '#Zbq-Vasb-Vasb-WninFpevcgUvag'; var str48 = ',n.svryqOgaPnapry'; var str49 = 'FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669357391353591&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_kkk-gdzogv_80=4413241q3660'; var str50 = 'FrffvbaQQS2=p98s8o9q42nr21or1r61pqorn1n002nsss569635984s6qp7; AFP_zp_kkk-gdzogv_80=4413241q3660; AFP_zp_kkk-aowb_80=4413235p3660; __hgzm=144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.2770915348920628700.1231367708.1231367708.1231367708.1; __hgzo=144631658.0.10.1231367708; __hgzp=144631658; ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669357391353591&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str51 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231367691141&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367691141&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Sjjj.zlfcnpr.pbz%2S&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=320757904.1231367694&tn_fvq=1231367694&tn_uvq=1758792003&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; var str52 = 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55332979829981?[NDO]&aqu=1&g=7%2S0%2S2009%2014%3N38%3N42%203%20480&af=zfacbegny&cntrAnzr=HF%20UCZFSGJ&t=uggc%3N%2S%2Sjjj.zfa.pbz%2S&f=1024k768&p=24&x=L&oj=994&ou=634&uc=A&{2}&[NDR]'; var str53 = 'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq qbhoyr2 ps'; var str54 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669357391353591&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str55 = 'ZFPhygher=VC=74.125.75.3&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669357391353591&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; var str56 = 'ne;ng;nh;or;oe;pn;pu;py;pa;qr;qx;rf;sv;se;to;ux;vq;vr;va;vg;wc;xe;zk;zl;ay;ab;am;cu;cy;cg;eh;fr;ft;gu;ge;gj;mn;'; var str57 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886&GHVQ=1'; var str58 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886'; var str59 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886; mvc=m:94043|yn:37.4154|yb:-122.0585|p:HF|ue:1'; var str60 = 'ZP1=I=3&THVQ=6nnpr9q661804s33nnop45nosqp17q85; zu=ZFSG; PHYGHER=RA-HF; SyvtugTebhcVq=97; SyvtugVq=OnfrCntr; ucfie=Z:5|S:5|G:5|R:5|Q:oyh|J:S; ucpyv=J.U|Y.|F.|E.|H.Y|P.|U.; hfucjrn=jp:HFPN0746; ZHVQ=Q783SN9O14054831N4869R51P0SO8886; mvc=m:94043|yn:37.4154|yb:-122.0585|p:HF'; var str61 = 'uggc://gx2.fgp.f-zfa.pbz/oe/uc/11/ra-hf/pff/v/g.tvs#uggc://gx2.fgo.f-zfa.pbz/v/29/4RQP4969777N048NPS4RRR3PO2S7S.wct'; var str62 = 'uggc://gx2.fgp.f-zfa.pbz/oe/uc/11/ra-hf/pff/v/g.tvs#uggc://gx2.fgo.f-zfa.pbz/v/OQ/63NP9O94NS5OQP1249Q9S1ROP7NS3.wct'; var str63 = 'zbmvyyn/5.0 (jvaqbjf; h; jvaqbjf ag 5.1; ra-hf) nccyrjroxvg/528.9 (xugzy, yvxr trpxb) puebzr/2.0.157.0 fnsnev/528.9'; function runBlock9() { for (var i = 0; i < 5; i++) { str42.split(re32); str43.split(re32); 'svz_zlfcnpr_hfre-ivrj-pbzzragf,svz_zlfcnpr_havgrq-fgngrf'.split(re20); str44.replace(re33, ''); 'zrah_arj zrah_arj_gbttyr zrah_gbttyr'.replace(re67, ''); 'zrah_byq zrah_byq_gbttyr zrah_gbttyr'.replace(re67, ''); re8.exec('102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98'); re8.exec('144631658.0.10.1231364380'); re8.exec('144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re8.exec('144631658.3931862196947939300.1231364380.1231364380.1231364380.1'); re8.exec('441326q33660'); re8.exec('SbeprqRkcvengvba=633669341278771470'); re8.exec(str45); re8.exec(str46); re8.exec('AFP_zp_dfctwzssrwh-aowb_80=441326q33660'); re8.exec('FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98'); re8.exec('__hgzn=144631658.3931862196947939300.1231364380.1231364380.1231364380.1'); re8.exec('__hgzo=144631658.0.10.1231364380'); re8.exec('__hgzm=144631658.1231364380.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); } for (var i = 0; i < 4; i++) { ' yvfg1'.replace(re14, ''); ' yvfg1'.replace(re15, ''); ' yvfg2'.replace(re14, ''); ' yvfg2'.replace(re15, ''); ' frneputebhc1'.replace(re14, ''); ' frneputebhc1'.replace(re15, ''); str47.replace(re68, ''); str47.replace(re18, ''); ''.replace(/&/g, ''); ''.replace(re35, ''); '(..-{0})(\|(\d+)|)'.replace(re63, ''); str48.replace(re18, ''); '//vzt.jro.qr/vij/FC/${cngu}/${anzr}/${inyhr}?gf=${abj}'.replace(re56, ''); '//vzt.jro.qr/vij/FC/tzk_uc/${anzr}/${inyhr}?gf=${abj}'.replace(/(\$\{anzr\})|(\$anzr\b)/g, ''); 'Jvaqbjf Yvir Ubgznvy{1}'.replace(re69, ''); '{0}{1}'.replace(re63, ''); '{1}'.replace(re69, ''); '{1}'.replace(re63, ''); 'Vzntrf'.replace(re15, ''); 'ZFA'.replace(re15, ''); 'Zncf'.replace(re15, ''); 'Zbq-Vasb-Vasb-WninFpevcgUvag'.replace(re39, ''); 'Arjf'.replace(re15, ''); str49.split(re32); str50.split(re32); 'Ivqrb'.replace(re15, ''); 'Jro'.replace(re15, ''); 'n'.replace(re39, ''); 'nwnkFgneg'.split(re70); 'nwnkFgbc'.split(re70); 'ovaq'.replace(re14, ''); 'ovaq'.replace(re15, ''); 'oevatf lbh zber. Zber fcnpr (5TO), zber frphevgl, fgvyy serr.'.replace(re63, ''); 'puvyq p1 svefg qrpx'.replace(re14, ''); 'puvyq p1 svefg qrpx'.replace(re15, ''); 'puvyq p1 svefg qbhoyr2'.replace(re14, ''); 'puvyq p1 svefg qbhoyr2'.replace(re15, ''); 'puvyq p2 ynfg'.replace(re14, ''); 'puvyq p2 ynfg'.replace(re15, ''); 'puvyq p2'.replace(re14, ''); 'puvyq p2'.replace(re15, ''); 'puvyq p3'.replace(re14, ''); 'puvyq p3'.replace(re15, ''); 'puvyq p4 ynfg'.replace(re14, ''); 'puvyq p4 ynfg'.replace(re15, ''); 'pbclevtug'.replace(re14, ''); 'pbclevtug'.replace(re15, ''); 'qZFAZR_1'.replace(re14, ''); 'qZFAZR_1'.replace(re15, ''); 'qbhoyr2 ps'.replace(re14, ''); 'qbhoyr2 ps'.replace(re15, ''); 'qbhoyr2'.replace(re14, ''); 'qbhoyr2'.replace(re15, ''); 'uqy_arj'.replace(re14, ''); 'uqy_arj'.replace(re15, ''); 'uc_fubccvatobk'.replace(re30, ''); 'ugzy%2Rvq'.replace(re29, ''); 'ugzy%2Rvq'.replace(re30, ''); str51.replace(re33, ''); 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/cebgbglcr.wf${4}${5}'.replace(re71, ''); 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/cebgbglcr.wf${5}'.replace(re72, ''); str52.replace(re73, ''); 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55332979829981?[NDO]&{1}&{2}&[NDR]'.replace(re69, ''); 'vztZFSG'.replace(re14, ''); 'vztZFSG'.replace(re15, ''); 'zfasbbg1 ps'.replace(re14, ''); 'zfasbbg1 ps'.replace(re15, ''); str53.replace(re14, ''); str53.replace(re15, ''); 'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq'.replace(re14, ''); 'cnerag puebzr6 fvatyr1 gno fryrpgrq ovaq'.replace(re15, ''); 'cevznel'.replace(re14, ''); 'cevznel'.replace(re15, ''); 'erpgnatyr'.replace(re30, ''); 'frpbaqnel'.replace(re14, ''); 'frpbaqnel'.replace(re15, ''); 'haybnq'.split(re70); '{0}{1}1'.replace(re63, ''); '|{1}1'.replace(re69, ''); /(..-HF)(\|(\d+)|)/i.exec('xb-xe,ra-va,gu-gu'); re4.exec('/ZlFcnprNccf/NccPnainf,45000012'); re8.exec('144631658.0.10.1231367708'); re8.exec('144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re8.exec('144631658.2770915348920628700.1231367708.1231367708.1231367708.1'); re8.exec('4413235p3660'); re8.exec('441327q73660'); re8.exec('9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473'); re8.exec('SbeprqRkcvengvba=633669350559478880'); re8.exec(str54); re8.exec(str55); re8.exec('AFP_zp_dfctwzs-aowb_80=441327q73660'); re8.exec('AFP_zp_kkk-aowb_80=4413235p3660'); re8.exec('FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473'); re8.exec('__hgzn=144631658.2770915348920628700.1231367708.1231367708.1231367708.1'); re8.exec('__hgzo=144631658.0.10.1231367708'); re8.exec('__hgzm=144631658.1231367708.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re34.exec(str49); re34.exec(str50); /ZFVR\s+5[.]01/.exec(str0); /HF(?=;)/i.exec(str56); re74.exec(str47); re28.exec('svefg npgvir svefgNpgvir'); re28.exec('ynfg'); /\bp:(..)/i.exec('m:94043|yn:37.4154|yb:-122.0585|p:HF'); re75.exec(str57); re75.exec(str58); re76.exec(str57); re76.exec(str58); re77.exec(str57); re77.exec(str58); /\bhfucce\s*=\s*([^;]*)/i.exec(str59); re78.exec(str57); re78.exec(str58); /\bjci\s*=\s*([^;]*)/i.exec(str59); re79.exec(str58); re79.exec(str60); re79.exec(str59); /\|p:([a-z]{2})/i.exec('m:94043|yn:37.4154|yb:-122.0585|p:HF|ue:1'); re80.exec(str47); re61.exec('cebgbglcr.wf'); re68.exec(str47); re81.exec(str47); re82.exec(str47); /^Fubpxjnir Synfu (\d)/.exec(str1); /^Fubpxjnir Synfu (\d+)/.exec(str1); re83.exec('[bowrpg tybony]'); re62.exec(str47); re84.exec(str61); re84.exec(str62); /jroxvg/.exec(str63); } } var re85 = /eaq_zbqobkva/; var str64 = '1231365729213'; var str65 = '74.125.75.3-1057165600.29978900'; var str66 = '74.125.75.3-1057165600.29978900.1231365730214'; var str67 = 'Frnepu%20Zvpebfbsg.pbz'; var str68 = 'FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn; ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669340386893867&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; var str69 = 'FrffvbaQQS2=8sqq78r9n442851q565599o401385sp3s04r92rnn7o19ssn; __hgzm=144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1877536177953918500.1231365779.1231365779.1231365779.1; __hgzo=144631658.0.10.1231365779; __hgzp=144631658; ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669340386893867&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str70 = 'I=3%26THVQ=757q3ss871q44o7o805n8113n5p72q52'; var str71 = 'I=3&THVQ=757q3ss871q44o7o805n8113n5p72q52'; var str72 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231365765292&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231365765292&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Sohyyrgvaf.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1579793869.1231365768&tn_fvq=1231365768&tn_uvq=2056210897&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; var str73 = 'frnepu.zvpebfbsg.pbz'; var str74 = 'frnepu.zvpebfbsg.pbz/'; var str75 = 'ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669340386893867&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str76 = 'ZFPhygher=VC=74.125.75.17&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669340386893867&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; function runBlock10() { for (var i = 0; i < 3; i++) { '%3Szxg=ra-HF'.replace(re39, ''); '-8'.replace(re40, ''); '-8'.replace(re10, ''); '-8'.replace(re51, ''); '-8'.replace(re52, ''); '-8'.replace(re53, ''); '-8'.replace(re39, ''); '-8'.replace(re54, ''); '1.5'.replace(re40, ''); '1.5'.replace(re10, ''); '1.5'.replace(re51, ''); '1.5'.replace(re52, ''); '1.5'.replace(re53, ''); '1.5'.replace(re39, ''); '1.5'.replace(re54, ''); '1024k768'.replace(re40, ''); '1024k768'.replace(re10, ''); '1024k768'.replace(re51, ''); '1024k768'.replace(re52, ''); '1024k768'.replace(re53, ''); '1024k768'.replace(re39, ''); '1024k768'.replace(re54, ''); str64.replace(re40, ''); str64.replace(re10, ''); str64.replace(re51, ''); str64.replace(re52, ''); str64.replace(re53, ''); str64.replace(re39, ''); str64.replace(re54, ''); '14'.replace(re40, ''); '14'.replace(re10, ''); '14'.replace(re51, ''); '14'.replace(re52, ''); '14'.replace(re53, ''); '14'.replace(re39, ''); '14'.replace(re54, ''); '24'.replace(re40, ''); '24'.replace(re10, ''); '24'.replace(re51, ''); '24'.replace(re52, ''); '24'.replace(re53, ''); '24'.replace(re39, ''); '24'.replace(re54, ''); str65.replace(re40, ''); str65.replace(re10, ''); str65.replace(re51, ''); str65.replace(re52, ''); str65.replace(re53, ''); str65.replace(re39, ''); str65.replace(re54, ''); str66.replace(re40, ''); str66.replace(re10, ''); str66.replace(re51, ''); str66.replace(re52, ''); str66.replace(re53, ''); str66.replace(re39, ''); str66.replace(re54, ''); '9.0'.replace(re40, ''); '9.0'.replace(re10, ''); '9.0'.replace(re51, ''); '9.0'.replace(re52, ''); '9.0'.replace(re53, ''); '9.0'.replace(re39, ''); '9.0'.replace(re54, ''); '994k634'.replace(re40, ''); '994k634'.replace(re10, ''); '994k634'.replace(re51, ''); '994k634'.replace(re52, ''); '994k634'.replace(re53, ''); '994k634'.replace(re39, ''); '994k634'.replace(re54, ''); '?zxg=ra-HF'.replace(re40, ''); '?zxg=ra-HF'.replace(re10, ''); '?zxg=ra-HF'.replace(re51, ''); '?zxg=ra-HF'.replace(re52, ''); '?zxg=ra-HF'.replace(re53, ''); '?zxg=ra-HF'.replace(re54, ''); 'PAA.pbz'.replace(re25, ''); 'PAA.pbz'.replace(re12, ''); 'PAA.pbz'.replace(re39, ''); 'Qngr & Gvzr'.replace(re25, ''); 'Qngr & Gvzr'.replace(re12, ''); 'Qngr & Gvzr'.replace(re39, ''); 'Frnepu Zvpebfbsg.pbz'.replace(re40, ''); 'Frnepu Zvpebfbsg.pbz'.replace(re54, ''); str67.replace(re10, ''); str67.replace(re51, ''); str67.replace(re52, ''); str67.replace(re53, ''); str67.replace(re39, ''); str68.split(re32); str69.split(re32); str70.replace(re52, ''); str70.replace(re53, ''); str70.replace(re39, ''); str71.replace(re40, ''); str71.replace(re10, ''); str71.replace(re51, ''); str71.replace(re54, ''); 'Jrngure'.replace(re25, ''); 'Jrngure'.replace(re12, ''); 'Jrngure'.replace(re39, ''); 'LbhGhor'.replace(re25, ''); 'LbhGhor'.replace(re12, ''); 'LbhGhor'.replace(re39, ''); str72.replace(re33, ''); 'erzbgr_vsenzr_1'.replace(/^erzbgr_vsenzr_/, ''); str73.replace(re40, ''); str73.replace(re10, ''); str73.replace(re51, ''); str73.replace(re52, ''); str73.replace(re53, ''); str73.replace(re39, ''); str73.replace(re54, ''); str74.replace(re40, ''); str74.replace(re10, ''); str74.replace(re51, ''); str74.replace(re52, ''); str74.replace(re53, ''); str74.replace(re39, ''); str74.replace(re54, ''); 'lhv-h'.replace(/\-/g, ''); re9.exec('p'); re9.exec('qz p'); re9.exec('zbqynory'); re9.exec('lhv-h svefg'); re8.exec('144631658.0.10.1231365779'); re8.exec('144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re8.exec('144631658.1877536177953918500.1231365779.1231365779.1231365779.1'); re8.exec(str75); re8.exec(str76); re8.exec('__hgzn=144631658.1877536177953918500.1231365779.1231365779.1231365779.1'); re8.exec('__hgzo=144631658.0.10.1231365779'); re8.exec('__hgzm=144631658.1231365779.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re34.exec(str68); re34.exec(str69); /^$/.exec(''); re31.exec('qr'); /^znk\d+$/.exec(''); /^zva\d+$/.exec(''); /^erfgber$/.exec(''); re85.exec('zbqobkva zbqobk_abcnqqvat '); re85.exec('zbqgvgyr'); re85.exec('eaq_zbqobkva '); re85.exec('eaq_zbqgvgyr '); /frpgvba\d+_pbagragf/.exec('obggbz_ani'); } } var re86 = /;\s*/; var re87 = /(\$\{inyhr\})|(\$inyhr\b)/g; var re88 = /(\$\{abj\})|(\$abj\b)/g; var re89 = /\s+$/; var re90 = /^\s+/; var re91 = /(\\\"|\x00-|\x1f|\x7f-|\x9f|\u00ad|\u0600-|\u0604|\u070f|\u17b4|\u17b5|\u200c-|\u200f|\u2028-|\u202f|\u2060-|\u206f|\ufeff|\ufff0-|\uffff)/g; var re92 = /^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/; var re93 = /^([:.#]*)((?:[\w\u0128-\uffff*_-]|\\.)+)/; var re94 = /^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/; var str77 = '#fubhgobk .pybfr'; var str78 = 'FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669341278771470&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzssrwh-aowb_80=441326q33660'; var str79 = 'FrffvbaQQS2=102n9o0o9pq60132qn0337rr867p75953502q2s27s2s5r98; AFP_zp_dfctwzssrwh-aowb_80=441326q33660; __hgzm=144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1670816052019209000.1231365869.1231365869.1231365869.1; __hgzo=144631658.0.10.1231365869; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669341278771470&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str80 = 'FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669350559478880&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R=; AFP_zp_dfctwzs-aowb_80=441327q73660'; var str81 = 'FrffvbaQQS2=9995p6rp12rrnr893334ro7nq70o7p64p69rqn844prs1473; AFP_zp_dfctwzs-aowb_80=441327q73660; __hgzm=144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar); __hgzn=144631658.1796080716621419500.1231367054.1231367054.1231367054.1; __hgzo=144631658.0.10.1231367054; __hgzp=144631658; ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669350559478880&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str82 = '[glcr=fhozvg]'; var str83 = 'n.svryqOga,n.svryqOgaPnapry'; var str84 = 'n.svryqOgaPnapry'; var str85 = 'oyvpxchaxg'; var str86 = 'qvi.bow-nppbeqvba qg'; var str87 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_nccf_wf&qg=1231367052227&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231367052227&punaary=svz_zlfcnpr_nccf-pnainf%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyr.zlfcnpr.pbz%2SZbqhyrf%2SNccyvpngvbaf%2SCntrf%2SPnainf.nfck&nq_glcr=grkg&rvq=6083027&rn=0&sez=1&tn_ivq=716357910.1231367056&tn_fvq=1231367056&tn_uvq=1387206491&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; var str88 = 'uggc://tbbtyrnqf.t.qbhoyrpyvpx.arg/cntrnq/nqf?pyvrag=pn-svz_zlfcnpr_zlfcnpr-ubzrcntr_wf&qg=1231365851658&uy=ra&nqfnsr=uvtu&br=hgs8&ahz_nqf=4&bhgchg=wf&nqgrfg=bss&pbeeryngbe=1231365851658&punaary=svz_zlfcnpr_ubzrcntr_abgybttrqva%2Psvz_zlfcnpr_aba_HTP%2Psvz_zlfcnpr_havgrq-fgngrf&hey=uggc%3N%2S%2Scebsvyrrqvg.zlfcnpr.pbz%2Svaqrk.psz&nq_glcr=grkg&rvq=6083027&rn=0&sez=0&tn_ivq=1979828129.1231365855&tn_fvq=1231365855&tn_uvq=2085229649&synfu=9.0.115&h_u=768&h_j=1024&h_nu=738&h_nj=1024&h_pq=24&h_gm=-480&h_uvf=2&h_wnin=gehr&h_acyht=7&h_azvzr=22'; var str89 = 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55023338617756?[NDO]&aqu=1&g=7%2S0%2S2009%2014%3N12%3N47%203%20480&af=zfacbegny&cntrAnzr=HF%20UCZFSGJ&t=uggc%3N%2S%2Sjjj.zfa.pbz%2S&f=0k0&p=43835816&x=A&oj=994&ou=634&uc=A&{2}&[NDR]'; var str90 = 'zrgn[anzr=nwnkHey]'; var str91 = 'anpuevpugra'; var str92 = 'b oS={\'oT\':1.1};x $8n(B){z(B!=o9)};x $S(B){O(!$8n(B))z A;O(B.4L)z\'T\';b S=7t B;O(S==\'2P\'&&B.p4){23(B.7f){12 1:z\'T\';12 3:z/\S/.2g(B.8M)?\'ox\':\'oh\'}}O(S==\'2P\'||S==\'x\'){23(B.nE){12 2V:z\'1O\';12 7I:z\'5a\';12 18:z\'4B\'}O(7t B.I==\'4F\'){O(B.3u)z\'pG\';O(B.8e)z\'1p\'}}z S};x $2p(){b 4E={};Z(b v=0;v<1p.I;v++){Z(b X 1o 1p[v]){b nc=1p[v][X];b 6E=4E[X];O(6E&&$S(nc)==\'2P\'&&$S(6E)==\'2P\')4E[X]=$2p(6E,nc);17 4E[X]=nc}}z 4E};b $E=7p.E=x(){b 1d=1p;O(!1d[1])1d=[p,1d[0]];Z(b X 1o 1d[1])1d[0][X]=1d[1][X];z 1d[0]};b $4D=7p.pJ=x(){Z(b v=0,y=1p.I;v-1:p.3F(2R)>-1},nX:x(){z p.3y(/([.*+?^${}()|[\]\/\\])/t,\'\\$1\')}});2V.E({5V:x(1O){O(p.I<3)z A;O(p.I==4&&p[3]==0&&!1O)z\'p5\';b 3P=[];Z(b v=0;v<3;v++){b 52=(p[v]-0).4h(16);3P.1x((52.I==1)?\'0\'+52:52)}z 1O?3P:\'#\'+3P.2u(\'\')},5U:x(1O){O(p.I!=3)z A;b 1i=[];Z(b v=0;v<3;v++){1i.1x(5K((p[v].I==1)?p[v]+p[v]:p[v],16))}z 1O?1i:\'1i(\'+1i.2u(\',\')+\')\'}});7F.E({3n:x(P){b J=p;P=$2p({\'L\':J,\'V\':A,\'1p\':1S,\'2x\':A,\'4s\':A,\'6W\':A},P);O($2O(P.1p)&&$S(P.1p)!=\'1O\')P.1p=[P.1p];z x(V){b 1d;O(P.V){V=V||H.V;1d=[(P.V===1r)?V:Y P.V(V)];O(P.1p)1d.E(P.1p)}17 1d=P.1p||1p;b 3C=x(){z J.3H($5S(P'; var str93 = 'hagreunyghat'; var str94 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669341278771470&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str95 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&Pbhagel=IIZ%3Q&SbeprqRkcvengvba=633669350559478880&gvzrMbar=-8&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R%3Q'; var str96 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669341278771470&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; var str97 = 'ZFPhygher=VC=74.125.75.1&VCPhygher=ra-HF&CersreerqPhygher=ra-HF&CersreerqPhygherCraqvat=&Pbhagel=IIZ=&SbeprqRkcvengvba=633669350559478880&gvzrMbar=0&HFEYBP=DKWyLHAiMTH9AwHjWxAcqUx9GJ91oaEunJ4tIzyyqlMQo3IhqUW5D29xMG1IHlMQo3IhqUW5GzSgMG1Iozy0MJDtH3EuqTImWxEgLHAiMTH9BQN3WxkuqTy0qJEyCGZ3YwDkBGVzGT9hM2y0qJEyCF0kZwVhZQH3APMDo3A0LJkQo2EyCGx0ZQDmWyWyM2yiox5uoJH9D0R='; var str98 = 'shapgvba (){Cuk.Nccyvpngvba.Frghc.Pber();Cuk.Nccyvpngvba.Frghc.Nwnk();Cuk.Nccyvpngvba.Frghc.Synfu();Cuk.Nccyvpngvba.Frghc.Zbqhyrf()}'; function runBlock11() { for (var i = 0; i < 2; i++) { ' .pybfr'.replace(re18, ''); ' n.svryqOgaPnapry'.replace(re18, ''); ' qg'.replace(re18, ''); str77.replace(re68, ''); str77.replace(re18, ''); ''.replace(re39, ''); ''.replace(/^/, ''); ''.split(re86); '*'.replace(re39, ''); '*'.replace(re68, ''); '*'.replace(re18, ''); '.pybfr'.replace(re68, ''); '.pybfr'.replace(re18, ''); '//vzt.jro.qr/vij/FC/tzk_uc/fperra/${inyhr}?gf=${abj}'.replace(re87, ''); '//vzt.jro.qr/vij/FC/tzk_uc/fperra/1024?gf=${abj}'.replace(re88, ''); '//vzt.jro.qr/vij/FC/tzk_uc/jvafvmr/${inyhr}?gf=${abj}'.replace(re87, ''); '//vzt.jro.qr/vij/FC/tzk_uc/jvafvmr/992/608?gf=${abj}'.replace(re88, ''); '300k120'.replace(re30, ''); '300k250'.replace(re30, ''); '310k120'.replace(re30, ''); '310k170'.replace(re30, ''); '310k250'.replace(re30, ''); '9.0 e115'.replace(/^.*\.(.*)\s.*$/, ''); 'Nppbeqvba'.replace(re2, ''); 'Nxghryy\x0a'.replace(re89, ''); 'Nxghryy\x0a'.replace(re90, ''); 'Nccyvpngvba'.replace(re2, ''); 'Oyvpxchaxg\x0a'.replace(re89, ''); 'Oyvpxchaxg\x0a'.replace(re90, ''); 'Svanamra\x0a'.replace(re89, ''); 'Svanamra\x0a'.replace(re90, ''); 'Tnzrf\x0a'.replace(re89, ''); 'Tnzrf\x0a'.replace(re90, ''); 'Ubebfxbc\x0a'.replace(re89, ''); 'Ubebfxbc\x0a'.replace(re90, ''); 'Xvab\x0a'.replace(re89, ''); 'Xvab\x0a'.replace(re90, ''); 'Zbqhyrf'.replace(re2, ''); 'Zhfvx\x0a'.replace(re89, ''); 'Zhfvx\x0a'.replace(re90, ''); 'Anpuevpugra\x0a'.replace(re89, ''); 'Anpuevpugra\x0a'.replace(re90, ''); 'Cuk'.replace(re2, ''); 'ErdhrfgSvavfu'.split(re70); 'ErdhrfgSvavfu.NWNK.Cuk'.split(re70); 'Ebhgr\x0a'.replace(re89, ''); 'Ebhgr\x0a'.replace(re90, ''); str78.split(re32); str79.split(re32); str80.split(re32); str81.split(re32); 'Fcbeg\x0a'.replace(re89, ''); 'Fcbeg\x0a'.replace(re90, ''); 'GI-Fcbg\x0a'.replace(re89, ''); 'GI-Fcbg\x0a'.replace(re90, ''); 'Gbhe\x0a'.replace(re89, ''); 'Gbhe\x0a'.replace(re90, ''); 'Hagreunyghat\x0a'.replace(re89, ''); 'Hagreunyghat\x0a'.replace(re90, ''); 'Ivqrb\x0a'.replace(re89, ''); 'Ivqrb\x0a'.replace(re90, ''); 'Jrggre\x0a'.replace(re89, ''); 'Jrggre\x0a'.replace(re90, ''); str82.replace(re68, ''); str82.replace(re18, ''); str83.replace(re68, ''); str83.replace(re18, ''); str84.replace(re68, ''); str84.replace(re18, ''); 'nqiFreivprObk'.replace(re30, ''); 'nqiFubccvatObk'.replace(re30, ''); 'nwnk'.replace(re39, ''); 'nxghryy'.replace(re40, ''); 'nxghryy'.replace(re41, ''); 'nxghryy'.replace(re42, ''); 'nxghryy'.replace(re43, ''); 'nxghryy'.replace(re44, ''); 'nxghryy'.replace(re45, ''); 'nxghryy'.replace(re46, ''); 'nxghryy'.replace(re47, ''); 'nxghryy'.replace(re48, ''); str85.replace(re40, ''); str85.replace(re41, ''); str85.replace(re42, ''); str85.replace(re43, ''); str85.replace(re44, ''); str85.replace(re45, ''); str85.replace(re46, ''); str85.replace(re47, ''); str85.replace(re48, ''); 'pngrtbel'.replace(re29, ''); 'pngrtbel'.replace(re30, ''); 'pybfr'.replace(re39, ''); 'qvi'.replace(re39, ''); str86.replace(re68, ''); str86.replace(re18, ''); 'qg'.replace(re39, ''); 'qg'.replace(re68, ''); 'qg'.replace(re18, ''); 'rzorq'.replace(re39, ''); 'rzorq'.replace(re68, ''); 'rzorq'.replace(re18, ''); 'svryqOga'.replace(re39, ''); 'svryqOgaPnapry'.replace(re39, ''); 'svz_zlfcnpr_nccf-pnainf,svz_zlfcnpr_havgrq-fgngrf'.split(re20); 'svanamra'.replace(re40, ''); 'svanamra'.replace(re41, ''); 'svanamra'.replace(re42, ''); 'svanamra'.replace(re43, ''); 'svanamra'.replace(re44, ''); 'svanamra'.replace(re45, ''); 'svanamra'.replace(re46, ''); 'svanamra'.replace(re47, ''); 'svanamra'.replace(re48, ''); 'sbphf'.split(re70); 'sbphf.gno sbphfva.gno'.split(re70); 'sbphfva'.split(re70); 'sbez'.replace(re39, ''); 'sbez.nwnk'.replace(re68, ''); 'sbez.nwnk'.replace(re18, ''); 'tnzrf'.replace(re40, ''); 'tnzrf'.replace(re41, ''); 'tnzrf'.replace(re42, ''); 'tnzrf'.replace(re43, ''); 'tnzrf'.replace(re44, ''); 'tnzrf'.replace(re45, ''); 'tnzrf'.replace(re46, ''); 'tnzrf'.replace(re47, ''); 'tnzrf'.replace(re48, ''); 'ubzrcntr'.replace(re30, ''); 'ubebfxbc'.replace(re40, ''); 'ubebfxbc'.replace(re41, ''); 'ubebfxbc'.replace(re42, ''); 'ubebfxbc'.replace(re43, ''); 'ubebfxbc'.replace(re44, ''); 'ubebfxbc'.replace(re45, ''); 'ubebfxbc'.replace(re46, ''); 'ubebfxbc'.replace(re47, ''); 'ubebfxbc'.replace(re48, ''); 'uc_cebzbobk_ugzy%2Puc_cebzbobk_vzt'.replace(re30, ''); 'uc_erpgnatyr'.replace(re30, ''); str87.replace(re33, ''); str88.replace(re33, ''); 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf${4}${5}'.replace(re71, ''); 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf${5}'.replace(re72, ''); 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/qlaYvo.wf${4}${5}'.replace(re71, ''); 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/qlaYvo.wf${5}'.replace(re72, ''); 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/rssrpgYvo.wf${4}${5}'.replace(re71, ''); 'uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/rssrpgYvo.wf${5}'.replace(re72, ''); str89.replace(re73, ''); 'uggc://zfacbegny.112.2b7.arg/o/ff/zfacbegnyubzr/1/U.7-cqi-2/f55023338617756?[NDO]&{1}&{2}&[NDR]'.replace(re69, ''); str6.replace(re23, ''); 'xvab'.replace(re40, ''); 'xvab'.replace(re41, ''); 'xvab'.replace(re42, ''); 'xvab'.replace(re43, ''); 'xvab'.replace(re44, ''); 'xvab'.replace(re45, ''); 'xvab'.replace(re46, ''); 'xvab'.replace(re47, ''); 'xvab'.replace(re48, ''); 'ybnq'.split(re70); 'zrqvnzbqgno lhv-anifrg lhv-anifrg-gbc'.replace(re18, ''); 'zrgn'.replace(re39, ''); str90.replace(re68, ''); str90.replace(re18, ''); 'zbhfrzbir'.split(re70); 'zbhfrzbir.gno'.split(re70); str63.replace(/^.*jroxvg\/(\d+(\.\d+)?).*$/, ''); 'zhfvx'.replace(re40, ''); 'zhfvx'.replace(re41, ''); 'zhfvx'.replace(re42, ''); 'zhfvx'.replace(re43, ''); 'zhfvx'.replace(re44, ''); 'zhfvx'.replace(re45, ''); 'zhfvx'.replace(re46, ''); 'zhfvx'.replace(re47, ''); 'zhfvx'.replace(re48, ''); 'zlfcnpr_nccf_pnainf'.replace(re52, ''); str91.replace(re40, ''); str91.replace(re41, ''); str91.replace(re42, ''); str91.replace(re43, ''); str91.replace(re44, ''); str91.replace(re45, ''); str91.replace(re46, ''); str91.replace(re47, ''); str91.replace(re48, ''); 'anzr'.replace(re39, ''); str92.replace(/\b\w+\b/g, ''); 'bow-nppbeqvba'.replace(re39, ''); 'bowrpg'.replace(re39, ''); 'bowrpg'.replace(re68, ''); 'bowrpg'.replace(re18, ''); 'cnenzf%2Rfglyrf'.replace(re29, ''); 'cnenzf%2Rfglyrf'.replace(re30, ''); 'cbchc'.replace(re30, ''); 'ebhgr'.replace(re40, ''); 'ebhgr'.replace(re41, ''); 'ebhgr'.replace(re42, ''); 'ebhgr'.replace(re43, ''); 'ebhgr'.replace(re44, ''); 'ebhgr'.replace(re45, ''); 'ebhgr'.replace(re46, ''); 'ebhgr'.replace(re47, ''); 'ebhgr'.replace(re48, ''); 'freivprobk_uc'.replace(re30, ''); 'fubccvatobk_uc'.replace(re30, ''); 'fubhgobk'.replace(re39, ''); 'fcbeg'.replace(re40, ''); 'fcbeg'.replace(re41, ''); 'fcbeg'.replace(re42, ''); 'fcbeg'.replace(re43, ''); 'fcbeg'.replace(re44, ''); 'fcbeg'.replace(re45, ''); 'fcbeg'.replace(re46, ''); 'fcbeg'.replace(re47, ''); 'fcbeg'.replace(re48, ''); 'gbhe'.replace(re40, ''); 'gbhe'.replace(re41, ''); 'gbhe'.replace(re42, ''); 'gbhe'.replace(re43, ''); 'gbhe'.replace(re44, ''); 'gbhe'.replace(re45, ''); 'gbhe'.replace(re46, ''); 'gbhe'.replace(re47, ''); 'gbhe'.replace(re48, ''); 'gi-fcbg'.replace(re40, ''); 'gi-fcbg'.replace(re41, ''); 'gi-fcbg'.replace(re42, ''); 'gi-fcbg'.replace(re43, ''); 'gi-fcbg'.replace(re44, ''); 'gi-fcbg'.replace(re45, ''); 'gi-fcbg'.replace(re46, ''); 'gi-fcbg'.replace(re47, ''); 'gi-fcbg'.replace(re48, ''); 'glcr'.replace(re39, ''); 'haqrsvarq'.replace(/\//g, ''); str93.replace(re40, ''); str93.replace(re41, ''); str93.replace(re42, ''); str93.replace(re43, ''); str93.replace(re44, ''); str93.replace(re45, ''); str93.replace(re46, ''); str93.replace(re47, ''); str93.replace(re48, ''); 'ivqrb'.replace(re40, ''); 'ivqrb'.replace(re41, ''); 'ivqrb'.replace(re42, ''); 'ivqrb'.replace(re43, ''); 'ivqrb'.replace(re44, ''); 'ivqrb'.replace(re45, ''); 'ivqrb'.replace(re46, ''); 'ivqrb'.replace(re47, ''); 'ivqrb'.replace(re48, ''); 'ivfvgf=1'.split(re86); 'jrggre'.replace(re40, ''); 'jrggre'.replace(re41, ''); 'jrggre'.replace(re42, ''); 'jrggre'.replace(re43, ''); 'jrggre'.replace(re44, ''); 'jrggre'.replace(re45, ''); 'jrggre'.replace(re46, ''); 'jrggre'.replace(re47, ''); 'jrggre'.replace(re48, ''); /#[a-z0-9]+$/i.exec('uggc://jjj.fpuhryreim.arg/Qrsnhyg'); re66.exec('fryrpgrq'); /(?:^|\s+)lhv-ani(?:\s+|$)/.exec('sff lhv-ani'); /(?:^|\s+)lhv-anifrg(?:\s+|$)/.exec('zrqvnzbqgno lhv-anifrg'); /(?:^|\s+)lhv-anifrg-gbc(?:\s+|$)/.exec('zrqvnzbqgno lhv-anifrg'); re91.exec('GnoThvq'); re91.exec('thvq'); /(pbzcngvoyr|jroxvg)/.exec(str63); /.+(?:ei|vg|en|vr)[\/: ]([\d.]+)/.exec(str63); re8.exec('144631658.0.10.1231365869'); re8.exec('144631658.0.10.1231367054'); re8.exec('144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re8.exec('144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re8.exec('144631658.1670816052019209000.1231365869.1231365869.1231365869.1'); re8.exec('144631658.1796080716621419500.1231367054.1231367054.1231367054.1'); re8.exec(str94); re8.exec(str95); re8.exec(str96); re8.exec(str97); re8.exec('__hgzn=144631658.1670816052019209000.1231365869.1231365869.1231365869.1'); re8.exec('__hgzn=144631658.1796080716621419500.1231367054.1231367054.1231367054.1'); re8.exec('__hgzo=144631658.0.10.1231365869'); re8.exec('__hgzo=144631658.0.10.1231367054'); re8.exec('__hgzm=144631658.1231365869.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re8.exec('__hgzm=144631658.1231367054.1.1.hgzpfe=(qverpg)|hgzppa=(qverpg)|hgzpzq=(abar)'); re34.exec(str78); re34.exec(str79); re34.exec(str81); re74.exec(str77); re74.exec('*'); re74.exec(str82); re74.exec(str83); re74.exec(str86); re74.exec('rzorq'); re74.exec('sbez.nwnk'); re74.exec(str90); re74.exec('bowrpg'); /\/onfr.wf(\?.+)?$/.exec('/uggc://wf.hv-cbegny.qr/tzk/ubzr/wf/20080602/onfr.wf'); re28.exec('uvag ynfgUvag ynfg'); re75.exec(''); re76.exec(''); re77.exec(''); re78.exec(''); re80.exec(str77); re80.exec('*'); re80.exec('.pybfr'); re80.exec(str82); re80.exec(str83); re80.exec(str84); re80.exec(str86); re80.exec('qg'); re80.exec('rzorq'); re80.exec('sbez.nwnk'); re80.exec(str90); re80.exec('bowrpg'); re61.exec('qlaYvo.wf'); re61.exec('rssrpgYvo.wf'); re61.exec('uggc://jjj.tzk.arg/qr/?fgnghf=uvajrvf'); re92.exec(' .pybfr'); re92.exec(' n.svryqOgaPnapry'); re92.exec(' qg'); re92.exec(str48); re92.exec('.nwnk'); re92.exec('.svryqOga,n.svryqOgaPnapry'); re92.exec('.svryqOgaPnapry'); re92.exec('.bow-nppbeqvba qg'); re68.exec(str77); re68.exec('*'); re68.exec('.pybfr'); re68.exec(str82); re68.exec(str83); re68.exec(str84); re68.exec(str86); re68.exec('qg'); re68.exec('rzorq'); re68.exec('sbez.nwnk'); re68.exec(str90); re68.exec('bowrpg'); re93.exec(' .pybfr'); re93.exec(' n.svryqOgaPnapry'); re93.exec(' qg'); re93.exec(str48); re93.exec('.nwnk'); re93.exec('.svryqOga,n.svryqOgaPnapry'); re93.exec('.svryqOgaPnapry'); re93.exec('.bow-nppbeqvba qg'); re81.exec(str77); re81.exec('*'); re81.exec(str48); re81.exec('.pybfr'); re81.exec(str82); re81.exec(str83); re81.exec(str84); re81.exec(str86); re81.exec('qg'); re81.exec('rzorq'); re81.exec('sbez.nwnk'); re81.exec(str90); re81.exec('bowrpg'); re94.exec(' .pybfr'); re94.exec(' n.svryqOgaPnapry'); re94.exec(' qg'); re94.exec(str48); re94.exec('.nwnk'); re94.exec('.svryqOga,n.svryqOgaPnapry'); re94.exec('.svryqOgaPnapry'); re94.exec('.bow-nppbeqvba qg'); re94.exec('[anzr=nwnkHey]'); re94.exec(str82); re31.exec('rf'); re31.exec('wn'); re82.exec(str77); re82.exec('*'); re82.exec(str48); re82.exec('.pybfr'); re82.exec(str82); re82.exec(str83); re82.exec(str84); re82.exec(str86); re82.exec('qg'); re82.exec('rzorq'); re82.exec('sbez.nwnk'); re82.exec(str90); re82.exec('bowrpg'); re83.exec(str98); re83.exec('shapgvba sbphf() { [angvir pbqr] }'); re62.exec('#Ybtva'); re62.exec('#Ybtva_cnffjbeq'); re62.exec(str77); re62.exec('#fubhgobkWf'); re62.exec('#fubhgobkWfReebe'); re62.exec('#fubhgobkWfFhpprff'); re62.exec('*'); re62.exec(str82); re62.exec(str83); re62.exec(str86); re62.exec('rzorq'); re62.exec('sbez.nwnk'); re62.exec(str90); re62.exec('bowrpg'); re49.exec('pbagrag'); re24.exec(str6); /xbadhrebe/.exec(str63); /znp/.exec('jva32'); /zbmvyyn/.exec(str63); /zfvr/.exec(str63); /ag\s5\.1/.exec(str63); /bcren/.exec(str63); /fnsnev/.exec(str63); /jva/.exec('jva32'); /jvaqbjf/.exec(str63); } } for (var i = 0; i < 5; i++) { runBlock0(); runBlock1(); runBlock2(); runBlock3(); runBlock4(); runBlock5(); runBlock6(); runBlock7(); runBlock8(); runBlock9(); runBlock10(); runBlock11(); } } runRegExpBenchmark(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/v8-v5/check-richards.js0000644000175000017500000003641711545150464023307 0ustar chr1schr1s// Copyright 2006-2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // This is a JavaScript implementation of the Richards // benchmark from: // // http://www.cl.cam.ac.uk/~mr10/Bench.html // // The benchmark was originally implemented in BCPL by // Martin Richards. //var Richards = new BenchmarkSuite('Richards', 34886, [ // new Benchmark("Richards", runRichards) //]); /** * The Richards benchmark simulates the task dispatcher of an * operating system. **/ function runRichards() { var scheduler = new Scheduler(); scheduler.addIdleTask(ID_IDLE, 0, null, COUNT); var queue = new Packet(null, ID_WORKER, KIND_WORK); queue = new Packet(queue, ID_WORKER, KIND_WORK); scheduler.addWorkerTask(ID_WORKER, 1000, queue); queue = new Packet(null, ID_DEVICE_A, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE); scheduler.addHandlerTask(ID_HANDLER_A, 2000, queue); queue = new Packet(null, ID_DEVICE_B, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE); scheduler.addHandlerTask(ID_HANDLER_B, 3000, queue); scheduler.addDeviceTask(ID_DEVICE_A, 4000, null); scheduler.addDeviceTask(ID_DEVICE_B, 5000, null); scheduler.schedule(); assertEq(scheduler.queueCount, EXPECTED_QUEUE_COUNT); assertEq(scheduler.holdCount, EXPECTED_HOLD_COUNT); } var COUNT = 1000; /** * These two constants specify how many times a packet is queued and * how many times a task is put on hold in a correct run of richards. * They don't have any meaning a such but are characteristic of a * correct run so if the actual queue or hold count is different from * the expected there must be a bug in the implementation. **/ var EXPECTED_QUEUE_COUNT = 2322; var EXPECTED_HOLD_COUNT = 928; /** * A scheduler can be used to schedule a set of tasks based on their relative * priorities. Scheduling is done by maintaining a list of task control blocks * which holds tasks and the data queue they are processing. * @constructor */ function Scheduler() { this.queueCount = 0; this.holdCount = 0; this.blocks = new Array(NUMBER_OF_IDS); this.list = null; this.currentTcb = null; this.currentId = null; } var ID_IDLE = 0; var ID_WORKER = 1; var ID_HANDLER_A = 2; var ID_HANDLER_B = 3; var ID_DEVICE_A = 4; var ID_DEVICE_B = 5; var NUMBER_OF_IDS = 6; var KIND_DEVICE = 0; var KIND_WORK = 1; /** * Add an idle task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task * @param {int} count the number of times to schedule the task */ Scheduler.prototype.addIdleTask = function (id, priority, queue, count) { this.addRunningTask(id, priority, queue, new IdleTask(this, 1, count)); }; /** * Add a work task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task */ Scheduler.prototype.addWorkerTask = function (id, priority, queue) { this.addTask(id, priority, queue, new WorkerTask(this, ID_HANDLER_A, 0)); }; /** * Add a handler task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task */ Scheduler.prototype.addHandlerTask = function (id, priority, queue) { this.addTask(id, priority, queue, new HandlerTask(this)); }; /** * Add a handler task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task */ Scheduler.prototype.addDeviceTask = function (id, priority, queue) { this.addTask(id, priority, queue, new DeviceTask(this)) }; /** * Add the specified task and mark it as running. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task * @param {Task} task the task to add */ Scheduler.prototype.addRunningTask = function (id, priority, queue, task) { this.addTask(id, priority, queue, task); this.currentTcb.setRunning(); }; /** * Add the specified task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task * @param {Task} task the task to add */ Scheduler.prototype.addTask = function (id, priority, queue, task) { this.currentTcb = new TaskControlBlock(this.list, id, priority, queue, task); this.list = this.currentTcb; this.blocks[id] = this.currentTcb; }; /** * Execute the tasks managed by this scheduler. */ Scheduler.prototype.schedule = function () { this.currentTcb = this.list; while (this.currentTcb != null) { if (this.currentTcb.isHeldOrSuspended()) { this.currentTcb = this.currentTcb.link; } else { this.currentId = this.currentTcb.id; this.currentTcb = this.currentTcb.run(); } } }; /** * Release a task that is currently blocked and return the next block to run. * @param {int} id the id of the task to suspend */ Scheduler.prototype.release = function (id) { var tcb = this.blocks[id]; if (tcb == null) return tcb; tcb.markAsNotHeld(); if (tcb.priority > this.currentTcb.priority) { return tcb; } else { return this.currentTcb; } }; /** * Block the currently executing task and return the next task control block * to run. The blocked task will not be made runnable until it is explicitly * released, even if new work is added to it. */ Scheduler.prototype.holdCurrent = function () { this.holdCount++; this.currentTcb.markAsHeld(); return this.currentTcb.link; }; /** * Suspend the currently executing task and return the next task control block * to run. If new work is added to the suspended task it will be made runnable. */ Scheduler.prototype.suspendCurrent = function () { this.currentTcb.markAsSuspended(); return this.currentTcb; }; /** * Add the specified packet to the end of the worklist used by the task * associated with the packet and make the task runnable if it is currently * suspended. * @param {Packet} packet the packet to add */ Scheduler.prototype.queue = function (packet) { var t = this.blocks[packet.id]; if (t == null) return t; this.queueCount++; packet.link = null; packet.id = this.currentId; return t.checkPriorityAdd(this.currentTcb, packet); }; /** * A task control block manages a task and the queue of work packages associated * with it. * @param {TaskControlBlock} link the preceding block in the linked block list * @param {int} id the id of this block * @param {int} priority the priority of this block * @param {Packet} queue the queue of packages to be processed by the task * @param {Task} task the task * @constructor */ function TaskControlBlock(link, id, priority, queue, task) { this.link = link; this.id = id; this.priority = priority; this.queue = queue; this.task = task; if (queue == null) { this.state = STATE_SUSPENDED; } else { this.state = STATE_SUSPENDED_RUNNABLE; } } /** * The task is running and is currently scheduled. */ var STATE_RUNNING = 0; /** * The task has packets left to process. */ var STATE_RUNNABLE = 1; /** * The task is not currently running. The task is not blocked as such and may * be started by the scheduler. */ var STATE_SUSPENDED = 2; /** * The task is blocked and cannot be run until it is explicitly released. */ var STATE_HELD = 4; var STATE_SUSPENDED_RUNNABLE = STATE_SUSPENDED | STATE_RUNNABLE; var STATE_NOT_HELD = ~STATE_HELD; TaskControlBlock.prototype.setRunning = function () { this.state = STATE_RUNNING; }; TaskControlBlock.prototype.markAsNotHeld = function () { this.state = this.state & STATE_NOT_HELD; }; TaskControlBlock.prototype.markAsHeld = function () { this.state = this.state | STATE_HELD; }; TaskControlBlock.prototype.isHeldOrSuspended = function () { return (this.state & STATE_HELD) != 0 || (this.state == STATE_SUSPENDED); }; TaskControlBlock.prototype.markAsSuspended = function () { this.state = this.state | STATE_SUSPENDED; }; TaskControlBlock.prototype.markAsRunnable = function () { this.state = this.state | STATE_RUNNABLE; }; /** * Runs this task, if it is ready to be run, and returns the next task to run. */ TaskControlBlock.prototype.run = function () { var packet; if (this.state == STATE_SUSPENDED_RUNNABLE) { packet = this.queue; this.queue = packet.link; if (this.queue == null) { this.state = STATE_RUNNING; } else { this.state = STATE_RUNNABLE; } } else { packet = null; } return this.task.run(packet); }; /** * Adds a packet to the worklist of this block's task, marks this as runnable if * necessary, and returns the next runnable object to run (the one * with the highest priority). */ TaskControlBlock.prototype.checkPriorityAdd = function (task, packet) { if (this.queue == null) { this.queue = packet; this.markAsRunnable(); if (this.priority > task.priority) return this; } else { this.queue = packet.addTo(this.queue); } return task; }; TaskControlBlock.prototype.toString = function () { return "tcb { " + this.task + "@" + this.state + " }"; }; /** * An idle task doesn't do any work itself but cycles control between the two * device tasks. * @param {Scheduler} scheduler the scheduler that manages this task * @param {int} v1 a seed value that controls how the device tasks are scheduled * @param {int} count the number of times this task should be scheduled * @constructor */ function IdleTask(scheduler, v1, count) { this.scheduler = scheduler; this.v1 = v1; this.count = count; } IdleTask.prototype.run = function (packet) { this.count--; if (this.count == 0) return this.scheduler.holdCurrent(); if ((this.v1 & 1) == 0) { this.v1 = this.v1 >> 1; return this.scheduler.release(ID_DEVICE_A); } else { this.v1 = (this.v1 >> 1) ^ 0xD008; return this.scheduler.release(ID_DEVICE_B); } }; IdleTask.prototype.toString = function () { return "IdleTask" }; /** * A task that suspends itself after each time it has been run to simulate * waiting for data from an external device. * @param {Scheduler} scheduler the scheduler that manages this task * @constructor */ function DeviceTask(scheduler) { this.scheduler = scheduler; this.v1 = null; } DeviceTask.prototype.run = function (packet) { if (packet == null) { if (this.v1 == null) return this.scheduler.suspendCurrent(); var v = this.v1; this.v1 = null; return this.scheduler.queue(v); } else { this.v1 = packet; return this.scheduler.holdCurrent(); } }; DeviceTask.prototype.toString = function () { return "DeviceTask"; }; /** * A task that manipulates work packets. * @param {Scheduler} scheduler the scheduler that manages this task * @param {int} v1 a seed used to specify how work packets are manipulated * @param {int} v2 another seed used to specify how work packets are manipulated * @constructor */ function WorkerTask(scheduler, v1, v2) { this.scheduler = scheduler; this.v1 = v1; this.v2 = v2; } WorkerTask.prototype.run = function (packet) { if (packet == null) { return this.scheduler.suspendCurrent(); } else { if (this.v1 == ID_HANDLER_A) { this.v1 = ID_HANDLER_B; } else { this.v1 = ID_HANDLER_A; } packet.id = this.v1; packet.a1 = 0; for (var i = 0; i < DATA_SIZE; i++) { this.v2++; if (this.v2 > 26) this.v2 = 1; packet.a2[i] = this.v2; } return this.scheduler.queue(packet); } }; WorkerTask.prototype.toString = function () { return "WorkerTask"; }; /** * A task that manipulates work packets and then suspends itself. * @param {Scheduler} scheduler the scheduler that manages this task * @constructor */ function HandlerTask(scheduler) { this.scheduler = scheduler; this.v1 = null; this.v2 = null; } HandlerTask.prototype.run = function (packet) { if (packet != null) { if (packet.kind == KIND_WORK) { this.v1 = packet.addTo(this.v1); } else { this.v2 = packet.addTo(this.v2); } } if (this.v1 != null) { var count = this.v1.a1; var v; if (count < DATA_SIZE) { if (this.v2 != null) { v = this.v2; this.v2 = this.v2.link; v.a1 = this.v1.a2[count]; this.v1.a1 = count + 1; return this.scheduler.queue(v); } } else { v = this.v1; this.v1 = this.v1.link; return this.scheduler.queue(v); } } return this.scheduler.suspendCurrent(); }; HandlerTask.prototype.toString = function () { return "HandlerTask"; }; /* --- * * P a c k e t * --- */ var DATA_SIZE = 4; /** * A simple package of data that is manipulated by the tasks. The exact layout * of the payload data carried by a packet is not importaint, and neither is the * nature of the work performed on packets by the tasks. * * Besides carrying data, packets form linked lists and are hence used both as * data and worklists. * @param {Packet} link the tail of the linked list of packets * @param {int} id an ID for this packet * @param {int} kind the type of this packet * @constructor */ function Packet(link, id, kind) { this.link = link; this.id = id; this.kind = kind; this.a1 = 0; this.a2 = new Array(DATA_SIZE); } /** * Add this packet to the end of a worklist, and return the worklist. * @param {Packet} queue the worklist to add this packet to */ Packet.prototype.addTo = function (queue) { this.link = null; if (queue == null) return this; var peek, next = queue; while ((peek = next.link) != null) next = peek; next.link = this; return queue; }; Packet.prototype.toString = function () { return "Packet"; }; runRichards(); mozjs-1.8.5-1.0.0+dfsg/js/src/jit-test/tests/v8-v5/check-splay.js0000644000175000017500000002556311545150464022640 0ustar chr1schr1s// Copyright 2009 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // This benchmark is based on a JavaScript log processing module used // by the V8 profiler to generate execution time profiles for runs of // JavaScript applications, and it effectively measures how fast the // JavaScript engine is at allocating nodes and reclaiming the memory // used for old nodes. Because of the way splay trees work, the engine // also has to deal with a lot of changes to the large tree object // graph. //var Splay = new BenchmarkSuite('Splay', 126125, [ // new Benchmark("Splay", SplayRun, SplaySetup, SplayTearDown) //]); // This is the best random number generator available to mankind ;) var MyMath = { seed: 49734321, random: function() { // Robert Jenkins' 32 bit integer hash function. this.seed = ((this.seed + 0x7ed55d16) + (this.seed << 12)) & 0xffffffff; this.seed = ((this.seed ^ 0xc761c23c) ^ (this.seed >>> 19)) & 0xffffffff; this.seed = ((this.seed + 0x165667b1) + (this.seed << 5)) & 0xffffffff; this.seed = ((this.seed + 0xd3a2646c) ^ (this.seed << 9)) & 0xffffffff; this.seed = ((this.seed + 0xfd7046c5) + (this.seed << 3)) & 0xffffffff; this.seed = ((this.seed ^ 0xb55a4f09) ^ (this.seed >>> 16)) & 0xffffffff; return (this.seed & 0xfffffff) / 0x10000000; }, }; // Configuration. var kSplayTreeSize = 8000; var kSplayTreeModifications = 80; var kSplayTreePayloadDepth = 5; var splayTree = null; function GeneratePayloadTree(depth, key) { if (depth == 0) { return { array : [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ], string : 'String for key ' + key + ' in leaf node' }; } else { return { left: GeneratePayloadTree(depth - 1, key), right: GeneratePayloadTree(depth - 1, key) }; } } function GenerateKey() { // The benchmark framework guarantees that Math.random is // deterministic; see base.js. // base.js isn't pulled in for jit-tests return MyMath.random(); } function InsertNewNode() { // Insert new node with a unique key. var key; do { key = GenerateKey(); } while (splayTree.find(key) != null); splayTree.insert(key, GeneratePayloadTree(kSplayTreePayloadDepth, key)); return key; } function SplaySetup() { splayTree = new SplayTree(); for (var i = 0; i < kSplayTreeSize; i++) InsertNewNode(); } function SplayTearDown() { // Allow the garbage collector to reclaim the memory // used by the splay tree no matter how we exit the // tear down function. var keys = splayTree.exportKeys(); splayTree = null; // Verify that the splay tree has the right size. var length = keys.length; assertEq(length, kSplayTreeSize); // Verify that the splay tree has sorted, unique keys. for (var i = 0; i < length - 1; i++) { assertEq(keys[i] < keys[i + 1], true); } } function SplayRun() { // Replace a few nodes in the splay tree. for (var i = 0; i < kSplayTreeModifications; i++) { var key = InsertNewNode(); var greatest = splayTree.findGreatestLessThan(key); if (greatest == null) splayTree.remove(key); else splayTree.remove(greatest.key); } } /** * Constructs a Splay tree. A splay tree is a self-balancing binary * search tree with the additional property that recently accessed * elements are quick to access again. It performs basic operations * such as insertion, look-up and removal in O(log(n)) amortized time. * * @constructor */ function SplayTree() { }; /** * Pointer to the root node of the tree. * * @type {SplayTree.Node} * @private */ SplayTree.prototype.root_ = null; /** * @return {boolean} Whether the tree is empty. */ SplayTree.prototype.isEmpty = function() { return !this.root_; }; /** * Inserts a node into the tree with the specified key and value if * the tree does not already contain a node with the specified key. If * the value is inserted, it becomes the root of the tree. * * @param {number} key Key to insert into the tree. * @param {*} value Value to insert into the tree. */ SplayTree.prototype.insert = function(key, value) { if (this.isEmpty()) { this.root_ = new SplayTree.Node(key, value); return; } // Splay on the key to move the last node on the search path for // the key to the root of the tree. this.splay_(key); if (this.root_.key == key) { return; } var node = new SplayTree.Node(key, value); if (key > this.root_.key) { node.left = this.root_; node.right = this.root_.right; this.root_.right = null; } else { node.right = this.root_; node.left = this.root_.left; this.root_.left = null; } this.root_ = node; }; /** * Removes a node with the specified key from the tree if the tree * contains a node with this key. The removed node is returned. If the * key is not found, an exception is thrown. * * @param {number} key Key to find and remove from the tree. * @return {SplayTree.Node} The removed node. */ SplayTree.prototype.remove = function(key) { if (this.isEmpty()) { throw Error('Key not found: ' + key); } this.splay_(key); if (this.root_.key != key) { throw Error('Key not found: ' + key); } var removed = this.root_; if (!this.root_.left) { this.root_ = this.root_.right; } else { var right = this.root_.right; this.root_ = this.root_.left; // Splay to make sure that the new root has an empty right child. this.splay_(key); // Insert the original right child as the right child of the new // root. this.root_.right = right; } return removed; }; /** * Returns the node having the specified key or null if the tree doesn't contain * a node with the specified key. * * @param {number} key Key to find in the tree. * @return {SplayTree.Node} Node having the specified key. */ SplayTree.prototype.find = function(key) { if (this.isEmpty()) { return null; } this.splay_(key); return this.root_.key == key ? this.root_ : null; }; /** * @return {SplayTree.Node} Node having the maximum key value that * is less or equal to the specified key value. */ SplayTree.prototype.findGreatestLessThan = function(key) { if (this.isEmpty()) { return null; } // Splay on the key to move the node with the given key or the last // node on the search path to the top of the tree. this.splay_(key); // Now the result is either the root node or the greatest node in // the left subtree. if (this.root_.key <= key) { return this.root_; } else if (this.root_.left) { return this.findMax(this.root_.left); } else { return null; } }; /** * @return {Array<*>} An array containing all the keys of tree's nodes. */ SplayTree.prototype.exportKeys = function() { var result = []; if (!this.isEmpty()) { this.root_.traverse_(function(node) { result.push(node.key); }); } return result; }; /** * Perform the splay operation for the given key. Moves the node with * the given key to the top of the tree. If no node has the given * key, the last node on the search path is moved to the top of the * tree. This is the simplified top-down splaying algorithm from: * "Self-adjusting Binary Search Trees" by Sleator and Tarjan * * @param {number} key Key to splay the tree on. * @private */ SplayTree.prototype.splay_ = function(key) { if (this.isEmpty()) { return; } // Create a dummy node. The use of the dummy node is a bit // counter-intuitive: The right child of the dummy node will hold // the L tree of the algorithm. The left child of the dummy node // will hold the R tree of the algorithm. Using a dummy node, left // and right will always be nodes and we avoid special cases. var dummy, left, right; dummy = left = right = new SplayTree.Node(null, null); var current = this.root_; while (true) { if (key < current.key) { if (!current.left) { break; } if (key < current.left.key) { // Rotate right. var tmp = current.left; current.left = tmp.right; tmp.right = current; current = tmp; if (!current.left) { break; } } // Link right. right.left = current; right = current; current = current.left; } else if (key > current.key) { if (!current.right) { break; } if (key > current.right.key) { // Rotate left. var tmp = current.right; current.right = tmp.left; tmp.left = current; current = tmp; if (!current.right) { break; } } // Link left. left.right = current; left = current; current = current.right; } else { break; } } // Assemble. left.right = current.left; right.left = current.right; current.left = dummy.right; current.right = dummy.left; this.root_ = current; }; /** * Constructs a Splay tree node. * * @param {number} key Key. * @param {*} value Value. */ SplayTree.Node = function(key, value) { this.key = key; this.value = value; }; /** * @type {SplayTree.Node} */ SplayTree.Node.prototype.left = null; /** * @type {SplayTree.Node} */ SplayTree.Node.prototype.right = null; /** * Performs an ordered traversal of the subtree starting at * this SplayTree.Node. * * @param {function(SplayTree.Node)} f Visitor function. * @private */ SplayTree.Node.prototype.traverse_ = function(f) { var current = this; while (current) { var left = current.left; if (left) left.traverse_(f); f(current); current = current.right; } }; SplaySetup(); SplayRun(); SplayTearDown(); mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/32-bit/many_params.in0000644000175000017500000000072011545150464022561 0ustar chr1schr1s.begin many_params pa = parami 0 0 pb = parami 1 0 pc = parami 2 0 pd = parami 3 0 pe = parami 4 0 pf = parami 5 0 pg = parami 6 0 ph = parami 7 0 res1 = addi pa pb res2 = addi res1 pc res3 = addi res2 pd res4 = addi res3 pe res5 = addi res4 pf res6 = addi res5 pg res7 = addi res6 ph reti res7 .end .begin main a = immi 1 b = immi 2 c = immi 3 d = immi 4 e = immi 5 f = immi 6 g = immi 7 h = immi 8 res = calli many_params fastcall a b c d e f g h reti res .end mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/32-bit/many_params.out0000644000175000017500000000001611545150464022760 0ustar chr1schr1sOutput is: 36 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/64-bit/dasq.in0000644000175000017500000000024711545150464021213 0ustar chr1schr1sq = immq 12345 d = qasd q q2 = dasq d one = immd 1.0 ; do some intermediate stuff to make it less trivial two = immd 2.0 three = addd one two i2 = q2i q2 reti i2 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/64-bit/dasq.out0000644000175000017500000000002111545150464021402 0ustar chr1schr1sOutput is: 12345 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/64-bit/qasd.in0000644000175000017500000000023111545150464021204 0ustar chr1schr1sone = immq 1 d = immd 123.45 q = dasq d q2 = addq q one ; do some intermediate stuff just to complicate things q3 = subq q2 one d2 = qasd q3 retd d2 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/64-bit/qasd.out0000644000175000017500000000002211545150464021403 0ustar chr1schr1sOutput is: 123.45 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/64-bit/shq.in0000644000175000017500000000130611545150464021053 0ustar chr1schr1s; Only the bottom 6 bits of the shift amount in lshq/rshq/rshuq are used. two = immq 2 sh1 = immi 1 sh2 = immi 65 ; 0100_0001b sh3 = immi 268435393 ; 0000_1111_1111_1111_1111_1111_1100_0001b a1 = lshq two sh1 ; --> 4 a2 = lshq two sh2 ; --> 4 a3 = lshq two sh3 ; --> 4 b1 = rshq two sh1 ; --> 1 b2 = rshq two sh2 ; --> 1 b3 = rshq two sh3 ; --> 1 c1 = rshuq two sh1 ; --> 1 c2 = rshuq two sh2 ; --> 1 c3 = rshuq two sh3 ; --> 1 s0 = immq 0 s1 = addq s0 a1 s2 = addq s1 a2 s3 = addq s2 a3 s4 = addq s3 b1 s5 = addq s4 b2 s6 = addq s5 b3 s7 = addq s6 c1 s8 = addq s7 c2 s9 = addq s8 c2 ; --> 18 retq s9 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/64-bit/shq.out0000644000175000017500000000001611545150464021251 0ustar chr1schr1sOutput is: 18 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/bigendian/fuzz-527178.in0000644000175000017500000000011611545150464022742 0ustar chr1schr1sbase = allocp 512 five = immi 5 sti five base 256 x = ldus2ui base 258 reti x mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/bigendian/fuzz-527178.out0000644000175000017500000000001511545150464023141 0ustar chr1schr1sOutput is: 5 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/bigendian/ldc2i.in0000644000175000017500000000066211545150464022174 0ustar chr1schr1sfull = immi 1288908529 ; 0x4cd32ef1 p = allocp 4 sti full p 0 n0chk = immi -15 ; sign_extend(0xf1) n1chk = immi 46 ; sign_extend(0x2e) n2chk = immi -45 ; sign_extend(0xd3) n3chk = immi 76 ; sign_extend(0x4c) n0 = ldc2i p 3 n1 = ldc2i p 2 n2 = ldc2i p 1 n3 = ldc2i p 0 ; Collate the results. r0 = xori n0chk n0 r1 = xori n1chk n1 r2 = xori n2chk n2 r3 = xori n3chk n3 r0_1 = ori r0 r1 r2_3 = ori r2 r3 r = ori r0_1 r2_3 reti r mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/bigendian/ldc2i.out0000644000175000017500000000001511545150464022365 0ustar chr1schr1sOutput is: 0 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/bigendian/lds2i.in0000644000175000017500000000040511545150464022207 0ustar chr1schr1sfull = immi -249334698 ; 0xf1237456 p = allocp 4 sti full p 0 n0chk = immi 29782 ; sign_extend(0x7456) n1chk = immi -3805 ; sign_extend(0xf123) n0 = lds2i p 2 n1 = lds2i p 0 ; Collate the results. r0 = xori n0chk n0 r1 = xori n1chk n1 r = ori r0 r1 reti r mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/bigendian/lds2i.out0000644000175000017500000000001511545150464022405 0ustar chr1schr1sOutput is: 0 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/bigendian/lduc2ui.in0000644000175000017500000000060611545150464022544 0ustar chr1schr1sfull = immi -992746767 ; 0xc4d3e2f1 p = allocp 4 sti full p 0 n0chk = immi 241 ; 0xf1 n1chk = immi 226 ; 0xe2 n2chk = immi 211 ; 0xd3 n3chk = immi 196 ; 0xc4 n0 = lduc2ui p 3 n1 = lduc2ui p 2 n2 = lduc2ui p 1 n3 = lduc2ui p 0 ; Collate the results. r0 = xori n0chk n0 r1 = xori n1chk n1 r2 = xori n2chk n2 r3 = xori n3chk n3 r0_1 = ori r0 r1 r2_3 = ori r2 r3 r = ori r0_1 r2_3 reti r mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/bigendian/lduc2ui.out0000644000175000017500000000001511545150464022737 0ustar chr1schr1sOutput is: 0 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/bigendian/ldus2ui.in0000644000175000017500000000041111545150464022556 0ustar chr1schr1sfull = immi -249334698 ; 0xf1237456 p = allocp 4 sti full p 0 n0chk = immi 29782 ; sign_extend(0x7456) n1chk = immi 61731 ; sign_extend(0xf123) n0 = ldus2ui p 2 n1 = ldus2ui p 0 ; Collate the results. r0 = xori n0chk n0 r1 = xori n1chk n1 r = ori r0 r1 reti r mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/bigendian/ldus2ui.out0000644000175000017500000000001511545150464022757 0ustar chr1schr1sOutput is: 0 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/hardfloat/d2i.in0000644000175000017500000000102711545150464021675 0ustar chr1schr1s; The rounding rules for d2i are pretty relaxed, but integer values should ; convert cleanly. c1 = immi -2147483648 d1 = immd -2147483648 i1 = d2i d1 r1 = xori c1 i1 c2 = immi 2147483647 d2 = immd 2147483647 i2 = d2i d2 r2 = xori i2 c2 ; The ARM back-end will do something different if there is no machine register ; allocated for d2i, and it doesn't hurt to test the same thing on other ; platforms too: c3 = immi 123456 d3 = immd 123456 i3 = d2i d3 regfence r3 = xori i3 c3 res1_2 = ori r1 r2 res1_3 = ori res1_2 r3 reti res1_3 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/hardfloat/d2i.out0000644000175000017500000000001511545150464022072 0ustar chr1schr1sOutput is: 0 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/hardfloat/f2i.in0000644000175000017500000000010111545150464021667 0ustar chr1schr1sa = allocp 8 d = immd 5.0 std d a 0 x = ldd a 0 i = d2i x reti i mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/hardfloat/f2i.out0000644000175000017500000000001511545150464022074 0ustar chr1schr1sOutput is: 5 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/hardfloat/i2d.in0000644000175000017500000000053711545150464021702 0ustar chr1schr1s; This test assumes that d2i and 32-bit integer arithmetic works properly. ; Start with 0x80000000 i1 = immi -2147483648 d1 = i2d i1 o1 = d2i d1 ; Test with -1 c2 = immi 2147483647 i2 = addi o1 c2 d2 = i2d i2 o2 = d2i d2 ; Test with 2147483647 i3 = subi o2 i1 d3 = i2d i3 o3 = d2i d3 ; Test with 0 i4 = subi o3 c2 d4 = i2d i4 o4 = d2i d4 reti o4 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/hardfloat/i2d.out0000644000175000017500000000001511545150464022072 0ustar chr1schr1sOutput is: 0 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/hardfloat/ui2d.in0000644000175000017500000000004011545150464022054 0ustar chr1schr1si = immi -1 d = ui2d i retd d mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/hardfloat/ui2d.out0000644000175000017500000000002711545150464022262 0ustar chr1schr1sOutput is: 4.29497e+09 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/littleendian/fuzz-527178.in0000644000175000017500000000011611545150464023476 0ustar chr1schr1sbase = allocp 512 five = immi 5 sti five base 256 x = ldus2ui base 256 reti x mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/littleendian/fuzz-527178.out0000644000175000017500000000001511545150464023675 0ustar chr1schr1sOutput is: 5 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/littleendian/ldc2i.in0000644000175000017500000000066211545150464022730 0ustar chr1schr1sfull = immi 1288908529 ; 0x4cd32ef1 p = allocp 4 sti full p 0 n0chk = immi -15 ; sign_extend(0xf1) n1chk = immi 46 ; sign_extend(0x2e) n2chk = immi -45 ; sign_extend(0xd3) n3chk = immi 76 ; sign_extend(0x4c) n0 = ldc2i p 0 n1 = ldc2i p 1 n2 = ldc2i p 2 n3 = ldc2i p 3 ; Collate the results. r0 = xori n0chk n0 r1 = xori n1chk n1 r2 = xori n2chk n2 r3 = xori n3chk n3 r0_1 = ori r0 r1 r2_3 = ori r2 r3 r = ori r0_1 r2_3 reti r mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/littleendian/ldc2i.out0000644000175000017500000000001511545150464023121 0ustar chr1schr1sOutput is: 0 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/littleendian/lds2i.in0000644000175000017500000000040511545150464022743 0ustar chr1schr1sfull = immi -249334698 ; 0xf1237456 p = allocp 4 sti full p 0 n0chk = immi 29782 ; sign_extend(0x7456) n1chk = immi -3805 ; sign_extend(0xf123) n0 = lds2i p 0 n1 = lds2i p 2 ; Collate the results. r0 = xori n0chk n0 r1 = xori n1chk n1 r = ori r0 r1 reti r mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/littleendian/lds2i.out0000644000175000017500000000001511545150464023141 0ustar chr1schr1sOutput is: 0 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/littleendian/lduc2ui.in0000644000175000017500000000060611545150464023300 0ustar chr1schr1sfull = immi -992746767 ; 0xc4d3e2f1 p = allocp 4 sti full p 0 n0chk = immi 241 ; 0xf1 n1chk = immi 226 ; 0xe2 n2chk = immi 211 ; 0xd3 n3chk = immi 196 ; 0xc4 n0 = lduc2ui p 0 n1 = lduc2ui p 1 n2 = lduc2ui p 2 n3 = lduc2ui p 3 ; Collate the results. r0 = xori n0chk n0 r1 = xori n1chk n1 r2 = xori n2chk n2 r3 = xori n3chk n3 r0_1 = ori r0 r1 r2_3 = ori r2 r3 r = ori r0_1 r2_3 reti r mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/littleendian/lduc2ui.out0000644000175000017500000000001511545150464023473 0ustar chr1schr1sOutput is: 0 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/littleendian/ldus2ui.in0000644000175000017500000000041111545150464023312 0ustar chr1schr1sfull = immi -249334698 ; 0xf1237456 p = allocp 4 sti full p 0 n0chk = immi 29782 ; sign_extend(0x7456) n1chk = immi 61731 ; sign_extend(0xf123) n0 = ldus2ui p 0 n1 = ldus2ui p 2 ; Collate the results. r0 = xori n0chk n0 r1 = xori n1chk n1 r = ori r0 r1 reti r mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/littleendian/ldus2ui.out0000644000175000017500000000001511545150464023513 0ustar chr1schr1sOutput is: 0 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/softfloat/dhi2i.in0000644000175000017500000000012211545150464022246 0ustar chr1schr1s; IEEE-754 encodes -0.0 as 0x80000000,00000000 d = immd -0.0 hi = dhi2i d reti hi mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/softfloat/dhi2i.out0000644000175000017500000000002711545150464022453 0ustar chr1schr1sOutput is: -2147483648 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/softfloat/dlo2i.in0000644000175000017500000000016211545150464022264 0ustar chr1schr1s; IEEE-754 encodes the following constant as 0x3ff00000,ffffffff d = immd 1.0000009536743162 lo = dlo2i d reti lo mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/softfloat/dlo2i.out0000644000175000017500000000001611545150464022463 0ustar chr1schr1sOutput is: -1 mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/softfloat/ii2d.in0000644000175000017500000000125411545150464022105 0ustar chr1schr1s; It's very difficult to test that the 'lo' part is actually doing anything ; because it tends to get lost when lirasm dumps the result to the console. ; By far the easiest way to check this is to use dlo2i and dhi2i to see if we ; get what we started with (assuming that those instructions work). hi = immi 1127219201 ; 0x43300001 (positive, exponent of +52 ... lo = immi -1 ; 0xffffffff (... mantissa of 0x100001ffffffff) d = ii2d lo hi hi2 = dhi2i d lo2 = dlo2i d ; XOR to check for differences, then OR the two results. 0 indicates success, ; but anything else indicates some kind of loss of data. rhi = xori hi hi2 rlo = xori lo lo2 res = ori rhi rlo reti res mozjs-1.8.5-1.0.0+dfsg/js/src/lirasm/tests/softfloat/ii2d.out0000644000175000017500000000001511545150464022300 0ustar chr1schr1sOutput is: 0 mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/gc/tests/clock.js0000644000175000017500000000123511545150464021125 0ustar chr1schr1s//Shell version of Clock Benchmark: https://bug548388.bugzilla.mozilla.org/attachment.cgi?id=434576 var t0; var tl; function alloc(dt) { if (dt > 100) dt = 100; for (var i = 0; i < dt * 1000; ++i) { var o = new String("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); } } function cycle() { if (!running) return; var t1 = new Date; if (t0 == undefined) t0 = t1; if (tl != undefined) { var dt = t1 - tl; alloc(dt); } tl = t1; if(t1 - t0 > (5 * 1000)) running = false; } var running = true; while(running) cycle(); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/gc/tests/dslots.js0000644000175000017500000000130011545150464021333 0ustar chr1schr1s//Benchmark to measure overhead of dslots allocation and deallocation function Object0() {}; function Object1() { this.a=1; }; function Object2() { this.a=1; this.b=1; }; function Object3() { this.a=1; this.b=1; this.c=1; }; function Object4() { this.a=1; this.b=1; this.c=1; this.d=1; }; function Object5() { this.a=1; this.b=1; this.c=1; this.d=1; this.e=1; }; function test() { var N = 1e5; gc(); for(var i = 0; i<=5; i++) { var tmp = i==0 ? Object0 : i==1 ? Object1 : i==2 ? Object2 : i==3 ? Object3 : i==4 ? Object4 : Object5; for (var j = 0; j != N; j++) { var a = new tmp(); } gc(); } } for(var i = 0; i<=5; i++) { test(); } mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/gc/tests/loops.js0000644000175000017500000000070011545150464021162 0ustar chr1schr1s//Measure plain GC. var t = []; var N = 500000 for(var i = 0; i < N; i++) t[i] = {}; gc() t = []; gc(); for(var i = 0; i < N; i++) t[i] = ({}); gc(); t = []; gc(); for(var i = 0; i < N; i++) t[i] = "asdf"; gc(); t = []; gc(); for(var i = 0; i < N; i++) t[i] = 1.12345; gc(); t=[]; gc(); for(var i = 0; i < N; i++) { t[i] = ({}); if (i != 0) t[i].a = t[i-1]; } gc(); t = []; gc(); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/gc/tests/objGraph.js0000644000175000017500000000100611545150464021562 0ustar chr1schr1stest(); function test() { function generate_big_object_graph() { var root = {}; f(root, 17); return root; function f(parent, depth) { if (depth == 0) return; --depth; f(parent.a = {}, depth); f(parent.b = {}, depth); } } function f(obj) { with (obj) return arguments; } for(var i = 0; i != 10; ++i) { gc(); var x = null; x = f(generate_big_object_graph()); gc(); //all used x = null; gc(); //all free } } mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/3d-cube.js0000644000175000017500000002062511545150464022505 0ustar chr1schr1s// 3D Cube Rotation // http://www.speich.net/computer/moztesting/3d.htm // Created by Simon Speich var Q = new Array(); var MTrans = new Array(); // transformation matrix var MQube = new Array(); // position information of qube var I = new Array(); // entity matrix var Origin = new Object(); var Testing = new Object(); var LoopTimer; var DisplArea = new Object(); DisplArea.Width = 300; DisplArea.Height = 300; function DrawLine(From, To) { var x1 = From.V[0]; var x2 = To.V[0]; var y1 = From.V[1]; var y2 = To.V[1]; var dx = Math.abs(x2 - x1); var dy = Math.abs(y2 - y1); var x = x1; var y = y1; var IncX1, IncY1; var IncX2, IncY2; var Den; var Num; var NumAdd; var NumPix; if (x2 >= x1) { IncX1 = 1; IncX2 = 1; } else { IncX1 = -1; IncX2 = -1; } if (y2 >= y1) { IncY1 = 1; IncY2 = 1; } else { IncY1 = -1; IncY2 = -1; } if (dx >= dy) { IncX1 = 0; IncY2 = 0; Den = dx; Num = dx / 2; NumAdd = dy; NumPix = dx; } else { IncX2 = 0; IncY1 = 0; Den = dy; Num = dy / 2; NumAdd = dx; NumPix = dy; } NumPix = Math.round(Q.LastPx + NumPix); var i = Q.LastPx; /* BEGIN LOOP */ for (; i < NumPix; i++) { Num += NumAdd; if (Num >= Den) { Num -= Den; x += IncX1; y += IncY1; } x += IncX2; y += IncY2; } /* END LOOP */ Q.LastPx = NumPix; } function CalcCross(V0, V1) { var Cross = new Array(); Cross[0] = V0[1]*V1[2] - V0[2]*V1[1]; Cross[1] = V0[2]*V1[0] - V0[0]*V1[2]; Cross[2] = V0[0]*V1[1] - V0[1]*V1[0]; return Cross; } function CalcNormal(V0, V1, V2) { var A = new Array(); var B = new Array(); /* BEGIN LOOP */ for (var i = 0; i < 3; i++) { A[i] = V0[i] - V1[i]; B[i] = V2[i] - V1[i]; } /* END LOOP */ A = CalcCross(A, B); var Length = Math.sqrt(A[0]*A[0] + A[1]*A[1] + A[2]*A[2]); /* BEGIN LOOP */ for (var i = 0; i < 3; i++) A[i] = A[i] / Length; /* END LOOP */ A[3] = 1; return A; } function CreateP(X,Y,Z) { this.V = [X,Y,Z,1]; } // multiplies two matrices function MMulti(M1, M2) { var M = [[],[],[],[]]; var i = 0; var j = 0; /* BEGIN LOOP */ for (; i < 4; i++) { j = 0; /* BEGIN LOOP */ for (; j < 4; j++) M[i][j] = M1[i][0] * M2[0][j] + M1[i][1] * M2[1][j] + M1[i][2] * M2[2][j] + M1[i][3] * M2[3][j]; /* END LOOP */ } /* END LOOP */ return M; } //multiplies matrix with vector function VMulti(M, V) { var Vect = new Array(); var i = 0; /* BEGIN LOOP */ for (;i < 4; i++) Vect[i] = M[i][0] * V[0] + M[i][1] * V[1] + M[i][2] * V[2] + M[i][3] * V[3]; /* END LOOP */ return Vect; } function VMulti2(M, V) { var Vect = new Array(); var i = 0; /* BEGIN LOOP */ for (;i < 3; i++) Vect[i] = M[i][0] * V[0] + M[i][1] * V[1] + M[i][2] * V[2]; /* END LOOP */ return Vect; } // add to matrices function MAdd(M1, M2) { var M = [[],[],[],[]]; var i = 0; var j = 0; /* BEGIN LOOP */ for (; i < 4; i++) { j = 0; /* BEGIN LOOP */ for (; j < 4; j++) M[i][j] = M1[i][j] + M2[i][j]; /* END LOOP */ } /* END LOOP */ return M; } function Translate(M, Dx, Dy, Dz) { var T = [ [1,0,0,Dx], [0,1,0,Dy], [0,0,1,Dz], [0,0,0,1] ]; return MMulti(T, M); } function RotateX(M, Phi) { var a = Phi; a *= Math.PI / 180; var Cos = Math.cos(a); var Sin = Math.sin(a); var R = [ [1,0,0,0], [0,Cos,-Sin,0], [0,Sin,Cos,0], [0,0,0,1] ]; return MMulti(R, M); } function RotateY(M, Phi) { var a = Phi; a *= Math.PI / 180; var Cos = Math.cos(a); var Sin = Math.sin(a); var R = [ [Cos,0,Sin,0], [0,1,0,0], [-Sin,0,Cos,0], [0,0,0,1] ]; return MMulti(R, M); } function RotateZ(M, Phi) { var a = Phi; a *= Math.PI / 180; var Cos = Math.cos(a); var Sin = Math.sin(a); var R = [ [Cos,-Sin,0,0], [Sin,Cos,0,0], [0,0,1,0], [0,0,0,1] ]; return MMulti(R, M); } function DrawQube() { // calc current normals var CurN = new Array(); var i = 5; Q.LastPx = 0; /* BEGIN LOOP */ for (; i > -1; i--) CurN[i] = VMulti2(MQube, Q.Normal[i]); /* END LOOP */ if (CurN[0][2] < 0) { if (!Q.Line[0]) { DrawLine(Q[0], Q[1]); Q.Line[0] = true; }; if (!Q.Line[1]) { DrawLine(Q[1], Q[2]); Q.Line[1] = true; }; if (!Q.Line[2]) { DrawLine(Q[2], Q[3]); Q.Line[2] = true; }; if (!Q.Line[3]) { DrawLine(Q[3], Q[0]); Q.Line[3] = true; }; } if (CurN[1][2] < 0) { if (!Q.Line[2]) { DrawLine(Q[3], Q[2]); Q.Line[2] = true; }; if (!Q.Line[9]) { DrawLine(Q[2], Q[6]); Q.Line[9] = true; }; if (!Q.Line[6]) { DrawLine(Q[6], Q[7]); Q.Line[6] = true; }; if (!Q.Line[10]) { DrawLine(Q[7], Q[3]); Q.Line[10] = true; }; } if (CurN[2][2] < 0) { if (!Q.Line[4]) { DrawLine(Q[4], Q[5]); Q.Line[4] = true; }; if (!Q.Line[5]) { DrawLine(Q[5], Q[6]); Q.Line[5] = true; }; if (!Q.Line[6]) { DrawLine(Q[6], Q[7]); Q.Line[6] = true; }; if (!Q.Line[7]) { DrawLine(Q[7], Q[4]); Q.Line[7] = true; }; } if (CurN[3][2] < 0) { if (!Q.Line[4]) { DrawLine(Q[4], Q[5]); Q.Line[4] = true; }; if (!Q.Line[8]) { DrawLine(Q[5], Q[1]); Q.Line[8] = true; }; if (!Q.Line[0]) { DrawLine(Q[1], Q[0]); Q.Line[0] = true; }; if (!Q.Line[11]) { DrawLine(Q[0], Q[4]); Q.Line[11] = true; }; } if (CurN[4][2] < 0) { if (!Q.Line[11]) { DrawLine(Q[4], Q[0]); Q.Line[11] = true; }; if (!Q.Line[3]) { DrawLine(Q[0], Q[3]); Q.Line[3] = true; }; if (!Q.Line[10]) { DrawLine(Q[3], Q[7]); Q.Line[10] = true; }; if (!Q.Line[7]) { DrawLine(Q[7], Q[4]); Q.Line[7] = true; }; } if (CurN[5][2] < 0) { if (!Q.Line[8]) { DrawLine(Q[1], Q[5]); Q.Line[8] = true; }; if (!Q.Line[5]) { DrawLine(Q[5], Q[6]); Q.Line[5] = true; }; if (!Q.Line[9]) { DrawLine(Q[6], Q[2]); Q.Line[9] = true; }; if (!Q.Line[1]) { DrawLine(Q[2], Q[1]); Q.Line[1] = true; }; } Q.Line = [false,false,false,false,false,false,false,false,false,false,false,false]; Q.LastPx = 0; } function Loop() { if (Testing.LoopCount > Testing.LoopMax) return; var TestingStr = String(Testing.LoopCount); /* BEGIN LOOP */ while (TestingStr.length < 3) TestingStr = "0" + TestingStr; /* END LOOP */ MTrans = Translate(I, -Q[8].V[0], -Q[8].V[1], -Q[8].V[2]); MTrans = RotateX(MTrans, 1); MTrans = RotateY(MTrans, 3); MTrans = RotateZ(MTrans, 5); MTrans = Translate(MTrans, Q[8].V[0], Q[8].V[1], Q[8].V[2]); MQube = MMulti(MTrans, MQube); var i = 8; /* BEGIN LOOP */ for (; i > -1; i--) { Q[i].V = VMulti(MTrans, Q[i].V); } /* END LOOP */ DrawQube(); Testing.LoopCount++; Loop(); } function Init(CubeSize) { // init/reset vars Origin.V = [150,150,20,1]; Testing.LoopCount = 0; Testing.LoopMax = 50; Testing.TimeMax = 0; Testing.TimeAvg = 0; Testing.TimeMin = 0; Testing.TimeTemp = 0; Testing.TimeTotal = 0; Testing.Init = false; // transformation matrix MTrans = [ [1,0,0,0], [0,1,0,0], [0,0,1,0], [0,0,0,1] ]; // position information of qube MQube = [ [1,0,0,0], [0,1,0,0], [0,0,1,0], [0,0,0,1] ]; // entity matrix I = [ [1,0,0,0], [0,1,0,0], [0,0,1,0], [0,0,0,1] ]; // create qube Q[0] = new CreateP(-CubeSize,-CubeSize, CubeSize); Q[1] = new CreateP(-CubeSize, CubeSize, CubeSize); Q[2] = new CreateP( CubeSize, CubeSize, CubeSize); Q[3] = new CreateP( CubeSize,-CubeSize, CubeSize); Q[4] = new CreateP(-CubeSize,-CubeSize,-CubeSize); Q[5] = new CreateP(-CubeSize, CubeSize,-CubeSize); Q[6] = new CreateP( CubeSize, CubeSize,-CubeSize); Q[7] = new CreateP( CubeSize,-CubeSize,-CubeSize); // center of gravity Q[8] = new CreateP(0, 0, 0); // anti-clockwise edge check Q.Edge = [[0,1,2],[3,2,6],[7,6,5],[4,5,1],[4,0,3],[1,5,6]]; // calculate squad normals Q.Normal = new Array(); /* BEGIN LOOP */ for (var i = 0; i < Q.Edge.length; i++) Q.Normal[i] = CalcNormal(Q[Q.Edge[i][0]].V, Q[Q.Edge[i][1]].V, Q[Q.Edge[i][2]].V); /* END LOOP */ // line drawn ? Q.Line = [false,false,false,false,false,false,false,false,false,false,false,false]; // create line pixels Q.NumPx = 9 * 2 * CubeSize; /* BEGIN LOOP */ for (var i = 0; i < Q.NumPx; i++) CreateP(0,0,0); /* END LOOP */ MTrans = Translate(MTrans, Origin.V[0], Origin.V[1], Origin.V[2]); MQube = MMulti(MTrans, MQube); var i = 0; /* BEGIN LOOP */ for (; i < 9; i++) { Q[i].V = VMulti(MTrans, Q[i].V); } /* END LOOP */ DrawQube(); Testing.Init = true; Loop(); } /* BEGIN LOOP */ for ( var i = 20; i <= 160; i *= 2 ) { Init(i); } /* END LOOP */ Q = null; MTrans = null; MQube = null; I = null; Origin = null; Testing = null; LoopTime = null; DisplArea = null; mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/3d-morph.js0000644000175000017500000000377711545150464022725 0ustar chr1schr1s/* * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ var loops = 15 var nx = 120 var nz = 120 function morph(a, f) { var PI2nx = Math.PI * 8/nx var sin = Math.sin var f30 = -(50 * sin(f*Math.PI*2)) /* BEGIN LOOP */ for (var i = 0; i < nz; ++i) { /* BEGIN LOOP */ for (var j = 0; j < nx; ++j) { a[3*(i*nx+j)+1] = sin((j-1) * PI2nx ) * -f30 } /* END LOOP */ } /* END LOOP */ } var a = Array() /* BEGIN LOOP */ for (var i=0; i < nx*nz*3; ++i) a[i] = 0 /* END LOOP */ /* BEGIN LOOP */ for (var i = 0; i < loops; ++i) { morph(a, i/loops) } /* END LOOP */ testOutput = 0; /* BEGIN LOOP */ for (var i = 0; i < nx; i++) testOutput += a[3*(i*nx+i)+1]; /* END LOOP */ a = null; mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/3d-raytrace.js0000644000175000017500000003476111545150464023407 0ustar chr1schr1s/* * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ function createVector(x,y,z) { return new Array(x,y,z); } function sqrLengthVector(self) { return self[0] * self[0] + self[1] * self[1] + self[2] * self[2]; } function lengthVector(self) { return Math.sqrt(self[0] * self[0] + self[1] * self[1] + self[2] * self[2]); } function addVector(self, v) { self[0] += v[0]; self[1] += v[1]; self[2] += v[2]; return self; } function subVector(self, v) { self[0] -= v[0]; self[1] -= v[1]; self[2] -= v[2]; return self; } function scaleVector(self, scale) { self[0] *= scale; self[1] *= scale; self[2] *= scale; return self; } function normaliseVector(self) { var len = Math.sqrt(self[0] * self[0] + self[1] * self[1] + self[2] * self[2]); self[0] /= len; self[1] /= len; self[2] /= len; return self; } function add(v1, v2) { return new Array(v1[0] + v2[0], v1[1] + v2[1], v1[2] + v2[2]); } function sub(v1, v2) { return new Array(v1[0] - v2[0], v1[1] - v2[1], v1[2] - v2[2]); } function scalev(v1, v2) { return new Array(v1[0] * v2[0], v1[1] * v2[1], v1[2] * v2[2]); } function dot(v1, v2) { return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]; } function scale(v, scale) { return [v[0] * scale, v[1] * scale, v[2] * scale]; } function cross(v1, v2) { return [v1[1] * v2[2] - v1[2] * v2[1], v1[2] * v2[0] - v1[0] * v2[2], v1[0] * v2[1] - v1[1] * v2[0]]; } function normalise(v) { var len = lengthVector(v); return [v[0] / len, v[1] / len, v[2] / len]; } function transformMatrix(self, v) { var vals = self; var x = vals[0] * v[0] + vals[1] * v[1] + vals[2] * v[2] + vals[3]; var y = vals[4] * v[0] + vals[5] * v[1] + vals[6] * v[2] + vals[7]; var z = vals[8] * v[0] + vals[9] * v[1] + vals[10] * v[2] + vals[11]; return [x, y, z]; } function invertMatrix(self) { var temp = new Array(16); var tx = -self[3]; var ty = -self[7]; var tz = -self[11]; /* BEGIN LOOP */ for (h = 0; h < 3; h++) { /* BEGIN LOOP */ for (v = 0; v < 3; v++) temp[h + v * 4] = self[v + h * 4]; /* END LOOP */ } /* END LOOP */ /* BEGIN LOOP */ for (i = 0; i < 11; i++) self[i] = temp[i]; /* END LOOP */ self[3] = tx * self[0] + ty * self[1] + tz * self[2]; self[7] = tx * self[4] + ty * self[5] + tz * self[6]; self[11] = tx * self[8] + ty * self[9] + tz * self[10]; return self; } // Triangle intersection using barycentric coord method function Triangle(p1, p2, p3) { var edge1 = sub(p3, p1); var edge2 = sub(p2, p1); var normal = cross(edge1, edge2); if (Math.abs(normal[0]) > Math.abs(normal[1])) if (Math.abs(normal[0]) > Math.abs(normal[2])) this.axis = 0; else this.axis = 2; else if (Math.abs(normal[1]) > Math.abs(normal[2])) this.axis = 1; else this.axis = 2; var u = (this.axis + 1) % 3; var v = (this.axis + 2) % 3; var u1 = edge1[u]; var v1 = edge1[v]; var u2 = edge2[u]; var v2 = edge2[v]; this.normal = normalise(normal); this.nu = normal[u] / normal[this.axis]; this.nv = normal[v] / normal[this.axis]; this.nd = dot(normal, p1) / normal[this.axis]; var det = u1 * v2 - v1 * u2; this.eu = p1[u]; this.ev = p1[v]; this.nu1 = u1 / det; this.nv1 = -v1 / det; this.nu2 = v2 / det; this.nv2 = -u2 / det; this.material = [0.7, 0.7, 0.7]; } Triangle.prototype.intersect = function(orig, dir, near, far) { var u = (this.axis + 1) % 3; var v = (this.axis + 2) % 3; var d = dir[this.axis] + this.nu * dir[u] + this.nv * dir[v]; var t = (this.nd - orig[this.axis] - this.nu * orig[u] - this.nv * orig[v]) / d; if (t < near || t > far) return null; var Pu = orig[u] + t * dir[u] - this.eu; var Pv = orig[v] + t * dir[v] - this.ev; var a2 = Pv * this.nu1 + Pu * this.nv1; if (a2 < 0) return null; var a3 = Pu * this.nu2 + Pv * this.nv2; if (a3 < 0) return null; if ((a2 + a3) > 1) return null; return t; } function Scene(a_triangles) { this.triangles = a_triangles; this.lights = []; this.ambient = [0,0,0]; this.background = [0.8,0.8,1]; } var zero = new Array(0,0,0); Scene.prototype.intersect = function(origin, dir, near, far) { var closest = null; /* BEGIN LOOP */ for (i = 0; i < this.triangles.length; i++) { var triangle = this.triangles[i]; var d = triangle.intersect(origin, dir, near, far); if (d == null || d > far || d < near) continue; far = d; closest = triangle; } /* END LOOP */ if (!closest) return [this.background[0],this.background[1],this.background[2]]; var normal = closest.normal; var hit = add(origin, scale(dir, far)); if (dot(dir, normal) > 0) normal = [-normal[0], -normal[1], -normal[2]]; var colour = null; if (closest.shader) { colour = closest.shader(closest, hit, dir); } else { colour = closest.material; } // do reflection var reflected = null; if (colour.reflection > 0.001) { var reflection = addVector(scale(normal, -2*dot(dir, normal)), dir); reflected = this.intersect(hit, reflection, 0.0001, 1000000); if (colour.reflection >= 0.999999) return reflected; } var l = [this.ambient[0], this.ambient[1], this.ambient[2]]; /* BEGIN LOOP */ for (var i = 0; i < this.lights.length; i++) { var light = this.lights[i]; var toLight = sub(light, hit); var distance = lengthVector(toLight); scaleVector(toLight, 1.0/distance); distance -= 0.0001; if (this.blocked(hit, toLight, distance)) continue; var nl = dot(normal, toLight); if (nl > 0) addVector(l, scale(light.colour, nl)); } /* END LOOP */ l = scalev(l, colour); if (reflected) { l = addVector(scaleVector(l, 1 - colour.reflection), scaleVector(reflected, colour.reflection)); } return l; } Scene.prototype.blocked = function(O, D, far) { var near = 0.0001; var closest = null; /* BEGIN LOOP */ for (i = 0; i < this.triangles.length; i++) { var triangle = this.triangles[i]; var d = triangle.intersect(O, D, near, far); if (d == null || d > far || d < near) continue; return true; } /* END LOOP */ return false; } // this camera code is from notes i made ages ago, it is from *somewhere* -- i cannot remember where // that somewhere is function Camera(origin, lookat, up) { var zaxis = normaliseVector(subVector(lookat, origin)); var xaxis = normaliseVector(cross(up, zaxis)); var yaxis = normaliseVector(cross(xaxis, subVector([0,0,0], zaxis))); var m = new Array(16); m[0] = xaxis[0]; m[1] = xaxis[1]; m[2] = xaxis[2]; m[4] = yaxis[0]; m[5] = yaxis[1]; m[6] = yaxis[2]; m[8] = zaxis[0]; m[9] = zaxis[1]; m[10] = zaxis[2]; invertMatrix(m); m[3] = 0; m[7] = 0; m[11] = 0; this.origin = origin; this.directions = new Array(4); this.directions[0] = normalise([-0.7, 0.7, 1]); this.directions[1] = normalise([ 0.7, 0.7, 1]); this.directions[2] = normalise([ 0.7, -0.7, 1]); this.directions[3] = normalise([-0.7, -0.7, 1]); this.directions[0] = transformMatrix(m, this.directions[0]); this.directions[1] = transformMatrix(m, this.directions[1]); this.directions[2] = transformMatrix(m, this.directions[2]); this.directions[3] = transformMatrix(m, this.directions[3]); } Camera.prototype.generateRayPair = function(y) { rays = new Array(new Object(), new Object()); rays[0].origin = this.origin; rays[1].origin = this.origin; rays[0].dir = addVector(scale(this.directions[0], y), scale(this.directions[3], 1 - y)); rays[1].dir = addVector(scale(this.directions[1], y), scale(this.directions[2], 1 - y)); return rays; } function renderRows(camera, scene, pixels, width, height, starty, stopy) { /* BEGIN LOOP */ for (var y = starty; y < stopy; y++) { var rays = camera.generateRayPair(y / height); /* BEGIN LOOP */ for (var x = 0; x < width; x++) { var xp = x / width; var origin = addVector(scale(rays[0].origin, xp), scale(rays[1].origin, 1 - xp)); var dir = normaliseVector(addVector(scale(rays[0].dir, xp), scale(rays[1].dir, 1 - xp))); var l = scene.intersect(origin, dir); pixels[y][x] = l; } /* END LOOP */ } /* END LOOP */ } Camera.prototype.render = function(scene, pixels, width, height) { var cam = this; var row = 0; renderRows(cam, scene, pixels, width, height, 0, height); } function raytraceScene() { var startDate = new Date().getTime(); var numTriangles = 2 * 6; var triangles = new Array();//numTriangles); var tfl = createVector(-10, 10, -10); var tfr = createVector( 10, 10, -10); var tbl = createVector(-10, 10, 10); var tbr = createVector( 10, 10, 10); var bfl = createVector(-10, -10, -10); var bfr = createVector( 10, -10, -10); var bbl = createVector(-10, -10, 10); var bbr = createVector( 10, -10, 10); // cube!!! // front var i = 0; triangles[i++] = new Triangle(tfl, tfr, bfr); triangles[i++] = new Triangle(tfl, bfr, bfl); // back triangles[i++] = new Triangle(tbl, tbr, bbr); triangles[i++] = new Triangle(tbl, bbr, bbl); // triangles[i-1].material = [0.7,0.2,0.2]; // triangles[i-1].material.reflection = 0.8; // left triangles[i++] = new Triangle(tbl, tfl, bbl); // triangles[i-1].reflection = 0.6; triangles[i++] = new Triangle(tfl, bfl, bbl); // triangles[i-1].reflection = 0.6; // right triangles[i++] = new Triangle(tbr, tfr, bbr); triangles[i++] = new Triangle(tfr, bfr, bbr); // top triangles[i++] = new Triangle(tbl, tbr, tfr); triangles[i++] = new Triangle(tbl, tfr, tfl); // bottom triangles[i++] = new Triangle(bbl, bbr, bfr); triangles[i++] = new Triangle(bbl, bfr, bfl); //Floor!!!! var green = createVector(0.0, 0.4, 0.0); var grey = createVector(0.4, 0.4, 0.4); grey.reflection = 1.0; var floorShader = function(tri, pos, view) { var x = ((pos[0]/32) % 2 + 2) % 2; var z = ((pos[2]/32 + 0.3) % 2 + 2) % 2; if (x < 1 != z < 1) { //in the real world we use the fresnel term... // var angle = 1-dot(view, tri.normal); // angle *= angle; // angle *= angle; // angle *= angle; //grey.reflection = angle; return grey; } else return green; } var ffl = createVector(-1000, -30, -1000); var ffr = createVector( 1000, -30, -1000); var fbl = createVector(-1000, -30, 1000); var fbr = createVector( 1000, -30, 1000); triangles[i++] = new Triangle(fbl, fbr, ffr); triangles[i-1].shader = floorShader; triangles[i++] = new Triangle(fbl, ffr, ffl); triangles[i-1].shader = floorShader; var _scene = new Scene(triangles); _scene.lights[0] = createVector(20, 38, -22); _scene.lights[0].colour = createVector(0.7, 0.3, 0.3); _scene.lights[1] = createVector(-23, 40, 17); _scene.lights[1].colour = createVector(0.7, 0.3, 0.3); _scene.lights[2] = createVector(23, 20, 17); _scene.lights[2].colour = createVector(0.7, 0.7, 0.7); _scene.ambient = createVector(0.1, 0.1, 0.1); // _scene.background = createVector(0.7, 0.7, 1.0); var size = 30; var pixels = new Array(); /* BEGIN LOOP */ for (var y = 0; y < size; y++) { pixels[y] = new Array(); /* BEGIN LOOP */ for (var x = 0; x < size; x++) { pixels[y][x] = 0; } /* END LOOP */ } /* END LOOP */ var _camera = new Camera(createVector(-40, 40, 40), createVector(0, 0, 0), createVector(0, 1, 0)); _camera.render(_scene, pixels, size, size); return pixels; } function arrayToCanvasCommands(pixels) { var s = '\nvar pixels = ['; var size = 30; /* BEGIN LOOP */ for (var y = 0; y < size; y++) { s += "["; /* BEGIN LOOP */ for (var x = 0; x < size; x++) { s += "[" + pixels[y][x] + "],"; } /* END LOOP */ s+= "],"; } /* END LOOP */ s += '];\n var canvas = document.getElementById("renderCanvas").getContext("2d");\n\ \n\ \n\ var size = 30;\n\ canvas.fillStyle = "red";\n\ canvas.fillRect(0, 0, size, size);\n\ canvas.scale(1, -1);\n\ canvas.translate(0, -size);\n\ \n\ if (!canvas.setFillColor)\n\ canvas.setFillColor = function(r, g, b, a) {\n\ this.fillStyle = "rgb("+[Math.floor(r * 255), Math.floor(g * 255), Math.floor(b * 255)]+")";\n\ }\n\ \n\ for (var y = 0; y < size; y++) {\n\ for (var x = 0; x < size; x++) {\n\ var l = pixels[y][x];\n\ canvas.setFillColor(l[0], l[1], l[2], 1);\n\ canvas.fillRect(x, y, 1, 1);\n\ }\n\ }'; return s; } testOutput = arrayToCanvasCommands(raytraceScene()); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/access-binary-trees.js0000644000175000017500000000253011545150464025121 0ustar chr1schr1s/* The Great Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ function TreeNode(left,right,item){ this.left = left; this.right = right; this.item = item; } TreeNode.prototype.itemCheck = function(){ if (this.left==null) return this.item; else return this.item + this.left.itemCheck() - this.right.itemCheck(); } function bottomUpTree(item,depth){ if (depth>0){ return new TreeNode( bottomUpTree(2*item-1, depth-1) ,bottomUpTree(2*item, depth-1) ,item ); } else { return new TreeNode(null,null,item); } } var ret; /* BEGIN LOOP */ for ( var n = 4; n <= 7; n += 1 ) { var minDepth = 4; var maxDepth = Math.max(minDepth + 2, n); var stretchDepth = maxDepth + 1; var check = bottomUpTree(0,stretchDepth).itemCheck(); var longLivedTree = bottomUpTree(0,maxDepth); /* BEGIN LOOP */ for (var depth=minDepth; depth<=maxDepth; depth+=2){ var iterations = 1 << (maxDepth - depth + minDepth); check = 0; /* BEGIN LOOP */ for (var i=1; i<=iterations; i++){ check += bottomUpTree(i,depth).itemCheck(); check += bottomUpTree(-i,depth).itemCheck(); } /* END LOOP */ } /* END LOOP */ ret = longLivedTree.itemCheck(); } /* END LOOP */ mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/access-fannkuch.js0000644000175000017500000000363711545150464024323 0ustar chr1schr1s/* The Great Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ function fannkuch(n) { var check = 0; var perm = Array(n); var perm1 = Array(n); var count = Array(n); var maxPerm = Array(n); var maxFlipsCount = 0; var m = n - 1; /* BEGIN LOOP */ for (var i = 0; i < n; i++) perm1[i] = i; /* END LOOP */ var r = n; /* BEGIN LOOP */ while (true) { // write-out the first 30 permutations if (check < 30){ var s = ""; /* BEGIN LOOP */ for(var i=0; i> 1; /* BEGIN LOOP */ for (var i = 0; i < k2; i++) { var temp = perm[i]; perm[i] = perm[k - i]; perm[k - i] = temp; } /* END LOOP */ flipsCount++; } /* END LOOP */ if (flipsCount > maxFlipsCount) { maxFlipsCount = flipsCount; /* BEGIN LOOP */ for (var i = 0; i < n; i++) maxPerm[i] = perm1[i]; /* END LOOP */ } } /* BEGIN LOOP */ while (true) { if (r == n) return maxFlipsCount; var perm0 = perm1[0]; var i = 0; /* BEGIN LOOP */ while (i < r) { var j = i + 1; perm1[i] = perm1[j]; i = j; } /* END LOOP */ perm1[r] = perm0; count[r] = count[r] - 1; if (count[r] > 0) break; r++; } /* END LOOP */ } /* END LOOP */ } var n = 8; var ret = fannkuch(n); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/access-nbody.js0000644000175000017500000001055111545150464023632 0ustar chr1schr1s/* The Great Computer Language Shootout http://shootout.alioth.debian.org/ contributed by Isaac Gouy */ var PI = 3.141592653589793; var SOLAR_MASS = 4 * PI * PI; var DAYS_PER_YEAR = 365.24; function Body(x,y,z,vx,vy,vz,mass){ this.x = x; this.y = y; this.z = z; this.vx = vx; this.vy = vy; this.vz = vz; this.mass = mass; } Body.prototype.offsetMomentum = function(px,py,pz) { this.vx = -px / SOLAR_MASS; this.vy = -py / SOLAR_MASS; this.vz = -pz / SOLAR_MASS; return this; } function Jupiter(){ return new Body( 4.84143144246472090e+00, -1.16032004402742839e+00, -1.03622044471123109e-01, 1.66007664274403694e-03 * DAYS_PER_YEAR, 7.69901118419740425e-03 * DAYS_PER_YEAR, -6.90460016972063023e-05 * DAYS_PER_YEAR, 9.54791938424326609e-04 * SOLAR_MASS ); } function Saturn(){ return new Body( 8.34336671824457987e+00, 4.12479856412430479e+00, -4.03523417114321381e-01, -2.76742510726862411e-03 * DAYS_PER_YEAR, 4.99852801234917238e-03 * DAYS_PER_YEAR, 2.30417297573763929e-05 * DAYS_PER_YEAR, 2.85885980666130812e-04 * SOLAR_MASS ); } function Uranus(){ return new Body( 1.28943695621391310e+01, -1.51111514016986312e+01, -2.23307578892655734e-01, 2.96460137564761618e-03 * DAYS_PER_YEAR, 2.37847173959480950e-03 * DAYS_PER_YEAR, -2.96589568540237556e-05 * DAYS_PER_YEAR, 4.36624404335156298e-05 * SOLAR_MASS ); } function Neptune(){ return new Body( 1.53796971148509165e+01, -2.59193146099879641e+01, 1.79258772950371181e-01, 2.68067772490389322e-03 * DAYS_PER_YEAR, 1.62824170038242295e-03 * DAYS_PER_YEAR, -9.51592254519715870e-05 * DAYS_PER_YEAR, 5.15138902046611451e-05 * SOLAR_MASS ); } function Sun(){ return new Body(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, SOLAR_MASS); } function NBodySystem(bodies){ this.bodies = bodies; var px = 0.0; var py = 0.0; var pz = 0.0; var size = this.bodies.length; /* BEGIN LOOP */ for (var i=0; i0){ /* BEGIN LOOP */ for (var i=1; i<=prefixWidth; i++) s = " " + s; /* END LOOP */ } return s; } function nsieve(m, isPrime){ var i, k, count; /* BEGIN LOOP */ for (i=2; i<=m; i++) { isPrime[i] = true; } /* END LOOP */ count = 0; /* BEGIN LOOP */ for (i=2; i<=m; i++){ if (isPrime[i]) { /* BEGIN LOOP */ for (k=i+i; k<=m; k+=i) isPrime[k] = false; /* END LOOP */ count++; } } /* END LOOP */ return count; } function sieve() { /* BEGIN LOOP */ for (var i = 1; i <= 3; i++ ) { var m = (1<> ((b << 1) & 14)); c += 3 & (bi3b >> ((b >> 2) & 14)); c += 3 & (bi3b >> ((b >> 5) & 6)); return c; /* lir4,0xE994; 9 instructions, no memory access, minimal register dependence, 6 shifts, 2 adds, 1 inline assign rlwinmr5,r3,1,28,30 rlwinmr6,r3,30,28,30 rlwinmr7,r3,27,29,30 rlwnmr8,r4,r5,30,31 rlwnmr9,r4,r6,30,31 rlwnmr10,r4,r7,30,31 addr3,r8,r9 addr3,r3,r10 */ } function TimeFunc(func) { var x, y, t; /* BEGIN LOOP */ for(var x=0; x<500; x++) { /* BEGIN LOOP */ for(var y=0; y<256; y++) func(y); /* END LOOP */ } /* END LOOP */ } TimeFunc(fast3bitlookup); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/bitops-bits-in-byte.js0000644000175000017500000000075011545150464025064 0ustar chr1schr1s// Copyright (c) 2004 by Arthur Langereis (arthur_ext at domain xfinitegames, tld com) // 1 op = 2 assigns, 16 compare/branches, 8 ANDs, (0-8) ADDs, 8 SHLs // O(n) function bitsinbyte(b) { var m = 1, c = 0; /* BEGIN LOOP */ while(m<0x100) { if(b & m) c++; m <<= 1; } /* END LOOP */ return c; } function TimeFunc(func) { var x, y, t; /* BEGIN LOOP */ for(var x=0; x<350; x++) { /* BEGIN LOOP */ for(var y=0; y<256; y++) func(y); /* END LOOP */ } /* END LOOP */ } TimeFunc(bitsinbyte); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/bitops-bitwise-and.js0000644000175000017500000000272411545150464024767 0ustar chr1schr1s/* * Copyright (C) 2007 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ bitwiseAndValue = 4294967296; /* BEGIN LOOP */ for (var i = 0; i < 600000; i++) bitwiseAndValue = bitwiseAndValue & i; /* END LOOP */ mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/bitops-nsieve-bits.js0000644000175000017500000000151511545150464025006 0ustar chr1schr1s// The Great Computer Language Shootout // http://shootout.alioth.debian.org // // Contributed by Ian Osgood function pad(n,width) { var s = n.toString(); /* BEGIN LOOP */ while (s.length < width) s = ' ' + s; /* END LOOP */ return s; } function primes(isPrime, n) { var i, count = 0, m = 10000<>5; /* BEGIN LOOP */ for (i=0; i>5] & 1<<(i&31)) { /* BEGIN LOOP */ for (var j=i+i; j>5] &= ~(1<<(j&31)); /* END LOOP */ count++; } /* END LOOP */ } function sieve() { /* BEGIN LOOP */ for (var i = 4; i <= 4; i++) { var isPrime = new Array((10000<>5); primes(isPrime, i); } /* END LOOP */ } sieve(); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/controlflow-recursive.js0000644000175000017500000000103011545150464025625 0ustar chr1schr1s// The Computer Language Shootout // http://shootout.alioth.debian.org/ // contributed by Isaac Gouy function ack(m,n){ if (m==0) { return n+1; } if (n==0) { return ack(m-1,1); } return ack(m-1, ack(m,n-1) ); } function fib(n) { if (n < 2){ return 1; } return fib(n-2) + fib(n-1); } function tak(x,y,z) { if (y >= x) return z; return tak(tak(x-1,y,z), tak(y-1,z,x), tak(z-1,x,y)); } /* BEGIN LOOP */ for ( var i = 3; i <= 5; i++ ) { ack(3,i); fib(17.0+i); tak(3*i+3,2*i+2,i+1); } /* END LOOP */ mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/crypto-aes.js0000644000175000017500000004374611545150464023362 0ustar chr1schr1s/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* * AES Cipher function: encrypt 'input' with Rijndael algorithm * * takes byte-array 'input' (16 bytes) * 2D byte-array key schedule 'w' (Nr+1 x Nb bytes) * * applies Nr rounds (10/12/14) using key schedule w for 'add round key' stage * * returns byte-array encrypted value (16 bytes) */ function Cipher(input, w) { // main Cipher function [§5.1] var Nb = 4; // block size (in words): no of columns in state (fixed at 4 for AES) var Nr = w.length/Nb - 1; // no of rounds: 10/12/14 for 128/192/256-bit keys var state = [[],[],[],[]]; // initialise 4xNb byte-array 'state' with input [§3.4] /* BEGIN LOOP */ for (var i=0; i<4*Nb; i++) state[i%4][Math.floor(i/4)] = input[i]; /* END LOOP */ state = AddRoundKey(state, w, 0, Nb); /* BEGIN LOOP */ for (var round=1; round 6 && i%Nk == 4) { temp = SubWord(temp); } /* BEGIN LOOP */ for (var t=0; t<4; t++) w[i][t] = w[i-Nk][t] ^ temp[t]; /* END LOOP */ } /* END LOOP */ return w; } function SubWord(w) { // apply SBox to 4-byte word w /* BEGIN LOOP */ for (var i=0; i<4; i++) w[i] = Sbox[w[i]]; /* END LOOP */ return w; } function RotWord(w) { // rotate 4-byte word w left by one byte w[4] = w[0]; /* BEGIN LOOP */ for (var i=0; i<4; i++) w[i] = w[i+1]; /* END LOOP */ return w; } // Sbox is pre-computed multiplicative inverse in GF(2^8) used in SubBytes and KeyExpansion [§5.1.1] var Sbox = [0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5,0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76, 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0,0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0, 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc,0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15, 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a,0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75, 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0,0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84, 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b,0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf, 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85,0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8, 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5,0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2, 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17,0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73, 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88,0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb, 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c,0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79, 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9,0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08, 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6,0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a, 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e,0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e, 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94,0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf, 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68,0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16]; // Rcon is Round Constant used for the Key Expansion [1st col is 2^(r-1) in GF(2^8)] [§5.2] var Rcon = [ [0x00, 0x00, 0x00, 0x00], [0x01, 0x00, 0x00, 0x00], [0x02, 0x00, 0x00, 0x00], [0x04, 0x00, 0x00, 0x00], [0x08, 0x00, 0x00, 0x00], [0x10, 0x00, 0x00, 0x00], [0x20, 0x00, 0x00, 0x00], [0x40, 0x00, 0x00, 0x00], [0x80, 0x00, 0x00, 0x00], [0x1b, 0x00, 0x00, 0x00], [0x36, 0x00, 0x00, 0x00] ]; /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* * Use AES to encrypt 'plaintext' with 'password' using 'nBits' key, in 'Counter' mode of operation * - see http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf * for each block * - outputblock = cipher(counter, key) * - cipherblock = plaintext xor outputblock */ function AESEncryptCtr(plaintext, password, nBits) { if (!(nBits==128 || nBits==192 || nBits==256)) return ''; // standard allows 128/192/256 bit keys // for this example script, generate the key by applying Cipher to 1st 16/24/32 chars of password; // for real-world applications, a more secure approach would be to hash the password e.g. with SHA-1 var nBytes = nBits/8; // no bytes in key var pwBytes = new Array(nBytes); /* BEGIN LOOP */ for (var i=0; i>> i*8) & 0xff; /* END LOOP */ /* BEGIN LOOP */ for (var i=0; i<4; i++) counterBlock[i+4] = (nonce/0x100000000 >>> i*8) & 0xff; /* END LOOP */ // generate key schedule - an expansion of the key into distinct Key Rounds for each round var keySchedule = KeyExpansion(key); var blockCount = Math.ceil(plaintext.length/blockSize); var ciphertext = new Array(blockCount); // ciphertext as array of strings /* BEGIN LOOP */ for (var b=0; b>> c*8) & 0xff; /* END LOOP */ /* BEGIN LOOP */ for (var c=0; c<4; c++) counterBlock[15-c-4] = (b/0x100000000 >>> c*8) /* END LOOP */ var cipherCntr = Cipher(counterBlock, keySchedule); // -- encrypt counter block -- // calculate length of final block: var blockLength = b>> c*8) & 0xff; /* END LOOP */ /* BEGIN LOOP */ for (var c=0; c<4; c++) counterBlock[15-c-4] = ((b/0x100000000-1) >>> c*8) & 0xff; /* END LOOP */ var cipherCntr = Cipher(counterBlock, keySchedule); // encrypt counter block ciphertext[b] = unescCtrlChars(ciphertext[b]); var pt = ''; /* BEGIN LOOP */ for (var i=0; i>18 & 0x3f; h2 = bits>>12 & 0x3f; h3 = bits>>6 & 0x3f; h4 = bits & 0x3f; // end of string? index to '=' in b64 if (isNaN(o3)) h4 = 64; if (isNaN(o2)) h3 = 64; // use hexets to index into b64, and append result to encoded string enc += b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); } while (i < str.length); /* END LOOP */ return enc; } function decodeBase64(str) { var o1, o2, o3, h1, h2, h3, h4, bits, i=0, enc=''; /* BEGIN LOOP */ do { // unpack four hexets into three octets using index points in b64 h1 = b64.indexOf(str.charAt(i++)); h2 = b64.indexOf(str.charAt(i++)); h3 = b64.indexOf(str.charAt(i++)); h4 = b64.indexOf(str.charAt(i++)); bits = h1<<18 | h2<<12 | h3<<6 | h4; o1 = bits>>16 & 0xff; o2 = bits>>8 & 0xff; o3 = bits & 0xff; if (h3 == 64) enc += String.fromCharCode(o1); else if (h4 == 64) enc += String.fromCharCode(o1, o2); else enc += String.fromCharCode(o1, o2, o3); } while (i < str.length); /* END LOOP */ return decodeUTF8(enc); // decode UTF-8 byte-array back to Unicode } function encodeUTF8(str) { // encode multi-byte string into utf-8 multiple single-byte characters str = str.replace( /[\u0080-\u07ff]/g, // U+0080 - U+07FF = 2-byte chars function(c) { var cc = c.charCodeAt(0); return String.fromCharCode(0xc0 | cc>>6, 0x80 | cc&0x3f); } ); str = str.replace( /[\u0800-\uffff]/g, // U+0800 - U+FFFF = 3-byte chars function(c) { var cc = c.charCodeAt(0); return String.fromCharCode(0xe0 | cc>>12, 0x80 | cc>>6&0x3F, 0x80 | cc&0x3f); } ); return str; } function decodeUTF8(str) { // decode utf-8 encoded string back into multi-byte characters str = str.replace( /[\u00c0-\u00df][\u0080-\u00bf]/g, // 2-byte chars function(c) { var cc = (c.charCodeAt(0)&0x1f)<<6 | c.charCodeAt(1)&0x3f; return String.fromCharCode(cc); } ); str = str.replace( /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, // 3-byte chars function(c) { var cc = (c.charCodeAt(0)&0x0f)<<12 | (c.charCodeAt(1)&0x3f<<6) | c.charCodeAt(2)&0x3f; return String.fromCharCode(cc); } ); return str; } function byteArrayToHexStr(b) { // convert byte array to hex string for displaying test vectors var s = ''; /* BEGIN LOOP */ for (var i=0; i> 5] |= 0x80 << ((len) % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; /* BEGIN LOOP */ for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); c = md5_ff(c, d, a, b, x[i+10], 17, -42063); b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); } /* END LOOP */ return Array(a, b, c, d); } /* * These functions implement the four basic operations the algorithm uses. */ function md5_cmn(q, a, b, x, s, t) { return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); } function md5_ff(a, b, c, d, x, s, t) { return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); } function md5_gg(a, b, c, d, x, s, t) { return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); } function md5_hh(a, b, c, d, x, s, t) { return md5_cmn(b ^ c ^ d, a, b, x, s, t); } function md5_ii(a, b, c, d, x, s, t) { return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); } /* * Calculate the HMAC-MD5, of a key and some data */ function core_hmac_md5(key, data) { var bkey = str2binl(key); if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); /* BEGIN LOOP */ for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } /* END LOOP */ var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz); return core_md5(opad.concat(hash), 512 + 128); } /* * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */ function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } /* * Bitwise rotate a 32-bit number to the left. */ function bit_rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } /* * Convert a string to an array of little-endian words * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. */ function str2binl(str) { var bin = Array(); var mask = (1 << chrsz) - 1; /* BEGIN LOOP */ for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); /* END LOOP */ return bin; } /* * Convert an array of little-endian words to a string */ function binl2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; /* BEGIN LOOP */ for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); /* END LOOP */ return str; } /* * Convert an array of little-endian words to a hex string. */ function binl2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; /* BEGIN LOOP */ for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); } /* END LOOP */ return str; } /* * Convert an array of little-endian words to a base-64 string */ function binl2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; /* BEGIN LOOP */ for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); /* BEGIN LOOP */ for(var j = 0; j < 4; j++) { if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); } /* END LOOP */ } /* END LOOP */ return str; } var plainText = "Rebellious subjects, enemies to peace,\n\ Profaners of this neighbour-stained steel,--\n\ Will they not hear? What, ho! you men, you beasts,\n\ That quench the fire of your pernicious rage\n\ With purple fountains issuing from your veins,\n\ On pain of torture, from those bloody hands\n\ Throw your mistemper'd weapons to the ground,\n\ And hear the sentence of your moved prince.\n\ Three civil brawls, bred of an airy word,\n\ By thee, old Capulet, and Montague,\n\ Have thrice disturb'd the quiet of our streets,\n\ And made Verona's ancient citizens\n\ Cast by their grave beseeming ornaments,\n\ To wield old partisans, in hands as old,\n\ Canker'd with peace, to part your canker'd hate:\n\ If ever you disturb our streets again,\n\ Your lives shall pay the forfeit of the peace.\n\ For this time, all the rest depart away:\n\ You Capulet; shall go along with me:\n\ And, Montague, come you this afternoon,\n\ To know our further pleasure in this case,\n\ To old Free-town, our common judgment-place.\n\ Once more, on pain of death, all men depart." /* BEGIN LOOP */ for (var i = 0; i <4; i++) { plainText += plainText; } /* END LOOP */ var md5Output = hex_md5(plainText); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/crypto-sha1.js0000644000175000017500000001500711545150464023433 0ustar chr1schr1s/* * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined * in FIPS PUB 180-1 * Version 2.1a Copyright Paul Johnston 2000 - 2002. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet * Distributed under the BSD License * See http://pajhome.org.uk/crypt/md5 for details. */ /* * Configurable variables. You may need to tweak these to be compatible with * the server-side, but the defaults work in most cases. */ var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ /* * These are the functions you'll usually want to call * They take string arguments and return either hex or base-64 encoded strings */ function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));} function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));} function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));} function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));} function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));} function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));} /* * Perform a simple self-test to see if the VM is working */ function sha1_vm_test() { return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d"; } /* * Calculate the SHA-1 of an array of big-endian words, and a bit length */ function core_sha1(x, len) { /* append padding */ x[len >> 5] |= 0x80 << (24 - len % 32); x[((len + 64 >> 9) << 4) + 15] = len; var w = Array(80); var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; var e = -1009589776; /* BEGIN LOOP */ for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; var olde = e; /* BEGIN LOOP */ for(var j = 0; j < 80; j++) { if(j < 16) w[j] = x[i + j]; else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j))); e = d; d = c; c = rol(b, 30); b = a; a = t; } /* END LOOP */ a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); e = safe_add(e, olde); } /* END LOOP */ return Array(a, b, c, d, e); } /* * Perform the appropriate triplet combination function for the current * iteration */ function sha1_ft(t, b, c, d) { if(t < 20) return (b & c) | ((~b) & d); if(t < 40) return b ^ c ^ d; if(t < 60) return (b & c) | (b & d) | (c & d); return b ^ c ^ d; } /* * Determine the appropriate additive constant for the current iteration */ function sha1_kt(t) { return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : (t < 60) ? -1894007588 : -899497514; } /* * Calculate the HMAC-SHA1 of a key and some data */ function core_hmac_sha1(key, data) { var bkey = str2binb(key); if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); /* BEGIN LOOP */ for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } /* END LOOP */ var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz); return core_sha1(opad.concat(hash), 512 + 160); } /* * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */ function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } /* * Bitwise rotate a 32-bit number to the left. */ function rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } /* * Convert an 8-bit or 16-bit string to an array of big-endian words * In 8-bit function, characters >255 have their hi-byte silently ignored. */ function str2binb(str) { var bin = Array(); var mask = (1 << chrsz) - 1; /* BEGIN LOOP */ for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32); /* END LOOP */ return bin; } /* * Convert an array of big-endian words to a string */ function binb2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; /* BEGIN LOOP */ for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask); /* END LOOP */ return str; } /* * Convert an array of big-endian words to a hex string. */ function binb2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; /* BEGIN LOOP */ for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF); } /* END LOOP */ return str; } /* * Convert an array of big-endian words to a base-64 string */ function binb2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; /* BEGIN LOOP */ for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 ) | ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF); /* BEGIN LOOP */ for(var j = 0; j < 4; j++) { if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); } /* END LOOP */ } /* END LOOP */ return str; } var plainText = "Two households, both alike in dignity,\n\ In fair Verona, where we lay our scene,\n\ From ancient grudge break to new mutiny,\n\ Where civil blood makes civil hands unclean.\n\ From forth the fatal loins of these two foes\n\ A pair of star-cross'd lovers take their life;\n\ Whole misadventured piteous overthrows\n\ Do with their death bury their parents' strife.\n\ The fearful passage of their death-mark'd love,\n\ And the continuance of their parents' rage,\n\ Which, but their children's end, nought could remove,\n\ Is now the two hours' traffic of our stage;\n\ The which if you with patient ears attend,\n\ What here shall miss, our toil shall strive to mend."; /* BEGIN LOOP */ for (var i = 0; i <4; i++) { plainText += plainText; } /* END LOOP */ var sha1Output = hex_sha1(plainText); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/date-format-tofte.js0000644000175000017500000002455611545150464024614 0ustar chr1schr1sfunction arrayExists(array, x) { /* BEGIN LOOP */ for (var i = 0; i < array.length; i++) { if (array[i] == x) return true; } /* END LOOP */ return false; } Date.prototype.formatDate = function (input,time) { // formatDate : // a PHP date like function, for formatting date strings // See: http://www.php.net/date // // input : format string // time : epoch time (seconds, and optional) // // if time is not passed, formatting is based on // the current "this" date object's set time. // // supported: // a, A, B, d, D, F, g, G, h, H, i, j, l (lowercase L), L, // m, M, n, O, r, s, S, t, U, w, W, y, Y, z // // unsupported: // I (capital i), T, Z var switches = ["a", "A", "B", "d", "D", "F", "g", "G", "h", "H", "i", "j", "l", "L", "m", "M", "n", "O", "r", "s", "S", "t", "U", "w", "W", "y", "Y", "z"]; var daysLong = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; var daysShort = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; var monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; var daysSuffix = ["st", "nd", "rd", "th", "th", "th", "th", // 1st - 7th "th", "th", "th", "th", "th", "th", "th", // 8th - 14th "th", "th", "th", "th", "th", "th", "st", // 15th - 21st "nd", "rd", "th", "th", "th", "th", "th", // 22nd - 28th "th", "th", "st"]; // 29th - 31st function a() { // Lowercase Ante meridiem and Post meridiem return self.getHours() > 11? "pm" : "am"; } function A() { // Uppercase Ante meridiem and Post meridiem return self.getHours() > 11? "PM" : "AM"; } function B(){ // Swatch internet time. code simply grabbed from ppk, // since I was feeling lazy: // http://www.xs4all.nl/~ppk/js/beat.html var off = (self.getTimezoneOffset() + 60)*60; var theSeconds = (self.getHours() * 3600) + (self.getMinutes() * 60) + self.getSeconds() + off; var beat = Math.floor(theSeconds/86.4); if (beat > 1000) beat -= 1000; if (beat < 0) beat += 1000; if ((""+beat).length == 1) beat = "00"+beat; if ((""+beat).length == 2) beat = "0"+beat; return beat; } function d() { // Day of the month, 2 digits with leading zeros return new String(self.getDate()).length == 1? "0"+self.getDate() : self.getDate(); } function D() { // A textual representation of a day, three letters return daysShort[self.getDay()]; } function F() { // A full textual representation of a month return monthsLong[self.getMonth()]; } function g() { // 12-hour format of an hour without leading zeros return self.getHours() > 12? self.getHours()-12 : self.getHours(); } function G() { // 24-hour format of an hour without leading zeros return self.getHours(); } function h() { // 12-hour format of an hour with leading zeros if (self.getHours() > 12) { var s = new String(self.getHours()-12); return s.length == 1? "0"+ (self.getHours()-12) : self.getHours()-12; } else { var s = new String(self.getHours()); return s.length == 1? "0"+self.getHours() : self.getHours(); } } function H() { // 24-hour format of an hour with leading zeros return new String(self.getHours()).length == 1? "0"+self.getHours() : self.getHours(); } function i() { // Minutes with leading zeros return new String(self.getMinutes()).length == 1? "0"+self.getMinutes() : self.getMinutes(); } function j() { // Day of the month without leading zeros return self.getDate(); } function l() { // A full textual representation of the day of the week return daysLong[self.getDay()]; } function L() { // leap year or not. 1 if leap year, 0 if not. // the logic should match iso's 8601 standard. var y_ = Y(); if ( (y_ % 4 == 0 && y_ % 100 != 0) || (y_ % 4 == 0 && y_ % 100 == 0 && y_ % 400 == 0) ) { return 1; } else { return 0; } } function m() { // Numeric representation of a month, with leading zeros return self.getMonth() < 9? "0"+(self.getMonth()+1) : self.getMonth()+1; } function M() { // A short textual representation of a month, three letters return monthsShort[self.getMonth()]; } function n() { // Numeric representation of a month, without leading zeros return self.getMonth()+1; } function O() { // Difference to Greenwich time (GMT) in hours var os = Math.abs(self.getTimezoneOffset()); var h = ""+Math.floor(os/60); var m = ""+(os%60); h.length == 1? h = "0"+h:1; m.length == 1? m = "0"+m:1; return self.getTimezoneOffset() < 0 ? "+"+h+m : "-"+h+m; } function r() { // RFC 822 formatted date var r; // result // Thu , 21 Dec 2000 r = D() + ", " + j() + " " + M() + " " + Y() + // 16 : 01 : 07 +0200 " " + H() + ":" + i() + ":" + s() + " " + O(); return r; } function S() { // English ordinal suffix for the day of the month, 2 characters return daysSuffix[self.getDate()-1]; } function s() { // Seconds, with leading zeros return new String(self.getSeconds()).length == 1? "0"+self.getSeconds() : self.getSeconds(); } function t() { // thanks to Matt Bannon for some much needed code-fixes here! var daysinmonths = [null,31,28,31,30,31,30,31,31,30,31,30,31]; if (L()==1 && n()==2) return 29; // leap day return daysinmonths[n()]; } function U() { // Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) return Math.round(self.getTime()/1000); } function W() { // Weeknumber, as per ISO specification: // http://www.cl.cam.ac.uk/~mgk25/iso-time.html // if the day is three days before newyears eve, // there's a chance it's "week 1" of next year. // here we check for that. var beforeNY = 364+L() - z(); var afterNY = z(); var weekday = w()!=0?w()-1:6; // makes sunday (0), into 6. if (beforeNY <= 2 && weekday <= 2-beforeNY) { return 1; } // similarly, if the day is within threedays of newyears // there's a chance it belongs in the old year. var ny = new Date("January 1 " + Y() + " 00:00:00"); var nyDay = ny.getDay()!=0?ny.getDay()-1:6; if ( (afterNY <= 2) && (nyDay >=4) && (afterNY >= (6-nyDay)) ) { // Since I'm not sure we can just always return 53, // i call the function here again, using the last day // of the previous year, as the date, and then just // return that week. var prevNY = new Date("December 31 " + (Y()-1) + " 00:00:00"); return prevNY.formatDate("W"); } // week 1, is the week that has the first thursday in it. // note that this value is not zero index. if (nyDay <= 3) { // first day of the year fell on a thursday, or earlier. return 1 + Math.floor( ( z() + nyDay ) / 7 ); } else { // first day of the year fell on a friday, or later. return 1 + Math.floor( ( z() - ( 7 - nyDay ) ) / 7 ); } } function w() { // Numeric representation of the day of the week return self.getDay(); } function Y() { // A full numeric representation of a year, 4 digits // we first check, if getFullYear is supported. if it // is, we just use that. ppks code is nice, but wont // work with dates outside 1900-2038, or something like that if (self.getFullYear) { var newDate = new Date("January 1 2001 00:00:00 +0000"); var x = newDate .getFullYear(); if (x == 2001) { // i trust the method now return self.getFullYear(); } } // else, do this: // codes thanks to ppk: // http://www.xs4all.nl/~ppk/js/introdate.html var x = self.getYear(); var y = x % 100; y += (y < 38) ? 2000 : 1900; return y; } function y() { // A two-digit representation of a year var y = Y()+""; return y.substring(y.length-2,y.length); } function z() { // The day of the year, zero indexed! 0 through 366 var t = new Date("January 1 " + Y() + " 00:00:00"); var diff = self.getTime() - t.getTime(); return Math.floor(diff/1000/60/60/24); } var self = this; if (time) { // save time var prevTime = self.getTime(); self.setTime(time); } var ia = input.split(""); var ij = 0; /* BEGIN LOOP */ while (ia[ij]) { if (ia[ij] == "\\") { // this is our way of allowing users to escape stuff ia.splice(ij,1); } else { if (arrayExists(switches,ia[ij])) { ia[ij] = eval(ia[ij] + "()"); } } ij++; } /* END LOOP */ // reset time, back to what it was if (prevTime) { self.setTime(prevTime); } return ia.join(""); } var date = new Date("1/1/2007 1:11:11"); /* BEGIN LOOP */ for (i = 0; i < 500; ++i) { var shortFormat = date.formatDate("Y-m-d"); var longFormat = date.formatDate("l, F d, Y g:i:s A"); date.setTime(date.getTime() + 84266956); } /* END LOOP */ mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/date-format-xparb.js0000644000175000017500000002772111545150464024604 0ustar chr1schr1s/* * Copyright (C) 2004 Baron Schwartz * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, version 2.1. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ Date.parseFunctions = {count:0}; Date.parseRegexes = []; Date.formatFunctions = {count:0}; Date.prototype.dateFormat = function(format) { if (Date.formatFunctions[format] == null) { Date.createNewFormat(format); } var func = Date.formatFunctions[format]; return this[func](); } Date.createNewFormat = function(format) { var funcName = "format" + Date.formatFunctions.count++; Date.formatFunctions[format] = funcName; var code = "Date.prototype." + funcName + " = function(){return "; var special = false; var ch = ''; /* BEGIN LOOP */ for (var i = 0; i < format.length; ++i) { ch = format.charAt(i); if (!special && ch == "\\") { special = true; } else if (special) { special = false; code += "'" + String.escape(ch) + "' + "; } else { code += Date.getFormatCode(ch); } } /* END LOOP */ eval(code.substring(0, code.length - 3) + ";}"); } Date.getFormatCode = function(character) { switch (character) { case "d": return "String.leftPad(this.getDate(), 2, '0') + "; case "D": return "Date.dayNames[this.getDay()].substring(0, 3) + "; case "j": return "this.getDate() + "; case "l": return "Date.dayNames[this.getDay()] + "; case "S": return "this.getSuffix() + "; case "w": return "this.getDay() + "; case "z": return "this.getDayOfYear() + "; case "W": return "this.getWeekOfYear() + "; case "F": return "Date.monthNames[this.getMonth()] + "; case "m": return "String.leftPad(this.getMonth() + 1, 2, '0') + "; case "M": return "Date.monthNames[this.getMonth()].substring(0, 3) + "; case "n": return "(this.getMonth() + 1) + "; case "t": return "this.getDaysInMonth() + "; case "L": return "(this.isLeapYear() ? 1 : 0) + "; case "Y": return "this.getFullYear() + "; case "y": return "('' + this.getFullYear()).substring(2, 4) + "; case "a": return "(this.getHours() < 12 ? 'am' : 'pm') + "; case "A": return "(this.getHours() < 12 ? 'AM' : 'PM') + "; case "g": return "((this.getHours() %12) ? this.getHours() % 12 : 12) + "; case "G": return "this.getHours() + "; case "h": return "String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + "; case "H": return "String.leftPad(this.getHours(), 2, '0') + "; case "i": return "String.leftPad(this.getMinutes(), 2, '0') + "; case "s": return "String.leftPad(this.getSeconds(), 2, '0') + "; case "O": return "this.getGMTOffset() + "; case "T": return "this.getTimezone() + "; case "Z": return "(this.getTimezoneOffset() * -60) + "; default: return "'" + String.escape(character) + "' + "; } } Date.parseDate = function(input, format) { if (Date.parseFunctions[format] == null) { Date.createParser(format); } var func = Date.parseFunctions[format]; return Date[func](input); } Date.createParser = function(format) { var funcName = "parse" + Date.parseFunctions.count++; var regexNum = Date.parseRegexes.length; var currentGroup = 1; Date.parseFunctions[format] = funcName; var code = "Date." + funcName + " = function(input){\n" + "var y = -1, m = -1, d = -1, h = -1, i = -1, s = -1;\n" + "var d = new Date();\n" + "y = d.getFullYear();\n" + "m = d.getMonth();\n" + "d = d.getDate();\n" + "var results = input.match(Date.parseRegexes[" + regexNum + "]);\n" + "if (results && results.length > 0) {" var regex = ""; var special = false; var ch = ''; /* BEGIN LOOP */ for (var i = 0; i < format.length; ++i) { ch = format.charAt(i); if (!special && ch == "\\") { special = true; } else if (special) { special = false; regex += String.escape(ch); } else { obj = Date.formatCodeToRegex(ch, currentGroup); currentGroup += obj.g; regex += obj.s; if (obj.g && obj.c) { code += obj.c; } } } /* END LOOP */ code += "if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n" + "{return new Date(y, m, d, h, i, s);}\n" + "else if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n" + "{return new Date(y, m, d, h, i);}\n" + "else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n" + "{return new Date(y, m, d, h);}\n" + "else if (y > 0 && m >= 0 && d > 0)\n" + "{return new Date(y, m, d);}\n" + "else if (y > 0 && m >= 0)\n" + "{return new Date(y, m);}\n" + "else if (y > 0)\n" + "{return new Date(y);}\n" + "}return null;}"; Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$"); eval(code); } Date.formatCodeToRegex = function(character, currentGroup) { switch (character) { case "D": return {g:0, c:null, s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"}; case "j": case "d": return {g:1, c:"d = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{1,2})"}; case "l": return {g:0, c:null, s:"(?:" + Date.dayNames.join("|") + ")"}; case "S": return {g:0, c:null, s:"(?:st|nd|rd|th)"}; case "w": return {g:0, c:null, s:"\\d"}; case "z": return {g:0, c:null, s:"(?:\\d{1,3})"}; case "W": return {g:0, c:null, s:"(?:\\d{2})"}; case "F": return {g:1, c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "].substring(0, 3)], 10);\n", s:"(" + Date.monthNames.join("|") + ")"}; case "M": return {g:1, c:"m = parseInt(Date.monthNumbers[results[" + currentGroup + "]], 10);\n", s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"}; case "n": case "m": return {g:1, c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n", s:"(\\d{1,2})"}; case "t": return {g:0, c:null, s:"\\d{1,2}"}; case "L": return {g:0, c:null, s:"(?:1|0)"}; case "Y": return {g:1, c:"y = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{4})"}; case "y": return {g:1, c:"var ty = parseInt(results[" + currentGroup + "], 10);\n" + "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", s:"(\\d{1,2})"}; case "a": return {g:1, c:"if (results[" + currentGroup + "] == 'am') {\n" + "if (h == 12) { h = 0; }\n" + "} else { if (h < 12) { h += 12; }}", s:"(am|pm)"}; case "A": return {g:1, c:"if (results[" + currentGroup + "] == 'AM') {\n" + "if (h == 12) { h = 0; }\n" + "} else { if (h < 12) { h += 12; }}", s:"(AM|PM)"}; case "g": case "G": case "h": case "H": return {g:1, c:"h = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{1,2})"}; case "i": return {g:1, c:"i = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{2})"}; case "s": return {g:1, c:"s = parseInt(results[" + currentGroup + "], 10);\n", s:"(\\d{2})"}; case "O": return {g:0, c:null, s:"[+-]\\d{4}"}; case "T": return {g:0, c:null, s:"[A-Z]{3}"}; case "Z": return {g:0, c:null, s:"[+-]\\d{1,5}"}; default: return {g:0, c:null, s:String.escape(character)}; } } Date.prototype.getTimezone = function() { return this.toString().replace( /^.*? ([A-Z]{3}) [0-9]{4}.*$/, "$1").replace( /^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/, "$1$2$3"); } Date.prototype.getGMTOffset = function() { return (this.getTimezoneOffset() > 0 ? "-" : "+") + String.leftPad(Math.floor(this.getTimezoneOffset() / 60), 2, "0") + String.leftPad(this.getTimezoneOffset() % 60, 2, "0"); } Date.prototype.getDayOfYear = function() { var num = 0; Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; /* BEGIN LOOP */ for (var i = 0; i < this.getMonth(); ++i) { num += Date.daysInMonth[i]; } /* END LOOP */ return num + this.getDate() - 1; } Date.prototype.getWeekOfYear = function() { // Skip to Thursday of this week var now = this.getDayOfYear() + (4 - this.getDay()); // Find the first Thursday of the year var jan1 = new Date(this.getFullYear(), 0, 1); var then = (7 - jan1.getDay() + 4); document.write(then); return String.leftPad(((now - then) / 7) + 1, 2, "0"); } Date.prototype.isLeapYear = function() { var year = this.getFullYear(); return ((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year))); } Date.prototype.getFirstDayOfMonth = function() { var day = (this.getDay() - (this.getDate() - 1)) % 7; return (day < 0) ? (day + 7) : day; } Date.prototype.getLastDayOfMonth = function() { var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7; return (day < 0) ? (day + 7) : day; } Date.prototype.getDaysInMonth = function() { Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28; return Date.daysInMonth[this.getMonth()]; } Date.prototype.getSuffix = function() { switch (this.getDate()) { case 1: case 21: case 31: return "st"; case 2: case 22: return "nd"; case 3: case 23: return "rd"; default: return "th"; } } String.escape = function(string) { return string.replace(/('|\\)/g, "\\$1"); } String.leftPad = function (val, size, ch) { var result = new String(val); if (ch == null) { ch = " "; } /* BEGIN LOOP */ while (result.length < size) { result = ch + result; } /* END LOOP */ return result; } Date.daysInMonth = [31,28,31,30,31,30,31,31,30,31,30,31]; Date.monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; Date.dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; Date.y2kYear = 50; Date.monthNumbers = { Jan:0, Feb:1, Mar:2, Apr:3, May:4, Jun:5, Jul:6, Aug:7, Sep:8, Oct:9, Nov:10, Dec:11}; Date.patterns = { ISO8601LongPattern:"Y-m-d H:i:s", ISO8601ShortPattern:"Y-m-d", ShortDatePattern: "n/j/Y", LongDatePattern: "l, F d, Y", FullDateTimePattern: "l, F d, Y g:i:s A", MonthDayPattern: "F d", ShortTimePattern: "g:i A", LongTimePattern: "g:i:s A", SortableDateTimePattern: "Y-m-d\\TH:i:s", UniversalSortableDateTimePattern: "Y-m-d H:i:sO", YearMonthPattern: "F, Y"}; var date = new Date("1/1/2007 1:11:11"); /* BEGIN LOOP */ for (i = 0; i < 4000; ++i) { var shortFormat = date.dateFormat("Y-m-d"); var longFormat = date.dateFormat("l, F d, Y g:i:s A"); date.setTime(date.getTime() + 84266956); } /* END LOOP */ mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/math-cordic.js0000644000175000017500000000525011545150464023452 0ustar chr1schr1s/* * Copyright (C) Rich Moore. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY CONTRIBUTORS ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /////. Start CORDIC var AG_CONST = 0.6072529350; function FIXED(X) { return X * 65536.0; } function FLOAT(X) { return X / 65536.0; } function DEG2RAD(X) { return 0.017453 * (X); } var Angles = [ FIXED(45.0), FIXED(26.565), FIXED(14.0362), FIXED(7.12502), FIXED(3.57633), FIXED(1.78991), FIXED(0.895174), FIXED(0.447614), FIXED(0.223811), FIXED(0.111906), FIXED(0.055953), FIXED(0.027977) ]; function cordicsincos() { var X; var Y; var TargetAngle; var CurrAngle; var Step; X = FIXED(AG_CONST); /* AG_CONST * cos(0) */ Y = 0; /* AG_CONST * sin(0) */ TargetAngle = FIXED(28.027); CurrAngle = 0; /* BEGIN LOOP */ for (Step = 0; Step < 12; Step++) { var NewX; if (TargetAngle > CurrAngle) { NewX = X - (Y >> Step); Y = (X >> Step) + Y; X = NewX; CurrAngle += Angles[Step]; } else { NewX = X + (Y >> Step); Y = -(X >> Step) + Y; X = NewX; CurrAngle -= Angles[Step]; } } /* END LOOP */ } ///// End CORDIC function cordic( runs ) { var start = new Date(); /* BEGIN LOOP */ for ( var i = 0 ; i < runs ; i++ ) { cordicsincos(); } /* END LOOP */ var end = new Date(); return end.getTime() - start.getTime(); } cordic(25000); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/math-partial-sums.js0000644000175000017500000000146311545150464024632 0ustar chr1schr1s// The Computer Language Shootout // http://shootout.alioth.debian.org/ // contributed by Isaac Gouy function partial(n){ var a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0.0; var twothirds = 2.0/3.0; var alt = -1.0; var k2 = k3 = sk = ck = 0.0; /* BEGIN LOOP */ for (var k = 1; k <= n; k++){ k2 = k*k; k3 = k2*k; sk = Math.sin(k); ck = Math.cos(k); alt = -alt; a1 += Math.pow(twothirds,k-1); a2 += Math.pow(k,-0.5); a3 += 1.0/(k*(k+1.0)); a4 += 1.0/(k3 * sk*sk); a5 += 1.0/(k3 * ck*ck); a6 += 1.0/k; a7 += 1.0/k2; a8 += alt/k; a9 += alt/(2*k -1); } /* END LOOP */ } /* BEGIN LOOP */ for (var i = 1024; i <= 16384; i *= 2) { partial(i); } /* END LOOP */ mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/math-spectral-norm.js0000644000175000017500000000220411545150464024771 0ustar chr1schr1s// The Great Computer Language Shootout // http://shootout.alioth.debian.org/ // // contributed by Ian Osgood function A(i,j) { return 1/((i+j)*(i+j+1)/2+i+1); } function Au(u,v) { /* BEGIN LOOP */ for (var i=0; i.*\n|\n/g,"") clen = dnaInput.length var dnaOutputString; /* BEGIN LOOP */ for(i in seqs) dnaOutputString += seqs[i].source + " " + (dnaInput.match(seqs[i]) || []).length + "\n"; /* END LOOP */ // match returns null if no matches, so replace with empty /* BEGIN LOOP */ for(k in subs) dnaInput = dnaInput.replace(k, subs[k], "g") /* END LOOP */ // search string, replacement string, flags mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/string-base64.js0000644000175000017500000001171511545150464023653 0ustar chr1schr1s/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla XML-RPC Client component. * * The Initial Developer of the Original Code is * Digital Creations 2, Inc. * Portions created by the Initial Developer are Copyright (C) 2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Martijn Pieters (original author) * Samuel Sieb * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // From: http://lxr.mozilla.org/mozilla/source/extensions/xml-rpc/src/nsXmlRpcClient.js#956 /* Convert data (an array of integers) to a Base64 string. */ var toBase64Table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; var base64Pad = '='; function toBase64(data) { var result = ''; var length = data.length; var i; // Convert every three bytes to 4 ascii characters. /* BEGIN LOOP */ for (i = 0; i < (length - 2); i += 3) { result += toBase64Table[data[i] >> 2]; result += toBase64Table[((data[i] & 0x03) << 4) + (data[i+1] >> 4)]; result += toBase64Table[((data[i+1] & 0x0f) << 2) + (data[i+2] >> 6)]; result += toBase64Table[data[i+2] & 0x3f]; } /* END LOOP */ // Convert the remaining 1 or 2 bytes, pad out to 4 characters. if (length%3) { i = length - (length%3); result += toBase64Table[data[i] >> 2]; if ((length%3) == 2) { result += toBase64Table[((data[i] & 0x03) << 4) + (data[i+1] >> 4)]; result += toBase64Table[(data[i+1] & 0x0f) << 2]; result += base64Pad; } else { result += toBase64Table[(data[i] & 0x03) << 4]; result += base64Pad + base64Pad; } } return result; } /* Convert Base64 data to a string */ var toBinaryTable = [ -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1, 0,-1,-1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1 ]; function base64ToString(data) { var result = ''; var leftbits = 0; // number of bits decoded, but yet to be appended var leftdata = 0; // bits decoded, but yet to be appended // Convert one by one. /* BEGIN LOOP */ for (var i = 0; i < data.length; i++) { var c = toBinaryTable[data.charCodeAt(i) & 0x7f]; var padding = (data[i] == base64Pad); // Skip illegal characters and whitespace if (c == -1) continue; // Collect data into leftdata, update bitcount leftdata = (leftdata << 6) | c; leftbits += 6; // If we have 8 or more bits, append 8 bits to the result if (leftbits >= 8) { leftbits -= 8; // Append if not padding. if (!padding) result += String.fromCharCode((leftdata >> leftbits) & 0xff); leftdata &= (1 << leftbits) - 1; } } /* END LOOP */ // If there are any bits left, the base64 string was corrupted if (leftbits) throw Components.Exception('Corrupted base64 string'); return result; } var str = ""; /* BEGIN LOOP */ for ( var i = 0; i < 8192; i++ ) str += String.fromCharCode( (25 * Math.random()) + 97 ); /* END LOOP */ /* BEGIN LOOP */ for ( var i = 8192; i <= 16384; i *= 2 ) { var base64; base64 = toBase64(str); base64ToString(base64); // Double the string str += str; } /* END LOOP */ toBinaryTable = null; mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/string-fasta.js0000644000175000017500000000377211545150464023671 0ustar chr1schr1s// The Great Computer Language Shootout // http://shootout.alioth.debian.org // // Contributed by Ian Osgood var last = 42, A = 3877, C = 29573, M = 139968; function rand(max) { last = (last * A + C) % M; return max * last / M; } var ALU = "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" + "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" + "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" + "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" + "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" + "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" + "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA"; var IUB = { a:0.27, c:0.12, g:0.12, t:0.27, B:0.02, D:0.02, H:0.02, K:0.02, M:0.02, N:0.02, R:0.02, S:0.02, V:0.02, W:0.02, Y:0.02 } var HomoSap = { a: 0.3029549426680, c: 0.1979883004921, g: 0.1975473066391, t: 0.3015094502008 } function makeCumulative(table) { var last = null; /* BEGIN LOOP */ for (var c in table) { if (last) table[c] += table[last]; last = c; } /* END LOOP */ } function fastaRepeat(n, seq) { var seqi = 0, lenOut = 60; /* BEGIN LOOP */ while (n>0) { if (n0) { if (n= 0x7f) { validates = false; break; } } /* END LOOP */ if (!validates) continue; var url = "http://example.com/tag/" + tag.replace(" ", "").toLowerCase(); var popularity = tagInfo[i].popularity; var color = 'rgb(' + Math.floor(255 * (popularity - 12) / 20) + ', 0, 255)'; output += ' ' + tag + ' \n'; } /* END LOOP */ output += ''; output.replace(" ", " "); return output; } var tagcloud = makeTagCloud(tagInfo); tagInfo = null; mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/sunspider/string-validate-input.js0000644000175000017500000000414311545150464025512 0ustar chr1schr1sletters = new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"); numbers = new Array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26); colors = new Array("FF","CC","99","66","33","00"); var endResult; function doTest() { endResult = ""; // make up email address /* BEGIN LOOP */ for (var k=0;k<4000;k++) { name = makeName(6); (k%2)?email=name+"@mac.com":email=name+"(at)mac.com"; // validate the email address var pattern = /^[a-zA-Z0-9\-\._]+@[a-zA-Z0-9\-_]+(\.?[a-zA-Z0-9\-_]*)\.[a-zA-Z]{2,3}$/; if(pattern.test(email)) { var r = email + " appears to be a valid email address."; addResult(r); } else { r = email + " does NOT appear to be a valid email address."; addResult(r); } } /* END LOOP */ // make up ZIP codes /* BEGIN LOOP */ for (var s=0;s<4000;s++) { var zipGood = true; var zip = makeNumber(4); (s%2)?zip=zip+"xyz":zip=zip.concat("7"); // validate the zip code /* BEGIN LOOP */ for (var i = 0; i < zip.length; i++) { var ch = zip.charAt(i); if (ch < "0" || ch > "9") { zipGood = false; r = zip + " contains letters."; addResult(r); } } /* END LOOP */ if (zipGood && zip.length>5) { zipGood = false; r = zip + " is longer than five characters."; addResult(r); } if (zipGood) { r = zip + " appears to be a valid ZIP code."; addResult(r); } } /* END LOOP */ } function makeName(n) { var tmp = ""; /* BEGIN LOOP */ for (var i=0;i>> 19)) & 0xffffffff; seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff; seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff; seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff; seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff; return (seed & 0xfffffff) / 0x10000000; }; })(); // Runs all registered benchmark suites and optionally yields between // each individual benchmark to avoid running for too long in the // context of browsers. Once done, the final score is reported to the // runner. BenchmarkSuite.RunSuites = function(runner) { var continuation = null; var suites = BenchmarkSuite.suites; var length = suites.length; BenchmarkSuite.scores = []; var index = 0; function RunStep() { while (continuation || index < length) { if (continuation) { continuation = continuation(); } else { var suite = suites[index++]; if (runner.NotifyStart) runner.NotifyStart(suite.name); continuation = suite.RunStep(runner); } if (continuation && typeof window != 'undefined' && window.setTimeout) { window.setTimeout(RunStep, 25); return; } } if (runner.NotifyScore) { var score = BenchmarkSuite.GeometricMean(BenchmarkSuite.scores); var formatted = BenchmarkSuite.FormatScore(100 * score); runner.NotifyScore(formatted); } } RunStep(); } // Counts the total number of registered benchmarks. Useful for // showing progress as a percentage. BenchmarkSuite.CountBenchmarks = function() { var result = 0; var suites = BenchmarkSuite.suites; for (var i = 0; i < suites.length; i++) { result += suites[i].benchmarks.length; } return result; } // Computes the geometric mean of a set of numbers. BenchmarkSuite.GeometricMean = function(numbers) { var log = 0; for (var i = 0; i < numbers.length; i++) { log += Math.log(numbers[i]); } return Math.pow(Math.E, log / numbers.length); } // Converts a score value to a string with at least three significant // digits. BenchmarkSuite.FormatScore = function(value) { if (value > 100) { return value.toFixed(0); } else { return value.toPrecision(3); } } // Notifies the runner that we're done running a single benchmark in // the benchmark suite. This can be useful to report progress. BenchmarkSuite.prototype.NotifyStep = function(result) { this.results.push(result); if (this.runner.NotifyStep) this.runner.NotifyStep(result.benchmark.name); } // Notifies the runner that we're done with running a suite and that // we have a result which can be reported to the user if needed. BenchmarkSuite.prototype.NotifyResult = function() { var mean = BenchmarkSuite.GeometricMean(this.results); var score = this.reference / mean; BenchmarkSuite.scores.push(score); if (this.runner.NotifyResult) { var formatted = BenchmarkSuite.FormatScore(100 * score); this.runner.NotifyResult(this.name, formatted); } } // Notifies the runner that running a benchmark resulted in an error. BenchmarkSuite.prototype.NotifyError = function(error) { if (this.runner.NotifyError) { this.runner.NotifyError(this.name, error); } if (this.runner.NotifyStep) { this.runner.NotifyStep(this.name); } } // Runs a single benchmark for at least a second and computes the // average time it takes to run a single iteration. BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark) { var elapsed = 0; var start = new Date(); for (var n = 0; elapsed < 1000; n++) { benchmark.run(); elapsed = new Date() - start; } var usec = (elapsed * 1000) / n; this.NotifyStep(new BenchmarkResult(benchmark, usec)); } // This function starts running a suite, but stops between each // individual benchmark in the suite and returns a continuation // function which can be invoked to run the next benchmark. Once the // last benchmark has been executed, null is returned. BenchmarkSuite.prototype.RunStep = function(runner) { this.results = []; this.runner = runner; var length = this.benchmarks.length; var index = 0; var suite = this; // Run the setup, the actual benchmark, and the tear down in three // separate steps to allow the framework to yield between any of the // steps. function RunNextSetup() { if (index < length) { try { suite.benchmarks[index].Setup(); } catch (e) { suite.NotifyError(e); return null; } return RunNextBenchmark; } suite.NotifyResult(); return null; } function RunNextBenchmark() { try { suite.RunSingleBenchmark(suite.benchmarks[index]); } catch (e) { suite.NotifyError(e); return null; } return RunNextTearDown; } function RunNextTearDown() { try { suite.benchmarks[index++].TearDown(); } catch (e) { suite.NotifyError(e); return null; } return RunNextSetup; } // Start out running the setup. return RunNextSetup(); } mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/v8/crypto.js0000644000175000017500000016426011545150464021130 0ustar chr1schr1s// Copyright 2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Simple framework for running the benchmark suites and // computing a score based on the timing measurements. // A benchmark has a name (string) and a function that will be run to // do the performance measurement. The optional setup and tearDown // arguments are functions that will be invoked before and after // running the benchmark, but the running time of these functions will // not be accounted for in the benchmark score. function Benchmark(name, run, setup, tearDown) { this.name = name; this.run = run; this.Setup = setup ? setup : function() { }; this.TearDown = tearDown ? tearDown : function() { }; } // Benchmark results hold the benchmark and the measured time used to // run the benchmark. The benchmark score is computed later once a // full benchmark suite has run to completion. function BenchmarkResult(benchmark, time) { this.benchmark = benchmark; this.time = time; } // Automatically convert results to numbers. Used by the geometric // mean computation. BenchmarkResult.prototype.valueOf = function() { return this.time; } // Suites of benchmarks consist of a name and the set of benchmarks in // addition to the reference timing that the final score will be based // on. This way, all scores are relative to a reference run and higher // scores implies better performance. function BenchmarkSuite(name, reference, benchmarks) { this.name = name; this.reference = reference; this.benchmarks = benchmarks; BenchmarkSuite.suites.push(this); } // Keep track of all declared benchmark suites. BenchmarkSuite.suites = []; // Scores are not comparable across versions. Bump the version if // you're making changes that will affect that scores, e.g. if you add // a new benchmark or change an existing one. BenchmarkSuite.version = '5'; // To make the benchmark results predictable, we replace Math.random // with a 100% deterministic alternative. Math.random = (function() { var seed = 49734321; return function() { // Robert Jenkins' 32 bit integer hash function. seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff; seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff; seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff; seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff; seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff; seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff; return (seed & 0xfffffff) / 0x10000000; }; })(); // Runs all registered benchmark suites and optionally yields between // each individual benchmark to avoid running for too long in the // context of browsers. Once done, the final score is reported to the // runner. BenchmarkSuite.RunSuites = function(runner) { var continuation = null; var suites = BenchmarkSuite.suites; var length = suites.length; BenchmarkSuite.scores = []; var index = 0; function RunStep() { while (continuation || index < length) { if (continuation) { continuation = continuation(); } else { var suite = suites[index++]; if (runner.NotifyStart) runner.NotifyStart(suite.name); continuation = suite.RunStep(runner); } if (continuation && typeof window != 'undefined' && window.setTimeout) { window.setTimeout(RunStep, 25); return; } } if (runner.NotifyScore) { var score = BenchmarkSuite.GeometricMean(BenchmarkSuite.scores); var formatted = BenchmarkSuite.FormatScore(100 * score); runner.NotifyScore(formatted); } } RunStep(); } // Counts the total number of registered benchmarks. Useful for // showing progress as a percentage. BenchmarkSuite.CountBenchmarks = function() { var result = 0; var suites = BenchmarkSuite.suites; for (var i = 0; i < suites.length; i++) { result += suites[i].benchmarks.length; } return result; } // Computes the geometric mean of a set of numbers. BenchmarkSuite.GeometricMean = function(numbers) { var log = 0; for (var i = 0; i < numbers.length; i++) { log += Math.log(numbers[i]); } return Math.pow(Math.E, log / numbers.length); } // Converts a score value to a string with at least three significant // digits. BenchmarkSuite.FormatScore = function(value) { if (value > 100) { return value.toFixed(0); } else { return value.toPrecision(3); } } // Notifies the runner that we're done running a single benchmark in // the benchmark suite. This can be useful to report progress. BenchmarkSuite.prototype.NotifyStep = function(result) { this.results.push(result); if (this.runner.NotifyStep) this.runner.NotifyStep(result.benchmark.name); } // Notifies the runner that we're done with running a suite and that // we have a result which can be reported to the user if needed. BenchmarkSuite.prototype.NotifyResult = function() { var mean = BenchmarkSuite.GeometricMean(this.results); var score = this.reference / mean; BenchmarkSuite.scores.push(score); if (this.runner.NotifyResult) { var formatted = BenchmarkSuite.FormatScore(100 * score); this.runner.NotifyResult(this.name, formatted); } } // Notifies the runner that running a benchmark resulted in an error. BenchmarkSuite.prototype.NotifyError = function(error) { if (this.runner.NotifyError) { this.runner.NotifyError(this.name, error); } if (this.runner.NotifyStep) { this.runner.NotifyStep(this.name); } } // Runs a single benchmark for at least a second and computes the // average time it takes to run a single iteration. BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark) { var elapsed = 0; var start = new Date(); for (var n = 0; elapsed < 20; n++) { benchmark.run(); elapsed = new Date() - start; } var usec = (elapsed * 1000) / n; this.NotifyStep(new BenchmarkResult(benchmark, usec)); } // This function starts running a suite, but stops between each // individual benchmark in the suite and returns a continuation // function which can be invoked to run the next benchmark. Once the // last benchmark has been executed, null is returned. BenchmarkSuite.prototype.RunStep = function(runner) { this.results = []; this.runner = runner; var length = this.benchmarks.length; var index = 0; var suite = this; // Run the setup, the actual benchmark, and the tear down in three // separate steps to allow the framework to yield between any of the // steps. function RunNextSetup() { if (index < length) { try { suite.benchmarks[index].Setup(); } catch (e) { suite.NotifyError(e); return null; } return RunNextBenchmark; } suite.NotifyResult(); return null; } function RunNextBenchmark() { try { suite.RunSingleBenchmark(suite.benchmarks[index]); } catch (e) { suite.NotifyError(e); return null; } return RunNextTearDown; } function RunNextTearDown() { try { suite.benchmarks[index++].TearDown(); } catch (e) { suite.NotifyError(e); return null; } return RunNextSetup; } // Start out running the setup. return RunNextSetup(); } /* * Copyright (c) 2003-2005 Tom Wu * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. * * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * In addition, the following condition applies: * * All redistributions must retain an intact copy of this copyright notice * and disclaimer. */ // The code has been adapted for use as a benchmark by Google. var Crypto = new BenchmarkSuite('Crypto', 203037, [ new Benchmark("Encrypt", encrypt), new Benchmark("Decrypt", decrypt) ]); // Basic JavaScript BN library - subset useful for RSA encryption. // Bits per digit var dbits; var BI_DB; var BI_DM; var BI_DV; var BI_FP; var BI_FV; var BI_F1; var BI_F2; // JavaScript engine analysis var canary = 0xdeadbeefcafe; var j_lm = ((canary&0xffffff)==0xefcafe); // (public) Constructor function BigInteger(a,b,c) { this.array = new Array(); if(a != null) if("number" == typeof a) this.fromNumber(a,b,c); else if(b == null && "string" != typeof a) this.fromString(a,256); else this.fromString(a,b); } // return new, unset BigInteger function nbi() { return new BigInteger(null); } // am: Compute w_j += (x*this_i), propagate carries, // c is initial carry, returns final carry. // c < 3*dvalue, x < 2*dvalue, this_i < dvalue // We need to select the fastest one that works in this environment. // am1: use a single mult and divide to get the high bits, // max digit bits should be 26 because // max internal value = 2*dvalue^2-2*dvalue (< 2^53) function am1(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; /* BEGIN LOOP */ while(--n >= 0) { var v = x*this_array[i++]+w_array[j]+c; c = Math.floor(v/0x4000000); w_array[j++] = v&0x3ffffff; } /* END LOOP */ return c; } // am2 avoids a big mult-and-extract completely. // Max digit bits should be <= 30 because we do bitwise ops // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) function am2(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; var xl = x&0x7fff, xh = x>>15; /* BEGIN LOOP */ while(--n >= 0) { var l = this_array[i]&0x7fff; var h = this_array[i++]>>15; var m = xh*l+h*xl; l = xl*l+((m&0x7fff)<<15)+w_array[j]+(c&0x3fffffff); c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); w_array[j++] = l&0x3fffffff; } /* END LOOP */ return c; } // Alternately, set max digit bits to 28 since some // browsers slow down when dealing with 32-bit numbers. function am3(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; var xl = x&0x3fff, xh = x>>14; /* BEGIN LOOP */ while(--n >= 0) { var l = this_array[i]&0x3fff; var h = this_array[i++]>>14; var m = xh*l+h*xl; l = xl*l+((m&0x3fff)<<14)+w_array[j]+c; c = (l>>28)+(m>>14)+xh*h; w_array[j++] = l&0xfffffff; } /* END LOOP */ return c; } // This is tailored to VMs with 2-bit tagging. It makes sure // that all the computations stay within the 29 bits available. function am4(i,x,w,j,c,n) { var this_array = this.array; var w_array = w.array; var xl = x&0x1fff, xh = x>>13; /* BEGIN LOOP */ while(--n >= 0) { var l = this_array[i]&0x1fff; var h = this_array[i++]>>13; var m = xh*l+h*xl; l = xl*l+((m&0x1fff)<<13)+w_array[j]+c; c = (l>>26)+(m>>13)+xh*h; w_array[j++] = l&0x3ffffff; } /* END LOOP */ return c; } // am3/28 is best for SM, Rhino, but am4/26 is best for v8. // Kestrel (Opera 9.5) gets its best result with am4/26. // IE7 does 9% better with am3/28 than with am4/26. // Firefox (SM) gets 10% faster with am3/28 than with am4/26. setupEngine = function(fn, bits) { BigInteger.prototype.am = fn; dbits = bits; BI_DB = dbits; BI_DM = ((1<= 0; --i) r_array[i] = this_array[i]; /* END LOOP */ r.t = this.t; r.s = this.s; } // (protected) set from integer value x, -DV <= x < DV function bnpFromInt(x) { var this_array = this.array; this.t = 1; this.s = (x<0)?-1:0; if(x > 0) this_array[0] = x; else if(x < -1) this_array[0] = x+DV; else this.t = 0; } // return bigint initialized to value function nbv(i) { var r = nbi(); r.fromInt(i); return r; } // (protected) set from string and radix function bnpFromString(s,b) { var this_array = this.array; var k; if(b == 16) k = 4; else if(b == 8) k = 3; else if(b == 256) k = 8; // byte array else if(b == 2) k = 1; else if(b == 32) k = 5; else if(b == 4) k = 2; else { this.fromRadix(s,b); return; } this.t = 0; this.s = 0; var i = s.length, mi = false, sh = 0; /* BEGIN LOOP */ while(--i >= 0) { var x = (k==8)?s[i]&0xff:intAt(s,i); if(x < 0) { if(s.charAt(i) == "-") mi = true; continue; } mi = false; if(sh == 0) this_array[this.t++] = x; else if(sh+k > BI_DB) { this_array[this.t-1] |= (x&((1<<(BI_DB-sh))-1))<>(BI_DB-sh)); } else this_array[this.t-1] |= x<= BI_DB) sh -= BI_DB; } /* END LOOP */ if(k == 8 && (s[0]&0x80) != 0) { this.s = -1; if(sh > 0) this_array[this.t-1] |= ((1<<(BI_DB-sh))-1)< 0 && this_array[this.t-1] == c) --this.t; /* END LOOP */ } // (public) return string representation in given radix function bnToString(b) { var this_array = this.array; if(this.s < 0) return "-"+this.negate().toString(b); var k; if(b == 16) k = 4; else if(b == 8) k = 3; else if(b == 2) k = 1; else if(b == 32) k = 5; else if(b == 4) k = 2; else return this.toRadix(b); var km = (1< 0) { if(p < BI_DB && (d = this_array[i]>>p) > 0) { m = true; r = int2char(d); } /* BEGIN LOOP */ while(i >= 0) { if(p < k) { d = (this_array[i]&((1<>(p+=BI_DB-k); } else { d = (this_array[i]>>(p-=k))&km; if(p <= 0) { p += BI_DB; --i; } } if(d > 0) m = true; if(m) r += int2char(d); } /* END LOOP */ } return m?r:"0"; } // (public) -this function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } // (public) |this| function bnAbs() { return (this.s<0)?this.negate():this; } // (public) return + if this > a, - if this < a, 0 if equal function bnCompareTo(a) { var this_array = this.array; var a_array = a.array; var r = this.s-a.s; if(r != 0) return r; var i = this.t; r = i-a.t; if(r != 0) return r; /* BEGIN LOOP */ while(--i >= 0) if((r=this_array[i]-a_array[i]) != 0) return r; /* END LOOP */ return 0; } // returns bit length of the integer x function nbits(x) { var r = 1, t; if((t=x>>>16) != 0) { x = t; r += 16; } if((t=x>>8) != 0) { x = t; r += 8; } if((t=x>>4) != 0) { x = t; r += 4; } if((t=x>>2) != 0) { x = t; r += 2; } if((t=x>>1) != 0) { x = t; r += 1; } return r; } // (public) return the number of bits in "this" function bnBitLength() { var this_array = this.array; if(this.t <= 0) return 0; return BI_DB*(this.t-1)+nbits(this_array[this.t-1]^(this.s&BI_DM)); } // (protected) r = this << n*DB function bnpDLShiftTo(n,r) { var this_array = this.array; var r_array = r.array; var i; /* BEGIN LOOP */ for(i = this.t-1; i >= 0; --i) r_array[i+n] = this_array[i]; /* END LOOP */ /* BEGIN LOOP */ for(i = n-1; i >= 0; --i) r_array[i] = 0; /* END LOOP */ r.t = this.t+n; r.s = this.s; } // (protected) r = this >> n*DB function bnpDRShiftTo(n,r) { var this_array = this.array; var r_array = r.array; /* BEGIN LOOP */ for(var i = n; i < this.t; ++i) r_array[i-n] = this_array[i]; /* END LOOP */ r.t = Math.max(this.t-n,0); r.s = this.s; } // (protected) r = this << n function bnpLShiftTo(n,r) { var this_array = this.array; var r_array = r.array; var bs = n%BI_DB; var cbs = BI_DB-bs; var bm = (1<= 0; --i) { r_array[i+ds+1] = (this_array[i]>>cbs)|c; c = (this_array[i]&bm)<= 0; --i) r_array[i] = 0; /* END LOOP */ r_array[ds] = c; r.t = this.t+ds+1; r.s = this.s; r.clamp(); } // (protected) r = this >> n function bnpRShiftTo(n,r) { var this_array = this.array; var r_array = r.array; r.s = this.s; var ds = Math.floor(n/BI_DB); if(ds >= this.t) { r.t = 0; return; } var bs = n%BI_DB; var cbs = BI_DB-bs; var bm = (1<>bs; /* BEGIN LOOP */ for(var i = ds+1; i < this.t; ++i) { r_array[i-ds-1] |= (this_array[i]&bm)<>bs; } /* END LOOP */ if(bs > 0) r_array[this.t-ds-1] |= (this.s&bm)<>= BI_DB; } /* END LOOP */ if(a.t < this.t) { c -= a.s; /* BEGIN LOOP */ while(i < this.t) { c += this_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } /* END LOOP */ c += this.s; } else { c += this.s; /* BEGIN LOOP */ while(i < a.t) { c -= a_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } /* END LOOP */ c -= a.s; } r.s = (c<0)?-1:0; if(c < -1) r_array[i++] = BI_DV+c; else if(c > 0) r_array[i++] = c; r.t = i; r.clamp(); } // (protected) r = this * a, r != this,a (HAC 14.12) // "this" should be the larger one if appropriate. function bnpMultiplyTo(a,r) { var this_array = this.array; var r_array = r.array; var x = this.abs(), y = a.abs(); var y_array = y.array; var i = x.t; r.t = i+y.t; /* BEGIN LOOP */ while(--i >= 0) r_array[i] = 0; /* END LOOP */ /* BEGIN LOOP */ for(i = 0; i < y.t; ++i) r_array[i+x.t] = x.am(0,y_array[i],r,i,0,x.t); r.s = 0; r.clamp(); if(this.s != a.s) BigInteger.ZERO.subTo(r,r); } // (protected) r = this^2, r != this (HAC 14.16) function bnpSquareTo(r) { var x = this.abs(); var x_array = x.array; var r_array = r.array; var i = r.t = 2*x.t; /* BEGIN LOOP */ while(--i >= 0) r_array[i] = 0; /* END LOOP */ /* BEGIN LOOP */ for(i = 0; i < x.t-1; ++i) { var c = x.am(i,x_array[i],r,2*i,0,1); if((r_array[i+x.t]+=x.am(i+1,2*x_array[i],r,2*i+1,c,x.t-i-1)) >= BI_DV) { r_array[i+x.t] -= BI_DV; r_array[i+x.t+1] = 1; } } /* END LOOP */ if(r.t > 0) r_array[r.t-1] += x.am(i,x_array[i],r,2*i,0,1); r.s = 0; r.clamp(); } // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) // r != q, this != m. q or r may be null. function bnpDivRemTo(m,q,r) { var pm = m.abs(); if(pm.t <= 0) return; var pt = this.abs(); if(pt.t < pm.t) { if(q != null) q.fromInt(0); if(r != null) this.copyTo(r); return; } if(r == null) r = nbi(); var y = nbi(), ts = this.s, ms = m.s; var pm_array = pm.array; var nsh = BI_DB-nbits(pm_array[pm.t-1]); // normalize modulus if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } else { pm.copyTo(y); pt.copyTo(r); } var ys = y.t; var y_array = y.array; var y0 = y_array[ys-1]; if(y0 == 0) return; var yt = y0*(1<1)?y_array[ys-2]>>BI_F2:0); var d1 = BI_FV/yt, d2 = (1<= 0) { r_array[r.t++] = 1; r.subTo(t,r); } BigInteger.ONE.dlShiftTo(ys,t); t.subTo(y,y); // "negative" y so we can replace sub with am later /* BEGIN LOOP */ while(y.t < ys) y_array[y.t++] = 0; /* END LOOP */ /* BEGIN LOOP */ while(--j >= 0) { // Estimate quotient digit var qd = (r_array[--i]==y0)?BI_DM:Math.floor(r_array[i]*d1+(r_array[i-1]+e)*d2); if((r_array[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out y.dlShiftTo(j,t); r.subTo(t,r); /* BEGIN LOOP */ while(r_array[i] < --qd) r.subTo(t,r); /* END LOOP */ } } /* END LOOP */ if(q != null) { r.drShiftTo(ys,q); if(ts != ms) BigInteger.ZERO.subTo(q,q); } r.t = ys; r.clamp(); if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder if(ts < 0) BigInteger.ZERO.subTo(r,r); } // (public) this mod a function bnMod(a) { var r = nbi(); this.abs().divRemTo(a,null,r); if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); return r; } // Modular reduction using "classic" algorithm function Classic(m) { this.m = m; } function cConvert(x) { if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); else return x; } function cRevert(x) { return x; } function cReduce(x) { x.divRemTo(this.m,null,x); } function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } Classic.prototype.convert = cConvert; Classic.prototype.revert = cRevert; Classic.prototype.reduce = cReduce; Classic.prototype.mulTo = cMulTo; Classic.prototype.sqrTo = cSqrTo; // (protected) return "-1/this % 2^DB"; useful for Mont. reduction // justification: // xy == 1 (mod m) // xy = 1+km // xy(2-xy) = (1+km)(1-km) // x[y(2-xy)] = 1-k^2m^2 // x[y(2-xy)] == 1 (mod m^2) // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. // JS multiply "overflows" differently from C/C++, so care is needed here. function bnpInvDigit() { var this_array = this.array; if(this.t < 1) return 0; var x = this_array[0]; if((x&1) == 0) return 0; var y = x&3; // y == 1/x mod 2^2 y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 // last step - calculate inverse mod DV directly; // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints y = (y*(2-x*y%BI_DV))%BI_DV; // y == 1/x mod 2^dbits // we really want the negative inverse, and -DV < y < DV return (y>0)?BI_DV-y:-y; } // Montgomery reduction function Montgomery(m) { this.m = m; this.mp = m.invDigit(); this.mpl = this.mp&0x7fff; this.mph = this.mp>>15; this.um = (1<<(BI_DB-15))-1; this.mt2 = 2*m.t; } // xR mod m function montConvert(x) { var r = nbi(); x.abs().dlShiftTo(this.m.t,r); r.divRemTo(this.m,null,r); if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); return r; } // x/R mod m function montRevert(x) { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } // x = x/R mod m (HAC 14.32) function montReduce(x) { var x_array = x.array; /* BEGIN LOOP */ while(x.t <= this.mt2) // pad x so am has enough room later x_array[x.t++] = 0; /* END LOOP */ /* BEGIN LOOP */ for(var i = 0; i < this.m.t; ++i) { // faster way of calculating u0 = x[i]*mp mod DV var j = x_array[i]&0x7fff; var u0 = (j*this.mpl+(((j*this.mph+(x_array[i]>>15)*this.mpl)&this.um)<<15))&BI_DM; // use am to combine the multiply-shift-add into one call j = i+this.m.t; x_array[j] += this.m.am(0,u0,x,i,0,this.m.t); // propagate carry /* BEGIN LOOP */ while(x_array[j] >= BI_DV) { x_array[j] -= BI_DV; x_array[++j]++; } /* BEGIN LOOP */ } /* END LOOP */ x.clamp(); x.drShiftTo(this.m.t,x); if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); } // r = "x^2/R mod m"; x != r function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } // r = "xy/R mod m"; x,y != r function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } Montgomery.prototype.convert = montConvert; Montgomery.prototype.revert = montRevert; Montgomery.prototype.reduce = montReduce; Montgomery.prototype.mulTo = montMulTo; Montgomery.prototype.sqrTo = montSqrTo; // (protected) true iff this is even function bnpIsEven() { var this_array = this.array; return ((this.t>0)?(this_array[0]&1):this.s) == 0; } // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) function bnpExp(e,z) { if(e > 0xffffffff || e < 1) return BigInteger.ONE; var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; g.copyTo(r); /* BEGIN LOOP */ while(--i >= 0) { z.sqrTo(r,r2); if((e&(1< 0) z.mulTo(r2,g,r); else { var t = r; r = r2; r2 = t; } } /* END LOOP */ return z.revert(r); } // (public) this^e % m, 0 <= e < 2^32 function bnModPowInt(e,m) { var z; if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); return this.exp(e,z); } // protected BigInteger.prototype.copyTo = bnpCopyTo; BigInteger.prototype.fromInt = bnpFromInt; BigInteger.prototype.fromString = bnpFromString; BigInteger.prototype.clamp = bnpClamp; BigInteger.prototype.dlShiftTo = bnpDLShiftTo; BigInteger.prototype.drShiftTo = bnpDRShiftTo; BigInteger.prototype.lShiftTo = bnpLShiftTo; BigInteger.prototype.rShiftTo = bnpRShiftTo; BigInteger.prototype.subTo = bnpSubTo; BigInteger.prototype.multiplyTo = bnpMultiplyTo; BigInteger.prototype.squareTo = bnpSquareTo; BigInteger.prototype.divRemTo = bnpDivRemTo; BigInteger.prototype.invDigit = bnpInvDigit; BigInteger.prototype.isEven = bnpIsEven; BigInteger.prototype.exp = bnpExp; // public BigInteger.prototype.toString = bnToString; BigInteger.prototype.negate = bnNegate; BigInteger.prototype.abs = bnAbs; BigInteger.prototype.compareTo = bnCompareTo; BigInteger.prototype.bitLength = bnBitLength; BigInteger.prototype.mod = bnMod; BigInteger.prototype.modPowInt = bnModPowInt; // "constants" BigInteger.ZERO = nbv(0); BigInteger.ONE = nbv(1); // Copyright (c) 2005 Tom Wu // All Rights Reserved. // See "LICENSE" for details. // Extended JavaScript BN functions, required for RSA private ops. // (public) function bnClone() { var r = nbi(); this.copyTo(r); return r; } // (public) return value as integer function bnIntValue() { var this_array = this.array; if(this.s < 0) { if(this.t == 1) return this_array[0]-BI_DV; else if(this.t == 0) return -1; } else if(this.t == 1) return this_array[0]; else if(this.t == 0) return 0; // assumes 16 < DB < 32 return ((this_array[1]&((1<<(32-BI_DB))-1))<>24; } // (public) return value as short (assumes DB>=16) function bnShortValue() { var this_array = this.array; return (this.t==0)?this.s:(this_array[0]<<16)>>16; } // (protected) return x s.t. r^x < DV function bnpChunkSize(r) { return Math.floor(Math.LN2*BI_DB/Math.log(r)); } // (public) 0 if this == 0, 1 if this > 0 function bnSigNum() { var this_array = this.array; if(this.s < 0) return -1; else if(this.t <= 0 || (this.t == 1 && this_array[0] <= 0)) return 0; else return 1; } // (protected) convert to radix string function bnpToRadix(b) { if(b == null) b = 10; if(this.signum() == 0 || b < 2 || b > 36) return "0"; var cs = this.chunkSize(b); var a = Math.pow(b,cs); var d = nbv(a), y = nbi(), z = nbi(), r = ""; this.divRemTo(d,y,z); /* BEGIN LOOP */ while(y.signum() > 0) { r = (a+z.intValue()).toString(b).substr(1) + r; y.divRemTo(d,y,z); } /* END LOOP */ return z.intValue().toString(b) + r; } // (protected) convert from radix string function bnpFromRadix(s,b) { this.fromInt(0); if(b == null) b = 10; var cs = this.chunkSize(b); var d = Math.pow(b,cs), mi = false, j = 0, w = 0; /* BEGIN LOOP */ for(var i = 0; i < s.length; ++i) { var x = intAt(s,i); if(x < 0) { if(s.charAt(i) == "-" && this.signum() == 0) mi = true; continue; } w = b*w+x; if(++j >= cs) { this.dMultiply(d); this.dAddOffset(w,0); j = 0; w = 0; } } /* END LOOP */ if(j > 0) { this.dMultiply(Math.pow(b,j)); this.dAddOffset(w,0); } if(mi) BigInteger.ZERO.subTo(this,this); } // (protected) alternate constructor function bnpFromNumber(a,b,c) { if("number" == typeof b) { // new BigInteger(int,int,RNG) if(a < 2) this.fromInt(1); else { this.fromNumber(a,c); if(!this.testBit(a-1)) // force MSB set this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); if(this.isEven()) this.dAddOffset(1,0); // force odd /* BEGIN LOOP */ while(!this.isProbablePrime(b)) { this.dAddOffset(2,0); if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); } /* END LOOP */ } } else { // new BigInteger(int,RNG) var x = new Array(), t = a&7; x.length = (a>>3)+1; b.nextBytes(x); if(t > 0) x[0] &= ((1< 0) { if(p < BI_DB && (d = this_array[i]>>p) != (this.s&BI_DM)>>p) r[k++] = d|(this.s<<(BI_DB-p)); /* BEGIN LOOP */ while(i >= 0) { if(p < 8) { d = (this_array[i]&((1<>(p+=BI_DB-8); } else { d = (this_array[i]>>(p-=8))&0xff; if(p <= 0) { p += BI_DB; --i; } } if((d&0x80) != 0) d |= -256; if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; if(k > 0 || d != this.s) r[k++] = d; } /* END LOOP */ } return r; } function bnEquals(a) { return(this.compareTo(a)==0); } function bnMin(a) { return(this.compareTo(a)<0)?this:a; } function bnMax(a) { return(this.compareTo(a)>0)?this:a; } // (protected) r = this op a (bitwise) function bnpBitwiseTo(a,op,r) { var this_array = this.array; var a_array = a.array; var r_array = r.array; var i, f, m = Math.min(a.t,this.t); /* BEGIN LOOP */ for(i = 0; i < m; ++i) r_array[i] = op(this_array[i],a_array[i]); /* END LOOP */ if(a.t < this.t) { f = a.s&BI_DM; /* BEGIN LOOP */ for(i = m; i < this.t; ++i) r_array[i] = op(this_array[i],f); /* END LOOP */ r.t = this.t; } else { f = this.s&BI_DM; /* BEGIN LOOP */ for(i = m; i < a.t; ++i) r_array[i] = op(f,a_array[i]); /* END LOOP */ r.t = a.t; } r.s = op(this.s,a.s); r.clamp(); } // (public) this & a function op_and(x,y) { return x&y; } function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } // (public) this | a function op_or(x,y) { return x|y; } function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } // (public) this ^ a function op_xor(x,y) { return x^y; } function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } // (public) this & ~a function op_andnot(x,y) { return x&~y; } function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } // (public) ~this function bnNot() { var this_array = this.array; var r = nbi(); var r_array = r.array; /* BEGIN LOOP */ for(var i = 0; i < this.t; ++i) r_array[i] = BI_DM&~this_array[i]; /* END LOOP */ r.t = this.t; r.s = ~this.s; return r; } // (public) this << n function bnShiftLeft(n) { var r = nbi(); if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); return r; } // (public) this >> n function bnShiftRight(n) { var r = nbi(); if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); return r; } // return index of lowest 1-bit in x, x < 2^31 function lbit(x) { if(x == 0) return -1; var r = 0; if((x&0xffff) == 0) { x >>= 16; r += 16; } if((x&0xff) == 0) { x >>= 8; r += 8; } if((x&0xf) == 0) { x >>= 4; r += 4; } if((x&3) == 0) { x >>= 2; r += 2; } if((x&1) == 0) ++r; return r; } // (public) returns index of lowest 1-bit (or -1 if none) function bnGetLowestSetBit() { var this_array = this.array; /* BEGIN LOOP */ for(var i = 0; i < this.t; ++i) if(this_array[i] != 0) return i*BI_DB+lbit(this_array[i]); /* END LOOP */ if(this.s < 0) return this.t*BI_DB; return -1; } // return number of 1 bits in x function cbit(x) { var r = 0; /* BEGIN LOOP */ while(x != 0) { x &= x-1; ++r; } /* END LOOP */ return r; } // (public) return number of set bits function bnBitCount() { var r = 0, x = this.s&BI_DM; /* BEGIN LOOP */ for(var i = 0; i < this.t; ++i) r += cbit(this_array[i]^x); /* END LOOP */ return r; } // (public) true iff nth bit is set function bnTestBit(n) { var this_array = this.array; var j = Math.floor(n/BI_DB); if(j >= this.t) return(this.s!=0); return((this_array[j]&(1<<(n%BI_DB)))!=0); } // (protected) this op (1<>= BI_DB; } /* END LOOP */ if(a.t < this.t) { c += a.s; /* BEGIN LOOP */ while(i < this.t) { c += this_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } /* END LOOP */ c += this.s; } else { c += this.s; /* BEGIN LOOP */ while(i < a.t) { c += a_array[i]; r_array[i++] = c&BI_DM; c >>= BI_DB; } /* END LOOP */ c += a.s; } r.s = (c<0)?-1:0; if(c > 0) r_array[i++] = c; else if(c < -1) r_array[i++] = BI_DV+c; r.t = i; r.clamp(); } // (public) this + a function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } // (public) this - a function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } // (public) this * a function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } // (public) this / a function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } // (public) this % a function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } // (public) [this/a,this%a] function bnDivideAndRemainder(a) { var q = nbi(), r = nbi(); this.divRemTo(a,q,r); return new Array(q,r); } // (protected) this *= n, this >= 0, 1 < n < DV function bnpDMultiply(n) { var this_array = this.array; this_array[this.t] = this.am(0,n-1,this,0,0,this.t); ++this.t; this.clamp(); } // (protected) this += n << w words, this >= 0 function bnpDAddOffset(n,w) { var this_array = this.array; /* BEGIN LOOP */ while(this.t <= w) this_array[this.t++] = 0; /* END LOOP */ this_array[w] += n; /* BEGIN LOOP */ while(this_array[w] >= BI_DV) { this_array[w] -= BI_DV; if(++w >= this.t) this_array[this.t++] = 0; ++this_array[w]; } /* END LOOP */ } // A "null" reducer function NullExp() {} function nNop(x) { return x; } function nMulTo(x,y,r) { x.multiplyTo(y,r); } function nSqrTo(x,r) { x.squareTo(r); } NullExp.prototype.convert = nNop; NullExp.prototype.revert = nNop; NullExp.prototype.mulTo = nMulTo; NullExp.prototype.sqrTo = nSqrTo; // (public) this^e function bnPow(e) { return this.exp(e,new NullExp()); } // (protected) r = lower n words of "this * a", a.t <= n // "this" should be the larger one if appropriate. function bnpMultiplyLowerTo(a,n,r) { var r_array = r.array; var a_array = a.array; var i = Math.min(this.t+a.t,n); r.s = 0; // assumes a,this >= 0 r.t = i; /* BEGIN LOOP */ while(i > 0) r_array[--i] = 0; /* END LOOP */ var j; /* BEGIN LOOP */ for(j = r.t-this.t; i < j; ++i) r_array[i+this.t] = this.am(0,a_array[i],r,i,0,this.t); /* END LOOP */ /* BEGIN LOOP */ for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a_array[i],r,i,0,n-i); /* END LOOP */ r.clamp(); } // (protected) r = "this * a" without lower n words, n > 0 // "this" should be the larger one if appropriate. function bnpMultiplyUpperTo(a,n,r) { var r_array = r.array; var a_array = a.array; --n; var i = r.t = this.t+a.t-n; r.s = 0; // assumes a,this >= 0 /* BEGIN LOOP */ while(--i >= 0) r_array[i] = 0; /* END LOOP */ /* BEGIN LOOP */ for(i = Math.max(n-this.t,0); i < a.t; ++i) r_array[this.t+i-n] = this.am(n-i,a_array[i],r,0,0,this.t+i-n); /* END LOOP */ r.clamp(); r.drShiftTo(1,r); } // Barrett modular reduction function Barrett(m) { // setup Barrett this.r2 = nbi(); this.q3 = nbi(); BigInteger.ONE.dlShiftTo(2*m.t,this.r2); this.mu = this.r2.divide(m); this.m = m; } function barrettConvert(x) { if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); else if(x.compareTo(this.m) < 0) return x; else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } } function barrettRevert(x) { return x; } // x = x mod m (HAC 14.42) function barrettReduce(x) { x.drShiftTo(this.m.t-1,this.r2); if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); /* BEGIN LOOP */ while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); /* END LOOP */ x.subTo(this.r2,x); /* BEGIN LOOP */ while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); /* END LOOP */ } // r = x^2 mod m; x != r function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } // r = x*y mod m; x,y != r function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } Barrett.prototype.convert = barrettConvert; Barrett.prototype.revert = barrettRevert; Barrett.prototype.reduce = barrettReduce; Barrett.prototype.mulTo = barrettMulTo; Barrett.prototype.sqrTo = barrettSqrTo; // (public) this^e % m (HAC 14.85) function bnModPow(e,m) { var e_array = e.array; var i = e.bitLength(), k, r = nbv(1), z; if(i <= 0) return r; else if(i < 18) k = 1; else if(i < 48) k = 3; else if(i < 144) k = 4; else if(i < 768) k = 5; else k = 6; if(i < 8) z = new Classic(m); else if(m.isEven()) z = new Barrett(m); else z = new Montgomery(m); // precomputation var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { var g2 = nbi(); z.sqrTo(g[1],g2); /* BEGIN LOOP */ while(n <= km) { g[n] = nbi(); z.mulTo(g2,g[n-2],g[n]); n += 2; } /* END LOOP */ } var j = e.t-1, w, is1 = true, r2 = nbi(), t; i = nbits(e_array[j])-1; /* BEGIN LOOP */ while(j >= 0) { if(i >= k1) w = (e_array[j]>>(i-k1))&km; else { w = (e_array[j]&((1<<(i+1))-1))<<(k1-i); if(j > 0) w |= e_array[j-1]>>(BI_DB+i-k1); } n = k; /* BEGIN LOOP */ while((w&1) == 0) { w >>= 1; --n; } /* END LOOP */ if((i -= n) < 0) { i += BI_DB; --j; } if(is1) { // ret == 1, don't bother squaring or multiplying it g[w].copyTo(r); is1 = false; } else { /* BEGIN LOOP */ while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } /* END LOOP */ if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } z.mulTo(r2,g[w],r); } /* BEGIN LOOP */ while(j >= 0 && (e_array[j]&(1< 0) { x.rShiftTo(g,x); y.rShiftTo(g,y); } /* BEGIN LOOP */ while(x.signum() > 0) { if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); if(x.compareTo(y) >= 0) { x.subTo(y,x); x.rShiftTo(1,x); } else { y.subTo(x,y); y.rShiftTo(1,y); } } /* END LOOP */ if(g > 0) y.lShiftTo(g,y); return y; } // (protected) this % n, n < 2^26 function bnpModInt(n) { var this_array = this.array; if(n <= 0) return 0; var d = BI_DV%n, r = (this.s<0)?n-1:0; if(this.t > 0) if(d == 0) r = this_array[0]%n; else for(var i = this.t-1; i >= 0; --i) r = (d*r+this_array[i])%n; return r; } // (public) 1/this % m (HAC 14.61) function bnModInverse(m) { var ac = m.isEven(); if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; var u = m.clone(), v = this.clone(); var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); /* BEGIN LOOP */ while(u.signum() != 0) { /* BEGIN LOOP */ while(u.isEven()) { u.rShiftTo(1,u); if(ac) { if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } a.rShiftTo(1,a); } else if(!b.isEven()) b.subTo(m,b); b.rShiftTo(1,b); } /* END LOOP */ /* BEGIN LOOP */ while(v.isEven()) { v.rShiftTo(1,v); if(ac) { if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } c.rShiftTo(1,c); } else if(!d.isEven()) d.subTo(m,d); d.rShiftTo(1,d); } /* END LOOP */ if(u.compareTo(v) >= 0) { u.subTo(v,u); if(ac) a.subTo(c,a); b.subTo(d,b); } else { v.subTo(u,v); if(ac) c.subTo(a,c); d.subTo(b,d); } } /* END LOOP */ if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; if(d.compareTo(m) >= 0) return d.subtract(m); if(d.signum() < 0) d.addTo(m,d); else return d; if(d.signum() < 0) return d.add(m); else return d; } var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509]; var lplim = (1<<26)/lowprimes[lowprimes.length-1]; // (public) test primality with certainty >= 1-.5^t function bnIsProbablePrime(t) { var i, x = this.abs(); var x_array = x.array; if(x.t == 1 && x_array[0] <= lowprimes[lowprimes.length-1]) { for(i = 0; i < lowprimes.length; ++i) if(x_array[0] == lowprimes[i]) return true; return false; } if(x.isEven()) return false; i = 1; /* BEGIN LOOP */ while(i < lowprimes.length) { var m = lowprimes[i], j = i+1; /* BEGIN LOOP */ while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; /* END LOOP */ m = x.modInt(m); /* BEGIN LOOP */ while(i < j) if(m%lowprimes[i++] == 0) return false; /* END LOOP */ } /* END LOOP */ return x.millerRabin(t); } // (protected) true if probably prime (HAC 4.24, Miller-Rabin) function bnpMillerRabin(t) { var n1 = this.subtract(BigInteger.ONE); var k = n1.getLowestSetBit(); if(k <= 0) return false; var r = n1.shiftRight(k); t = (t+1)>>1; if(t > lowprimes.length) t = lowprimes.length; var a = nbi(); /* BEGIN LOOP */ for(var i = 0; i < t; ++i) { a.fromInt(lowprimes[i]); var y = a.modPow(r,this); if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { var j = 1; /* BEGIN LOOP */ while(j++ < k && y.compareTo(n1) != 0) { y = y.modPowInt(2,this); if(y.compareTo(BigInteger.ONE) == 0) return false; } /* END LOOP */ if(y.compareTo(n1) != 0) return false; } } /* END LOOP */ return true; } // protected BigInteger.prototype.chunkSize = bnpChunkSize; BigInteger.prototype.toRadix = bnpToRadix; BigInteger.prototype.fromRadix = bnpFromRadix; BigInteger.prototype.fromNumber = bnpFromNumber; BigInteger.prototype.bitwiseTo = bnpBitwiseTo; BigInteger.prototype.changeBit = bnpChangeBit; BigInteger.prototype.addTo = bnpAddTo; BigInteger.prototype.dMultiply = bnpDMultiply; BigInteger.prototype.dAddOffset = bnpDAddOffset; BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; BigInteger.prototype.modInt = bnpModInt; BigInteger.prototype.millerRabin = bnpMillerRabin; // public BigInteger.prototype.clone = bnClone; BigInteger.prototype.intValue = bnIntValue; BigInteger.prototype.byteValue = bnByteValue; BigInteger.prototype.shortValue = bnShortValue; BigInteger.prototype.signum = bnSigNum; BigInteger.prototype.toByteArray = bnToByteArray; BigInteger.prototype.equals = bnEquals; BigInteger.prototype.min = bnMin; BigInteger.prototype.max = bnMax; BigInteger.prototype.and = bnAnd; BigInteger.prototype.or = bnOr; BigInteger.prototype.xor = bnXor; BigInteger.prototype.andNot = bnAndNot; BigInteger.prototype.not = bnNot; BigInteger.prototype.shiftLeft = bnShiftLeft; BigInteger.prototype.shiftRight = bnShiftRight; BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; BigInteger.prototype.bitCount = bnBitCount; BigInteger.prototype.testBit = bnTestBit; BigInteger.prototype.setBit = bnSetBit; BigInteger.prototype.clearBit = bnClearBit; BigInteger.prototype.flipBit = bnFlipBit; BigInteger.prototype.add = bnAdd; BigInteger.prototype.subtract = bnSubtract; BigInteger.prototype.multiply = bnMultiply; BigInteger.prototype.divide = bnDivide; BigInteger.prototype.remainder = bnRemainder; BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; BigInteger.prototype.modPow = bnModPow; BigInteger.prototype.modInverse = bnModInverse; BigInteger.prototype.pow = bnPow; BigInteger.prototype.gcd = bnGCD; BigInteger.prototype.isProbablePrime = bnIsProbablePrime; // BigInteger interfaces not implemented in jsbn: // BigInteger(int signum, byte[] magnitude) // double doubleValue() // float floatValue() // int hashCode() // long longValue() // static BigInteger valueOf(long val) // prng4.js - uses Arcfour as a PRNG function Arcfour() { this.i = 0; this.j = 0; this.S = new Array(); } // Initialize arcfour context from key, an array of ints, each from [0..255] function ARC4init(key) { var i, j, t; /* BEGIN LOOP */ for(i = 0; i < 256; ++i) this.S[i] = i; /* END LOOP */ j = 0; /* BEGIN LOOP */ for(i = 0; i < 256; ++i) { j = (j + this.S[i] + key[i % key.length]) & 255; t = this.S[i]; this.S[i] = this.S[j]; this.S[j] = t; } /* END LOOP */ this.i = 0; this.j = 0; } function ARC4next() { var t; this.i = (this.i + 1) & 255; this.j = (this.j + this.S[this.i]) & 255; t = this.S[this.i]; this.S[this.i] = this.S[this.j]; this.S[this.j] = t; return this.S[(t + this.S[this.i]) & 255]; } Arcfour.prototype.init = ARC4init; Arcfour.prototype.next = ARC4next; // Plug in your RNG constructor here function prng_newstate() { return new Arcfour(); } // Pool size must be a multiple of 4 and greater than 32. // An array of bytes the size of the pool will be passed to init() var rng_psize = 256; // Random number generator - requires a PRNG backend, e.g. prng4.js // For best results, put code like // // in your main HTML document. var rng_state; var rng_pool; var rng_pptr; // Mix in a 32-bit integer into the pool function rng_seed_int(x) { rng_pool[rng_pptr++] ^= x & 255; rng_pool[rng_pptr++] ^= (x >> 8) & 255; rng_pool[rng_pptr++] ^= (x >> 16) & 255; rng_pool[rng_pptr++] ^= (x >> 24) & 255; if(rng_pptr >= rng_psize) rng_pptr -= rng_psize; } // Mix in the current time (w/milliseconds) into the pool function rng_seed_time() { rng_seed_int(new Date().getTime()); } // Initialize the pool with junk if needed. if(rng_pool == null) { rng_pool = new Array(); rng_pptr = 0; var t; /* BEGIN LOOP */ while(rng_pptr < rng_psize) { // extract some randomness from Math.random() t = Math.floor(65536 * Math.random()); rng_pool[rng_pptr++] = t >>> 8; rng_pool[rng_pptr++] = t & 255; } /* END LOOP */ rng_pptr = 0; rng_seed_time(); //rng_seed_int(window.screenX); //rng_seed_int(window.screenY); } function rng_get_byte() { if(rng_state == null) { rng_seed_time(); rng_state = prng_newstate(); rng_state.init(rng_pool); /* BEGIN LOOP */ for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) rng_pool[rng_pptr] = 0; /* END LOOP */ rng_pptr = 0; //rng_pool = null; } // TODO: allow reseeding after first request return rng_state.next(); } function rng_get_bytes(ba) { var i; /* BEGIN LOOP */ for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); /* END LOOP */ } function SecureRandom() {} SecureRandom.prototype.nextBytes = rng_get_bytes; // Depends on jsbn.js and rng.js // convert a (hex) string to a bignum object function parseBigInt(str,r) { return new BigInteger(str,r); } function linebrk(s,n) { var ret = ""; var i = 0; /* BEGIN LOOP */ while(i + n < s.length) { ret += s.substring(i,i+n) + "\n"; i += n; } /* END LOOP */ return ret + s.substring(i,s.length); } function byte2Hex(b) { if(b < 0x10) return "0" + b.toString(16); else return b.toString(16); } // PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint function pkcs1pad2(s,n) { if(n < s.length + 11) { alert("Message too long for RSA"); return null; } var ba = new Array(); var i = s.length - 1; /* BEGIN LOOP */ while(i >= 0 && n > 0) ba[--n] = s.charCodeAt(i--); /* END LOOP */ ba[--n] = 0; var rng = new SecureRandom(); var x = new Array(); /* BEGIN LOOP */ while(n > 2) { // random non-zero pad x[0] = 0; /* BEGIN LOOP */ while(x[0] == 0) rng.nextBytes(x); /* END LOOP */ ba[--n] = x[0]; } /* END LOOP */ ba[--n] = 2; ba[--n] = 0; return new BigInteger(ba); } // "empty" RSA key constructor function RSAKey() { this.n = null; this.e = 0; this.d = null; this.p = null; this.q = null; this.dmp1 = null; this.dmq1 = null; this.coeff = null; } // Set the public key fields N and e from hex strings function RSASetPublic(N,E) { if(N != null && E != null && N.length > 0 && E.length > 0) { this.n = parseBigInt(N,16); this.e = parseInt(E,16); } else alert("Invalid RSA public key"); } // Perform raw public operation on "x": return x^e (mod n) function RSADoPublic(x) { return x.modPowInt(this.e, this.n); } // Return the PKCS#1 RSA encryption of "text" as an even-length hex string function RSAEncrypt(text) { var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3); if(m == null) return null; var c = this.doPublic(m); if(c == null) return null; var h = c.toString(16); if((h.length & 1) == 0) return h; else return "0" + h; } // Return the PKCS#1 RSA encryption of "text" as a Base64-encoded string //function RSAEncryptB64(text) { // var h = this.encrypt(text); // if(h) return hex2b64(h); else return null; //} // protected RSAKey.prototype.doPublic = RSADoPublic; // public RSAKey.prototype.setPublic = RSASetPublic; RSAKey.prototype.encrypt = RSAEncrypt; //RSAKey.prototype.encrypt_b64 = RSAEncryptB64; // Depends on rsa.js and jsbn2.js // Undo PKCS#1 (type 2, random) padding and, if valid, return the plaintext function pkcs1unpad2(d,n) { var b = d.toByteArray(); var i = 0; /* BEGIN LOOP */ while(i < b.length && b[i] == 0) ++i; /* END LOOP */ if(b.length-i != n-1 || b[i] != 2) return null; ++i; /* BEGIN LOOP */ while(b[i] != 0) if(++i >= b.length) return null; /* END LOOP */ var ret = ""; /* BEGIN LOOP */ while(++i < b.length) ret += String.fromCharCode(b[i]); /* END LOOP */ return ret; } // Set the private key fields N, e, and d from hex strings function RSASetPrivate(N,E,D) { if(N != null && E != null && N.length > 0 && E.length > 0) { this.n = parseBigInt(N,16); this.e = parseInt(E,16); this.d = parseBigInt(D,16); } else alert("Invalid RSA private key"); } // Set the private key fields N, e, d and CRT params from hex strings function RSASetPrivateEx(N,E,D,P,Q,DP,DQ,C) { if(N != null && E != null && N.length > 0 && E.length > 0) { this.n = parseBigInt(N,16); this.e = parseInt(E,16); this.d = parseBigInt(D,16); this.p = parseBigInt(P,16); this.q = parseBigInt(Q,16); this.dmp1 = parseBigInt(DP,16); this.dmq1 = parseBigInt(DQ,16); this.coeff = parseBigInt(C,16); } else alert("Invalid RSA private key"); } // Generate a new random private key B bits long, using public expt E function RSAGenerate(B,E) { var rng = new SecureRandom(); var qs = B>>1; this.e = parseInt(E,16); var ee = new BigInteger(E,16); /* BEGIN LOOP */ for(;;) { /* BEGIN LOOP */ for(;;) { this.p = new BigInteger(B-qs,1,rng); if(this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)) break; } /* END LOOP */ /* BEGIN LOOP */ for(;;) { this.q = new BigInteger(qs,1,rng); if(this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)) break; } /* END LOOP */ if(this.p.compareTo(this.q) <= 0) { var t = this.p; this.p = this.q; this.q = t; } var p1 = this.p.subtract(BigInteger.ONE); var q1 = this.q.subtract(BigInteger.ONE); var phi = p1.multiply(q1); if(phi.gcd(ee).compareTo(BigInteger.ONE) == 0) { this.n = this.p.multiply(this.q); this.d = ee.modInverse(phi); this.dmp1 = this.d.mod(p1); this.dmq1 = this.d.mod(q1); this.coeff = this.q.modInverse(this.p); break; } } /* END LOOP */ } // Perform raw private operation on "x": return x^d (mod n) function RSADoPrivate(x) { if(this.p == null || this.q == null) return x.modPow(this.d, this.n); // TODO: re-calculate any missing CRT params var xp = x.mod(this.p).modPow(this.dmp1, this.p); var xq = x.mod(this.q).modPow(this.dmq1, this.q); /* BEGIN LOOP */ while(xp.compareTo(xq) < 0) xp = xp.add(this.p); /* END LOOP */ return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq); } // Return the PKCS#1 RSA decryption of "ctext". // "ctext" is an even-length hex string and the output is a plain string. function RSADecrypt(ctext) { var c = parseBigInt(ctext, 16); var m = this.doPrivate(c); if(m == null) return null; return pkcs1unpad2(m, (this.n.bitLength()+7)>>3); } // Return the PKCS#1 RSA decryption of "ctext". // "ctext" is a Base64-encoded string and the output is a plain string. //function RSAB64Decrypt(ctext) { // var h = b64tohex(ctext); // if(h) return this.decrypt(h); else return null; //} // protected RSAKey.prototype.doPrivate = RSADoPrivate; // public RSAKey.prototype.setPrivate = RSASetPrivate; RSAKey.prototype.setPrivateEx = RSASetPrivateEx; RSAKey.prototype.generate = RSAGenerate; RSAKey.prototype.decrypt = RSADecrypt; //RSAKey.prototype.b64_decrypt = RSAB64Decrypt; nValue="a5261939975948bb7a58dffe5ff54e65f0498f9175f5a09288810b8975871e99af3b5dd94057b0fc07535f5f97444504fa35169d461d0d30cf0192e307727c065168c788771c561a9400fb49175e9e6aa4e23fe11af69e9412dd23b0cb6684c4c2429bce139e848ab26d0829073351f4acd36074eafd036a5eb83359d2a698d3"; eValue="10001"; dValue="8e9912f6d3645894e8d38cb58c0db81ff516cf4c7e5a14c7f1eddb1459d2cded4d8d293fc97aee6aefb861859c8b6a3d1dfe710463e1f9ddc72048c09751971c4a580aa51eb523357a3cc48d31cfad1d4a165066ed92d4748fb6571211da5cb14bc11b6e2df7c1a559e6d5ac1cd5c94703a22891464fba23d0d965086277a161"; pValue="d090ce58a92c75233a6486cb0a9209bf3583b64f540c76f5294bb97d285eed33aec220bde14b2417951178ac152ceab6da7090905b478195498b352048f15e7d"; qValue="cab575dc652bb66df15a0359609d51d1db184750c00c6698b90ef3465c99655103edbf0d54c56aec0ce3c4d22592338092a126a0cc49f65a4a30d222b411e58f"; dmp1Value="1a24bca8e273df2f0e47c199bbf678604e7df7215480c77c8db39f49b000ce2cf7500038acfff5433b7d582a01f1826e6f4d42e1c57f5e1fef7b12aabc59fd25"; dmq1Value="3d06982efbbe47339e1f6d36b1216b8a741d410b0c662f54f7118b27b9a4ec9d914337eb39841d8666f3034408cf94f5b62f11c402fc994fe15a05493150d9fd"; coeffValue="3a3e731acd8960b7ff9eb81a7ff93bd1cfa74cbd56987db58b4594fb09c09084db1734c8143f98b602b981aaa9243ca28deb69b5b280ee8dcee0fd2625e53250"; setupEngine(am3, 28); var RSA = new RSAKey(); var TEXT = "The quick brown fox jumped over the extremely lazy frogs!"; RSA.setPublic(nValue, eValue); RSA.setPrivateEx(nValue, eValue, dValue, pValue, qValue, dmp1Value, dmq1Value, coeffValue); function encrypt() { return RSA.encrypt(TEXT); } function decrypt() { return RSA.decrypt(TEXT); } function PrintResult(name, result) { } function PrintScore(score) { // print(score); } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/v8/deltablue.js0000644000175000017500000010463011545150464021544 0ustar chr1schr1s// Copyright 2008 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Simple framework for running the benchmark suites and // computing a score based on the timing measurements. // A benchmark has a name (string) and a function that will be run to // do the performance measurement. The optional setup and tearDown // arguments are functions that will be invoked before and after // running the benchmark, but the running time of these functions will // not be accounted for in the benchmark score. function Benchmark(name, run, setup, tearDown) { this.name = name; this.run = run; this.Setup = setup ? setup : function() { }; this.TearDown = tearDown ? tearDown : function() { }; } // Benchmark results hold the benchmark and the measured time used to // run the benchmark. The benchmark score is computed later once a // full benchmark suite has run to completion. function BenchmarkResult(benchmark, time) { this.benchmark = benchmark; this.time = time; } // Automatically convert results to numbers. Used by the geometric // mean computation. BenchmarkResult.prototype.valueOf = function() { return this.time; } // Suites of benchmarks consist of a name and the set of benchmarks in // addition to the reference timing that the final score will be based // on. This way, all scores are relative to a reference run and higher // scores implies better performance. function BenchmarkSuite(name, reference, benchmarks) { this.name = name; this.reference = reference; this.benchmarks = benchmarks; BenchmarkSuite.suites.push(this); } // Keep track of all declared benchmark suites. BenchmarkSuite.suites = []; // Scores are not comparable across versions. Bump the version if // you're making changes that will affect that scores, e.g. if you add // a new benchmark or change an existing one. BenchmarkSuite.version = '5'; // To make the benchmark results predictable, we replace Math.random // with a 100% deterministic alternative. Math.random = (function() { var seed = 49734321; return function() { // Robert Jenkins' 32 bit integer hash function. seed = ((seed + 0x7ed55d16) + (seed << 12)) & 0xffffffff; seed = ((seed ^ 0xc761c23c) ^ (seed >>> 19)) & 0xffffffff; seed = ((seed + 0x165667b1) + (seed << 5)) & 0xffffffff; seed = ((seed + 0xd3a2646c) ^ (seed << 9)) & 0xffffffff; seed = ((seed + 0xfd7046c5) + (seed << 3)) & 0xffffffff; seed = ((seed ^ 0xb55a4f09) ^ (seed >>> 16)) & 0xffffffff; return (seed & 0xfffffff) / 0x10000000; }; })(); // Runs all registered benchmark suites and optionally yields between // each individual benchmark to avoid running for too long in the // context of browsers. Once done, the final score is reported to the // runner. BenchmarkSuite.RunSuites = function(runner) { var continuation = null; var suites = BenchmarkSuite.suites; var length = suites.length; BenchmarkSuite.scores = []; var index = 0; function RunStep() { while (continuation || index < length) { if (continuation) { continuation = continuation(); } else { var suite = suites[index++]; if (runner.NotifyStart) runner.NotifyStart(suite.name); continuation = suite.RunStep(runner); } if (continuation && typeof window != 'undefined' && window.setTimeout) { window.setTimeout(RunStep, 25); return; } } if (runner.NotifyScore) { var score = BenchmarkSuite.GeometricMean(BenchmarkSuite.scores); var formatted = BenchmarkSuite.FormatScore(100 * score); runner.NotifyScore(formatted); } } RunStep(); } // Counts the total number of registered benchmarks. Useful for // showing progress as a percentage. BenchmarkSuite.CountBenchmarks = function() { var result = 0; var suites = BenchmarkSuite.suites; for (var i = 0; i < suites.length; i++) { result += suites[i].benchmarks.length; } return result; } // Computes the geometric mean of a set of numbers. BenchmarkSuite.GeometricMean = function(numbers) { var log = 0; for (var i = 0; i < numbers.length; i++) { log += Math.log(numbers[i]); } return Math.pow(Math.E, log / numbers.length); } // Converts a score value to a string with at least three significant // digits. BenchmarkSuite.FormatScore = function(value) { if (value > 100) { return value.toFixed(0); } else { return value.toPrecision(3); } } // Notifies the runner that we're done running a single benchmark in // the benchmark suite. This can be useful to report progress. BenchmarkSuite.prototype.NotifyStep = function(result) { this.results.push(result); if (this.runner.NotifyStep) this.runner.NotifyStep(result.benchmark.name); } // Notifies the runner that we're done with running a suite and that // we have a result which can be reported to the user if needed. BenchmarkSuite.prototype.NotifyResult = function() { var mean = BenchmarkSuite.GeometricMean(this.results); var score = this.reference / mean; BenchmarkSuite.scores.push(score); if (this.runner.NotifyResult) { var formatted = BenchmarkSuite.FormatScore(100 * score); this.runner.NotifyResult(this.name, formatted); } } // Notifies the runner that running a benchmark resulted in an error. BenchmarkSuite.prototype.NotifyError = function(error) { if (this.runner.NotifyError) { this.runner.NotifyError(this.name, error); } if (this.runner.NotifyStep) { this.runner.NotifyStep(this.name); } } // Runs a single benchmark for at least a second and computes the // average time it takes to run a single iteration. BenchmarkSuite.prototype.RunSingleBenchmark = function(benchmark) { var elapsed = 0; var start = new Date(); for (var n = 0; elapsed < 200; n++) { benchmark.run(); elapsed = new Date() - start; } var usec = (elapsed * 1000) / n; this.NotifyStep(new BenchmarkResult(benchmark, usec)); } // This function starts running a suite, but stops between each // individual benchmark in the suite and returns a continuation // function which can be invoked to run the next benchmark. Once the // last benchmark has been executed, null is returned. BenchmarkSuite.prototype.RunStep = function(runner) { this.results = []; this.runner = runner; var length = this.benchmarks.length; var index = 0; var suite = this; // Run the setup, the actual benchmark, and the tear down in three // separate steps to allow the framework to yield between any of the // steps. function RunNextSetup() { if (index < length) { try { suite.benchmarks[index].Setup(); } catch (e) { suite.NotifyError(e); return null; } return RunNextBenchmark; } suite.NotifyResult(); return null; } function RunNextBenchmark() { try { suite.RunSingleBenchmark(suite.benchmarks[index]); } catch (e) { suite.NotifyError(e); return null; } return RunNextTearDown; } function RunNextTearDown() { try { suite.benchmarks[index++].TearDown(); } catch (e) { suite.NotifyError(e); return null; } return RunNextSetup; } // Start out running the setup. return RunNextSetup(); } // Copyright 2008 Google Inc. All Rights Reserved. // Copyright 1996 John Maloney and Mario Wolczko. // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // This implementation of the DeltaBlue benchmark is derived // from the Smalltalk implementation by John Maloney and Mario // Wolczko. Some parts have been translated directly, whereas // others have been modified more aggresively to make it feel // more like a JavaScript program. var DeltaBlue = new BenchmarkSuite('DeltaBlue', 71104, [ new Benchmark('DeltaBlue', deltaBlue) ]); /** * A JavaScript implementation of the DeltaBlue constrain-solving * algorithm, as described in: * * "The DeltaBlue Algorithm: An Incremental Constraint Hierarchy Solver" * Bjorn N. Freeman-Benson and John Maloney * January 1990 Communications of the ACM, * also available as University of Washington TR 89-08-06. * * Beware: this benchmark is written in a grotesque style where * the constraint model is built by side-effects from constructors. * I've kept it this way to avoid deviating too much from the original * implementation. */ /* --- O b j e c t M o d e l --- */ Object.prototype.inherits = function (shuper) { function Inheriter() { } Inheriter.prototype = shuper.prototype; this.prototype = new Inheriter(); this.superConstructor = shuper; } function OrderedCollection() { this.elms = new Array(); } OrderedCollection.prototype.add = function (elm) { this.elms.push(elm); } OrderedCollection.prototype.at = function (index) { return this.elms[index]; } OrderedCollection.prototype.size = function () { return this.elms.length; } OrderedCollection.prototype.removeFirst = function () { return this.elms.pop(); } OrderedCollection.prototype.remove = function (elm) { var index = 0, skipped = 0; /* BEGIN LOOP */ for (var i = 0; i < this.elms.length; i++) { var value = this.elms[i]; if (value != elm) { this.elms[index] = value; index++; } else { skipped++; } } /* END LOOP */ /* BEGIN LOOP */ for (var i = 0; i < skipped; i++) this.elms.pop(); /* END LOOP */ } /* --- * * S t r e n g t h * --- */ /** * Strengths are used to measure the relative importance of constraints. * New strengths may be inserted in the strength hierarchy without * disrupting current constraints. Strengths cannot be created outside * this class, so pointer comparison can be used for value comparison. */ function Strength(strengthValue, name) { this.strengthValue = strengthValue; this.name = name; } Strength.stronger = function (s1, s2) { return s1.strengthValue < s2.strengthValue; } Strength.weaker = function (s1, s2) { return s1.strengthValue > s2.strengthValue; } Strength.weakestOf = function (s1, s2) { return this.weaker(s1, s2) ? s1 : s2; } Strength.strongest = function (s1, s2) { return this.stronger(s1, s2) ? s1 : s2; } Strength.prototype.nextWeaker = function () { switch (this.strengthValue) { case 0: return Strength.WEAKEST; case 1: return Strength.WEAK_DEFAULT; case 2: return Strength.NORMAL; case 3: return Strength.STRONG_DEFAULT; case 4: return Strength.PREFERRED; case 5: return Strength.REQUIRED; } } // Strength constants. Strength.REQUIRED = new Strength(0, "required"); Strength.STONG_PREFERRED = new Strength(1, "strongPreferred"); Strength.PREFERRED = new Strength(2, "preferred"); Strength.STRONG_DEFAULT = new Strength(3, "strongDefault"); Strength.NORMAL = new Strength(4, "normal"); Strength.WEAK_DEFAULT = new Strength(5, "weakDefault"); Strength.WEAKEST = new Strength(6, "weakest"); /* --- * * C o n s t r a i n t * --- */ /** * An abstract class representing a system-maintainable relationship * (or "constraint") between a set of variables. A constraint supplies * a strength instance variable; concrete subclasses provide a means * of storing the constrained variables and other information required * to represent a constraint. */ function Constraint(strength) { this.strength = strength; } /** * Activate this constraint and attempt to satisfy it. */ Constraint.prototype.addConstraint = function () { this.addToGraph(); planner.incrementalAdd(this); } /** * Attempt to find a way to enforce this constraint. If successful, * record the solution, perhaps modifying the current dataflow * graph. Answer the constraint that this constraint overrides, if * there is one, or nil, if there isn't. * Assume: I am not already satisfied. */ Constraint.prototype.satisfy = function (mark) { this.chooseMethod(mark); if (!this.isSatisfied()) { if (this.strength == Strength.REQUIRED) alert("Could not satisfy a required constraint!"); return null; } this.markInputs(mark); var out = this.output(); var overridden = out.determinedBy; if (overridden != null) overridden.markUnsatisfied(); out.determinedBy = this; if (!planner.addPropagate(this, mark)) alert("Cycle encountered"); out.mark = mark; return overridden; } Constraint.prototype.destroyConstraint = function () { if (this.isSatisfied()) planner.incrementalRemove(this); else this.removeFromGraph(); } /** * Normal constraints are not input constraints. An input constraint * is one that depends on external state, such as the mouse, the * keybord, a clock, or some arbitraty piece of imperative code. */ Constraint.prototype.isInput = function () { return false; } /* --- * * U n a r y C o n s t r a i n t * --- */ /** * Abstract superclass for constraints having a single possible output * variable. */ function UnaryConstraint(v, strength) { UnaryConstraint.superConstructor.call(this, strength); this.myOutput = v; this.satisfied = false; this.addConstraint(); } UnaryConstraint.inherits(Constraint); /** * Adds this constraint to the constraint graph */ UnaryConstraint.prototype.addToGraph = function () { this.myOutput.addConstraint(this); this.satisfied = false; } /** * Decides if this constraint can be satisfied and records that * decision. */ UnaryConstraint.prototype.chooseMethod = function (mark) { this.satisfied = (this.myOutput.mark != mark) && Strength.stronger(this.strength, this.myOutput.walkStrength); } /** * Returns true if this constraint is satisfied in the current solution. */ UnaryConstraint.prototype.isSatisfied = function () { return this.satisfied; } UnaryConstraint.prototype.markInputs = function (mark) { // has no inputs } /** * Returns the current output variable. */ UnaryConstraint.prototype.output = function () { return this.myOutput; } /** * Calculate the walkabout strength, the stay flag, and, if it is * 'stay', the value for the current output of this constraint. Assume * this constraint is satisfied. */ UnaryConstraint.prototype.recalculate = function () { this.myOutput.walkStrength = this.strength; this.myOutput.stay = !this.isInput(); if (this.myOutput.stay) this.execute(); // Stay optimization } /** * Records that this constraint is unsatisfied */ UnaryConstraint.prototype.markUnsatisfied = function () { this.satisfied = false; } UnaryConstraint.prototype.inputsKnown = function () { return true; } UnaryConstraint.prototype.removeFromGraph = function () { if (this.myOutput != null) this.myOutput.removeConstraint(this); this.satisfied = false; } /* --- * * S t a y C o n s t r a i n t * --- */ /** * Variables that should, with some level of preference, stay the same. * Planners may exploit the fact that instances, if satisfied, will not * change their output during plan execution. This is called "stay * optimization". */ function StayConstraint(v, str) { StayConstraint.superConstructor.call(this, v, str); } StayConstraint.inherits(UnaryConstraint); StayConstraint.prototype.execute = function () { // Stay constraints do nothing } /* --- * * E d i t C o n s t r a i n t * --- */ /** * A unary input constraint used to mark a variable that the client * wishes to change. */ function EditConstraint(v, str) { EditConstraint.superConstructor.call(this, v, str); } EditConstraint.inherits(UnaryConstraint); /** * Edits indicate that a variable is to be changed by imperative code. */ EditConstraint.prototype.isInput = function () { return true; } EditConstraint.prototype.execute = function () { // Edit constraints do nothing } /* --- * * B i n a r y C o n s t r a i n t * --- */ var Direction = new Object(); Direction.NONE = 0; Direction.FORWARD = 1; Direction.BACKWARD = -1; /** * Abstract superclass for constraints having two possible output * variables. */ function BinaryConstraint(var1, var2, strength) { BinaryConstraint.superConstructor.call(this, strength); this.v1 = var1; this.v2 = var2; this.direction = Direction.NONE; this.addConstraint(); } BinaryConstraint.inherits(Constraint); /** * Decides if this constratint can be satisfied and which way it * should flow based on the relative strength of the variables related, * and record that decision. */ BinaryConstraint.prototype.chooseMethod = function (mark) { if (this.v1.mark == mark) { this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v2.walkStrength)) ? Direction.FORWARD : Direction.NONE; } if (this.v2.mark == mark) { this.direction = (this.v1.mark != mark && Strength.stronger(this.strength, this.v1.walkStrength)) ? Direction.BACKWARD : Direction.NONE; } if (Strength.weaker(this.v1.walkStrength, this.v2.walkStrength)) { this.direction = Strength.stronger(this.strength, this.v1.walkStrength) ? Direction.BACKWARD : Direction.NONE; } else { this.direction = Strength.stronger(this.strength, this.v2.walkStrength) ? Direction.FORWARD : Direction.BACKWARD } } /** * Add this constraint to the constraint graph */ BinaryConstraint.prototype.addToGraph = function () { this.v1.addConstraint(this); this.v2.addConstraint(this); this.direction = Direction.NONE; } /** * Answer true if this constraint is satisfied in the current solution. */ BinaryConstraint.prototype.isSatisfied = function () { return this.direction != Direction.NONE; } /** * Mark the input variable with the given mark. */ BinaryConstraint.prototype.markInputs = function (mark) { this.input().mark = mark; } /** * Returns the current input variable */ BinaryConstraint.prototype.input = function () { return (this.direction == Direction.FORWARD) ? this.v1 : this.v2; } /** * Returns the current output variable */ BinaryConstraint.prototype.output = function () { return (this.direction == Direction.FORWARD) ? this.v2 : this.v1; } /** * Calculate the walkabout strength, the stay flag, and, if it is * 'stay', the value for the current output of this * constraint. Assume this constraint is satisfied. */ BinaryConstraint.prototype.recalculate = function () { var ihn = this.input(), out = this.output(); out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength); out.stay = ihn.stay; if (out.stay) this.execute(); } /** * Record the fact that this constraint is unsatisfied. */ BinaryConstraint.prototype.markUnsatisfied = function () { this.direction = Direction.NONE; } BinaryConstraint.prototype.inputsKnown = function (mark) { var i = this.input(); return i.mark == mark || i.stay || i.determinedBy == null; } BinaryConstraint.prototype.removeFromGraph = function () { if (this.v1 != null) this.v1.removeConstraint(this); if (this.v2 != null) this.v2.removeConstraint(this); this.direction = Direction.NONE; } /* --- * * S c a l e C o n s t r a i n t * --- */ /** * Relates two variables by the linear scaling relationship: "v2 = * (v1 * scale) + offset". Either v1 or v2 may be changed to maintain * this relationship but the scale factor and offset are considered * read-only. */ function ScaleConstraint(src, scale, offset, dest, strength) { this.direction = Direction.NONE; this.scale = scale; this.offset = offset; ScaleConstraint.superConstructor.call(this, src, dest, strength); } ScaleConstraint.inherits(BinaryConstraint); /** * Adds this constraint to the constraint graph. */ ScaleConstraint.prototype.addToGraph = function () { ScaleConstraint.superConstructor.prototype.addToGraph.call(this); this.scale.addConstraint(this); this.offset.addConstraint(this); } ScaleConstraint.prototype.removeFromGraph = function () { ScaleConstraint.superConstructor.prototype.removeFromGraph.call(this); if (this.scale != null) this.scale.removeConstraint(this); if (this.offset != null) this.offset.removeConstraint(this); } ScaleConstraint.prototype.markInputs = function (mark) { ScaleConstraint.superConstructor.prototype.markInputs.call(this, mark); this.scale.mark = this.offset.mark = mark; } /** * Enforce this constraint. Assume that it is satisfied. */ ScaleConstraint.prototype.execute = function () { if (this.direction == Direction.FORWARD) { this.v2.value = this.v1.value * this.scale.value + this.offset.value; } else { this.v1.value = (this.v2.value - this.offset.value) / this.scale.value; } } /** * Calculate the walkabout strength, the stay flag, and, if it is * 'stay', the value for the current output of this constraint. Assume * this constraint is satisfied. */ ScaleConstraint.prototype.recalculate = function () { var ihn = this.input(), out = this.output(); out.walkStrength = Strength.weakestOf(this.strength, ihn.walkStrength); out.stay = ihn.stay && this.scale.stay && this.offset.stay; if (out.stay) this.execute(); } /* --- * * E q u a l i t y C o n s t r a i n t * --- */ /** * Constrains two variables to have the same value. */ function EqualityConstraint(var1, var2, strength) { EqualityConstraint.superConstructor.call(this, var1, var2, strength); } EqualityConstraint.inherits(BinaryConstraint); /** * Enforce this constraint. Assume that it is satisfied. */ EqualityConstraint.prototype.execute = function () { this.output().value = this.input().value; } /* --- * * V a r i a b l e * --- */ /** * A constrained variable. In addition to its value, it maintain the * structure of the constraint graph, the current dataflow graph, and * various parameters of interest to the DeltaBlue incremental * constraint solver. **/ function Variable(name, initialValue) { this.value = initialValue || 0; this.constraints = new OrderedCollection(); this.determinedBy = null; this.mark = 0; this.walkStrength = Strength.WEAKEST; this.stay = true; this.name = name; } /** * Add the given constraint to the set of all constraints that refer * this variable. */ Variable.prototype.addConstraint = function (c) { this.constraints.add(c); } /** * Removes all traces of c from this variable. */ Variable.prototype.removeConstraint = function (c) { this.constraints.remove(c); if (this.determinedBy == c) this.determinedBy = null; } /* --- * * P l a n n e r * --- */ /** * The DeltaBlue planner */ function Planner() { this.currentMark = 0; } /** * Attempt to satisfy the given constraint and, if successful, * incrementally update the dataflow graph. Details: If satifying * the constraint is successful, it may override a weaker constraint * on its output. The algorithm attempts to resatisfy that * constraint using some other method. This process is repeated * until either a) it reaches a variable that was not previously * determined by any constraint or b) it reaches a constraint that * is too weak to be satisfied using any of its methods. The * variables of constraints that have been processed are marked with * a unique mark value so that we know where we've been. This allows * the algorithm to avoid getting into an infinite loop even if the * constraint graph has an inadvertent cycle. */ Planner.prototype.incrementalAdd = function (c) { var mark = this.newMark(); var overridden = c.satisfy(mark); /* BEGIN LOOP */ while (overridden != null) overridden = overridden.satisfy(mark); /* END LOOP */ } /** * Entry point for retracting a constraint. Remove the given * constraint and incrementally update the dataflow graph. * Details: Retracting the given constraint may allow some currently * unsatisfiable downstream constraint to be satisfied. We therefore collect * a list of unsatisfied downstream constraints and attempt to * satisfy each one in turn. This list is traversed by constraint * strength, strongest first, as a heuristic for avoiding * unnecessarily adding and then overriding weak constraints. * Assume: c is satisfied. */ Planner.prototype.incrementalRemove = function (c) { var out = c.output(); c.markUnsatisfied(); c.removeFromGraph(); var unsatisfied = this.removePropagateFrom(out); var strength = Strength.REQUIRED; /* BEGIN LOOP */ do { /* BEGIN LOOP */ for (var i = 0; i < unsatisfied.size(); i++) { var u = unsatisfied.at(i); if (u.strength == strength) this.incrementalAdd(u); } /* END LOOP */ strength = strength.nextWeaker(); } while (strength != Strength.WEAKEST); /* END LOOP */ } /** * Select a previously unused mark value. */ Planner.prototype.newMark = function () { return ++this.currentMark; } /** * Extract a plan for resatisfaction starting from the given source * constraints, usually a set of input constraints. This method * assumes that stay optimization is desired; the plan will contain * only constraints whose output variables are not stay. Constraints * that do no computation, such as stay and edit constraints, are * not included in the plan. * Details: The outputs of a constraint are marked when it is added * to the plan under construction. A constraint may be appended to * the plan when all its input variables are known. A variable is * known if either a) the variable is marked (indicating that has * been computed by a constraint appearing earlier in the plan), b) * the variable is 'stay' (i.e. it is a constant at plan execution * time), or c) the variable is not determined by any * constraint. The last provision is for past states of history * variables, which are not stay but which are also not computed by * any constraint. * Assume: sources are all satisfied. */ Planner.prototype.makePlan = function (sources) { var mark = this.newMark(); var plan = new Plan(); var todo = sources; /* BEGIN LOOP */ while (todo.size() > 0) { var c = todo.removeFirst(); if (c.output().mark != mark && c.inputsKnown(mark)) { plan.addConstraint(c); c.output().mark = mark; this.addConstraintsConsumingTo(c.output(), todo); } } /* END LOOP */ return plan; } /** * Extract a plan for resatisfying starting from the output of the * given constraints, usually a set of input constraints. */ Planner.prototype.extractPlanFromConstraints = function (constraints) { var sources = new OrderedCollection(); /* BEGIN LOOP */ for (var i = 0; i < constraints.size(); i++) { var c = constraints.at(i); if (c.isInput() && c.isSatisfied()) // not in plan already and eligible for inclusion sources.add(c); } /* END LOOP */ return this.makePlan(sources); } /** * Recompute the walkabout strengths and stay flags of all variables * downstream of the given constraint and recompute the actual * values of all variables whose stay flag is true. If a cycle is * detected, remove the given constraint and answer * false. Otherwise, answer true. * Details: Cycles are detected when a marked variable is * encountered downstream of the given constraint. The sender is * assumed to have marked the inputs of the given constraint with * the given mark. Thus, encountering a marked node downstream of * the output constraint means that there is a path from the * constraint's output to one of its inputs. */ Planner.prototype.addPropagate = function (c, mark) { var todo = new OrderedCollection(); todo.add(c); /* BEGIN LOOP */ while (todo.size() > 0) { var d = todo.removeFirst(); if (d.output().mark == mark) { this.incrementalRemove(c); return false; } d.recalculate(); this.addConstraintsConsumingTo(d.output(), todo); } /* END LOOP */ return true; } /** * Update the walkabout strengths and stay flags of all variables * downstream of the given constraint. Answer a collection of * unsatisfied constraints sorted in order of decreasing strength. */ Planner.prototype.removePropagateFrom = function (out) { out.determinedBy = null; out.walkStrength = Strength.WEAKEST; out.stay = true; var unsatisfied = new OrderedCollection(); var todo = new OrderedCollection(); todo.add(out); /* BEGIN LOOP */ while (todo.size() > 0) { var v = todo.removeFirst(); /* BEGIN LOOP */ for (var i = 0; i < v.constraints.size(); i++) { var c = v.constraints.at(i); if (!c.isSatisfied()) unsatisfied.add(c); } /* END LOOP */ var determining = v.determinedBy; /* BEGIN LOOP */ for (var i = 0; i < v.constraints.size(); i++) { var next = v.constraints.at(i); if (next != determining && next.isSatisfied()) { next.recalculate(); todo.add(next.output()); } } /* END LOOP */ } /* END LOOP */ return unsatisfied; } Planner.prototype.addConstraintsConsumingTo = function (v, coll) { var determining = v.determinedBy; var cc = v.constraints; /* BEGIN LOOP */ for (var i = 0; i < cc.size(); i++) { var c = cc.at(i); if (c != determining && c.isSatisfied()) coll.add(c); } /* END LOOP */ } /* --- * * P l a n * --- */ /** * A Plan is an ordered list of constraints to be executed in sequence * to resatisfy all currently satisfiable constraints in the face of * one or more changing inputs. */ function Plan() { this.v = new OrderedCollection(); } Plan.prototype.addConstraint = function (c) { this.v.add(c); } Plan.prototype.size = function () { return this.v.size(); } Plan.prototype.constraintAt = function (index) { return this.v.at(index); } Plan.prototype.execute = function () { /* BEGIN LOOP */ for (var i = 0; i < this.size(); i++) { var c = this.constraintAt(i); c.execute(); } /* END LOOP */ } /* --- * * M a i n * --- */ /** * This is the standard DeltaBlue benchmark. A long chain of equality * constraints is constructed with a stay constraint on one end. An * edit constraint is then added to the opposite end and the time is * measured for adding and removing this constraint, and extracting * and executing a constraint satisfaction plan. There are two cases. * In case 1, the added constraint is stronger than the stay * constraint and values must propagate down the entire length of the * chain. In case 2, the added constraint is weaker than the stay * constraint so it cannot be accomodated. The cost in this case is, * of course, very low. Typical situations lie somewhere between these * two extremes. */ function chainTest(n) { planner = new Planner(); var prev = null, first = null, last = null; // Build chain of n equality constraints /* BEGIN LOOP */ for (var i = 0; i <= n; i++) { var name = "v" + i; var v = new Variable(name); if (prev != null) new EqualityConstraint(prev, v, Strength.REQUIRED); if (i == 0) first = v; if (i == n) last = v; prev = v; } /* END LOOP */ new StayConstraint(last, Strength.STRONG_DEFAULT); var edit = new EditConstraint(first, Strength.PREFERRED); var edits = new OrderedCollection(); edits.add(edit); var plan = planner.extractPlanFromConstraints(edits); /* BEGIN LOOP */ for (var i = 0; i < 100; i++) { first.value = i; plan.execute(); if (last.value != i) alert("Chain test failed."); } /* END LOOP */ } /** * This test constructs a two sets of variables related to each * other by a simple linear transformation (scale and offset). The * time is measured to change a variable on either side of the * mapping and to change the scale and offset factors. */ function projectionTest(n) { planner = new Planner(); var scale = new Variable("scale", 10); var offset = new Variable("offset", 1000); var src = null, dst = null; var dests = new OrderedCollection(); /* BEGIN LOOP */ for (var i = 0; i < n; i++) { src = new Variable("src" + i, i); dst = new Variable("dst" + i, i); dests.add(dst); new StayConstraint(src, Strength.NORMAL); new ScaleConstraint(src, scale, offset, dst, Strength.REQUIRED); } /* END LOOP */ change(src, 17); if (dst.value != 1170) alert("Projection 1 failed"); change(dst, 1050); if (src.value != 5) alert("Projection 2 failed"); change(scale, 5); /* BEGIN LOOP */ for (var i = 0; i < n - 1; i++) { if (dests.at(i).value != i * 5 + 1000) alert("Projection 3 failed"); } /* END LOOP */ change(offset, 2000); /* BEGIN LOOP */ for (var i = 0; i < n - 1; i++) { if (dests.at(i).value != i * 5 + 2000) alert("Projection 4 failed"); } /* END LOOP */ } function change(v, newValue) { var edit = new EditConstraint(v, Strength.PREFERRED); var edits = new OrderedCollection(); edits.add(edit); var plan = planner.extractPlanFromConstraints(edits); /* BEGIN LOOP */ for (var i = 0; i < 10; i++) { v.value = newValue; plan.execute(); } /* END LOOP */ edit.destroyConstraint(); } // Global variable holding the current planner. var planner = null; function deltaBlue() { chainTest(100); projectionTest(100); } function PrintResult(name, result) { } function PrintScore(score) { } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/v8/earley-boyer.js0000644000175000017500000057515711545150464022222 0ustar chr1schr1s// This file is automatically generated by scheme2js, except for the // benchmark harness code at the beginning and end of the file. var EarleyBoyer = new BenchmarkSuite('EarleyBoyer', 765819, [ new Benchmark("Earley", function () { BgL_earleyzd2benchmarkzd2(); }), new Benchmark("Boyer", function () { BgL_nboyerzd2benchmarkzd2(); }) ]); /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /************* GENERATED FILE - DO NOT EDIT *************/ /* * To use write/prints/... the default-output port has to be set first. * Simply setting SC_DEFAULT_OUT and SC_ERROR_OUT to the desired values * should do the trick. * In the following example the std-out and error-port are redirected to * a DIV. function initRuntime() { function escapeHTML(s) { var tmp = s; tmp = tmp.replace(/&/g, "&"); tmp = tmp.replace(//g, ">"); tmp = tmp.replace(/ /g, " "); tmp = tmp.replace(/\n/g, "
"); tmp = tmp.replace(/\t/g, "    "); return tmp; } document.write("
"); SC_DEFAULT_OUT = new sc_GenericOutputPort( function(s) { var stdout = document.getElementById('stdout'); stdout.innerHTML = stdout.innerHTML + escapeHTML(s); }); SC_ERROR_OUT = SC_DEFAULT_OUT; } */ function sc_print_debug() { sc_print.apply(null, arguments); } /*** META ((export *js*)) */ var sc_JS_GLOBALS = this; var __sc_LINE=-1; var __sc_FILE=""; /*** META ((export #t)) */ function sc_alert() { var len = arguments.length; var s = ""; var i; for( i = 0; i < len; i++ ) { s += sc_toDisplayString(arguments[ i ]); } return alert( s ); } /*** META ((export #t)) */ function sc_typeof( x ) { return typeof x; } /*** META ((export #t)) */ function sc_error() { var a = [sc_jsstring2symbol("*error*")]; for (var i = 0; i < arguments.length; i++) { a[i+1] = arguments[i]; } throw a; } /*** META ((export #t) (peephole (prefix "throw "))) */ function sc_raise(obj) { throw obj; } /*** META ((export with-handler-lambda)) */ function sc_withHandlerLambda(handler, body) { try { return body(); } catch(e) { if (!e._internalException) return handler(e); else throw e; } } var sc_properties = new Object(); /*** META ((export #t)) */ function sc_putpropBang(sym, key, val) { var ht = sc_properties[sym]; if (!ht) { ht = new Object(); sc_properties[sym] = ht; } ht[key] = val; } /*** META ((export #t)) */ function sc_getprop(sym, key) { var ht = sc_properties[sym]; if (ht) { if (key in ht) return ht[key]; else return false; } else return false; } /*** META ((export #t)) */ function sc_rempropBang(sym, key) { var ht = sc_properties[sym]; if (ht) delete ht[key]; } /*** META ((export #t)) */ function sc_any2String(o) { return jsstring2string(sc_toDisplayString(o)); } /*** META ((export #t) (peephole (infix 2 2 "===")) (type bool)) */ function sc_isEqv(o1, o2) { return (o1 === o2); } /*** META ((export #t) (peephole (infix 2 2 "===")) (type bool)) */ function sc_isEq(o1, o2) { return (o1 === o2); } /*** META ((export #t) (type bool)) */ function sc_isNumber(n) { return (typeof n === "number"); } /*** META ((export #t) (type bool)) */ function sc_isComplex(n) { return sc_isNumber(n); } /*** META ((export #t) (type bool)) */ function sc_isReal(n) { return sc_isNumber(n); } /*** META ((export #t) (type bool)) */ function sc_isRational(n) { return sc_isReal(n); } /*** META ((export #t) (type bool)) */ function sc_isInteger(n) { return (parseInt(n) === n); } /*** META ((export #t) (type bool) (peephole (postfix ", false"))) */ // we don't have exact numbers... function sc_isExact(n) { return false; } /*** META ((export #t) (peephole (postfix ", true")) (type bool)) */ function sc_isInexact(n) { return true; } /*** META ((export = =fx =fl) (type bool) (peephole (infix 2 2 "==="))) */ function sc_equal(x) { for (var i = 1; i < arguments.length; i++) if (x !== arguments[i]) return false; return true; } /*** META ((export < = arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export > >fx >fl) (type bool) (peephole (infix 2 2 ">"))) */ function sc_greater(x, y) { for (var i = 1; i < arguments.length; i++) { if (x <= arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export <= <=fx <=fl) (type bool) (peephole (infix 2 2 "<="))) */ function sc_lessEqual(x, y) { for (var i = 1; i < arguments.length; i++) { if (x > arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export >= >=fl >=fx) (type bool) (peephole (infix 2 2 ">="))) */ function sc_greaterEqual(x, y) { for (var i = 1; i < arguments.length; i++) { if (x < arguments[i]) return false; x = arguments[i]; } return true; } /*** META ((export #t) (type bool) (peephole (postfix "=== 0"))) */ function sc_isZero(x) { return (x === 0); } /*** META ((export #t) (type bool) (peephole (postfix "> 0"))) */ function sc_isPositive(x) { return (x > 0); } /*** META ((export #t) (type bool) (peephole (postfix "< 0"))) */ function sc_isNegative(x) { return (x < 0); } /*** META ((export #t) (type bool) (peephole (postfix "%2===1"))) */ function sc_isOdd(x) { return (x % 2 === 1); } /*** META ((export #t) (type bool) (peephole (postfix "%2===0"))) */ function sc_isEven(x) { return (x % 2 === 0); } /*** META ((export #t)) */ var sc_max = Math.max; /*** META ((export #t)) */ var sc_min = Math.min; /*** META ((export + +fx +fl) (peephole (infix 0 #f "+" "0"))) */ function sc_plus() { var sum = 0; for (var i = 0; i < arguments.length; i++) sum += arguments[i]; return sum; } /*** META ((export * *fx *fl) (peephole (infix 0 #f "*" "1"))) */ function sc_multi() { var product = 1; for (var i = 0; i < arguments.length; i++) product *= arguments[i]; return product; } /*** META ((export - -fx -fl) (peephole (minus))) */ function sc_minus(x) { if (arguments.length === 1) return -x; else { var res = x; for (var i = 1; i < arguments.length; i++) res -= arguments[i]; return res; } } /*** META ((export / /fl) (peephole (div))) */ function sc_div(x) { if (arguments.length === 1) return 1/x; else { var res = x; for (var i = 1; i < arguments.length; i++) res /= arguments[i]; return res; } } /*** META ((export #t)) */ var sc_abs = Math.abs; /*** META ((export quotient /fx) (peephole (hole 2 "parseInt(" x "/" y ")"))) */ function sc_quotient(x, y) { return parseInt(x / y); } /*** META ((export #t) (peephole (infix 2 2 "%"))) */ function sc_remainder(x, y) { return x % y; } /*** META ((export #t) (peephole (modulo))) */ function sc_modulo(x, y) { var remainder = x % y; // if they don't have the same sign if ((remainder * y) < 0) return remainder + y; else return remainder; } function sc_euclid_gcd(a, b) { var temp; if (a === 0) return b; if (b === 0) return a; if (a < 0) {a = -a;}; if (b < 0) {b = -b;}; if (b > a) {temp = a; a = b; b = temp;}; while (true) { a %= b; if(a === 0) {return b;}; b %= a; if(b === 0) {return a;}; }; return b; } /*** META ((export #t)) */ function sc_gcd() { var gcd = 0; for (var i = 0; i < arguments.length; i++) gcd = sc_euclid_gcd(gcd, arguments[i]); return gcd; } /*** META ((export #t)) */ function sc_lcm() { var lcm = 1; for (var i = 0; i < arguments.length; i++) { var f = Math.round(arguments[i] / sc_euclid_gcd(arguments[i], lcm)); lcm *= Math.abs(f); } return lcm; } // LIMITATION: numerator and denominator don't make sense in floating point world. //var SC_MAX_DECIMALS = 1000000 // // function sc_numerator(x) { // var rounded = Math.round(x * SC_MAX_DECIMALS); // return Math.round(rounded / sc_euclid_gcd(rounded, SC_MAX_DECIMALS)); // } // function sc_denominator(x) { // var rounded = Math.round(x * SC_MAX_DECIMALS); // return Math.round(SC_MAX_DECIMALS / sc_euclid_gcd(rounded, SC_MAX_DECIMALS)); // } /*** META ((export #t)) */ var sc_floor = Math.floor; /*** META ((export #t)) */ var sc_ceiling = Math.ceil; /*** META ((export #t)) */ var sc_truncate = parseInt; /*** META ((export #t)) */ var sc_round = Math.round; // LIMITATION: sc_rationalize doesn't make sense in a floating point world. /*** META ((export #t)) */ var sc_exp = Math.exp; /*** META ((export #t)) */ var sc_log = Math.log; /*** META ((export #t)) */ var sc_sin = Math.sin; /*** META ((export #t)) */ var sc_cos = Math.cos; /*** META ((export #t)) */ var sc_tan = Math.tan; /*** META ((export #t)) */ var sc_asin = Math.asin; /*** META ((export #t)) */ var sc_acos = Math.acos; /*** META ((export #t)) */ var sc_atan = Math.atan; /*** META ((export #t)) */ var sc_sqrt = Math.sqrt; /*** META ((export #t)) */ var sc_expt = Math.pow; // LIMITATION: we don't have complex numbers. // LIMITATION: the following functions are hence not implemented. // LIMITATION: make-rectangular, make-polar, real-part, imag-part, magnitude, angle // LIMITATION: 2 argument atan /*** META ((export #t) (peephole (id))) */ function sc_exact2inexact(x) { return x; } /*** META ((export #t) (peephole (id))) */ function sc_inexact2exact(x) { return x; } function sc_number2jsstring(x, radix) { if (radix) return x.toString(radix); else return x.toString(); } function sc_jsstring2number(s, radix) { if (s === "") return false; if (radix) { var t = parseInt(s, radix); if (!t && t !== 0) return false; // verify that each char is in range. (parseInt ignores leading // white and trailing chars) var allowedChars = "01234567890abcdefghijklmnopqrstuvwxyz".substring(0, radix+1); if ((new RegExp("^["+allowedChars+"]*$", "i")).test(s)) return t; else return false; } else { var t = +s; // does not ignore trailing chars. if (!t && t !== 0) return false; // simply verify that first char is not whitespace. var c = s.charAt(0); // if +c is 0, but the char is not "0", then we have a whitespace. if (+c === 0 && c !== "0") return false; return t; } } /*** META ((export #t) (type bool) (peephole (not))) */ function sc_not(b) { return b === false; } /*** META ((export #t) (type bool)) */ function sc_isBoolean(b) { return (b === true) || (b === false); } function sc_Pair(car, cdr) { this.car = car; this.cdr = cdr; } sc_Pair.prototype.toString = function() { return sc_toDisplayString(this); }; sc_Pair.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) { var current = this; var res = "("; while(true) { res += writeOrDisplay(current.car); if (sc_isPair(current.cdr)) { res += " "; current = current.cdr; } else if (current.cdr !== null) { res += " . " + writeOrDisplay(current.cdr); break; } else // current.cdr == null break; } res += ")"; return res; }; sc_Pair.prototype.sc_toDisplayString = function() { return this.sc_toWriteOrDisplayString(sc_toDisplayString); }; sc_Pair.prototype.sc_toWriteString = function() { return this.sc_toWriteOrDisplayString(sc_toWriteString); }; // sc_Pair.prototype.sc_toWriteCircleString in IO.js /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_Pair"))) */ function sc_isPair(p) { return (p instanceof sc_Pair); } function sc_isPairEqual(p1, p2, comp) { return (comp(p1.car, p2.car) && comp(p1.cdr, p2.cdr)); } /*** META ((export #t) (peephole (hole 2 "new sc_Pair(" car ", " cdr ")"))) */ function sc_cons(car, cdr) { return new sc_Pair(car, cdr); } /*** META ((export cons*)) */ function sc_consStar() { var res = arguments[arguments.length - 1]; for (var i = arguments.length-2; i >= 0; i--) res = new sc_Pair(arguments[i], res); return res; } /*** META ((export #t) (peephole (postfix ".car"))) */ function sc_car(p) { return p.car; } /*** META ((export #t) (peephole (postfix ".cdr"))) */ function sc_cdr(p) { return p.cdr; } /*** META ((export #t) (peephole (hole 2 p ".car = " val))) */ function sc_setCarBang(p, val) { p.car = val; } /*** META ((export #t) (peephole (hole 2 p ".cdr = " val))) */ function sc_setCdrBang(p, val) { p.cdr = val; } /*** META ((export #t) (peephole (postfix ".car.car"))) */ function sc_caar(p) { return p.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.car"))) */ function sc_cadr(p) { return p.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.cdr"))) */ function sc_cdar(p) { return p.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr"))) */ function sc_cddr(p) { return p.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".car.car.car"))) */ function sc_caaar(p) { return p.car.car.car; } /*** META ((export #t) (peephole (postfix ".car.cdr.car"))) */ function sc_cadar(p) { return p.car.cdr.car; } /*** META ((export #t) (peephole (postfix ".cdr.car.car"))) */ function sc_caadr(p) { return p.cdr.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.car"))) */ function sc_caddr(p) { return p.cdr.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.car.cdr"))) */ function sc_cdaar(p) { return p.car.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.car.cdr"))) */ function sc_cdadr(p) { return p.cdr.car.cdr; } /*** META ((export #t) (peephole (postfix ".car.cdr.cdr"))) */ function sc_cddar(p) { return p.car.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr"))) */ function sc_cdddr(p) { return p.cdr.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".car.car.car.car"))) */ function sc_caaaar(p) { return p.car.car.car.car; } /*** META ((export #t) (peephole (postfix ".car.cdr.car.car"))) */ function sc_caadar(p) { return p.car.cdr.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.car.car.car"))) */ function sc_caaadr(p) { return p.cdr.car.car.car; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.car.car"))) */ function sc_caaddr(p) { return p.cdr.cdr.car.car; } /*** META ((export #t) (peephole (postfix ".car.car.car.cdr"))) */ function sc_cdaaar(p) { return p.car.car.car.cdr; } /*** META ((export #t) (peephole (postfix ".car.cdr.car.cdr"))) */ function sc_cdadar(p) { return p.car.cdr.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.car.car.cdr"))) */ function sc_cdaadr(p) { return p.cdr.car.car.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.car.cdr"))) */ function sc_cdaddr(p) { return p.cdr.cdr.car.cdr; } /*** META ((export #t) (peephole (postfix ".car.car.cdr.car"))) */ function sc_cadaar(p) { return p.car.car.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.cdr.cdr.car"))) */ function sc_caddar(p) { return p.car.cdr.cdr.car; } /*** META ((export #t) (peephole (postfix ".cdr.car.cdr.car"))) */ function sc_cadadr(p) { return p.cdr.car.cdr.car; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr.car"))) */ function sc_cadddr(p) { return p.cdr.cdr.cdr.car; } /*** META ((export #t) (peephole (postfix ".car.car.cdr.cdr"))) */ function sc_cddaar(p) { return p.car.car.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".car.cdr.cdr.cdr"))) */ function sc_cdddar(p) { return p.car.cdr.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.car.cdr.cdr"))) */ function sc_cddadr(p) { return p.cdr.car.cdr.cdr; } /*** META ((export #t) (peephole (postfix ".cdr.cdr.cdr.cdr"))) */ function sc_cddddr(p) { return p.cdr.cdr.cdr.cdr; } /*** META ((export #t)) */ function sc_lastPair(l) { if (!sc_isPair(l)) sc_error("sc_lastPair: pair expected"); var res = l; var cdr = l.cdr; while (sc_isPair(cdr)) { res = cdr; cdr = res.cdr; } return res; } /*** META ((export #t) (type bool) (peephole (postfix " === null"))) */ function sc_isNull(o) { return (o === null); } /*** META ((export #t) (type bool)) */ function sc_isList(o) { var rabbit; var turtle; var rabbit = o; var turtle = o; while (true) { if (rabbit === null || (rabbit instanceof sc_Pair && rabbit.cdr === null)) return true; // end of list else if ((rabbit instanceof sc_Pair) && (rabbit.cdr instanceof sc_Pair)) { rabbit = rabbit.cdr.cdr; turtle = turtle.cdr; if (rabbit === turtle) return false; // cycle } else return false; // not pair } } /*** META ((export #t)) */ function sc_list() { var res = null; var a = arguments; for (var i = a.length-1; i >= 0; i--) res = new sc_Pair(a[i], res); return res; } /*** META ((export #t)) */ function sc_iota(num, init) { var res = null; if (!init) init = 0; for (var i = num - 1; i >= 0; i--) res = new sc_Pair(i + init, res); return res; } /*** META ((export #t)) */ function sc_makeList(nbEls, fill) { var res = null; for (var i = 0; i < nbEls; i++) res = new sc_Pair(fill, res); return res; } /*** META ((export #t)) */ function sc_length(l) { var res = 0; while (l !== null) { res++; l = l.cdr; } return res; } /*** META ((export #t)) */ function sc_remq(o, l) { var dummy = { cdr : null }; var tail = dummy; while (l !== null) { if (l.car !== o) { tail.cdr = sc_cons(l.car, null); tail = tail.cdr; } l = l.cdr; } return dummy.cdr; } /*** META ((export #t)) */ function sc_remqBang(o, l) { var dummy = { cdr : null }; var tail = dummy; var needsAssig = true; while (l !== null) { if (l.car === o) { needsAssig = true; } else { if (needsAssig) { tail.cdr = l; needsAssig = false; } tail = l; } l = l.cdr; } tail.cdr = null; return dummy.cdr; } /*** META ((export #t)) */ function sc_delete(o, l) { var dummy = { cdr : null }; var tail = dummy; while (l !== null) { if (!sc_isEqual(l.car, o)) { tail.cdr = sc_cons(l.car, null); tail = tail.cdr; } l = l.cdr; } return dummy.cdr; } /*** META ((export #t)) */ function sc_deleteBang(o, l) { var dummy = { cdr : null }; var tail = dummy; var needsAssig = true; while (l !== null) { if (sc_isEqual(l.car, o)) { needsAssig = true; } else { if (needsAssig) { tail.cdr = l; needsAssig = false; } tail = l; } l = l.cdr; } tail.cdr = null; return dummy.cdr; } function sc_reverseAppendBang(l1, l2) { var res = l2; while (l1 !== null) { var tmp = res; res = l1; l1 = l1.cdr; res.cdr = tmp; } return res; } function sc_dualAppend(l1, l2) { if (l1 === null) return l2; if (l2 === null) return l1; var rev = sc_reverse(l1); return sc_reverseAppendBang(rev, l2); } /*** META ((export #t)) */ function sc_append() { if (arguments.length === 0) return null; var res = arguments[arguments.length - 1]; for (var i = arguments.length - 2; i >= 0; i--) res = sc_dualAppend(arguments[i], res); return res; } function sc_dualAppendBang(l1, l2) { if (l1 === null) return l2; if (l2 === null) return l1; var tmp = l1; while (tmp.cdr !== null) tmp=tmp.cdr; tmp.cdr = l2; return l1; } /*** META ((export #t)) */ function sc_appendBang() { var res = null; for (var i = 0; i < arguments.length; i++) res = sc_dualAppendBang(res, arguments[i]); return res; } /*** META ((export #t)) */ function sc_reverse(l1) { var res = null; while (l1 !== null) { res = sc_cons(l1.car, res); l1 = l1.cdr; } return res; } /*** META ((export #t)) */ function sc_reverseBang(l) { return sc_reverseAppendBang(l, null); } /*** META ((export #t)) */ function sc_listTail(l, k) { var res = l; for (var i = 0; i < k; i++) { res = res.cdr; } return res; } /*** META ((export #t)) */ function sc_listRef(l, k) { return sc_listTail(l, k).car; } /* // unoptimized generic versions function sc_memX(o, l, comp) { while (l != null) { if (comp(l.car, o)) return l; l = l.cdr; } return false; } function sc_memq(o, l) { return sc_memX(o, l, sc_isEq); } function sc_memv(o, l) { return sc_memX(o, l, sc_isEqv); } function sc_member(o, l) { return sc_memX(o, l, sc_isEqual); } */ /* optimized versions */ /*** META ((export #t)) */ function sc_memq(o, l) { while (l !== null) { if (l.car === o) return l; l = l.cdr; } return false; } /*** META ((export #t)) */ function sc_memv(o, l) { while (l !== null) { if (l.car === o) return l; l = l.cdr; } return false; } /*** META ((export #t)) */ function sc_member(o, l) { while (l !== null) { if (sc_isEqual(l.car,o)) return l; l = l.cdr; } return false; } /* // generic unoptimized versions function sc_assX(o, al, comp) { while (al != null) { if (comp(al.car.car, o)) return al.car; al = al.cdr; } return false; } function sc_assq(o, al) { return sc_assX(o, al, sc_isEq); } function sc_assv(o, al) { return sc_assX(o, al, sc_isEqv); } function sc_assoc(o, al) { return sc_assX(o, al, sc_isEqual); } */ // optimized versions /*** META ((export #t)) */ function sc_assq(o, al) { while (al !== null) { if (al.car.car === o) return al.car; al = al.cdr; } return false; } /*** META ((export #t)) */ function sc_assv(o, al) { while (al !== null) { if (al.car.car === o) return al.car; al = al.cdr; } return false; } /*** META ((export #t)) */ function sc_assoc(o, al) { while (al !== null) { if (sc_isEqual(al.car.car, o)) return al.car; al = al.cdr; } return false; } /* can be used for mutable strings and characters */ function sc_isCharStringEqual(cs1, cs2) { return cs1.val === cs2.val; } function sc_isCharStringLess(cs1, cs2) { return cs1.val < cs2.val; } function sc_isCharStringGreater(cs1, cs2) { return cs1.val > cs2.val; } function sc_isCharStringLessEqual(cs1, cs2) { return cs1.val <= cs2.val; } function sc_isCharStringGreaterEqual(cs1, cs2) { return cs1.val >= cs2.val; } function sc_isCharStringCIEqual(cs1, cs2) { return cs1.val.toLowerCase() === cs2.val.toLowerCase(); } function sc_isCharStringCILess(cs1, cs2) { return cs1.val.toLowerCase() < cs2.val.toLowerCase(); } function sc_isCharStringCIGreater(cs1, cs2) { return cs1.val.toLowerCase() > cs2.val.toLowerCase(); } function sc_isCharStringCILessEqual(cs1, cs2) { return cs1.val.toLowerCase() <= cs2.val.toLowerCase(); } function sc_isCharStringCIGreaterEqual(cs1, cs2) { return cs1.val.toLowerCase() >= cs2.val.toLowerCase(); } function sc_Char(c) { var cached = sc_Char.lazy[c]; if (cached) return cached; this.val = c; sc_Char.lazy[c] = this; // add return, so FF does not complain. return undefined; } sc_Char.lazy = new Object(); // thanks to Eric sc_Char.char2readable = { "\000": "#\\null", "\007": "#\\bell", "\010": "#\\backspace", "\011": "#\\tab", "\012": "#\\newline", "\014": "#\\page", "\015": "#\\return", "\033": "#\\escape", "\040": "#\\space", "\177": "#\\delete", /* poeticless names */ "\001": "#\\soh", "\002": "#\\stx", "\003": "#\\etx", "\004": "#\\eot", "\005": "#\\enq", "\006": "#\\ack", "\013": "#\\vt", "\016": "#\\so", "\017": "#\\si", "\020": "#\\dle", "\021": "#\\dc1", "\022": "#\\dc2", "\023": "#\\dc3", "\024": "#\\dc4", "\025": "#\\nak", "\026": "#\\syn", "\027": "#\\etb", "\030": "#\\can", "\031": "#\\em", "\032": "#\\sub", "\033": "#\\esc", "\034": "#\\fs", "\035": "#\\gs", "\036": "#\\rs", "\037": "#\\us"}; sc_Char.readable2char = { "null": "\000", "bell": "\007", "backspace": "\010", "tab": "\011", "newline": "\012", "page": "\014", "return": "\015", "escape": "\033", "space": "\040", "delete": "\000", "soh": "\001", "stx": "\002", "etx": "\003", "eot": "\004", "enq": "\005", "ack": "\006", "bel": "\007", "bs": "\010", "ht": "\011", "nl": "\012", "vt": "\013", "np": "\014", "cr": "\015", "so": "\016", "si": "\017", "dle": "\020", "dc1": "\021", "dc2": "\022", "dc3": "\023", "dc4": "\024", "nak": "\025", "syn": "\026", "etb": "\027", "can": "\030", "em": "\031", "sub": "\032", "esc": "\033", "fs": "\034", "gs": "\035", "rs": "\036", "us": "\037", "sp": "\040", "del": "\177"}; sc_Char.prototype.toString = function() { return this.val; }; // sc_toDisplayString == toString sc_Char.prototype.sc_toWriteString = function() { var entry = sc_Char.char2readable[this.val]; if (entry) return entry; else return "#\\" + this.val; }; /*** META ((export #t) (type bool) (peephole (postfix "instanceof sc_Char"))) */ function sc_isChar(c) { return (c instanceof sc_Char); } /*** META ((export char=?) (type bool) (peephole (hole 2 c1 ".val === " c2 ".val"))) */ var sc_isCharEqual = sc_isCharStringEqual; /*** META ((export char?) (type bool) (peephole (hole 2 c1 ".val > " c2 ".val"))) */ var sc_isCharGreater = sc_isCharStringGreater; /*** META ((export char<=?) (type bool) (peephole (hole 2 c1 ".val <= " c2 ".val"))) */ var sc_isCharLessEqual = sc_isCharStringLessEqual; /*** META ((export char>=?) (type bool) (peephole (hole 2 c1 ".val >= " c2 ".val"))) */ var sc_isCharGreaterEqual = sc_isCharStringGreaterEqual; /*** META ((export char-ci=?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() === " c2 ".val.toLowerCase()"))) */ var sc_isCharCIEqual = sc_isCharStringCIEqual; /*** META ((export char-ci?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() > " c2 ".val.toLowerCase()"))) */ var sc_isCharCIGreater = sc_isCharStringCIGreater; /*** META ((export char-ci<=?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() <= " c2 ".val.toLowerCase()"))) */ var sc_isCharCILessEqual = sc_isCharStringCILessEqual; /*** META ((export char-ci>=?) (type bool) (peephole (hole 2 c1 ".val.toLowerCase() >= " c2 ".val.toLowerCase()"))) */ var sc_isCharCIGreaterEqual = sc_isCharStringCIGreaterEqual; var SC_NUMBER_CLASS = "0123456789"; var SC_WHITESPACE_CLASS = ' \r\n\t\f'; var SC_LOWER_CLASS = 'abcdefghijklmnopqrstuvwxyz'; var SC_UPPER_CLASS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; function sc_isCharOfClass(c, cl) { return (cl.indexOf(c) != -1); } /*** META ((export #t) (type bool)) */ function sc_isCharAlphabetic(c) { return sc_isCharOfClass(c.val, SC_LOWER_CLASS) || sc_isCharOfClass(c.val, SC_UPPER_CLASS); } /*** META ((export #t) (type bool) (peephole (hole 1 "SC_NUMBER_CLASS.indexOf(" c ".val) != -1"))) */ function sc_isCharNumeric(c) { return sc_isCharOfClass(c.val, SC_NUMBER_CLASS); } /*** META ((export #t) (type bool)) */ function sc_isCharWhitespace(c) { var tmp = c.val; return tmp === " " || tmp === "\r" || tmp === "\n" || tmp === "\t" || tmp === "\f"; } /*** META ((export #t) (type bool) (peephole (hole 1 "SC_UPPER_CLASS.indexOf(" c ".val) != -1"))) */ function sc_isCharUpperCase(c) { return sc_isCharOfClass(c.val, SC_UPPER_CLASS); } /*** META ((export #t) (type bool) (peephole (hole 1 "SC_LOWER_CLASS.indexOf(" c ".val) != -1"))) */ function sc_isCharLowerCase(c) { return sc_isCharOfClass(c.val, SC_LOWER_CLASS); } /*** META ((export #t) (peephole (postfix ".val.charCodeAt(0)"))) */ function sc_char2integer(c) { return c.val.charCodeAt(0); } /*** META ((export #t) (peephole (hole 1 "new sc_Char(String.fromCharCode(" n "))"))) */ function sc_integer2char(n) { return new sc_Char(String.fromCharCode(n)); } /*** META ((export #t) (peephole (hole 1 "new sc_Char(" c ".val.toUpperCase())"))) */ function sc_charUpcase(c) { return new sc_Char(c.val.toUpperCase()); } /*** META ((export #t) (peephole (hole 1 "new sc_Char(" c ".val.toLowerCase())"))) */ function sc_charDowncase(c) { return new sc_Char(c.val.toLowerCase()); } function sc_makeJSStringOfLength(k, c) { var fill; if (c === undefined) fill = " "; else fill = c; var res = ""; var len = 1; // every round doubles the size of fill. while (k >= len) { if (k & len) res = res.concat(fill); fill = fill.concat(fill); len *= 2; } return res; } function sc_makejsString(k, c) { var fill; if (c) fill = c.val; else fill = " "; return sc_makeJSStringOfLength(k, fill); } function sc_jsstring2list(s) { var res = null; for (var i = s.length - 1; i >= 0; i--) res = sc_cons(new sc_Char(s.charAt(i)), res); return res; } function sc_list2jsstring(l) { var a = new Array(); while(l !== null) { a.push(l.car.val); l = l.cdr; } return "".concat.apply("", a); } var sc_Vector = Array; sc_Vector.prototype.sc_toWriteOrDisplayString = function(writeOrDisplay) { if (this.length === 0) return "#()"; var res = "#(" + writeOrDisplay(this[0]); for (var i = 1; i < this.length; i++) res += " " + writeOrDisplay(this[i]); res += ")"; return res; }; sc_Vector.prototype.sc_toDisplayString = function() { return this.sc_toWriteOrDisplayString(sc_toDisplayString); }; sc_Vector.prototype.sc_toWriteString = function() { return this.sc_toWriteOrDisplayString(sc_toWriteString); }; /*** META ((export vector? array?) (type bool) (peephole (postfix " instanceof sc_Vector"))) */ function sc_isVector(v) { return (v instanceof sc_Vector); } // only applies to vectors function sc_isVectorEqual(v1, v2, comp) { if (v1.length !== v2.length) return false; for (var i = 0; i < v1.length; i++) if (!comp(v1[i], v2[i])) return false; return true; } /*** META ((export make-vector make-array)) */ function sc_makeVector(size, fill) { var a = new sc_Vector(size); if (fill !== undefined) sc_vectorFillBang(a, fill); return a; } /*** META ((export vector array) (peephole (vector))) */ function sc_vector() { var a = new sc_Vector(); for (var i = 0; i < arguments.length; i++) a.push(arguments[i]); return a; } /*** META ((export vector-length array-length) (peephole (postfix ".length"))) */ function sc_vectorLength(v) { return v.length; } /*** META ((export vector-ref array-ref) (peephole (hole 2 v "[" pos "]"))) */ function sc_vectorRef(v, pos) { return v[pos]; } /*** META ((export vector-set! array-set!) (peephole (hole 3 v "[" pos "] = " val))) */ function sc_vectorSetBang(v, pos, val) { v[pos] = val; } /*** META ((export vector->list array->list)) */ function sc_vector2list(a) { var res = null; for (var i = a.length-1; i >= 0; i--) res = sc_cons(a[i], res); return res; } /*** META ((export list->vector list->array)) */ function sc_list2vector(l) { var a = new sc_Vector(); while(l !== null) { a.push(l.car); l = l.cdr; } return a; } /*** META ((export vector-fill! array-fill!)) */ function sc_vectorFillBang(a, fill) { for (var i = 0; i < a.length; i++) a[i] = fill; } /*** META ((export #t)) */ function sc_copyVector(a, len) { if (len <= a.length) return a.slice(0, len); else { var tmp = a.concat(); tmp.length = len; return tmp; } } /*** META ((export #t) (peephole (hole 3 a ".slice(" start "," end ")"))) */ function sc_vectorCopy(a, start, end) { return a.slice(start, end); } /*** META ((export #t)) */ function sc_vectorCopyBang(target, tstart, source, sstart, send) { if (!sstart) sstart = 0; if (!send) send = source.length; // if target == source we don't want to overwrite not yet copied elements. if (tstart <= sstart) { for (var i = tstart, j = sstart; j < send; i++, j++) { target[i] = source[j]; } } else { var diff = send - sstart; for (var i = tstart + diff - 1, j = send - 1; j >= sstart; i--, j--) { target[i] = source[j]; } } return target; } /*** META ((export #t) (type bool) (peephole (hole 1 "typeof " o " === 'function'"))) */ function sc_isProcedure(o) { return (typeof o === "function"); } /*** META ((export #t)) */ function sc_apply(proc) { var args = new Array(); // first part of arguments are not in list-form. for (var i = 1; i < arguments.length - 1; i++) args.push(arguments[i]); var l = arguments[arguments.length - 1]; while (l !== null) { args.push(l.car); l = l.cdr; } return proc.apply(null, args); } /*** META ((export #t)) */ function sc_map(proc, l1) { if (l1 === undefined) return null; // else var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); var revres = null; while (l1 !== null) { for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } revres = sc_cons(proc.apply(null, applyArgs), revres); } return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_mapBang(proc, l1) { if (l1 === undefined) return null; // else var l1_orig = l1; var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); while (l1 !== null) { var tmp = l1; for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } tmp.car = proc.apply(null, applyArgs); } return l1_orig; } /*** META ((export #t)) */ function sc_forEach(proc, l1) { if (l1 === undefined) return undefined; // else var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); while (l1 !== null) { for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } proc.apply(null, applyArgs); } // add return so FF does not complain. return undefined; } /*** META ((export #t)) */ function sc_filter(proc, l1) { var dummy = { cdr : null }; var tail = dummy; while (l1 !== null) { if (proc(l1.car) !== false) { tail.cdr = sc_cons(l1.car, null); tail = tail.cdr; } l1 = l1.cdr; } return dummy.cdr; } /*** META ((export #t)) */ function sc_filterBang(proc, l1) { var head = sc_cons("dummy", l1); var it = head; var next = l1; while (next !== null) { if (proc(next.car) !== false) { it.cdr = next it = next; } next = next.cdr; } it.cdr = null; return head.cdr; } function sc_filterMap1(proc, l1) { var revres = null; while (l1 !== null) { var tmp = proc(l1.car) if (tmp !== false) revres = sc_cons(tmp, revres); l1 = l1.cdr; } return sc_reverseAppendBang(revres, null); } function sc_filterMap2(proc, l1, l2) { var revres = null; while (l1 !== null) { var tmp = proc(l1.car, l2.car); if(tmp !== false) revres = sc_cons(tmp, revres); l1 = l1.cdr; l2 = l2.cdr } return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_filterMap(proc, l1, l2, l3) { if (l2 === undefined) return sc_filterMap1(proc, l1); else if (l3 === undefined) return sc_filterMap2(proc, l1, l2); // else var nbApplyArgs = arguments.length - 1; var applyArgs = new Array(nbApplyArgs); var revres = null; while (l1 !== null) { for (var i = 0; i < nbApplyArgs; i++) { applyArgs[i] = arguments[i + 1].car; arguments[i + 1] = arguments[i + 1].cdr; } var tmp = proc.apply(null, applyArgs); if(tmp !== false) revres = sc_cons(tmp, revres); } return sc_reverseAppendBang(revres, null); } /*** META ((export #t)) */ function sc_any(proc, l) { var revres = null; while (l !== null) { var tmp = proc(l.car); if(tmp !== false) return tmp; l = l.cdr; } return false; } /*** META ((export any?) (peephole (hole 2 "sc_any(" proc "," l ") !== false"))) */ function sc_anyPred(proc, l) { return sc_any(proc, l)!== false; } /*** META ((export #t)) */ function sc_every(proc, l) { var revres = null; var tmp = true; while (l !== null) { tmp = proc(l.car); if (tmp === false) return false; l = l.cdr; } return tmp; } /*** META ((export every?) (peephole (hole 2 "sc_every(" proc "," l ") !== false"))) */ function sc_everyPred(proc, l) { var tmp = sc_every(proc, l); if (tmp !== false) return true; return false; } /*** META ((export #t) (peephole (postfix "()"))) */ function sc_force(o) { return o(); } /*** META ((export #t)) */ function sc_makePromise(proc) { var isResultReady = false; var result = undefined; return function() { if (!isResultReady) { var tmp = proc(); if (!isResultReady) { isResultReady = true; result = tmp; } } return result; }; } function sc_Values(values) { this.values = values; } /*** META ((export #t) (peephole (values))) */ function sc_values() { if (arguments.length === 1) return arguments[0]; else return new sc_Values(arguments); } /*** META ((export #t)) */ function sc_callWithValues(producer, consumer) { var produced = producer(); if (produced instanceof sc_Values) return consumer.apply(null, produced.values); else return consumer(produced); } /*** META ((export #t)) */ function sc_dynamicWind(before, thunk, after) { before(); try { var res = thunk(); return res; } finally { after(); } } // TODO: eval/scheme-report-environment/null-environment/interaction-environment // LIMITATION: 'load' doesn't exist without files. // LIMITATION: transcript-on/transcript-off doesn't exist without files. function sc_Struct(name) { this.name = name; } sc_Struct.prototype.sc_toDisplayString = function() { return "#"; }; sc_Struct.prototype.sc_toWriteString = sc_Struct.prototype.sc_toDisplayString; /*** META ((export #t) (peephole (hole 1 "new sc_Struct(" name ")"))) */ function sc_makeStruct(name) { return new sc_Struct(name); } /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_Struct"))) */ function sc_isStruct(o) { return (o instanceof sc_Struct); } /*** META ((export #t) (type bool) (peephole (hole 2 "(" 1 " instanceof sc_Struct) && ( " 1 ".name === " 0 ")"))) */ function sc_isStructNamed(name, s) { return ((s instanceof sc_Struct) && (s.name === name)); } /*** META ((export struct-field) (peephole (hole 3 0 "[" 2 "]"))) */ function sc_getStructField(s, name, field) { return s[field]; } /*** META ((export struct-field-set!) (peephole (hole 4 0 "[" 2 "] = " 3))) */ function sc_setStructFieldBang(s, name, field, val) { s[field] = val; } /*** META ((export #t) (peephole (prefix "~"))) */ function sc_bitNot(x) { return ~x; } /*** META ((export #t) (peephole (infix 2 2 "&"))) */ function sc_bitAnd(x, y) { return x & y; } /*** META ((export #t) (peephole (infix 2 2 "|"))) */ function sc_bitOr(x, y) { return x | y; } /*** META ((export #t) (peephole (infix 2 2 "^"))) */ function sc_bitXor(x, y) { return x ^ y; } /*** META ((export #t) (peephole (infix 2 2 "<<"))) */ function sc_bitLsh(x, y) { return x << y; } /*** META ((export #t) (peephole (infix 2 2 ">>"))) */ function sc_bitRsh(x, y) { return x >> y; } /*** META ((export #t) (peephole (infix 2 2 ">>>"))) */ function sc_bitUrsh(x, y) { return x >>> y; } /*** META ((export js-field js-property) (peephole (hole 2 o "[" field "]"))) */ function sc_jsField(o, field) { return o[field]; } /*** META ((export js-field-set! js-property-set!) (peephole (hole 3 o "[" field "] = " val))) */ function sc_setJsFieldBang(o, field, val) { return o[field] = val; } /*** META ((export js-field-delete! js-property-delete!) (peephole (hole 2 "delete" o "[" field "]"))) */ function sc_deleteJsFieldBang(o, field) { delete o[field]; } /*** META ((export #t) (peephole (jsCall))) */ function sc_jsCall(o, fun) { var args = new Array(); for (var i = 2; i < arguments.length; i++) args[i-2] = arguments[i]; return fun.apply(o, args); } /*** META ((export #t) (peephole (jsMethodCall))) */ function sc_jsMethodCall(o, field) { var args = new Array(); for (var i = 2; i < arguments.length; i++) args[i-2] = arguments[i]; return o[field].apply(o, args); } /*** META ((export new js-new) (peephole (jsNew))) */ function sc_jsNew(c) { var evalStr = "new c("; evalStr +=arguments.length > 1? "arguments[1]": ""; for (var i = 2; i < arguments.length; i++) evalStr += ", arguments[" + i + "]"; evalStr +=")"; return eval(evalStr); } // ======================== RegExp ==================== /*** META ((export #t)) */ function sc_pregexp(re) { return new RegExp(sc_string2jsstring(re)); } /*** META ((export #t)) */ function sc_pregexpMatch(re, s) { var reg = (re instanceof RegExp) ? re : sc_pregexp(re); var tmp = reg.exec(sc_string2jsstring(s)); if (tmp == null) return false; var res = null; for (var i = tmp.length-1; i >= 0; i--) { if (tmp[i] !== null) { res = sc_cons(sc_jsstring2string(tmp[i]), res); } else { res = sc_cons(false, res); } } return res; } /*** META ((export #t)) */ function sc_pregexpReplace(re, s1, s2) { var reg; var jss1 = sc_string2jsstring(s1); var jss2 = sc_string2jsstring(s2); if (re instanceof RegExp) { if (re.global) reg = re; else reg = new RegExp(re.source); } else { reg = new RegExp(sc_string2jsstring(re)); } return jss1.replace(reg, jss2); } /*** META ((export pregexp-replace*)) */ function sc_pregexpReplaceAll(re, s1, s2) { var reg; var jss1 = sc_string2jsstring(s1); var jss2 = sc_string2jsstring(s2); if (re instanceof RegExp) { if (re.global) reg = re; else reg = new RegExp(re.source, "g"); } else { reg = new RegExp(sc_string2jsstring(re), "g"); } return jss1.replace(reg, jss2); } /*** META ((export #t)) */ function sc_pregexpSplit(re, s) { var reg = ((re instanceof RegExp) ? re : new RegExp(sc_string2jsstring(re))); var jss = sc_string2jsstring(s); var tmp = jss.split(reg); if (tmp == null) return false; return sc_vector2list(tmp); } /* =========================================================================== */ /* Other library stuff */ /* =========================================================================== */ /*** META ((export #t) (peephole (hole 1 "Math.floor(Math.random()*" 'n ")"))) */ function sc_random(n) { return Math.floor(Math.random()*n); } /*** META ((export current-date) (peephole (hole 0 "new Date()"))) */ function sc_currentDate() { return new Date(); } function sc_Hashtable() { } sc_Hashtable.prototype.toString = function() { return "#{%hashtable}"; }; // sc_toWriteString == sc_toDisplayString == toString function sc_HashtableElement(key, val) { this.key = key; this.val = val; } /*** META ((export #t) (peephole (hole 0 "new sc_Hashtable()"))) */ function sc_makeHashtable() { return new sc_Hashtable(); } /*** META ((export #t)) */ function sc_hashtablePutBang(ht, key, val) { var hash = sc_hash(key); ht[hash] = new sc_HashtableElement(key, val); } /*** META ((export #t)) */ function sc_hashtableGet(ht, key) { var hash = sc_hash(key); if (hash in ht) return ht[hash].val; else return false; } /*** META ((export #t)) */ function sc_hashtableForEach(ht, f) { for (var v in ht) { if (ht[v] instanceof sc_HashtableElement) f(ht[v].key, ht[v].val); } } /*** META ((export hashtable-contains?) (peephole (hole 2 "sc_hash(" 1 ") in " 0))) */ function sc_hashtableContains(ht, key) { var hash = sc_hash(key); if (hash in ht) return true; else return false; } var SC_HASH_COUNTER = 0; function sc_hash(o) { if (o === null) return "null"; else if (o === undefined) return "undefined"; else if (o === true) return "true"; else if (o === false) return "false"; else if (typeof o === "number") return "num-" + o; else if (typeof o === "string") return "jsstr-" + o; else if (o.sc_getHash) return o.sc_getHash(); else return sc_counterHash.call(o); } function sc_counterHash() { if (!this.sc_hash) { this.sc_hash = "hash-" + SC_HASH_COUNTER; SC_HASH_COUNTER++; } return this.sc_hash; } function sc_Trampoline(args, maxTailCalls) { this['__trampoline return__'] = true; this.args = args; this.MAX_TAIL_CALLs = maxTailCalls; } // TODO: call/cc stuff sc_Trampoline.prototype.restart = function() { var o = this; while (true) { // set both globals. SC_TAIL_OBJECT.calls = o.MAX_TAIL_CALLs-1; var fun = o.args.callee; var res = fun.apply(SC_TAIL_OBJECT, o.args); if (res instanceof sc_Trampoline) o = res; else return res; } } /*** META ((export bind-exit-lambda)) */ function sc_bindExitLambda(proc) { var escape_obj = new sc_BindExitException(); var escape = function(res) { escape_obj.res = res; throw escape_obj; }; try { return proc(escape); } catch(e) { if (e === escape_obj) { return e.res; } throw e; } } function sc_BindExitException() { this._internalException = true; } var SC_SCM2JS_GLOBALS = new Object(); // default tail-call depth. // normally the program should set it again. but just in case... var SC_TAIL_OBJECT = new Object(); SC_SCM2JS_GLOBALS.TAIL_OBJECT = SC_TAIL_OBJECT; // ======================== I/O ======================= /*------------------------------------------------------------------*/ function sc_EOF() { } var SC_EOF_OBJECT = new sc_EOF(); function sc_Port() { } /* --------------- Input ports -------------------------------------*/ function sc_InputPort() { } sc_InputPort.prototype = new sc_Port(); sc_InputPort.prototype.peekChar = function() { if (!("peeked" in this)) this.peeked = this.getNextChar(); return this.peeked; } sc_InputPort.prototype.readChar = function() { var tmp = this.peekChar(); delete this.peeked; return tmp; } sc_InputPort.prototype.isCharReady = function() { return true; } sc_InputPort.prototype.close = function() { // do nothing } /* .............. String port ..........................*/ function sc_ErrorInputPort() { }; sc_ErrorInputPort.prototype = new sc_InputPort(); sc_ErrorInputPort.prototype.getNextChar = function() { throw "can't read from error-port."; }; sc_ErrorInputPort.prototype.isCharReady = function() { return false; }; /* .............. String port ..........................*/ function sc_StringInputPort(jsStr) { // we are going to do some charAts on the str. // instead of recreating all the time a String-object, we // create one in the beginning. (not sure, if this is really an optim) this.str = new String(jsStr); this.pos = 0; } sc_StringInputPort.prototype = new sc_InputPort(); sc_StringInputPort.prototype.getNextChar = function() { if (this.pos >= this.str.length) return SC_EOF_OBJECT; return this.str.charAt(this.pos++); }; /* ------------- Read and other lib-funs -------------------------------*/ function sc_Token(type, val, pos) { this.type = type; this.val = val; this.pos = pos; } sc_Token.EOF = 0/*EOF*/; sc_Token.OPEN_PAR = 1/*OPEN_PAR*/; sc_Token.CLOSE_PAR = 2/*CLOSE_PAR*/; sc_Token.OPEN_BRACE = 3/*OPEN_BRACE*/; sc_Token.CLOSE_BRACE = 4/*CLOSE_BRACE*/; sc_Token.OPEN_BRACKET = 5/*OPEN_BRACKET*/; sc_Token.CLOSE_BRACKET = 6/*CLOSE_BRACKET*/; sc_Token.WHITESPACE = 7/*WHITESPACE*/; sc_Token.QUOTE = 8/*QUOTE*/; sc_Token.ID = 9/*ID*/; sc_Token.DOT = 10/*DOT*/; sc_Token.STRING = 11/*STRING*/; sc_Token.NUMBER = 12/*NUMBER*/; sc_Token.ERROR = 13/*ERROR*/; sc_Token.VECTOR_BEGIN = 14/*VECTOR_BEGIN*/; sc_Token.TRUE = 15/*TRUE*/; sc_Token.FALSE = 16/*FALSE*/; sc_Token.UNSPECIFIED = 17/*UNSPECIFIED*/; sc_Token.REFERENCE = 18/*REFERENCE*/; sc_Token.STORE = 19/*STORE*/; sc_Token.CHAR = 20/*CHAR*/; var SC_ID_CLASS = SC_LOWER_CLASS + SC_UPPER_CLASS + "!$%*+-./:<=>?@^_~"; function sc_Tokenizer(port) { this.port = port; } sc_Tokenizer.prototype.peekToken = function() { if (this.peeked) return this.peeked; var newToken = this.nextToken(); this.peeked = newToken; return newToken; }; sc_Tokenizer.prototype.readToken = function() { var tmp = this.peekToken(); delete this.peeked; return tmp; }; sc_Tokenizer.prototype.nextToken = function() { var port = this.port; function isNumberChar(c) { return (c >= "0" && c <= "9"); }; function isIdOrNumberChar(c) { return SC_ID_CLASS.indexOf(c) != -1 || // ID-char (c >= "0" && c <= "9"); } function isWhitespace(c) { return c === " " || c === "\r" || c === "\n" || c === "\t" || c === "\f"; }; function isWhitespaceOrEOF(c) { return isWhitespace(c) || c === SC_EOF_OBJECT; }; function readString() { res = ""; while (true) { var c = port.readChar(); switch (c) { case '"': return new sc_Token(11/*STRING*/, res); case "\\": var tmp = port.readChar(); switch (tmp) { case '0': res += "\0"; break; case 'a': res += "\a"; break; case 'b': res += "\b"; break; case 'f': res += "\f"; break; case 'n': res += "\n"; break; case 'r': res += "\r"; break; case 't': res += "\t"; break; case 'v': res += "\v"; break; case '"': res += '"'; break; case '\\': res += '\\'; break; case 'x': /* hexa-number */ var nb = 0; while (true) { var hexC = port.peekChar(); if (hexC >= '0' && hexC <= '9') { port.readChar(); nb = nb * 16 + hexC.charCodeAt(0) - '0'.charCodeAt(0); } else if (hexC >= 'a' && hexC <= 'f') { port.readChar(); nb = nb * 16 + hexC.charCodeAt(0) - 'a'.charCodeAt(0); } else if (hexC >= 'A' && hexC <= 'F') { port.readChar(); nb = nb * 16 + hexC.charCodeAt(0) - 'A'.charCodeAt(0); } else { // next char isn't part of hex. res += String.fromCharCode(nb); break; } } break; default: if (tmp === SC_EOF_OBJECT) { return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res); } res += tmp; } break; default: if (c === SC_EOF_OBJECT) { return new sc_Token(13/*ERROR*/, "unclosed string-literal" + res); } res += c; } } }; function readIdOrNumber(firstChar) { var res = firstChar; while (isIdOrNumberChar(port.peekChar())) res += port.readChar(); if (isNaN(res)) return new sc_Token(9/*ID*/, res); else return new sc_Token(12/*NUMBER*/, res - 0); }; function skipWhitespaceAndComments() { var done = false; while (!done) { done = true; while (isWhitespace(port.peekChar())) port.readChar(); if (port.peekChar() === ';') { port.readChar(); done = false; while (true) { curChar = port.readChar(); if (curChar === SC_EOF_OBJECT || curChar === '\n') break; } } } }; function readDot() { if (isWhitespace(port.peekChar())) return new sc_Token(10/*DOT*/); else return readIdOrNumber("."); }; function readSharp() { var c = port.readChar(); if (isWhitespace(c)) return new sc_Token(13/*ERROR*/, "bad #-pattern0."); // reference if (isNumberChar(c)) { var nb = c - 0; while (isNumberChar(port.peekChar())) nb = nb*10 + (port.readChar() - 0); switch (port.readChar()) { case '#': return new sc_Token(18/*REFERENCE*/, nb); case '=': return new sc_Token(19/*STORE*/, nb); default: return new sc_Token(13/*ERROR*/, "bad #-pattern1." + nb); } } if (c === "(") return new sc_Token(14/*VECTOR_BEGIN*/); if (c === "\\") { // character var tmp = "" while (!isWhitespaceOrEOF(port.peekChar())) tmp += port.readChar(); switch (tmp.length) { case 0: // it's escaping a whitespace char: if (sc_isEOFObject(port.peekChar)) return new sc_Token(13/*ERROR*/, "bad #-pattern2."); else return new sc_Token(20/*CHAR*/, port.readChar()); case 1: return new sc_Token(20/*CHAR*/, tmp); default: var entry = sc_Char.readable2char[tmp.toLowerCase()]; if (entry) return new sc_Token(20/*CHAR*/, entry); else return new sc_Token(13/*ERROR*/, "unknown character description: #\\" + tmp); } } // some constants (#t, #f, #unspecified) var res; var needing; switch (c) { case 't': res = new sc_Token(15/*TRUE*/, true); needing = ""; break; case 'f': res = new sc_Token(16/*FALSE*/, false); needing = ""; break; case 'u': res = new sc_Token(17/*UNSPECIFIED*/, undefined); needing = "nspecified"; break; default: return new sc_Token(13/*ERROR*/, "bad #-pattern3: " + c); } while(true) { c = port.peekChar(); if ((isWhitespaceOrEOF(c) || c === ')') && needing == "") return res; else if (isWhitespace(c) || needing == "") return new sc_Token(13/*ERROR*/, "bad #-pattern4 " + c + " " + needing); else if (needing.charAt(0) == c) { port.readChar(); // consume needing = needing.slice(1); } else return new sc_Token(13/*ERROR*/, "bad #-pattern5"); } }; skipWhitespaceAndComments(); var curChar = port.readChar(); if (curChar === SC_EOF_OBJECT) return new sc_Token(0/*EOF*/, curChar); switch (curChar) { case " ": case "\n": case "\t": return readWhitespace(); case "(": return new sc_Token(1/*OPEN_PAR*/); case ")": return new sc_Token(2/*CLOSE_PAR*/); case "{": return new sc_Token(3/*OPEN_BRACE*/); case "}": return new sc_Token(4/*CLOSE_BRACE*/); case "[": return new sc_Token(5/*OPEN_BRACKET*/); case "]": return new sc_Token(6/*CLOSE_BRACKET*/); case "'": return new sc_Token(8/*QUOTE*/); case "#": return readSharp(); case ".": return readDot(); case '"': return readString(); default: if (isIdOrNumberChar(curChar)) return readIdOrNumber(curChar); throw "unexpected character: " + curChar; } }; function sc_Reader(tokenizer) { this.tokenizer = tokenizer; this.backref = new Array(); } sc_Reader.prototype.read = function() { function readList(listBeginType) { function matchesPeer(open, close) { return open === 1/*OPEN_PAR*/ && close === 2/*CLOSE_PAR*/ || open === 3/*OPEN_BRACE*/ && close === 4/*CLOSE_BRACE*/ || open === 5/*OPEN_BRACKET*/ && close === 6/*CLOSE_BRACKET*/; }; var res = null; while (true) { var token = tokenizer.peekToken(); switch (token.type) { case 2/*CLOSE_PAR*/: case 4/*CLOSE_BRACE*/: case 6/*CLOSE_BRACKET*/: if (matchesPeer(listBeginType, token.type)) { tokenizer.readToken(); // consume token return sc_reverseBang(res); } else throw "closing par doesn't match: " + listBeginType + " " + listEndType; case 0/*EOF*/: throw "unexpected end of file"; case 10/*DOT*/: tokenizer.readToken(); // consume token var cdr = this.read(); var par = tokenizer.readToken(); if (!matchesPeer(listBeginType, par.type)) throw "closing par doesn't match: " + listBeginType + " " + par.type; else return sc_reverseAppendBang(res, cdr); default: res = sc_cons(this.read(), res); } } }; function readQuote() { return sc_cons("quote", sc_cons(this.read(), null)); }; function readVector() { // opening-parenthesis is already consumed var a = new Array(); while (true) { var token = tokenizer.peekToken(); switch (token.type) { case 2/*CLOSE_PAR*/: tokenizer.readToken(); return a; default: a.push(this.read()); } } }; function storeRefence(nb) { var tmp = this.read(); this.backref[nb] = tmp; return tmp; }; function readReference(nb) { if (nb in this.backref) return this.backref[nb]; else throw "bad reference: " + nb; }; var tokenizer = this.tokenizer; var token = tokenizer.readToken(); // handle error if (token.type === 13/*ERROR*/) throw token.val; switch (token.type) { case 1/*OPEN_PAR*/: case 3/*OPEN_BRACE*/: case 5/*OPEN_BRACKET*/: return readList.call(this, token.type); case 8/*QUOTE*/: return readQuote.call(this); case 11/*STRING*/: return sc_jsstring2string(token.val); case 20/*CHAR*/: return new sc_Char(token.val); case 14/*VECTOR_BEGIN*/: return readVector.call(this); case 18/*REFERENCE*/: return readReference.call(this, token.val); case 19/*STORE*/: return storeRefence.call(this, token.val); case 9/*ID*/: return sc_jsstring2symbol(token.val); case 0/*EOF*/: case 12/*NUMBER*/: case 15/*TRUE*/: case 16/*FALSE*/: case 17/*UNSPECIFIED*/: return token.val; default: throw "unexpected token " + token.type + " " + token.val; } }; /*** META ((export #t)) */ function sc_read(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... var reader = new sc_Reader(new sc_Tokenizer(port)); return reader.read(); } /*** META ((export #t)) */ function sc_readChar(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... var t = port.readChar(); return t === SC_EOF_OBJECT? t: new sc_Char(t); } /*** META ((export #t)) */ function sc_peekChar(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... var t = port.peekChar(); return t === SC_EOF_OBJECT? t: new sc_Char(t); } /*** META ((export #t) (type bool)) */ function sc_isCharReady(port) { if (port === undefined) // we assume the port hasn't been given. port = SC_DEFAULT_IN; // THREAD: shared var... return port.isCharReady(); } /*** META ((export #t) (peephole (postfix ".close()"))) */ function sc_closeInputPort(p) { return p.close(); } /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_InputPort"))) */ function sc_isInputPort(o) { return (o instanceof sc_InputPort); } /*** META ((export eof-object?) (type bool) (peephole (postfix " === SC_EOF_OBJECT"))) */ function sc_isEOFObject(o) { return o === SC_EOF_OBJECT; } /*** META ((export #t) (peephole (hole 0 "SC_DEFAULT_IN"))) */ function sc_currentInputPort() { return SC_DEFAULT_IN; } /* ------------ file operations are not supported -----------*/ /*** META ((export #t)) */ function sc_callWithInputFile(s, proc) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_callWithOutputFile(s, proc) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_withInputFromFile(s, thunk) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_withOutputToFile(s, thunk) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_openInputFile(s) { throw "can't open " + s; } /*** META ((export #t)) */ function sc_openOutputFile(s) { throw "can't open " + s; } /* ----------------------------------------------------------------------------*/ /*** META ((export #t)) */ function sc_basename(p) { var i = p.lastIndexOf('/'); if(i >= 0) return p.substring(i + 1, p.length); else return ''; } /*** META ((export #t)) */ function sc_dirname(p) { var i = p.lastIndexOf('/'); if(i >= 0) return p.substring(0, i); else return ''; } /* ----------------------------------------------------------------------------*/ /*** META ((export #t)) */ function sc_withInputFromPort(p, thunk) { try { var tmp = SC_DEFAULT_IN; // THREAD: shared var. SC_DEFAULT_IN = p; return thunk(); } finally { SC_DEFAULT_IN = tmp; } } /*** META ((export #t)) */ function sc_withInputFromString(s, thunk) { return sc_withInputFromPort(new sc_StringInputPort(sc_string2jsstring(s)), thunk); } /*** META ((export #t)) */ function sc_withOutputToPort(p, thunk) { try { var tmp = SC_DEFAULT_OUT; // THREAD: shared var. SC_DEFAULT_OUT = p; return thunk(); } finally { SC_DEFAULT_OUT = tmp; } } /*** META ((export #t)) */ function sc_withOutputToString(thunk) { var p = new sc_StringOutputPort(); sc_withOutputToPort(p, thunk); return p.close(); } /*** META ((export #t)) */ function sc_withOutputToProcedure(proc, thunk) { var t = function(s) { proc(sc_jsstring2string(s)); }; return sc_withOutputToPort(new sc_GenericOutputPort(t), thunk); } /*** META ((export #t) (peephole (hole 0 "new sc_StringOutputPort()"))) */ function sc_openOutputString() { return new sc_StringOutputPort(); } /*** META ((export #t)) */ function sc_openInputString(str) { return new sc_StringInputPort(sc_string2jsstring(str)); } /* ----------------------------------------------------------------------------*/ function sc_OutputPort() { } sc_OutputPort.prototype = new sc_Port(); sc_OutputPort.prototype.appendJSString = function(obj) { /* do nothing */ } sc_OutputPort.prototype.close = function() { /* do nothing */ } function sc_StringOutputPort() { this.res = ""; } sc_StringOutputPort.prototype = new sc_OutputPort(); sc_StringOutputPort.prototype.appendJSString = function(s) { this.res += s; } sc_StringOutputPort.prototype.close = function() { return sc_jsstring2string(this.res); } /*** META ((export #t)) */ function sc_getOutputString(sp) { return sc_jsstring2string(sp.res); } function sc_ErrorOutputPort() { } sc_ErrorOutputPort.prototype = new sc_OutputPort(); sc_ErrorOutputPort.prototype.appendJSString = function(s) { throw "don't write on ErrorPort!"; } sc_ErrorOutputPort.prototype.close = function() { /* do nothing */ } function sc_GenericOutputPort(appendJSString, close) { this.appendJSString = appendJSString; if (close) this.close = close; } sc_GenericOutputPort.prototype = new sc_OutputPort(); /*** META ((export #t) (type bool) (peephole (postfix " instanceof sc_OutputPort"))) */ function sc_isOutputPort(o) { return (o instanceof sc_OutputPort); } /*** META ((export #t) (peephole (postfix ".close()"))) */ function sc_closeOutputPort(p) { return p.close(); } /* ------------------ write ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_write(o, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(sc_toWriteString(o)); } function sc_toWriteString(o) { if (o === null) return "()"; else if (o === true) return "#t"; else if (o === false) return "#f"; else if (o === undefined) return "#unspecified"; else if (typeof o === 'function') return "#"; else if (o.sc_toWriteString) return o.sc_toWriteString(); else return o.toString(); } function sc_escapeWriteString(s) { var res = ""; var j = 0; for (i = 0; i < s.length; i++) { switch (s.charAt(i)) { case "\0": res += s.substring(j, i) + "\\0"; j = i + 1; break; case "\b": res += s.substring(j, i) + "\\b"; j = i + 1; break; case "\f": res += s.substring(j, i) + "\\f"; j = i + 1; break; case "\n": res += s.substring(j, i) + "\\n"; j = i + 1; break; case "\r": res += s.substring(j, i) + "\\r"; j = i + 1; break; case "\t": res += s.substring(j, i) + "\\t"; j = i + 1; break; case "\v": res += s.substring(j, i) + "\\v"; j = i + 1; break; case '"': res += s.substring(j, i) + '\\"'; j = i + 1; break; case "\\": res += s.substring(j, i) + "\\\\"; j = i + 1; break; default: var c = s.charAt(i); if ("\a" !== "a" && c == "\a") { res += s.substring(j, i) + "\\a"; j = i + 1; continue; } if ("\v" !== "v" && c == "\v") { res += s.substring(j, i) + "\\v"; j = i + 1; continue; } //if (s.charAt(i) < ' ' || s.charCodeAt(i) > 127) { // CARE: Manuel is this OK with HOP? if (s.charAt(i) < ' ') { /* non printable character and special chars */ res += s.substring(j, i) + "\\x" + s.charCodeAt(i).toString(16); j = i + 1; } // else just let i increase... } } res += s.substring(j, i); return res; } /* ------------------ display ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_display(o, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(sc_toDisplayString(o)); } function sc_toDisplayString(o) { if (o === null) return "()"; else if (o === true) return "#t"; else if (o === false) return "#f"; else if (o === undefined) return "#unspecified"; else if (typeof o === 'function') return "#"; else if (o.sc_toDisplayString) return o.sc_toDisplayString(); else return o.toString(); } /* ------------------ newline ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_newline(p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString("\n"); } /* ------------------ write-char ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_writeChar(c, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(c.val); } /* ------------------ write-circle ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_writeCircle(o, p) { if (p === undefined) // we assume not given p = SC_DEFAULT_OUT; p.appendJSString(sc_toWriteCircleString(o)); } function sc_toWriteCircleString(o) { var symb = sc_gensym("writeCircle"); var nbPointer = new Object(); nbPointer.nb = 0; sc_prepWriteCircle(o, symb, nbPointer); return sc_genToWriteCircleString(o, symb); } function sc_prepWriteCircle(o, symb, nbPointer) { // TODO sc_Struct if (o instanceof sc_Pair || o instanceof sc_Vector) { if (o[symb] !== undefined) { // not the first visit. o[symb]++; // unless there is already a number, assign one. if (!o[symb + "nb"]) o[symb + "nb"] = nbPointer.nb++; return; } o[symb] = 0; if (o instanceof sc_Pair) { sc_prepWriteCircle(o.car, symb, nbPointer); sc_prepWriteCircle(o.cdr, symb, nbPointer); } else { for (var i = 0; i < o.length; i++) sc_prepWriteCircle(o[i], symb, nbPointer); } } } function sc_genToWriteCircleString(o, symb) { if (!(o instanceof sc_Pair || o instanceof sc_Vector)) return sc_toWriteString(o); return o.sc_toWriteCircleString(symb); } sc_Pair.prototype.sc_toWriteCircleString = function(symb, inList) { if (this[symb + "use"]) { // use-flag is set. Just use it. var nb = this[symb + "nb"]; if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } if (inList) return '. #' + nb + '#'; else return '#' + nb + '#'; } if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } var res = ""; if (this[symb] !== undefined) { // implies > 0 this[symb + "use"] = true; if (inList) res += '. #' + this[symb + "nb"] + '='; else res += '#' + this[symb + "nb"] + '='; inList = false; } if (!inList) res += "("; // print car res += sc_genToWriteCircleString(this.car, symb); if (sc_isPair(this.cdr)) { res += " " + this.cdr.sc_toWriteCircleString(symb, true); } else if (this.cdr !== null) { res += " . " + sc_genToWriteCircleString(this.cdr, symb); } if (!inList) res += ")"; return res; }; sc_Vector.prototype.sc_toWriteCircleString = function(symb) { if (this[symb + "use"]) { // use-flag is set. Just use it. var nb = this[symb + "nb"]; if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } return '#' + nb + '#'; } if (this[symb]-- === 0) { // if we are the last use. remove all fields. delete this[symb]; delete this[symb + "nb"]; delete this[symb + "use"]; } var res = ""; if (this[symb] !== undefined) { // implies > 0 this[symb + "use"] = true; res += '#' + this[symb + "nb"] + '='; } res += "#("; for (var i = 0; i < this.length; i++) { res += sc_genToWriteCircleString(this[i], symb); if (i < this.length - 1) res += " "; } res += ")"; return res; }; /* ------------------ print ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_print(s) { if (arguments.length === 1) { sc_display(s); sc_newline(); } else { for (var i = 0; i < arguments.length; i++) sc_display(arguments[i]); sc_newline(); } } /* ------------------ format ---------------------------------------------------*/ /*** META ((export #t)) */ function sc_format(s, args) { var len = s.length; var p = new sc_StringOutputPort(); var i = 0, j = 1; while( i < len ) { var i2 = s.indexOf("~", i); if (i2 == -1) { p.appendJSString( s.substring( i, len ) ); return p.close(); } else { if (i2 > i) { if (i2 == (len - 1)) { p.appendJSString(s.substring(i, len)); return p.close(); } else { p.appendJSString(s.substring(i, i2)); i = i2; } } switch(s.charCodeAt(i2 + 1)) { case 65: case 97: // a sc_display(arguments[j], p); i += 2; j++; break; case 83: case 115: // s sc_write(arguments[j], p); i += 2; j++; break; case 86: case 118: // v sc_display(arguments[j], p); p.appendJSString("\n"); i += 2; j++; break; case 67: case 99: // c p.appendJSString(String.fromCharCode(arguments[j])); i += 2; j++; break; case 88: case 120: // x p.appendJSString(arguments[j].toString(6)); i += 2; j++; break; case 79: case 111: // o p.appendJSString(arguments[j].toString(8)); i += 2; j++; break; case 66: case 98: // b p.appendJSString(arguments[j].toString(2)); i += 2; j++; break; case 37: case 110: // %, n p.appendJSString("\n"); i += 2; break; case 114: // r p.appendJSString("\r"); i += 2; break; case 126: // ~ p.appendJSString("~"); i += 2; break; default: sc_error( "format: illegal ~" + String.fromCharCode(s.charCodeAt(i2 + 1)) + " sequence" ); return ""; } } } return p.close(); } /* ------------------ global ports ---------------------------------------------------*/ var SC_DEFAULT_IN = new sc_ErrorInputPort(); var SC_DEFAULT_OUT = new sc_ErrorOutputPort(); var SC_ERROR_OUT = new sc_ErrorOutputPort(); var sc_SYMBOL_PREFIX = "\u1E9C"; var sc_KEYWORD_PREFIX = "\u1E9D"; /*** META ((export #t) (peephole (id))) */ function sc_jsstring2string(s) { return s; } /*** META ((export #t) (peephole (prefix "'\\u1E9C' +"))) */ function sc_jsstring2symbol(s) { return sc_SYMBOL_PREFIX + s; } /*** META ((export #t) (peephole (id))) */ function sc_string2jsstring(s) { return s; } /*** META ((export #t) (peephole (symbol2jsstring_immutable))) */ function sc_symbol2jsstring(s) { return s.slice(1); } /*** META ((export #t) (peephole (postfix ".slice(1)"))) */ function sc_keyword2jsstring(k) { return k.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9D' +"))) */ function sc_jsstring2keyword(s) { return sc_KEYWORD_PREFIX + s; } /*** META ((export #t) (type bool)) */ function sc_isKeyword(s) { return (typeof s === "string") && (s.charAt(0) === sc_KEYWORD_PREFIX); } /*** META ((export #t)) */ var sc_gensym = function() { var counter = 1000; return function(sym) { counter++; if (!sym) sym = sc_SYMBOL_PREFIX; return sym + "s" + counter + "~" + "^sC-GeNsYm "; }; }(); /*** META ((export #t) (type bool)) */ function sc_isEqual(o1, o2) { return ((o1 === o2) || (sc_isPair(o1) && sc_isPair(o2) && sc_isPairEqual(o1, o2, sc_isEqual)) || (sc_isVector(o1) && sc_isVector(o2) && sc_isVectorEqual(o1, o2, sc_isEqual))); } /*** META ((export number->symbol integer->symbol)) */ function sc_number2symbol(x, radix) { return sc_SYMBOL_PREFIX + sc_number2jsstring(x, radix); } /*** META ((export number->string integer->string)) */ var sc_number2string = sc_number2jsstring; /*** META ((export #t)) */ function sc_symbol2number(s, radix) { return sc_jsstring2number(s.slice(1), radix); } /*** META ((export #t)) */ var sc_string2number = sc_jsstring2number; /*** META ((export #t) (peephole (prefix "+" s))) ;; peephole will only apply if no radix is given. */ function sc_string2integer(s, radix) { if (!radix) return +s; return parseInt(s, radix); } /*** META ((export #t) (peephole (prefix "+"))) */ function sc_string2real(s) { return +s; } /*** META ((export #t) (type bool)) */ function sc_isSymbol(s) { return (typeof s === "string") && (s.charAt(0) === sc_SYMBOL_PREFIX); } /*** META ((export #t) (peephole (symbol2string_immutable))) */ function sc_symbol2string(s) { return s.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9C' +"))) */ function sc_string2symbol(s) { return sc_SYMBOL_PREFIX + s; } /*** META ((export symbol-append) (peephole (symbolAppend_immutable))) */ function sc_symbolAppend() { var res = sc_SYMBOL_PREFIX; for (var i = 0; i < arguments.length; i++) res += arguments[i].slice(1); return res; } /*** META ((export #t) (peephole (postfix ".val"))) */ function sc_char2string(c) { return c.val; } /*** META ((export #t) (peephole (hole 1 "'\\u1E9C' + " c ".val"))) */ function sc_char2symbol(c) { return sc_SYMBOL_PREFIX + c.val; } /*** META ((export #t) (type bool)) */ function sc_isString(s) { return (typeof s === "string") && (s.charAt(0) !== sc_SYMBOL_PREFIX); } /*** META ((export #t)) */ var sc_makeString = sc_makejsString; /*** META ((export #t)) */ function sc_string() { for (var i = 0; i < arguments.length; i++) arguments[i] = arguments[i].val; return "".concat.apply("", arguments); } /*** META ((export #t) (peephole (postfix ".length"))) */ function sc_stringLength(s) { return s.length; } /*** META ((export #t)) */ function sc_stringRef(s, k) { return new sc_Char(s.charAt(k)); } /* there's no stringSet in the immutable version function sc_stringSet(s, k, c) */ /*** META ((export string=?) (type bool) (peephole (hole 2 str1 " === " str2))) */ function sc_isStringEqual(s1, s2) { return s1 === s2; } /*** META ((export string?) (type bool) (peephole (hole 2 str1 " > " str2))) */ function sc_isStringGreater(s1, s2) { return s1 > s2; } /*** META ((export string<=?) (type bool) (peephole (hole 2 str1 " <= " str2))) */ function sc_isStringLessEqual(s1, s2) { return s1 <= s2; } /*** META ((export string>=?) (type bool) (peephole (hole 2 str1 " >= " str2))) */ function sc_isStringGreaterEqual(s1, s2) { return s1 >= s2; } /*** META ((export string-ci=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() === " str2 ".toLowerCase()"))) */ function sc_isStringCIEqual(s1, s2) { return s1.toLowerCase() === s2.toLowerCase(); } /*** META ((export string-ci?) (type bool) (peephole (hole 2 str1 ".toLowerCase() > " str2 ".toLowerCase()"))) */ function sc_isStringCIGreater(s1, s2) { return s1.toLowerCase() > s2.toLowerCase(); } /*** META ((export string-ci<=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() <= " str2 ".toLowerCase()"))) */ function sc_isStringCILessEqual(s1, s2) { return s1.toLowerCase() <= s2.toLowerCase(); } /*** META ((export string-ci>=?) (type bool) (peephole (hole 2 str1 ".toLowerCase() >= " str2 ".toLowerCase()"))) */ function sc_isStringCIGreaterEqual(s1, s2) { return s1.toLowerCase() >= s2.toLowerCase(); } /*** META ((export #t) (peephole (hole 3 s ".substring(" start ", " end ")"))) */ function sc_substring(s, start, end) { return s.substring(start, end); } /*** META ((export #t)) */ function sc_isSubstring_at(s1, s2, i) { return s2 == s1.substring(i, i+ s2.length); } /*** META ((export #t) (peephole (infix 0 #f "+" "''"))) */ function sc_stringAppend() { return "".concat.apply("", arguments); } /*** META ((export #t)) */ var sc_string2list = sc_jsstring2list; /*** META ((export #t)) */ var sc_list2string = sc_list2jsstring; /*** META ((export #t) (peephole (id))) */ function sc_stringCopy(s) { return s; } /* there's no string-fill in the immutable version function sc_stringFill(s, c) */ /*** META ((export #t) (peephole (postfix ".slice(1)"))) */ function sc_keyword2string(o) { return o.slice(1); } /*** META ((export #t) (peephole (prefix "'\\u1E9D' +"))) */ function sc_string2keyword(o) { return sc_KEYWORD_PREFIX + o; } String.prototype.sc_toDisplayString = function() { if (this.charAt(0) === sc_SYMBOL_PREFIX) // TODO: care for symbols with spaces (escape-chars symbols). return this.slice(1); else if (this.charAt(0) === sc_KEYWORD_PREFIX) return ":" + this.slice(1); else return this.toString(); }; String.prototype.sc_toWriteString = function() { if (this.charAt(0) === sc_SYMBOL_PREFIX) // TODO: care for symbols with spaces (escape-chars symbols). return this.slice(1); else if (this.charAt(0) === sc_KEYWORD_PREFIX) return ":" + this.slice(1); else return '"' + sc_escapeWriteString(this) + '"'; }; /* Exported Variables */ var BgL_testzd2boyerzd2; var BgL_nboyerzd2benchmarkzd2; var BgL_setupzd2boyerzd2; /* End Exports */ var translate_term_nboyer; var translate_args_nboyer; var untranslate_term_nboyer; var BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer; var BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer; var translate_alist_nboyer; var apply_subst_nboyer; var apply_subst_lst_nboyer; var tautologyp_nboyer; var if_constructor_nboyer; var rewrite_count_nboyer; var rewrite_nboyer; var rewrite_args_nboyer; var unify_subst_nboyer; var one_way_unify1_nboyer; var false_term_nboyer; var true_term_nboyer; var trans_of_implies1_nboyer; var is_term_equal_nboyer; var is_term_member_nboyer; var const_nboyer; var sc_const_3_nboyer; var sc_const_4_nboyer; { (sc_const_4_nboyer = (new sc_Pair("\u1E9Cimplies",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cu",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cw",null)))))),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cw",null)))))),null))))))); (sc_const_3_nboyer = sc_list((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccompile",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Ccodegen",(new sc_Pair((new sc_Pair("\u1E9Coptimize",(new sc_Pair("\u1E9Cform",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreaterp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clesseqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cboolean",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ciff",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ceven1",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Codd",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccountps-",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccountps-loop",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cpred",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfact-",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfact-loop",(new sc_Pair("\u1E9Ci",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdivides",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-true",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassume-false",(new sc_Pair("\u1E9Cvar",(new sc_Pair("\u1E9Calist",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cvar",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))),(new sc_Pair("\u1E9Calist",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctautology-checker",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctautologyp",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfalsify",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfalsify1",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime1",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cx",null)))),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair("\u1E9Cp",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cimplies",(new sc_Pair("\u1E9Cp",(new sc_Pair("\u1E9Cq",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cp",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cq",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair((new sc_Pair("\u1E9Cf",null)),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Ct",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))))),(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",(new sc_Pair("\u1E9Ce",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cc",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cplus-fringe",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cexec",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cpds",(new sc_Pair("\u1E9Cenvrn",null)))))))),(new sc_Pair("\u1E9Cenvrn",null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmc-flatten",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Cintersect",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Ck",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ck",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair((new sc_Pair("\u1E9Cexp",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ck",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Cy",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Creverse-loop",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Csort-lp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ccount-list",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus1",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cl",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Ci",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cbase",null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cj",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cj",(new sc_Pair((1),null)))))),null)))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Ci",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cpower-eval",(new sc_Pair((new sc_Pair("\u1E9Cbig-plus",(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cpower-rep",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Cbase",null)))))))))),(new sc_Pair("\u1E9Cbase",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cj",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Ca",null)))),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cw",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cx",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cc",null)))))),null)))))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cb",(new sc_Pair("\u1E9Cc",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cz",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Cgcd",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair((new sc_Pair("\u1E9Cnormalize",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cvalue",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cy",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnlistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csamefringe",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((1),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair((new sc_Pair("\u1E9Cgreatest-factor",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ctimes-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cprime-list",(new sc_Pair("\u1E9Cy",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Cz",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cz",null)))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cz",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cw",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cgreatereqp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cor",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cand",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cy",(new sc_Pair((1),null)))))),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((1),null)))))),(new sc_Pair(sc_list("\u1E9Cand", (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair("\u1E9Cb",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Ca",null)))), (new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cb",null)))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csub1",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cl",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cl",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cl",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdsort",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Csort2",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx1",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx2",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx3",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx4",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx5",(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair("\u1E9Cx6",(new sc_Pair("\u1E9Cx7",null)))))),null)))))),null)))))),null)))))),null)))))),null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((6),(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cx7",null)))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((2),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair("\u1E9Cy",(new sc_Pair((2),null)))))),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Csigma",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ci",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Ci",null)))),null)))))),(new sc_Pair((2),null)))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cz",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnot",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cz",null)))),null)))))),null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair((new sc_Pair("\u1E9Cdelete",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmeaning",(new sc_Pair((new sc_Pair("\u1E9Cplus-tree",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair("\u1E9Ca",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cadd1",(new sc_Pair("\u1E9Cy",null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cnumberp",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cnth",(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Ci",null)))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Cb",null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Ca",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Clast",(new sc_Pair("\u1E9Ca",null)))),null)))),(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair("\u1E9Cb",null)))))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clessp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ct",null)),(new sc_Pair("\u1E9Cz",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cf",null)),(new sc_Pair("\u1E9Cz",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Cassignedp",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Ca",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cassignment",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cb",null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccar",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cgopher",(new sc_Pair("\u1E9Cx",null)))),null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Clistp",(new sc_Pair("\u1E9Cx",null)))),(new sc_Pair((new sc_Pair("\u1E9Ccdr",(new sc_Pair((new sc_Pair("\u1E9Cflatten",(new sc_Pair("\u1E9Cx",null)))),null)))),(new sc_Pair((new sc_Pair("\u1E9Ccons",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cquotient",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cx",null)))))),(new sc_Pair("\u1E9Cy",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Czerop",(new sc_Pair("\u1E9Cy",null)))),(new sc_Pair((new sc_Pair("\u1E9Czero",null)),(new sc_Pair((new sc_Pair("\u1E9Cfix",(new sc_Pair("\u1E9Cx",null)))),null)))))))),null)))))), (new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair((new sc_Pair("\u1E9Cset",(new sc_Pair("\u1E9Ci",(new sc_Pair("\u1E9Cval",(new sc_Pair("\u1E9Cmem",null)))))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cif",(new sc_Pair((new sc_Pair("\u1E9Ceqp",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Ci",null)))))),(new sc_Pair("\u1E9Cval",(new sc_Pair((new sc_Pair("\u1E9Cget",(new sc_Pair("\u1E9Cj",(new sc_Pair("\u1E9Cmem",null)))))),null)))))))),null)))))))); (const_nboyer = (new sc_Pair((new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair((new sc_Pair("\u1E9Czero",null)),null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cy",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair((new sc_Pair("\u1E9Ctimes",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Cc",(new sc_Pair("\u1E9Cd",null)))))),null)))))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cz",(new sc_Pair("\u1E9Cf",(new sc_Pair((new sc_Pair("\u1E9Creverse",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair((new sc_Pair("\u1E9Cappend",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cnil",null)),null)))))),null)))),null)))))),(new sc_Pair((new sc_Pair("\u1E9Cu",(new sc_Pair("\u1E9Cequal",(new sc_Pair((new sc_Pair("\u1E9Cplus",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cdifference",(new sc_Pair("\u1E9Cx",(new sc_Pair("\u1E9Cy",null)))))),null)))))))),(new sc_Pair((new sc_Pair("\u1E9Cw",(new sc_Pair("\u1E9Clessp",(new sc_Pair((new sc_Pair("\u1E9Cremainder",(new sc_Pair("\u1E9Ca",(new sc_Pair("\u1E9Cb",null)))))),(new sc_Pair((new sc_Pair("\u1E9Cmember",(new sc_Pair("\u1E9Ca",(new sc_Pair((new sc_Pair("\u1E9Clength",(new sc_Pair("\u1E9Cb",null)))),null)))))),null)))))))),null))))))))))); BgL_nboyerzd2benchmarkzd2 = function() { var args = null; for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { args = sc_cons(arguments[sc_tmp], args); } var n; return ((n = ((args === null)?(0):(args.car))), (BgL_setupzd2boyerzd2()), (BgL_runzd2benchmarkzd2(("nboyer"+(sc_number2string(n))), (1), function() { return (BgL_testzd2boyerzd2(n)); }, function(rewrites) { if ((sc_isNumber(rewrites))) switch (n) { case (0): return (rewrites===(95024)); break; case (1): return (rewrites===(591777)); break; case (2): return (rewrites===(1813975)); break; case (3): return (rewrites===(5375678)); break; case (4): return (rewrites===(16445406)); break; case (5): return (rewrites===(51507739)); break; default: return true; break; } else return false; }))); }; BgL_setupzd2boyerzd2 = function() { return true; }; BgL_testzd2boyerzd2 = function() { return true; }; translate_term_nboyer = function(term) { var lst; return (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((translate_term_nboyer((lst.car))), (translate_args_nboyer((lst.cdr)))))))))); }; translate_args_nboyer = function(lst) { var sc_lst_5; var term; return ((lst === null)?null:(new sc_Pair(((term = (lst.car)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))), ((sc_lst_5 = (lst.cdr)), ((sc_lst_5 === null)?null:(new sc_Pair((translate_term_nboyer((sc_lst_5.car))), (translate_args_nboyer((sc_lst_5.cdr)))))))))); }; untranslate_term_nboyer = function(term) { var optrOpnd; var tail1131; var L1127; var falseHead1130; var symbol_record; if (!(term instanceof sc_Pair)) return term; else { (falseHead1130 = (new sc_Pair(null, null))); (L1127 = (term.cdr)); (tail1131 = falseHead1130); while (!(L1127 === null)) { { (tail1131.cdr = (new sc_Pair((untranslate_term_nboyer((L1127.car))), null))); (tail1131 = (tail1131.cdr)); (L1127 = (L1127.cdr)); } } (optrOpnd = (falseHead1130.cdr)); return (new sc_Pair(((symbol_record = (term.car)), (symbol_record[(0)])), optrOpnd)); } }; BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer = function(sym) { var r; var x; return ((x = (sc_assq(sym, BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), ((x!== false)?(x.cdr):((r = [sym, null]), (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = (new sc_Pair((new sc_Pair(sym, r)), BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer))), r))); }; (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null); translate_alist_nboyer = function(alist) { var sc_alist_6; var term; return ((alist === null)?null:(new sc_Pair((new sc_Pair((alist.car.car), ((term = (alist.car.cdr)), (!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr))))))))), ((sc_alist_6 = (alist.cdr)), ((sc_alist_6 === null)?null:(new sc_Pair((new sc_Pair((sc_alist_6.car.car), (translate_term_nboyer((sc_alist_6.car.cdr))))), (translate_alist_nboyer((sc_alist_6.cdr)))))))))); }; apply_subst_nboyer = function(alist, term) { var lst; var temp_temp; return (!(term instanceof sc_Pair)?((temp_temp = (sc_assq(term, alist))), ((temp_temp!== false)?(temp_temp.cdr):term)):(new sc_Pair((term.car), ((lst = (term.cdr)), ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), (apply_subst_lst_nboyer(alist, (lst.cdr)))))))))); }; apply_subst_lst_nboyer = function(alist, lst) { var sc_lst_7; return ((lst === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (lst.car))), ((sc_lst_7 = (lst.cdr)), ((sc_lst_7 === null)?null:(new sc_Pair((apply_subst_nboyer(alist, (sc_lst_7.car))), (apply_subst_lst_nboyer(alist, (sc_lst_7.cdr)))))))))); }; tautologyp_nboyer = function(sc_x_11, true_lst, false_lst) { var tmp1125; var x; var tmp1126; var sc_x_8; var sc_tmp1125_9; var sc_tmp1126_10; var sc_x_11; var true_lst; var false_lst; while (true) { if ((((sc_tmp1126_10 = (is_term_equal_nboyer(sc_x_11, true_term_nboyer))), ((sc_tmp1126_10!== false)?sc_tmp1126_10:(is_term_member_nboyer(sc_x_11, true_lst))))!== false)) return true; else if ((((sc_tmp1125_9 = (is_term_equal_nboyer(sc_x_11, false_term_nboyer))), ((sc_tmp1125_9!== false)?sc_tmp1125_9:(is_term_member_nboyer(sc_x_11, false_lst))))!== false)) return false; else if (!(sc_x_11 instanceof sc_Pair)) return false; else if (((sc_x_11.car)===if_constructor_nboyer)) if ((((sc_x_8 = (sc_x_11.cdr.car)), (tmp1126 = (is_term_equal_nboyer(sc_x_8, true_term_nboyer))), ((tmp1126!== false)?tmp1126:(is_term_member_nboyer(sc_x_8, true_lst))))!== false)) (sc_x_11 = (sc_x_11.cdr.cdr.car)); else if ((((x = (sc_x_11.cdr.car)), (tmp1125 = (is_term_equal_nboyer(x, false_term_nboyer))), ((tmp1125!== false)?tmp1125:(is_term_member_nboyer(x, false_lst))))!== false)) (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car)); else if (((tautologyp_nboyer((sc_x_11.cdr.cdr.car), (new sc_Pair((sc_x_11.cdr.car), true_lst)), false_lst))!== false)) { (false_lst = (new sc_Pair((sc_x_11.cdr.car), false_lst))); (sc_x_11 = (sc_x_11.cdr.cdr.cdr.car)); } else return false; else return false; } }; (if_constructor_nboyer = "\u1E9C*"); (rewrite_count_nboyer = (0)); rewrite_nboyer = function(term) { var term2; var sc_term_12; var lst; var symbol_record; var sc_lst_13; { (++rewrite_count_nboyer); if (!(term instanceof sc_Pair)) return term; else { (sc_term_12 = (new sc_Pair((term.car), ((sc_lst_13 = (term.cdr)), ((sc_lst_13 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_13.car))), (rewrite_args_nboyer((sc_lst_13.cdr)))))))))); (lst = ((symbol_record = (term.car)), (symbol_record[(1)]))); while (true) { if ((lst === null)) return sc_term_12; else if ((((term2 = ((lst.car).cdr.car)), (unify_subst_nboyer = null), (one_way_unify1_nboyer(sc_term_12, term2)))!== false)) return (rewrite_nboyer((apply_subst_nboyer(unify_subst_nboyer, ((lst.car).cdr.cdr.car))))); else (lst = (lst.cdr)); } } } }; rewrite_args_nboyer = function(lst) { var sc_lst_14; return ((lst === null)?null:(new sc_Pair((rewrite_nboyer((lst.car))), ((sc_lst_14 = (lst.cdr)), ((sc_lst_14 === null)?null:(new sc_Pair((rewrite_nboyer((sc_lst_14.car))), (rewrite_args_nboyer((sc_lst_14.cdr)))))))))); }; (unify_subst_nboyer = "\u1E9C*"); one_way_unify1_nboyer = function(term1, term2) { var lst1; var lst2; var temp_temp; if (!(term2 instanceof sc_Pair)) { (temp_temp = (sc_assq(term2, unify_subst_nboyer))); if ((temp_temp!== false)) return (is_term_equal_nboyer(term1, (temp_temp.cdr))); else if ((sc_isNumber(term2))) return (sc_isEqual(term1, term2)); else { (unify_subst_nboyer = (new sc_Pair((new sc_Pair(term2, term1)), unify_subst_nboyer))); return true; } } else if (!(term1 instanceof sc_Pair)) return false; else if (((term1.car)===(term2.car))) { (lst1 = (term1.cdr)); (lst2 = (term2.cdr)); while (true) { if ((lst1 === null)) return (lst2 === null); else if ((lst2 === null)) return false; else if (((one_way_unify1_nboyer((lst1.car), (lst2.car)))!== false)) { (lst1 = (lst1.cdr)); (lst2 = (lst2.cdr)); } else return false; } } else return false; }; (false_term_nboyer = "\u1E9C*"); (true_term_nboyer = "\u1E9C*"); trans_of_implies1_nboyer = function(n) { var sc_n_15; return ((sc_isEqual(n, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (n-(1)), n)), ((sc_n_15 = (n-(1))), ((sc_isEqual(sc_n_15, (1)))?(sc_list("\u1E9Cimplies", (0), (1))):(sc_list("\u1E9Cand", (sc_list("\u1E9Cimplies", (sc_n_15-(1)), sc_n_15)), (trans_of_implies1_nboyer((sc_n_15-(1))))))))))); }; is_term_equal_nboyer = function(x, y) { var lst1; var lst2; var r2; var r1; if ((x instanceof sc_Pair)) if ((y instanceof sc_Pair)) if ((((r1 = (x.car)), (r2 = (y.car)), (r1===r2))!== false)) { (lst1 = (x.cdr)); (lst2 = (y.cdr)); while (true) { if ((lst1 === null)) return (lst2 === null); else if ((lst2 === null)) return false; else if (((is_term_equal_nboyer((lst1.car), (lst2.car)))!== false)) { (lst1 = (lst1.cdr)); (lst2 = (lst2.cdr)); } else return false; } } else return false; else return false; else return (sc_isEqual(x, y)); }; is_term_member_nboyer = function(x, lst) { var x; var lst; while (true) { if ((lst === null)) return false; else if (((is_term_equal_nboyer(x, (lst.car)))!== false)) return true; else (lst = (lst.cdr)); } }; BgL_setupzd2boyerzd2 = function() { var symbol_record; var value; var BgL_sc_symbolzd2record_16zd2; var sym; var sc_sym_17; var term; var lst; var sc_term_18; var sc_term_19; { (BgL_sc_za2symbolzd2recordszd2alistza2_2z00_nboyer = null); (if_constructor_nboyer = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer("\u1E9Cif"))); (false_term_nboyer = ((sc_term_19 = (new sc_Pair("\u1E9Cf",null))), (!(sc_term_19 instanceof sc_Pair)?sc_term_19:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_19.car))), (translate_args_nboyer((sc_term_19.cdr)))))))); (true_term_nboyer = ((sc_term_18 = (new sc_Pair("\u1E9Ct",null))), (!(sc_term_18 instanceof sc_Pair)?sc_term_18:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_18.car))), (translate_args_nboyer((sc_term_18.cdr)))))))); (lst = sc_const_3_nboyer); while (!(lst === null)) { { (term = (lst.car)); if (((term instanceof sc_Pair)&&(((term.car)==="\u1E9Cequal")&&((term.cdr.car) instanceof sc_Pair)))) { (sc_sym_17 = ((term.cdr.car).car)); (value = (new sc_Pair((!(term instanceof sc_Pair)?term:(new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((term.car))), (translate_args_nboyer((term.cdr)))))), ((sym = ((term.cdr.car).car)), (BgL_sc_symbolzd2record_16zd2 = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sym))), (BgL_sc_symbolzd2record_16zd2[(1)]))))); (symbol_record = (BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer(sc_sym_17))); (symbol_record[(1)] = value); } else (sc_error("ADD-LEMMA did not like term: ", term)); (lst = (lst.cdr)); } } return true; } }; BgL_testzd2boyerzd2 = function(n) { var optrOpnd; var term; var sc_n_20; var answer; var sc_term_21; var sc_term_22; { (rewrite_count_nboyer = (0)); (term = sc_const_4_nboyer); (sc_n_20 = n); while (!(sc_n_20=== 0)) { { (term = (sc_list("\u1E9Cor", term, (new sc_Pair("\u1E9Cf",null))))); (--sc_n_20); } } (sc_term_22 = term); if (!(sc_term_22 instanceof sc_Pair)) (optrOpnd = sc_term_22); else (optrOpnd = (new sc_Pair((BgL_sc_symbolzd2ze3symbolzd2record_1ze3_nboyer((sc_term_22.car))), (translate_args_nboyer((sc_term_22.cdr)))))); (sc_term_21 = (apply_subst_nboyer(((const_nboyer === null)?null:(new sc_Pair((new sc_Pair((const_nboyer.car.car), (translate_term_nboyer((const_nboyer.car.cdr))))), (translate_alist_nboyer((const_nboyer.cdr)))))), optrOpnd))); (answer = (tautologyp_nboyer((rewrite_nboyer(sc_term_21)), null, null))); (sc_write(rewrite_count_nboyer)); (sc_display(" rewrites")); (sc_newline()); if ((answer!== false)) return rewrite_count_nboyer; else return false; } }; } /* Exported Variables */ var BgL_parsezd2ze3nbzd2treesze3; var BgL_earleyzd2benchmarkzd2; var BgL_parsezd2ze3parsedzf3zc2; var test; var BgL_parsezd2ze3treesz31; var BgL_makezd2parserzd2; /* End Exports */ var const_earley; { (const_earley = (new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair((new sc_Pair("\u1E9Ca",null)),(new sc_Pair((new sc_Pair("\u1E9Cs",(new sc_Pair("\u1E9Cs",null)))),null)))))),null))); BgL_makezd2parserzd2 = function(grammar, lexer) { var i; var parser_descr; var def_loop; var nb_nts; var names; var steps; var predictors; var enders; var starters; var nts; var sc_names_1; var sc_steps_2; var sc_predictors_3; var sc_enders_4; var sc_starters_5; var nb_confs; var BgL_sc_defzd2loop_6zd2; var BgL_sc_nbzd2nts_7zd2; var sc_nts_8; var BgL_sc_defzd2loop_9zd2; var ind; { ind = function(nt, sc_nts_10) { var i; { (i = ((sc_nts_10.length)-(1))); while (true) { if ((i>=(0))) if ((sc_isEqual((sc_nts_10[i]), nt))) return i; else (--i); else return false; } } }; (sc_nts_8 = ((BgL_sc_defzd2loop_9zd2 = function(defs, sc_nts_11) { var rule_loop; var head; var def; return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, sc_nts_12) { var nt; var l; var sc_nts_13; var rule; if ((rules instanceof sc_Pair)) { (rule = (rules.car)); (l = rule); (sc_nts_13 = sc_nts_12); while ((l instanceof sc_Pair)) { { (nt = (l.car)); (l = (l.cdr)); (sc_nts_13 = (((sc_member(nt, sc_nts_13))!== false)?sc_nts_13:(new sc_Pair(nt, sc_nts_13)))); } } return (rule_loop((rules.cdr), sc_nts_13)); } else return (BgL_sc_defzd2loop_9zd2((defs.cdr), sc_nts_12)); }), (rule_loop((def.cdr), (((sc_member(head, sc_nts_11))!== false)?sc_nts_11:(new sc_Pair(head, sc_nts_11)))))):(sc_list2vector((sc_reverse(sc_nts_11))))); }), (BgL_sc_defzd2loop_9zd2(grammar, null)))); (BgL_sc_nbzd2nts_7zd2 = (sc_nts_8.length)); (nb_confs = (((BgL_sc_defzd2loop_6zd2 = function(defs, BgL_sc_nbzd2confs_14zd2) { var rule_loop; var def; return ((defs instanceof sc_Pair)?((def = (defs.car)), (rule_loop = function(rules, BgL_sc_nbzd2confs_15zd2) { var l; var BgL_sc_nbzd2confs_16zd2; var rule; if ((rules instanceof sc_Pair)) { (rule = (rules.car)); (l = rule); (BgL_sc_nbzd2confs_16zd2 = BgL_sc_nbzd2confs_15zd2); while ((l instanceof sc_Pair)) { { (l = (l.cdr)); (++BgL_sc_nbzd2confs_16zd2); } } return (rule_loop((rules.cdr), (BgL_sc_nbzd2confs_16zd2+(1)))); } else return (BgL_sc_defzd2loop_6zd2((defs.cdr), BgL_sc_nbzd2confs_15zd2)); }), (rule_loop((def.cdr), BgL_sc_nbzd2confs_14zd2))):BgL_sc_nbzd2confs_14zd2); }), (BgL_sc_defzd2loop_6zd2(grammar, (0))))+BgL_sc_nbzd2nts_7zd2)); (sc_starters_5 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); (sc_enders_4 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); (sc_predictors_3 = (sc_makeVector(BgL_sc_nbzd2nts_7zd2, null))); (sc_steps_2 = (sc_makeVector(nb_confs, false))); (sc_names_1 = (sc_makeVector(nb_confs, false))); (nts = sc_nts_8); (starters = sc_starters_5); (enders = sc_enders_4); (predictors = sc_predictors_3); (steps = sc_steps_2); (names = sc_names_1); (nb_nts = (sc_nts_8.length)); (i = (nb_nts-(1))); while ((i>=(0))) { { (sc_steps_2[i] = (i-nb_nts)); (sc_names_1[i] = (sc_list((sc_nts_8[i]), (0)))); (sc_enders_4[i] = (sc_list(i))); (--i); } } def_loop = function(defs, conf) { var rule_loop; var head; var def; return ((defs instanceof sc_Pair)?((def = (defs.car)), (head = (def.car)), (rule_loop = function(rules, conf, rule_num) { var i; var sc_i_17; var nt; var l; var sc_conf_18; var sc_i_19; var rule; if ((rules instanceof sc_Pair)) { (rule = (rules.car)); (names[conf] = (sc_list(head, rule_num))); (sc_i_19 = (ind(head, nts))); (starters[sc_i_19] = (new sc_Pair(conf, (starters[sc_i_19])))); (l = rule); (sc_conf_18 = conf); while ((l instanceof sc_Pair)) { { (nt = (l.car)); (steps[sc_conf_18] = (ind(nt, nts))); (sc_i_17 = (ind(nt, nts))); (predictors[sc_i_17] = (new sc_Pair(sc_conf_18, (predictors[sc_i_17])))); (l = (l.cdr)); (++sc_conf_18); } } (steps[sc_conf_18] = ((ind(head, nts))-nb_nts)); (i = (ind(head, nts))); (enders[i] = (new sc_Pair(sc_conf_18, (enders[i])))); return (rule_loop((rules.cdr), (sc_conf_18+(1)), (rule_num+(1)))); } else return (def_loop((defs.cdr), conf)); }), (rule_loop((def.cdr), conf, (1)))):undefined); }; (def_loop(grammar, (sc_nts_8.length))); (parser_descr = [lexer, sc_nts_8, sc_starters_5, sc_enders_4, sc_predictors_3, sc_steps_2, sc_names_1]); return function(input) { var optrOpnd; var sc_optrOpnd_20; var sc_optrOpnd_21; var sc_optrOpnd_22; var loop1; var BgL_sc_stateza2_23za2; var toks; var BgL_sc_nbzd2nts_24zd2; var sc_steps_25; var sc_enders_26; var state_num; var BgL_sc_statesza2_27za2; var states; var i; var conf; var l; var tok_nts; var sc_i_28; var sc_i_29; var l1; var l2; var tok; var tail1129; var L1125; var goal_enders; var BgL_sc_statesza2_30za2; var BgL_sc_nbzd2nts_31zd2; var BgL_sc_nbzd2confs_32zd2; var nb_toks; var goal_starters; var sc_states_33; var BgL_sc_nbzd2confs_34zd2; var BgL_sc_nbzd2toks_35zd2; var sc_toks_36; var falseHead1128; var sc_names_37; var sc_steps_38; var sc_predictors_39; var sc_enders_40; var sc_starters_41; var sc_nts_42; var lexer; var sc_ind_43; var make_states; var BgL_sc_confzd2setzd2getza2_44za2; var conf_set_merge_new_bang; var conf_set_adjoin; var BgL_sc_confzd2setzd2adjoinza2_45za2; var BgL_sc_confzd2setzd2adjoinza2za2_46z00; var conf_set_union; var forw; var is_parsed; var deriv_trees; var BgL_sc_derivzd2treesza2_47z70; var nb_deriv_trees; var BgL_sc_nbzd2derivzd2treesza2_48za2; { sc_ind_43 = function(nt, sc_nts_49) { var i; { (i = ((sc_nts_49.length)-(1))); while (true) { if ((i>=(0))) if ((sc_isEqual((sc_nts_49[i]), nt))) return i; else (--i); else return false; } } }; make_states = function(BgL_sc_nbzd2toks_50zd2, BgL_sc_nbzd2confs_51zd2) { var v; var i; var sc_states_52; { (sc_states_52 = (sc_makeVector((BgL_sc_nbzd2toks_50zd2+(1)), false))); (i = BgL_sc_nbzd2toks_50zd2); while ((i>=(0))) { { (v = (sc_makeVector((BgL_sc_nbzd2confs_51zd2+(1)), false))); (v[(0)] = (-1)); (sc_states_52[i] = v); (--i); } } return sc_states_52; } }; BgL_sc_confzd2setzd2getza2_44za2 = function(state, BgL_sc_statezd2num_53zd2, sc_conf_54) { var conf_set; var BgL_sc_confzd2set_55zd2; return ((BgL_sc_confzd2set_55zd2 = (state[(sc_conf_54+(1))])), ((BgL_sc_confzd2set_55zd2!== false)?BgL_sc_confzd2set_55zd2:((conf_set = (sc_makeVector((BgL_sc_statezd2num_53zd2+(6)), false))), (conf_set[(1)] = (-3)), (conf_set[(2)] = (-1)), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1)), (state[(sc_conf_54+(1))] = conf_set), conf_set))); }; conf_set_merge_new_bang = function(conf_set) { return ((conf_set[((conf_set[(1)])+(5))] = (conf_set[(4)])), (conf_set[(1)] = (conf_set[(3)])), (conf_set[(3)] = (-1)), (conf_set[(4)] = (-1))); }; conf_set_adjoin = function(state, conf_set, sc_conf_56, i) { var tail; return ((tail = (conf_set[(3)])), (conf_set[(i+(5))] = (-1)), (conf_set[(tail+(5))] = i), (conf_set[(3)] = i), ((tail<(0))?((conf_set[(0)] = (state[(0)])), (state[(0)] = sc_conf_56)):undefined)); }; BgL_sc_confzd2setzd2adjoinza2_45za2 = function(sc_states_57, BgL_sc_statezd2num_58zd2, l, i) { var conf_set; var sc_conf_59; var l1; var state; { (state = (sc_states_57[BgL_sc_statezd2num_58zd2])); (l1 = l); while ((l1 instanceof sc_Pair)) { { (sc_conf_59 = (l1.car)); (conf_set = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_58zd2, sc_conf_59))); if (((conf_set[(i+(5))])=== false)) { (conf_set_adjoin(state, conf_set, sc_conf_59, i)); (l1 = (l1.cdr)); } else (l1 = (l1.cdr)); } } return undefined; } }; BgL_sc_confzd2setzd2adjoinza2za2_46z00 = function(sc_states_60, BgL_sc_statesza2_61za2, BgL_sc_statezd2num_62zd2, sc_conf_63, i) { var BgL_sc_confzd2setza2_64z70; var BgL_sc_stateza2_65za2; var conf_set; var state; return ((state = (sc_states_60[BgL_sc_statezd2num_62zd2])), ((((conf_set = (state[(sc_conf_63+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)?((BgL_sc_stateza2_65za2 = (BgL_sc_statesza2_61za2[BgL_sc_statezd2num_62zd2])), (BgL_sc_confzd2setza2_64z70 = (BgL_sc_confzd2setzd2getza2_44za2(BgL_sc_stateza2_65za2, BgL_sc_statezd2num_62zd2, sc_conf_63))), (((BgL_sc_confzd2setza2_64z70[(i+(5))])=== false)?(conf_set_adjoin(BgL_sc_stateza2_65za2, BgL_sc_confzd2setza2_64z70, sc_conf_63, i)):undefined), true):false)); }; conf_set_union = function(state, conf_set, sc_conf_66, other_set) { var i; { (i = (other_set[(2)])); while ((i>=(0))) { if (((conf_set[(i+(5))])=== false)) { (conf_set_adjoin(state, conf_set, sc_conf_66, i)); (i = (other_set[(i+(5))])); } else (i = (other_set[(i+(5))])); } return undefined; } }; forw = function(sc_states_67, BgL_sc_statezd2num_68zd2, sc_starters_69, sc_enders_70, sc_predictors_71, sc_steps_72, sc_nts_73) { var next_set; var next; var conf_set; var ender; var l; var starter_set; var starter; var sc_l_74; var sc_loop1_75; var head; var BgL_sc_confzd2set_76zd2; var BgL_sc_statezd2num_77zd2; var state; var sc_states_78; var preds; var BgL_sc_confzd2set_79zd2; var step; var sc_conf_80; var BgL_sc_nbzd2nts_81zd2; var sc_state_82; { (sc_state_82 = (sc_states_67[BgL_sc_statezd2num_68zd2])); (BgL_sc_nbzd2nts_81zd2 = (sc_nts_73.length)); while (true) { { (sc_conf_80 = (sc_state_82[(0)])); if ((sc_conf_80>=(0))) { (step = (sc_steps_72[sc_conf_80])); (BgL_sc_confzd2set_79zd2 = (sc_state_82[(sc_conf_80+(1))])); (head = (BgL_sc_confzd2set_79zd2[(4)])); (sc_state_82[(0)] = (BgL_sc_confzd2set_79zd2[(0)])); (conf_set_merge_new_bang(BgL_sc_confzd2set_79zd2)); if ((step>=(0))) { (sc_l_74 = (sc_starters_69[step])); while ((sc_l_74 instanceof sc_Pair)) { { (starter = (sc_l_74.car)); (starter_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, starter))); if (((starter_set[(BgL_sc_statezd2num_68zd2+(5))])=== false)) { (conf_set_adjoin(sc_state_82, starter_set, starter, BgL_sc_statezd2num_68zd2)); (sc_l_74 = (sc_l_74.cdr)); } else (sc_l_74 = (sc_l_74.cdr)); } } (l = (sc_enders_70[step])); while ((l instanceof sc_Pair)) { { (ender = (l.car)); if ((((conf_set = (sc_state_82[(ender+(1))])), ((conf_set!== false)?(conf_set[(BgL_sc_statezd2num_68zd2+(5))]):false))!== false)) { (next = (sc_conf_80+(1))); (next_set = (BgL_sc_confzd2setzd2getza2_44za2(sc_state_82, BgL_sc_statezd2num_68zd2, next))); (conf_set_union(sc_state_82, next_set, next, BgL_sc_confzd2set_79zd2)); (l = (l.cdr)); } else (l = (l.cdr)); } } } else { (preds = (sc_predictors_71[(step+BgL_sc_nbzd2nts_81zd2)])); (sc_states_78 = sc_states_67); (state = sc_state_82); (BgL_sc_statezd2num_77zd2 = BgL_sc_statezd2num_68zd2); (BgL_sc_confzd2set_76zd2 = BgL_sc_confzd2set_79zd2); sc_loop1_75 = function(l) { var sc_state_83; var BgL_sc_nextzd2set_84zd2; var sc_next_85; var pred_set; var i; var pred; if ((l instanceof sc_Pair)) { (pred = (l.car)); (i = head); while ((i>=(0))) { { (pred_set = ((sc_state_83 = (sc_states_78[i])), (sc_state_83[(pred+(1))]))); if ((pred_set!== false)) { (sc_next_85 = (pred+(1))); (BgL_sc_nextzd2set_84zd2 = (BgL_sc_confzd2setzd2getza2_44za2(state, BgL_sc_statezd2num_77zd2, sc_next_85))); (conf_set_union(state, BgL_sc_nextzd2set_84zd2, sc_next_85, pred_set)); } (i = (BgL_sc_confzd2set_76zd2[(i+(5))])); } } return (sc_loop1_75((l.cdr))); } else return undefined; }; (sc_loop1_75(preds)); } } else return undefined; } } } }; is_parsed = function(nt, i, j, sc_nts_86, sc_enders_87, sc_states_88) { var conf_set; var state; var sc_conf_89; var l; var BgL_sc_ntza2_90za2; { (BgL_sc_ntza2_90za2 = (sc_ind_43(nt, sc_nts_86))); if ((BgL_sc_ntza2_90za2!== false)) { (sc_nts_86.length); (l = (sc_enders_87[BgL_sc_ntza2_90za2])); while (true) { if ((l instanceof sc_Pair)) { (sc_conf_89 = (l.car)); if ((((state = (sc_states_88[j])), (conf_set = (state[(sc_conf_89+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) return true; else (l = (l.cdr)); } else return false; } } else return false; } }; deriv_trees = function(sc_conf_91, i, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2) { var sc_loop1_98; var prev; var name; return ((name = (sc_names_94[sc_conf_91])), ((name!== false)?((sc_conf_91=(0))) if (((k>=i)&&(((sc_state_99 = (sc_states_96[k])), (conf_set = (sc_state_99[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))) { (prev_trees = (deriv_trees(prev, i, k, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2))); (ender_trees = (deriv_trees(ender, k, j, sc_enders_92, sc_steps_93, sc_names_94, sc_toks_95, sc_states_96, BgL_sc_nbzd2nts_97zd2))); loop3 = function(l3, l2) { var l4; var sc_l2_100; var ender_tree; if ((l3 instanceof sc_Pair)) { (ender_tree = (sc_list((l3.car)))); (l4 = prev_trees); (sc_l2_100 = l2); while ((l4 instanceof sc_Pair)) { { (sc_l2_100 = (new sc_Pair((sc_append((l4.car), ender_tree)), sc_l2_100))); (l4 = (l4.cdr)); } } return (loop3((l3.cdr), sc_l2_100)); } else return (loop2((ender_set[(k+(5))]), l2)); }; return (loop3(ender_trees, l2)); } else (k = (ender_set[(k+(5))])); else return (sc_loop1_98((l1.cdr), l2)); } }; return (loop2((ender_set[(2)]), l2)); } else (l1 = (l1.cdr)); } else return l2; } }), (sc_loop1_98((sc_enders_92[(sc_steps_93[prev])]), null))))); }; BgL_sc_derivzd2treesza2_47z70 = function(nt, i, j, sc_nts_101, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106) { var conf_set; var state; var sc_conf_107; var l; var trees; var BgL_sc_nbzd2nts_108zd2; var BgL_sc_ntza2_109za2; { (BgL_sc_ntza2_109za2 = (sc_ind_43(nt, sc_nts_101))); if ((BgL_sc_ntza2_109za2!== false)) { (BgL_sc_nbzd2nts_108zd2 = (sc_nts_101.length)); (l = (sc_enders_102[BgL_sc_ntza2_109za2])); (trees = null); while ((l instanceof sc_Pair)) { { (sc_conf_107 = (l.car)); if ((((state = (sc_states_106[j])), (conf_set = (state[(sc_conf_107+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) { (l = (l.cdr)); (trees = (sc_append((deriv_trees(sc_conf_107, i, j, sc_enders_102, sc_steps_103, sc_names_104, sc_toks_105, sc_states_106, BgL_sc_nbzd2nts_108zd2)), trees))); } else (l = (l.cdr)); } } return trees; } else return false; } }; nb_deriv_trees = function(sc_conf_110, i, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2) { var sc_loop1_116; var tmp1124; var prev; return ((prev = (sc_conf_110-(1))), ((((tmp1124 = (sc_conf_110=(0))) { if (((k>=i)&&(((state = (sc_states_114[k])), (conf_set = (state[(prev+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false))) { (nb_prev_trees = (nb_deriv_trees(prev, i, k, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2))); (nb_ender_trees = (nb_deriv_trees(ender, k, j, sc_enders_111, sc_steps_112, sc_toks_113, sc_states_114, BgL_sc_nbzd2nts_115zd2))); (k = (ender_set[(k+(5))])); (n +=(nb_prev_trees*nb_ender_trees)); } else (k = (ender_set[(k+(5))])); } return (sc_loop1_116((l.cdr), n)); } else (l = (l.cdr)); } else return sc_n_118; } }), (sc_loop1_116((sc_enders_111[(sc_steps_112[prev])]), (0)))))); }; BgL_sc_nbzd2derivzd2treesza2_48za2 = function(nt, i, j, sc_nts_119, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123) { var conf_set; var state; var sc_conf_124; var l; var nb_trees; var BgL_sc_nbzd2nts_125zd2; var BgL_sc_ntza2_126za2; { (BgL_sc_ntza2_126za2 = (sc_ind_43(nt, sc_nts_119))); if ((BgL_sc_ntza2_126za2!== false)) { (BgL_sc_nbzd2nts_125zd2 = (sc_nts_119.length)); (l = (sc_enders_120[BgL_sc_ntza2_126za2])); (nb_trees = (0)); while ((l instanceof sc_Pair)) { { (sc_conf_124 = (l.car)); if ((((state = (sc_states_123[j])), (conf_set = (state[(sc_conf_124+(1))])), ((conf_set!== false)?(conf_set[(i+(5))]):false))!== false)) { (l = (l.cdr)); (nb_trees = ((nb_deriv_trees(sc_conf_124, i, j, sc_enders_120, sc_steps_121, sc_toks_122, sc_states_123, BgL_sc_nbzd2nts_125zd2))+nb_trees)); } else (l = (l.cdr)); } } return nb_trees; } else return false; } }; (lexer = (parser_descr[(0)])); (sc_nts_42 = (parser_descr[(1)])); (sc_starters_41 = (parser_descr[(2)])); (sc_enders_40 = (parser_descr[(3)])); (sc_predictors_39 = (parser_descr[(4)])); (sc_steps_38 = (parser_descr[(5)])); (sc_names_37 = (parser_descr[(6)])); (falseHead1128 = (new sc_Pair(null, null))); (L1125 = (lexer(input))); (tail1129 = falseHead1128); while (!(L1125 === null)) { { (tok = (L1125.car)); (l1 = (tok.cdr)); (l2 = null); while ((l1 instanceof sc_Pair)) { { (sc_i_29 = (sc_ind_43((l1.car), sc_nts_42))); if ((sc_i_29!== false)) { (l1 = (l1.cdr)); (l2 = (new sc_Pair(sc_i_29, l2))); } else (l1 = (l1.cdr)); } } (sc_optrOpnd_22 = (new sc_Pair((tok.car), (sc_reverse(l2))))); (sc_optrOpnd_21 = (new sc_Pair(sc_optrOpnd_22, null))); (tail1129.cdr = sc_optrOpnd_21); (tail1129 = (tail1129.cdr)); (L1125 = (L1125.cdr)); } } (sc_optrOpnd_20 = (falseHead1128.cdr)); (sc_toks_36 = (sc_list2vector(sc_optrOpnd_20))); (BgL_sc_nbzd2toks_35zd2 = (sc_toks_36.length)); (BgL_sc_nbzd2confs_34zd2 = (sc_steps_38.length)); (sc_states_33 = (make_states(BgL_sc_nbzd2toks_35zd2, BgL_sc_nbzd2confs_34zd2))); (goal_starters = (sc_starters_41[(0)])); (BgL_sc_confzd2setzd2adjoinza2_45za2(sc_states_33, (0), goal_starters, (0))); (forw(sc_states_33, (0), sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_nts_42)); (sc_i_28 = (0)); while ((sc_i_28=(0))) { { (states = sc_states_33); (BgL_sc_statesza2_27za2 = BgL_sc_statesza2_30za2); (state_num = i); (sc_enders_26 = sc_enders_40); (sc_steps_25 = sc_steps_38); (BgL_sc_nbzd2nts_24zd2 = BgL_sc_nbzd2nts_31zd2); (toks = sc_toks_36); (BgL_sc_stateza2_23za2 = (BgL_sc_statesza2_30za2[i])); loop1 = function() { var sc_loop1_127; var prev; var BgL_sc_statesza2_128za2; var sc_states_129; var j; var i; var sc_i_130; var head; var conf_set; var sc_conf_131; { (sc_conf_131 = (BgL_sc_stateza2_23za2[(0)])); if ((sc_conf_131>=(0))) { (conf_set = (BgL_sc_stateza2_23za2[(sc_conf_131+(1))])); (head = (conf_set[(4)])); (BgL_sc_stateza2_23za2[(0)] = (conf_set[(0)])); (conf_set_merge_new_bang(conf_set)); (sc_i_130 = head); while ((sc_i_130>=(0))) { { (i = sc_i_130); (j = state_num); (sc_states_129 = states); (BgL_sc_statesza2_128za2 = BgL_sc_statesza2_27za2); (prev = (sc_conf_131-(1))); if (((sc_conf_131>=BgL_sc_nbzd2nts_24zd2)&&((sc_steps_25[prev])>=(0)))) { sc_loop1_127 = function(l) { var k; var ender_set; var state; var ender; var l; while (true) { if ((l instanceof sc_Pair)) { (ender = (l.car)); (ender_set = ((state = (sc_states_129[j])), (state[(ender+(1))]))); if ((ender_set!== false)) { (k = (ender_set[(2)])); while ((k>=(0))) { { if ((k>=i)) if (((BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, k, prev, i))!== false)) (BgL_sc_confzd2setzd2adjoinza2za2_46z00(sc_states_129, BgL_sc_statesza2_128za2, j, ender, k)); (k = (ender_set[(k+(5))])); } } return (sc_loop1_127((l.cdr))); } else (l = (l.cdr)); } else return undefined; } }; (sc_loop1_127((sc_enders_26[(sc_steps_25[prev])]))); } (sc_i_130 = (conf_set[(sc_i_130+(5))])); } } return (loop1()); } else return undefined; } }; (loop1()); (--i); } } (optrOpnd = BgL_sc_statesza2_30za2); return [sc_nts_42, sc_starters_41, sc_enders_40, sc_predictors_39, sc_steps_38, sc_names_37, sc_toks_36, optrOpnd, is_parsed, BgL_sc_derivzd2treesza2_47z70, BgL_sc_nbzd2derivzd2treesza2_48za2]; } }; } }; BgL_parsezd2ze3parsedzf3zc2 = function(parse, nt, i, j) { var is_parsed; var states; var enders; var nts; return ((nts = (parse[(0)])), (enders = (parse[(2)])), (states = (parse[(7)])), (is_parsed = (parse[(8)])), (is_parsed(nt, i, j, nts, enders, states))); }; BgL_parsezd2ze3treesz31 = function(parse, nt, i, j) { var BgL_sc_derivzd2treesza2_132z70; var states; var toks; var names; var steps; var enders; var nts; return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (names = (parse[(5)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_derivzd2treesza2_132z70 = (parse[(9)])), (BgL_sc_derivzd2treesza2_132z70(nt, i, j, nts, enders, steps, names, toks, states))); }; BgL_parsezd2ze3nbzd2treesze3 = function(parse, nt, i, j) { var BgL_sc_nbzd2derivzd2treesza2_133za2; var states; var toks; var steps; var enders; var nts; return ((nts = (parse[(0)])), (enders = (parse[(2)])), (steps = (parse[(4)])), (toks = (parse[(6)])), (states = (parse[(7)])), (BgL_sc_nbzd2derivzd2treesza2_133za2 = (parse[(10)])), (BgL_sc_nbzd2derivzd2treesza2_133za2(nt, i, j, nts, enders, steps, toks, states))); }; test = function(k) { var x; var p; return ((p = (BgL_makezd2parserzd2(const_earley, function(l) { var sc_x_134; var tail1134; var L1130; var falseHead1133; { (falseHead1133 = (new sc_Pair(null, null))); (tail1134 = falseHead1133); (L1130 = l); while (!(L1130 === null)) { { (tail1134.cdr = (new sc_Pair(((sc_x_134 = (L1130.car)), (sc_list(sc_x_134, sc_x_134))), null))); (tail1134 = (tail1134.cdr)); (L1130 = (L1130.cdr)); } } return (falseHead1133.cdr); } }))), (x = (p((sc_vector2list((sc_makeVector(k, "\u1E9Ca"))))))), (sc_length((BgL_parsezd2ze3treesz31(x, "\u1E9Cs", (0), k))))); }; BgL_earleyzd2benchmarkzd2 = function() { var args = null; for (var sc_tmp = arguments.length - 1; sc_tmp >= 0; sc_tmp--) { args = sc_cons(arguments[sc_tmp], args); } var k; return ((k = ((args === null)?(7):(args.car))), (BgL_runzd2benchmarkzd2("earley", (1), function() { return (test(k)); }, function(result) { return ((sc_display(result)), (sc_newline()), true); }))); }; } /************* END OF GENERATED CODE *************/ // Invoke this function to run a benchmark. // The first argument is a string identifying the benchmark. // The second argument is the number of times to run the benchmark. // The third argument is a function that runs the benchmark. // The fourth argument is a unary function that warns if the result // returned by the benchmark is incorrect. // // Example: // RunBenchmark("new Array()", // 1, // function () { new Array(1000000); } // function (v) { // return (v instanceof Array) && (v.length == 1000000); // }); SC_DEFAULT_OUT = new sc_GenericOutputPort(function(s) {}); SC_ERROR_OUT = SC_DEFAULT_OUT; function RunBenchmark(name, count, run, warn) { for (var n = 0; n < count; ++n) { result = run(); } } var BgL_runzd2benchmarkzd2 = RunBenchmark; mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/v8/raytrace.js0000644000175000017500000030166411545150464021423 0ustar chr1schr1s// The ray tracer code in this file is written by Adam Burmister. It // is available in its original form from: // // http://labs.flog.nz.co/raytracer/ // // It has been modified slightly by Google to work as a standalone // benchmark, but the all the computational code remains // untouched. This file also contains a copy of the Prototype // JavaScript framework which is used by the ray tracer. var RayTrace = new BenchmarkSuite('RayTrace', 932666, [ new Benchmark('RayTrace', renderScene) ]); // Create dummy objects if we're not running in a browser. if (typeof document == 'undefined') { document = { }; window = { opera: null }; navigator = { userAgent: null, appVersion: "" }; } // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ /* Prototype JavaScript framework, version 1.5.0 * (c) 2005-2007 Sam Stephenson * * Prototype is freely distributable under the terms of an MIT-style license. * For details, see the Prototype web site: http://prototype.conio.net/ * /*--------------------------------------------------------------------------*/ //-------------------- var Prototype = { Version: '1.5.0', BrowserFeatures: { XPath: !!document.evaluate }, ScriptFragment: '(?:)((\n|\r|.)*?)(?:<\/script>)', emptyFunction: function() {}, K: function(x) { return x } } var Class = { create: function() { return function() { this.initialize.apply(this, arguments); } } } var Abstract = new Object(); Object.extend = function(destination, source) { for (var property in source) { destination[property] = source[property]; } return destination; } Object.extend(Object, { inspect: function(object) { try { if (object === undefined) return 'undefined'; if (object === null) return 'null'; return object.inspect ? object.inspect() : object.toString(); } catch (e) { if (e instanceof RangeError) return '...'; throw e; } }, keys: function(object) { var keys = []; for (var property in object) keys.push(property); return keys; }, values: function(object) { var values = []; for (var property in object) values.push(object[property]); return values; }, clone: function(object) { return Object.extend({}, object); } }); Function.prototype.bind = function() { var __method = this, args = $A(arguments), object = args.shift(); return function() { return __method.apply(object, args.concat($A(arguments))); } } Function.prototype.bindAsEventListener = function(object) { var __method = this, args = $A(arguments), object = args.shift(); return function(event) { return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments))); } } Object.extend(Number.prototype, { toColorPart: function() { var digits = this.toString(16); if (this < 16) return '0' + digits; return digits; }, succ: function() { return this + 1; }, times: function(iterator) { $R(0, this, true).each(iterator); return this; } }); var Try = { these: function() { var returnValue; for (var i = 0, length = arguments.length; i < length; i++) { var lambda = arguments[i]; try { returnValue = lambda(); break; } catch (e) {} } return returnValue; } } /*--------------------------------------------------------------------------*/ var PeriodicalExecuter = Class.create(); PeriodicalExecuter.prototype = { initialize: function(callback, frequency) { this.callback = callback; this.frequency = frequency; this.currentlyExecuting = false; this.registerCallback(); }, registerCallback: function() { this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); }, stop: function() { if (!this.timer) return; clearInterval(this.timer); this.timer = null; }, onTimerEvent: function() { if (!this.currentlyExecuting) { try { this.currentlyExecuting = true; this.callback(this); } finally { this.currentlyExecuting = false; } } } } String.interpret = function(value){ return value == null ? '' : String(value); } Object.extend(String.prototype, { gsub: function(pattern, replacement) { var result = '', source = this, match; replacement = arguments.callee.prepareReplacement(replacement); while (source.length > 0) { if (match = source.match(pattern)) { result += source.slice(0, match.index); result += String.interpret(replacement(match)); source = source.slice(match.index + match[0].length); } else { result += source, source = ''; } } return result; }, sub: function(pattern, replacement, count) { replacement = this.gsub.prepareReplacement(replacement); count = count === undefined ? 1 : count; return this.gsub(pattern, function(match) { if (--count < 0) return match[0]; return replacement(match); }); }, scan: function(pattern, iterator) { this.gsub(pattern, iterator); return this; }, truncate: function(length, truncation) { length = length || 30; truncation = truncation === undefined ? '...' : truncation; return this.length > length ? this.slice(0, length - truncation.length) + truncation : this; }, strip: function() { return this.replace(/^\s+/, '').replace(/\s+$/, ''); }, stripTags: function() { return this.replace(/<\/?[^>]+>/gi, ''); }, stripScripts: function() { return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); }, extractScripts: function() { var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); return (this.match(matchAll) || []).map(function(scriptTag) { return (scriptTag.match(matchOne) || ['', ''])[1]; }); }, evalScripts: function() { return this.extractScripts().map(function(script) { return eval(script) }); }, escapeHTML: function() { var div = document.createElement('div'); var text = document.createTextNode(this); div.appendChild(text); return div.innerHTML; }, unescapeHTML: function() { var div = document.createElement('div'); div.innerHTML = this.stripTags(); return div.childNodes[0] ? (div.childNodes.length > 1 ? $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) : div.childNodes[0].nodeValue) : ''; }, toQueryParams: function(separator) { var match = this.strip().match(/([^?#]*)(#.*)?$/); if (!match) return {}; return match[1].split(separator || '&').inject({}, function(hash, pair) { if ((pair = pair.split('='))[0]) { var name = decodeURIComponent(pair[0]); var value = pair[1] ? decodeURIComponent(pair[1]) : undefined; if (hash[name] !== undefined) { if (hash[name].constructor != Array) hash[name] = [hash[name]]; if (value) hash[name].push(value); } else hash[name] = value; } return hash; }); }, toArray: function() { return this.split(''); }, succ: function() { return this.slice(0, this.length - 1) + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); }, camelize: function() { var parts = this.split('-'), len = parts.length; if (len == 1) return parts[0]; var camelized = this.charAt(0) == '-' ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) : parts[0]; for (var i = 1; i < len; i++) camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); return camelized; }, capitalize: function(){ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); }, underscore: function() { return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); }, dasherize: function() { return this.gsub(/_/,'-'); }, inspect: function(useDoubleQuotes) { var escapedString = this.replace(/\\/g, '\\\\'); if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; else return "'" + escapedString.replace(/'/g, '\\\'') + "'"; } }); String.prototype.gsub.prepareReplacement = function(replacement) { if (typeof replacement == 'function') return replacement; var template = new Template(replacement); return function(match) { return template.evaluate(match) }; } String.prototype.parseQuery = String.prototype.toQueryParams; var Template = Class.create(); Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; Template.prototype = { initialize: function(template, pattern) { this.template = template.toString(); this.pattern = pattern || Template.Pattern; }, evaluate: function(object) { return this.template.gsub(this.pattern, function(match) { var before = match[1]; if (before == '\\') return match[2]; return before + String.interpret(object[match[3]]); }); } } var $break = new Object(); var $continue = new Object(); var Enumerable = { each: function(iterator) { var index = 0; try { this._each(function(value) { try { iterator(value, index++); } catch (e) { if (e != $continue) throw e; } }); } catch (e) { if (e != $break) throw e; } return this; }, eachSlice: function(number, iterator) { var index = -number, slices = [], array = this.toArray(); while ((index += number) < array.length) slices.push(array.slice(index, index+number)); return slices.map(iterator); }, all: function(iterator) { var result = true; this.each(function(value, index) { result = result && !!(iterator || Prototype.K)(value, index); if (!result) throw $break; }); return result; }, any: function(iterator) { var result = false; this.each(function(value, index) { if (result = !!(iterator || Prototype.K)(value, index)) throw $break; }); return result; }, collect: function(iterator) { var results = []; this.each(function(value, index) { results.push((iterator || Prototype.K)(value, index)); }); return results; }, detect: function(iterator) { var result; this.each(function(value, index) { if (iterator(value, index)) { result = value; throw $break; } }); return result; }, findAll: function(iterator) { var results = []; this.each(function(value, index) { if (iterator(value, index)) results.push(value); }); return results; }, grep: function(pattern, iterator) { var results = []; this.each(function(value, index) { var stringValue = value.toString(); if (stringValue.match(pattern)) results.push((iterator || Prototype.K)(value, index)); }) return results; }, include: function(object) { var found = false; this.each(function(value) { if (value == object) { found = true; throw $break; } }); return found; }, inGroupsOf: function(number, fillWith) { fillWith = fillWith === undefined ? null : fillWith; return this.eachSlice(number, function(slice) { while(slice.length < number) slice.push(fillWith); return slice; }); }, inject: function(memo, iterator) { this.each(function(value, index) { memo = iterator(memo, value, index); }); return memo; }, invoke: function(method) { var args = $A(arguments).slice(1); return this.map(function(value) { return value[method].apply(value, args); }); }, max: function(iterator) { var result; this.each(function(value, index) { value = (iterator || Prototype.K)(value, index); if (result == undefined || value >= result) result = value; }); return result; }, min: function(iterator) { var result; this.each(function(value, index) { value = (iterator || Prototype.K)(value, index); if (result == undefined || value < result) result = value; }); return result; }, partition: function(iterator) { var trues = [], falses = []; this.each(function(value, index) { ((iterator || Prototype.K)(value, index) ? trues : falses).push(value); }); return [trues, falses]; }, pluck: function(property) { var results = []; this.each(function(value, index) { results.push(value[property]); }); return results; }, reject: function(iterator) { var results = []; this.each(function(value, index) { if (!iterator(value, index)) results.push(value); }); return results; }, sortBy: function(iterator) { return this.map(function(value, index) { return {value: value, criteria: iterator(value, index)}; }).sort(function(left, right) { var a = left.criteria, b = right.criteria; return a < b ? -1 : a > b ? 1 : 0; }).pluck('value'); }, toArray: function() { return this.map(); }, zip: function() { var iterator = Prototype.K, args = $A(arguments); if (typeof args.last() == 'function') iterator = args.pop(); var collections = [this].concat(args).map($A); return this.map(function(value, index) { return iterator(collections.pluck(index)); }); }, size: function() { return this.toArray().length; }, inspect: function() { return '#'; } } Object.extend(Enumerable, { map: Enumerable.collect, find: Enumerable.detect, select: Enumerable.findAll, member: Enumerable.include, entries: Enumerable.toArray }); var $A = Array.from = function(iterable) { if (!iterable) return []; if (iterable.toArray) { return iterable.toArray(); } else { var results = []; for (var i = 0, length = iterable.length; i < length; i++) results.push(iterable[i]); return results; } } Object.extend(Array.prototype, Enumerable); if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse; Object.extend(Array.prototype, { _each: function(iterator) { for (var i = 0, length = this.length; i < length; i++) iterator(this[i]); }, clear: function() { this.length = 0; return this; }, first: function() { return this[0]; }, last: function() { return this[this.length - 1]; }, compact: function() { return this.select(function(value) { return value != null; }); }, flatten: function() { return this.inject([], function(array, value) { return array.concat(value && value.constructor == Array ? value.flatten() : [value]); }); }, without: function() { var values = $A(arguments); return this.select(function(value) { return !values.include(value); }); }, indexOf: function(object) { for (var i = 0, length = this.length; i < length; i++) if (this[i] == object) return i; return -1; }, reverse: function(inline) { return (inline !== false ? this : this.toArray())._reverse(); }, reduce: function() { return this.length > 1 ? this : this[0]; }, uniq: function() { return this.inject([], function(array, value) { return array.include(value) ? array : array.concat([value]); }); }, clone: function() { return [].concat(this); }, size: function() { return this.length; }, inspect: function() { return '[' + this.map(Object.inspect).join(', ') + ']'; } }); Array.prototype.toArray = Array.prototype.clone; function $w(string){ string = string.strip(); return string ? string.split(/\s+/) : []; } if(window.opera){ Array.prototype.concat = function(){ var array = []; for(var i = 0, length = this.length; i < length; i++) array.push(this[i]); for(var i = 0, length = arguments.length; i < length; i++) { if(arguments[i].constructor == Array) { for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) array.push(arguments[i][j]); } else { array.push(arguments[i]); } } return array; } } var Hash = function(obj) { Object.extend(this, obj || {}); }; Object.extend(Hash, { toQueryString: function(obj) { var parts = []; this.prototype._each.call(obj, function(pair) { if (!pair.key) return; if (pair.value && pair.value.constructor == Array) { var values = pair.value.compact(); if (values.length < 2) pair.value = values.reduce(); else { key = encodeURIComponent(pair.key); values.each(function(value) { value = value != undefined ? encodeURIComponent(value) : ''; parts.push(key + '=' + encodeURIComponent(value)); }); return; } } if (pair.value == undefined) pair[1] = ''; parts.push(pair.map(encodeURIComponent).join('=')); }); return parts.join('&'); } }); Object.extend(Hash.prototype, Enumerable); Object.extend(Hash.prototype, { _each: function(iterator) { for (var key in this) { var value = this[key]; if (value && value == Hash.prototype[key]) continue; var pair = [key, value]; pair.key = key; pair.value = value; iterator(pair); } }, keys: function() { return this.pluck('key'); }, values: function() { return this.pluck('value'); }, merge: function(hash) { return $H(hash).inject(this, function(mergedHash, pair) { mergedHash[pair.key] = pair.value; return mergedHash; }); }, remove: function() { var result; for(var i = 0, length = arguments.length; i < length; i++) { var value = this[arguments[i]]; if (value !== undefined){ if (result === undefined) result = value; else { if (result.constructor != Array) result = [result]; result.push(value) } } delete this[arguments[i]]; } return result; }, toQueryString: function() { return Hash.toQueryString(this); }, inspect: function() { return '#'; } }); function $H(object) { if (object && object.constructor == Hash) return object; return new Hash(object); }; ObjectRange = Class.create(); Object.extend(ObjectRange.prototype, Enumerable); Object.extend(ObjectRange.prototype, { initialize: function(start, end, exclusive) { this.start = start; this.end = end; this.exclusive = exclusive; }, _each: function(iterator) { var value = this.start; while (this.include(value)) { iterator(value); value = value.succ(); } }, include: function(value) { if (value < this.start) return false; if (this.exclusive) return value < this.end; return value <= this.end; } }); var $R = function(start, end, exclusive) { return new ObjectRange(start, end, exclusive); } var Ajax = { getTransport: function() { return Try.these( function() {return new XMLHttpRequest()}, function() {return new ActiveXObject('Msxml2.XMLHTTP')}, function() {return new ActiveXObject('Microsoft.XMLHTTP')} ) || false; }, activeRequestCount: 0 } Ajax.Responders = { responders: [], _each: function(iterator) { this.responders._each(iterator); }, register: function(responder) { if (!this.include(responder)) this.responders.push(responder); }, unregister: function(responder) { this.responders = this.responders.without(responder); }, dispatch: function(callback, request, transport, json) { this.each(function(responder) { if (typeof responder[callback] == 'function') { try { responder[callback].apply(responder, [request, transport, json]); } catch (e) {} } }); } }; Object.extend(Ajax.Responders, Enumerable); Ajax.Responders.register({ onCreate: function() { Ajax.activeRequestCount++; }, onComplete: function() { Ajax.activeRequestCount--; } }); Ajax.Base = function() {}; Ajax.Base.prototype = { setOptions: function(options) { this.options = { method: 'post', asynchronous: true, contentType: 'application/x-www-form-urlencoded', encoding: 'UTF-8', parameters: '' } Object.extend(this.options, options || {}); this.options.method = this.options.method.toLowerCase(); if (typeof this.options.parameters == 'string') this.options.parameters = this.options.parameters.toQueryParams(); } } Ajax.Request = Class.create(); Ajax.Request.Events = ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; Ajax.Request.prototype = Object.extend(new Ajax.Base(), { _complete: false, initialize: function(url, options) { this.transport = Ajax.getTransport(); this.setOptions(options); this.request(url); }, request: function(url) { this.url = url; this.method = this.options.method; var params = this.options.parameters; if (!['get', 'post'].include(this.method)) { // simulate other verbs over post params['_method'] = this.method; this.method = 'post'; } params = Hash.toQueryString(params); if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_=' // when GET, append parameters to URL if (this.method == 'get' && params) this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params; try { Ajax.Responders.dispatch('onCreate', this, this.transport); this.transport.open(this.method.toUpperCase(), this.url, this.options.asynchronous); if (this.options.asynchronous) setTimeout(function() { this.respondToReadyState(1) }.bind(this), 10); this.transport.onreadystatechange = this.onStateChange.bind(this); this.setRequestHeaders(); var body = this.method == 'post' ? (this.options.postBody || params) : null; this.transport.send(body); /* Force Firefox to handle ready state 4 for synchronous requests */ if (!this.options.asynchronous && this.transport.overrideMimeType) this.onStateChange(); } catch (e) { this.dispatchException(e); } }, onStateChange: function() { var readyState = this.transport.readyState; if (readyState > 1 && !((readyState == 4) && this._complete)) this.respondToReadyState(this.transport.readyState); }, setRequestHeaders: function() { var headers = { 'X-Requested-With': 'XMLHttpRequest', 'X-Prototype-Version': Prototype.Version, 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' }; if (this.method == 'post') { headers['Content-type'] = this.options.contentType + (this.options.encoding ? '; charset=' + this.options.encoding : ''); /* Force "Connection: close" for older Mozilla browsers to work * around a bug where XMLHttpRequest sends an incorrect * Content-length header. See Mozilla Bugzilla #246651. */ if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) headers['Connection'] = 'close'; } // user-defined headers if (typeof this.options.requestHeaders == 'object') { var extras = this.options.requestHeaders; if (typeof extras.push == 'function') for (var i = 0, length = extras.length; i < length; i += 2) headers[extras[i]] = extras[i+1]; else $H(extras).each(function(pair) { headers[pair.key] = pair.value }); } for (var name in headers) this.transport.setRequestHeader(name, headers[name]); }, success: function() { return !this.transport.status || (this.transport.status >= 200 && this.transport.status < 300); }, respondToReadyState: function(readyState) { var state = Ajax.Request.Events[readyState]; var transport = this.transport, json = this.evalJSON(); if (state == 'Complete') { try { this._complete = true; (this.options['on' + this.transport.status] || this.options['on' + (this.success() ? 'Success' : 'Failure')] || Prototype.emptyFunction)(transport, json); } catch (e) { this.dispatchException(e); } if ((this.getHeader('Content-type') || 'text/javascript').strip(). match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)) this.evalResponse(); } try { (this.options['on' + state] || Prototype.emptyFunction)(transport, json); Ajax.Responders.dispatch('on' + state, this, transport, json); } catch (e) { this.dispatchException(e); } if (state == 'Complete') { // avoid memory leak in MSIE: clean up this.transport.onreadystatechange = Prototype.emptyFunction; } }, getHeader: function(name) { try { return this.transport.getResponseHeader(name); } catch (e) { return null } }, evalJSON: function() { try { var json = this.getHeader('X-JSON'); return json ? eval('(' + json + ')') : null; } catch (e) { return null } }, evalResponse: function() { try { return eval(this.transport.responseText); } catch (e) { this.dispatchException(e); } }, dispatchException: function(exception) { (this.options.onException || Prototype.emptyFunction)(this, exception); Ajax.Responders.dispatch('onException', this, exception); } }); Ajax.Updater = Class.create(); Object.extend(Object.extend(Ajax.Updater.prototype, Ajax.Request.prototype), { initialize: function(container, url, options) { this.container = { success: (container.success || container), failure: (container.failure || (container.success ? null : container)) } this.transport = Ajax.getTransport(); this.setOptions(options); var onComplete = this.options.onComplete || Prototype.emptyFunction; this.options.onComplete = (function(transport, param) { this.updateContent(); onComplete(transport, param); }).bind(this); this.request(url); }, updateContent: function() { var receiver = this.container[this.success() ? 'success' : 'failure']; var response = this.transport.responseText; if (!this.options.evalScripts) response = response.stripScripts(); if (receiver = $(receiver)) { if (this.options.insertion) new this.options.insertion(receiver, response); else receiver.update(response); } if (this.success()) { if (this.onComplete) setTimeout(this.onComplete.bind(this), 10); } } }); Ajax.PeriodicalUpdater = Class.create(); Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), { initialize: function(container, url, options) { this.setOptions(options); this.onComplete = this.options.onComplete; this.frequency = (this.options.frequency || 2); this.decay = (this.options.decay || 1); this.updater = {}; this.container = container; this.url = url; this.start(); }, start: function() { this.options.onComplete = this.updateComplete.bind(this); this.onTimerEvent(); }, stop: function() { this.updater.options.onComplete = undefined; clearTimeout(this.timer); (this.onComplete || Prototype.emptyFunction).apply(this, arguments); }, updateComplete: function(request) { if (this.options.decay) { this.decay = (request.responseText == this.lastText ? this.decay * this.options.decay : 1); this.lastText = request.responseText; } this.timer = setTimeout(this.onTimerEvent.bind(this), this.decay * this.frequency * 1000); }, onTimerEvent: function() { this.updater = new Ajax.Updater(this.container, this.url, this.options); } }); function $(element) { if (arguments.length > 1) { for (var i = 0, elements = [], length = arguments.length; i < length; i++) elements.push($(arguments[i])); return elements; } if (typeof element == 'string') element = document.getElementById(element); return Element.extend(element); } if (Prototype.BrowserFeatures.XPath) { document._getElementsByXPath = function(expression, parentElement) { var results = []; var query = document.evaluate(expression, $(parentElement) || document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); for (var i = 0, length = query.snapshotLength; i < length; i++) results.push(query.snapshotItem(i)); return results; }; } document.getElementsByClassName = function(className, parentElement) { if (Prototype.BrowserFeatures.XPath) { var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]"; return document._getElementsByXPath(q, parentElement); } else { var children = ($(parentElement) || document.body).getElementsByTagName('*'); var elements = [], child; for (var i = 0, length = children.length; i < length; i++) { child = children[i]; if (Element.hasClassName(child, className)) elements.push(Element.extend(child)); } return elements; } }; /*--------------------------------------------------------------------------*/ if (!window.Element) var Element = new Object(); Element.extend = function(element) { if (!element || _nativeExtensions || element.nodeType == 3) return element; if (!element._extended && element.tagName && element != window) { var methods = Object.clone(Element.Methods), cache = Element.extend.cache; if (element.tagName == 'FORM') Object.extend(methods, Form.Methods); if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName)) Object.extend(methods, Form.Element.Methods); Object.extend(methods, Element.Methods.Simulated); for (var property in methods) { var value = methods[property]; if (typeof value == 'function' && !(property in element)) element[property] = cache.findOrStore(value); } } element._extended = true; return element; }; Element.extend.cache = { findOrStore: function(value) { return this[value] = this[value] || function() { return value.apply(null, [this].concat($A(arguments))); } } }; Element.Methods = { visible: function(element) { return $(element).style.display != 'none'; }, toggle: function(element) { element = $(element); Element[Element.visible(element) ? 'hide' : 'show'](element); return element; }, hide: function(element) { $(element).style.display = 'none'; return element; }, show: function(element) { $(element).style.display = ''; return element; }, remove: function(element) { element = $(element); element.parentNode.removeChild(element); return element; }, update: function(element, html) { html = typeof html == 'undefined' ? '' : html.toString(); $(element).innerHTML = html.stripScripts(); setTimeout(function() {html.evalScripts()}, 10); return element; }, replace: function(element, html) { element = $(element); html = typeof html == 'undefined' ? '' : html.toString(); if (element.outerHTML) { element.outerHTML = html.stripScripts(); } else { var range = element.ownerDocument.createRange(); range.selectNodeContents(element); element.parentNode.replaceChild( range.createContextualFragment(html.stripScripts()), element); } setTimeout(function() {html.evalScripts()}, 10); return element; }, inspect: function(element) { element = $(element); var result = '<' + element.tagName.toLowerCase(); $H({'id': 'id', 'className': 'class'}).each(function(pair) { var property = pair.first(), attribute = pair.last(); var value = (element[property] || '').toString(); if (value) result += ' ' + attribute + '=' + value.inspect(true); }); return result + '>'; }, recursivelyCollect: function(element, property) { element = $(element); var elements = []; while (element = element[property]) if (element.nodeType == 1) elements.push(Element.extend(element)); return elements; }, ancestors: function(element) { return $(element).recursivelyCollect('parentNode'); }, descendants: function(element) { return $A($(element).getElementsByTagName('*')); }, immediateDescendants: function(element) { if (!(element = $(element).firstChild)) return []; while (element && element.nodeType != 1) element = element.nextSibling; if (element) return [element].concat($(element).nextSiblings()); return []; }, previousSiblings: function(element) { return $(element).recursivelyCollect('previousSibling'); }, nextSiblings: function(element) { return $(element).recursivelyCollect('nextSibling'); }, siblings: function(element) { element = $(element); return element.previousSiblings().reverse().concat(element.nextSiblings()); }, match: function(element, selector) { if (typeof selector == 'string') selector = new Selector(selector); return selector.match($(element)); }, up: function(element, expression, index) { return Selector.findElement($(element).ancestors(), expression, index); }, down: function(element, expression, index) { return Selector.findElement($(element).descendants(), expression, index); }, previous: function(element, expression, index) { return Selector.findElement($(element).previousSiblings(), expression, index); }, next: function(element, expression, index) { return Selector.findElement($(element).nextSiblings(), expression, index); }, getElementsBySelector: function() { var args = $A(arguments), element = $(args.shift()); return Selector.findChildElements(element, args); }, getElementsByClassName: function(element, className) { return document.getElementsByClassName(className, element); }, readAttribute: function(element, name) { element = $(element); if (document.all && !window.opera) { var t = Element._attributeTranslations; if (t.values[name]) return t.values[name](element, name); if (t.names[name]) name = t.names[name]; var attribute = element.attributes[name]; if(attribute) return attribute.nodeValue; } return element.getAttribute(name); }, getHeight: function(element) { return $(element).getDimensions().height; }, getWidth: function(element) { return $(element).getDimensions().width; }, classNames: function(element) { return new Element.ClassNames(element); }, hasClassName: function(element, className) { if (!(element = $(element))) return; var elementClassName = element.className; if (elementClassName.length == 0) return false; if (elementClassName == className || elementClassName.match(new RegExp("(^|\\s)" + className + "(\\s|$)"))) return true; return false; }, addClassName: function(element, className) { if (!(element = $(element))) return; Element.classNames(element).add(className); return element; }, removeClassName: function(element, className) { if (!(element = $(element))) return; Element.classNames(element).remove(className); return element; }, toggleClassName: function(element, className) { if (!(element = $(element))) return; Element.classNames(element)[element.hasClassName(className) ? 'remove' : 'add'](className); return element; }, observe: function() { Event.observe.apply(Event, arguments); return $A(arguments).first(); }, stopObserving: function() { Event.stopObserving.apply(Event, arguments); return $A(arguments).first(); }, // removes whitespace-only text node children cleanWhitespace: function(element) { element = $(element); var node = element.firstChild; while (node) { var nextNode = node.nextSibling; if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) element.removeChild(node); node = nextNode; } return element; }, empty: function(element) { return $(element).innerHTML.match(/^\s*$/); }, descendantOf: function(element, ancestor) { element = $(element), ancestor = $(ancestor); while (element = element.parentNode) if (element == ancestor) return true; return false; }, scrollTo: function(element) { element = $(element); var pos = Position.cumulativeOffset(element); window.scrollTo(pos[0], pos[1]); return element; }, getStyle: function(element, style) { element = $(element); if (['float','cssFloat'].include(style)) style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat'); style = style.camelize(); var value = element.style[style]; if (!value) { if (document.defaultView && document.defaultView.getComputedStyle) { var css = document.defaultView.getComputedStyle(element, null); value = css ? css[style] : null; } else if (element.currentStyle) { value = element.currentStyle[style]; } } if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none')) value = element['offset'+style.capitalize()] + 'px'; if (window.opera && ['left', 'top', 'right', 'bottom'].include(style)) if (Element.getStyle(element, 'position') == 'static') value = 'auto'; if(style == 'opacity') { if(value) return parseFloat(value); if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) if(value[1]) return parseFloat(value[1]) / 100; return 1.0; } return value == 'auto' ? null : value; }, setStyle: function(element, style) { element = $(element); for (var name in style) { var value = style[name]; if(name == 'opacity') { if (value == 1) { value = (/Gecko/.test(navigator.userAgent) && !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0; if(/MSIE/.test(navigator.userAgent) && !window.opera) element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); } else if(value == '') { if(/MSIE/.test(navigator.userAgent) && !window.opera) element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); } else { if(value < 0.00001) value = 0; if(/MSIE/.test(navigator.userAgent) && !window.opera) element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') + 'alpha(opacity='+value*100+')'; } } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat'; element.style[name.camelize()] = value; } return element; }, getDimensions: function(element) { element = $(element); var display = $(element).getStyle('display'); if (display != 'none' && display != null) // Safari bug return {width: element.offsetWidth, height: element.offsetHeight}; // All *Width and *Height properties give 0 on elements with display none, // so enable the element temporarily var els = element.style; var originalVisibility = els.visibility; var originalPosition = els.position; var originalDisplay = els.display; els.visibility = 'hidden'; els.position = 'absolute'; els.display = 'block'; var originalWidth = element.clientWidth; var originalHeight = element.clientHeight; els.display = originalDisplay; els.position = originalPosition; els.visibility = originalVisibility; return {width: originalWidth, height: originalHeight}; }, makePositioned: function(element) { element = $(element); var pos = Element.getStyle(element, 'position'); if (pos == 'static' || !pos) { element._madePositioned = true; element.style.position = 'relative'; // Opera returns the offset relative to the positioning context, when an // element is position relative but top and left have not been defined if (window.opera) { element.style.top = 0; element.style.left = 0; } } return element; }, undoPositioned: function(element) { element = $(element); if (element._madePositioned) { element._madePositioned = undefined; element.style.position = element.style.top = element.style.left = element.style.bottom = element.style.right = ''; } return element; }, makeClipping: function(element) { element = $(element); if (element._overflow) return element; element._overflow = element.style.overflow || 'auto'; if ((Element.getStyle(element, 'overflow') || 'visible') != 'hidden') element.style.overflow = 'hidden'; return element; }, undoClipping: function(element) { element = $(element); if (!element._overflow) return element; element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; element._overflow = null; return element; } }; Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf}); Element._attributeTranslations = {}; Element._attributeTranslations.names = { colspan: "colSpan", rowspan: "rowSpan", valign: "vAlign", datetime: "dateTime", accesskey: "accessKey", tabindex: "tabIndex", enctype: "encType", maxlength: "maxLength", readonly: "readOnly", longdesc: "longDesc" }; Element._attributeTranslations.values = { _getAttr: function(element, attribute) { return element.getAttribute(attribute, 2); }, _flag: function(element, attribute) { return $(element).hasAttribute(attribute) ? attribute : null; }, style: function(element) { return element.style.cssText.toLowerCase(); }, title: function(element) { var node = element.getAttributeNode('title'); return node.specified ? node.nodeValue : null; } }; Object.extend(Element._attributeTranslations.values, { href: Element._attributeTranslations.values._getAttr, src: Element._attributeTranslations.values._getAttr, disabled: Element._attributeTranslations.values._flag, checked: Element._attributeTranslations.values._flag, readonly: Element._attributeTranslations.values._flag, multiple: Element._attributeTranslations.values._flag }); Element.Methods.Simulated = { hasAttribute: function(element, attribute) { var t = Element._attributeTranslations; attribute = t.names[attribute] || attribute; return $(element).getAttributeNode(attribute).specified; } }; // IE is missing .innerHTML support for TABLE-related elements if (document.all && !window.opera){ Element.Methods.update = function(element, html) { element = $(element); html = typeof html == 'undefined' ? '' : html.toString(); var tagName = element.tagName.toUpperCase(); if (['THEAD','TBODY','TR','TD'].include(tagName)) { var div = document.createElement('div'); switch (tagName) { case 'THEAD': case 'TBODY': div.innerHTML = '' + html.stripScripts() + '
'; depth = 2; break; case 'TR': div.innerHTML = '' + html.stripScripts() + '
'; depth = 3; break; case 'TD': div.innerHTML = '
' + html.stripScripts() + '
'; depth = 4; } $A(element.childNodes).each(function(node){ element.removeChild(node) }); depth.times(function(){ div = div.firstChild }); $A(div.childNodes).each( function(node){ element.appendChild(node) }); } else { element.innerHTML = html.stripScripts(); } setTimeout(function() {html.evalScripts()}, 10); return element; } }; Object.extend(Element, Element.Methods); var _nativeExtensions = false; if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) { var className = 'HTML' + tag + 'Element'; if(window[className]) return; var klass = window[className] = {}; klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__; }); Element.addMethods = function(methods) { Object.extend(Element.Methods, methods || {}); function copy(methods, destination, onlyIfAbsent) { onlyIfAbsent = onlyIfAbsent || false; var cache = Element.extend.cache; for (var property in methods) { var value = methods[property]; if (!onlyIfAbsent || !(property in destination)) destination[property] = cache.findOrStore(value); } } if (typeof HTMLElement != 'undefined') { copy(Element.Methods, HTMLElement.prototype); copy(Element.Methods.Simulated, HTMLElement.prototype, true); copy(Form.Methods, HTMLFormElement.prototype); [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) { copy(Form.Element.Methods, klass.prototype); }); _nativeExtensions = true; } } var Toggle = new Object(); Toggle.display = Element.toggle; /*--------------------------------------------------------------------------*/ Abstract.Insertion = function(adjacency) { this.adjacency = adjacency; } Abstract.Insertion.prototype = { initialize: function(element, content) { this.element = $(element); this.content = content.stripScripts(); if (this.adjacency && this.element.insertAdjacentHTML) { try { this.element.insertAdjacentHTML(this.adjacency, this.content); } catch (e) { var tagName = this.element.tagName.toUpperCase(); if (['TBODY', 'TR'].include(tagName)) { this.insertContent(this.contentFromAnonymousTable()); } else { throw e; } } } else { this.range = this.element.ownerDocument.createRange(); if (this.initializeRange) this.initializeRange(); this.insertContent([this.range.createContextualFragment(this.content)]); } setTimeout(function() {content.evalScripts()}, 10); }, contentFromAnonymousTable: function() { var div = document.createElement('div'); div.innerHTML = '' + this.content + '
'; return $A(div.childNodes[0].childNodes[0].childNodes); } } var Insertion = new Object(); Insertion.Before = Class.create(); Insertion.Before.prototype = Object.extend(new Abstract.Insertion('beforeBegin'), { initializeRange: function() { this.range.setStartBefore(this.element); }, insertContent: function(fragments) { fragments.each((function(fragment) { this.element.parentNode.insertBefore(fragment, this.element); }).bind(this)); } }); Insertion.Top = Class.create(); Insertion.Top.prototype = Object.extend(new Abstract.Insertion('afterBegin'), { initializeRange: function() { this.range.selectNodeContents(this.element); this.range.collapse(true); }, insertContent: function(fragments) { fragments.reverse(false).each((function(fragment) { this.element.insertBefore(fragment, this.element.firstChild); }).bind(this)); } }); Insertion.Bottom = Class.create(); Insertion.Bottom.prototype = Object.extend(new Abstract.Insertion('beforeEnd'), { initializeRange: function() { this.range.selectNodeContents(this.element); this.range.collapse(this.element); }, insertContent: function(fragments) { fragments.each((function(fragment) { this.element.appendChild(fragment); }).bind(this)); } }); Insertion.After = Class.create(); Insertion.After.prototype = Object.extend(new Abstract.Insertion('afterEnd'), { initializeRange: function() { this.range.setStartAfter(this.element); }, insertContent: function(fragments) { fragments.each((function(fragment) { this.element.parentNode.insertBefore(fragment, this.element.nextSibling); }).bind(this)); } }); /*--------------------------------------------------------------------------*/ Element.ClassNames = Class.create(); Element.ClassNames.prototype = { initialize: function(element) { this.element = $(element); }, _each: function(iterator) { this.element.className.split(/\s+/).select(function(name) { return name.length > 0; })._each(iterator); }, set: function(className) { this.element.className = className; }, add: function(classNameToAdd) { if (this.include(classNameToAdd)) return; this.set($A(this).concat(classNameToAdd).join(' ')); }, remove: function(classNameToRemove) { if (!this.include(classNameToRemove)) return; this.set($A(this).without(classNameToRemove).join(' ')); }, toString: function() { return $A(this).join(' '); } }; Object.extend(Element.ClassNames.prototype, Enumerable); var Selector = Class.create(); Selector.prototype = { initialize: function(expression) { this.params = {classNames: []}; this.expression = expression.toString().strip(); this.parseExpression(); this.compileMatcher(); }, parseExpression: function() { function abort(message) { throw 'Parse error in selector: ' + message; } if (this.expression == '') abort('empty expression'); var params = this.params, expr = this.expression, match, modifier, clause, rest; while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) { params.attributes = params.attributes || []; params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''}); expr = match[1]; } if (expr == '*') return this.params.wildcard = true; while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) { modifier = match[1], clause = match[2], rest = match[3]; switch (modifier) { case '#': params.id = clause; break; case '.': params.classNames.push(clause); break; case '': case undefined: params.tagName = clause.toUpperCase(); break; default: abort(expr.inspect()); } expr = rest; } if (expr.length > 0) abort(expr.inspect()); }, buildMatchExpression: function() { var params = this.params, conditions = [], clause; if (params.wildcard) conditions.push('true'); if (clause = params.id) conditions.push('element.readAttribute("id") == ' + clause.inspect()); if (clause = params.tagName) conditions.push('element.tagName.toUpperCase() == ' + clause.inspect()); if ((clause = params.classNames).length > 0) for (var i = 0, length = clause.length; i < length; i++) conditions.push('element.hasClassName(' + clause[i].inspect() + ')'); if (clause = params.attributes) { clause.each(function(attribute) { var value = 'element.readAttribute(' + attribute.name.inspect() + ')'; var splitValueBy = function(delimiter) { return value + ' && ' + value + '.split(' + delimiter.inspect() + ')'; } switch (attribute.operator) { case '=': conditions.push(value + ' == ' + attribute.value.inspect()); break; case '~=': conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break; case '|=': conditions.push( splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect() ); break; case '!=': conditions.push(value + ' != ' + attribute.value.inspect()); break; case '': case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break; default: throw 'Unknown operator ' + attribute.operator + ' in selector'; } }); } return conditions.join(' && '); }, compileMatcher: function() { this.match = new Function('element', 'if (!element.tagName) return false; \ element = $(element); \ return ' + this.buildMatchExpression()); }, findElements: function(scope) { var element; if (element = $(this.params.id)) if (this.match(element)) if (!scope || Element.childOf(element, scope)) return [element]; scope = (scope || document).getElementsByTagName(this.params.tagName || '*'); var results = []; for (var i = 0, length = scope.length; i < length; i++) if (this.match(element = scope[i])) results.push(Element.extend(element)); return results; }, toString: function() { return this.expression; } } Object.extend(Selector, { matchElements: function(elements, expression) { var selector = new Selector(expression); return elements.select(selector.match.bind(selector)).map(Element.extend); }, findElement: function(elements, expression, index) { if (typeof expression == 'number') index = expression, expression = false; return Selector.matchElements(elements, expression || '*')[index || 0]; }, findChildElements: function(element, expressions) { return expressions.map(function(expression) { return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) { var selector = new Selector(expr); return results.inject([], function(elements, result) { return elements.concat(selector.findElements(result || element)); }); }); }).flatten(); } }); function $$() { return Selector.findChildElements(document, $A(arguments)); } var Form = { reset: function(form) { $(form).reset(); return form; }, serializeElements: function(elements, getHash) { var data = elements.inject({}, function(result, element) { if (!element.disabled && element.name) { var key = element.name, value = $(element).getValue(); if (value != undefined) { if (result[key]) { if (result[key].constructor != Array) result[key] = [result[key]]; result[key].push(value); } else result[key] = value; } } return result; }); return getHash ? data : Hash.toQueryString(data); } }; Form.Methods = { serialize: function(form, getHash) { return Form.serializeElements(Form.getElements(form), getHash); }, getElements: function(form) { return $A($(form).getElementsByTagName('*')).inject([], function(elements, child) { if (Form.Element.Serializers[child.tagName.toLowerCase()]) elements.push(Element.extend(child)); return elements; } ); }, getInputs: function(form, typeName, name) { form = $(form); var inputs = form.getElementsByTagName('input'); if (!typeName && !name) return $A(inputs).map(Element.extend); for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { var input = inputs[i]; if ((typeName && input.type != typeName) || (name && input.name != name)) continue; matchingInputs.push(Element.extend(input)); } return matchingInputs; }, disable: function(form) { form = $(form); form.getElements().each(function(element) { element.blur(); element.disabled = 'true'; }); return form; }, enable: function(form) { form = $(form); form.getElements().each(function(element) { element.disabled = ''; }); return form; }, findFirstElement: function(form) { return $(form).getElements().find(function(element) { return element.type != 'hidden' && !element.disabled && ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); }); }, focusFirstElement: function(form) { form = $(form); form.findFirstElement().activate(); return form; } } Object.extend(Form, Form.Methods); /*--------------------------------------------------------------------------*/ Form.Element = { focus: function(element) { $(element).focus(); return element; }, select: function(element) { $(element).select(); return element; } } Form.Element.Methods = { serialize: function(element) { element = $(element); if (!element.disabled && element.name) { var value = element.getValue(); if (value != undefined) { var pair = {}; pair[element.name] = value; return Hash.toQueryString(pair); } } return ''; }, getValue: function(element) { element = $(element); var method = element.tagName.toLowerCase(); return Form.Element.Serializers[method](element); }, clear: function(element) { $(element).value = ''; return element; }, present: function(element) { return $(element).value != ''; }, activate: function(element) { element = $(element); element.focus(); if (element.select && ( element.tagName.toLowerCase() != 'input' || !['button', 'reset', 'submit'].include(element.type) ) ) element.select(); return element; }, disable: function(element) { element = $(element); element.disabled = true; return element; }, enable: function(element) { element = $(element); element.blur(); element.disabled = false; return element; } } Object.extend(Form.Element, Form.Element.Methods); var Field = Form.Element; var $F = Form.Element.getValue; /*--------------------------------------------------------------------------*/ Form.Element.Serializers = { input: function(element) { switch (element.type.toLowerCase()) { case 'checkbox': case 'radio': return Form.Element.Serializers.inputSelector(element); default: return Form.Element.Serializers.textarea(element); } }, inputSelector: function(element) { return element.checked ? element.value : null; }, textarea: function(element) { return element.value; }, select: function(element) { return this[element.type == 'select-one' ? 'selectOne' : 'selectMany'](element); }, selectOne: function(element) { var index = element.selectedIndex; return index >= 0 ? this.optionValue(element.options[index]) : null; }, selectMany: function(element) { var values, length = element.length; if (!length) return null; for (var i = 0, values = []; i < length; i++) { var opt = element.options[i]; if (opt.selected) values.push(this.optionValue(opt)); } return values; }, optionValue: function(opt) { // extend element because hasAttribute may not be native return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; } } /*--------------------------------------------------------------------------*/ Abstract.TimedObserver = function() {} Abstract.TimedObserver.prototype = { initialize: function(element, frequency, callback) { this.frequency = frequency; this.element = $(element); this.callback = callback; this.lastValue = this.getValue(); this.registerCallback(); }, registerCallback: function() { setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); }, onTimerEvent: function() { var value = this.getValue(); var changed = ('string' == typeof this.lastValue && 'string' == typeof value ? this.lastValue != value : String(this.lastValue) != String(value)); if (changed) { this.callback(this.element, value); this.lastValue = value; } } } Form.Element.Observer = Class.create(); Form.Element.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { getValue: function() { return Form.Element.getValue(this.element); } }); Form.Observer = Class.create(); Form.Observer.prototype = Object.extend(new Abstract.TimedObserver(), { getValue: function() { return Form.serialize(this.element); } }); /*--------------------------------------------------------------------------*/ Abstract.EventObserver = function() {} Abstract.EventObserver.prototype = { initialize: function(element, callback) { this.element = $(element); this.callback = callback; this.lastValue = this.getValue(); if (this.element.tagName.toLowerCase() == 'form') this.registerFormCallbacks(); else this.registerCallback(this.element); }, onElementEvent: function() { var value = this.getValue(); if (this.lastValue != value) { this.callback(this.element, value); this.lastValue = value; } }, registerFormCallbacks: function() { Form.getElements(this.element).each(this.registerCallback.bind(this)); }, registerCallback: function(element) { if (element.type) { switch (element.type.toLowerCase()) { case 'checkbox': case 'radio': Event.observe(element, 'click', this.onElementEvent.bind(this)); break; default: Event.observe(element, 'change', this.onElementEvent.bind(this)); break; } } } } Form.Element.EventObserver = Class.create(); Form.Element.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { getValue: function() { return Form.Element.getValue(this.element); } }); Form.EventObserver = Class.create(); Form.EventObserver.prototype = Object.extend(new Abstract.EventObserver(), { getValue: function() { return Form.serialize(this.element); } }); if (!window.Event) { var Event = new Object(); } Object.extend(Event, { KEY_BACKSPACE: 8, KEY_TAB: 9, KEY_RETURN: 13, KEY_ESC: 27, KEY_LEFT: 37, KEY_UP: 38, KEY_RIGHT: 39, KEY_DOWN: 40, KEY_DELETE: 46, KEY_HOME: 36, KEY_END: 35, KEY_PAGEUP: 33, KEY_PAGEDOWN: 34, element: function(event) { return event.target || event.srcElement; }, isLeftClick: function(event) { return (((event.which) && (event.which == 1)) || ((event.button) && (event.button == 1))); }, pointerX: function(event) { return event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)); }, pointerY: function(event) { return event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)); }, stop: function(event) { if (event.preventDefault) { event.preventDefault(); event.stopPropagation(); } else { event.returnValue = false; event.cancelBubble = true; } }, // find the first node with the given tagName, starting from the // node the event was triggered on; traverses the DOM upwards findElement: function(event, tagName) { var element = Event.element(event); while (element.parentNode && (!element.tagName || (element.tagName.toUpperCase() != tagName.toUpperCase()))) element = element.parentNode; return element; }, observers: false, _observeAndCache: function(element, name, observer, useCapture) { if (!this.observers) this.observers = []; if (element.addEventListener) { this.observers.push([element, name, observer, useCapture]); element.addEventListener(name, observer, useCapture); } else if (element.attachEvent) { this.observers.push([element, name, observer, useCapture]); element.attachEvent('on' + name, observer); } }, unloadCache: function() { if (!Event.observers) return; for (var i = 0, length = Event.observers.length; i < length; i++) { Event.stopObserving.apply(this, Event.observers[i]); Event.observers[i][0] = null; } Event.observers = false; }, observe: function(element, name, observer, useCapture) { element = $(element); useCapture = useCapture || false; if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.attachEvent)) name = 'keydown'; Event._observeAndCache(element, name, observer, useCapture); }, stopObserving: function(element, name, observer, useCapture) { element = $(element); useCapture = useCapture || false; if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.detachEvent)) name = 'keydown'; if (element.removeEventListener) { element.removeEventListener(name, observer, useCapture); } else if (element.detachEvent) { try { element.detachEvent('on' + name, observer); } catch (e) {} } } }); /* prevent memory leaks in IE */ if (navigator.appVersion.match(/\bMSIE\b/)) Event.observe(window, 'unload', Event.unloadCache, false); var Position = { // set to true if needed, warning: firefox performance problems // NOT neeeded for page scrolling, only if draggable contained in // scrollable elements includeScrollOffsets: false, // must be called before calling withinIncludingScrolloffset, every time the // page is scrolled prepare: function() { this.deltaX = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; this.deltaY = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; }, realOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.scrollTop || 0; valueL += element.scrollLeft || 0; element = element.parentNode; } while (element); return [valueL, valueT]; }, cumulativeOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent; } while (element); return [valueL, valueT]; }, positionedOffset: function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; element = element.offsetParent; if (element) { if(element.tagName=='BODY') break; var p = Element.getStyle(element, 'position'); if (p == 'relative' || p == 'absolute') break; } } while (element); return [valueL, valueT]; }, offsetParent: function(element) { if (element.offsetParent) return element.offsetParent; if (element == document.body) return element; while ((element = element.parentNode) && element != document.body) if (Element.getStyle(element, 'position') != 'static') return element; return document.body; }, // caches x/y coordinate pair to use with overlap within: function(element, x, y) { if (this.includeScrollOffsets) return this.withinIncludingScrolloffsets(element, x, y); this.xcomp = x; this.ycomp = y; this.offset = this.cumulativeOffset(element); return (y >= this.offset[1] && y < this.offset[1] + element.offsetHeight && x >= this.offset[0] && x < this.offset[0] + element.offsetWidth); }, withinIncludingScrolloffsets: function(element, x, y) { var offsetcache = this.realOffset(element); this.xcomp = x + offsetcache[0] - this.deltaX; this.ycomp = y + offsetcache[1] - this.deltaY; this.offset = this.cumulativeOffset(element); return (this.ycomp >= this.offset[1] && this.ycomp < this.offset[1] + element.offsetHeight && this.xcomp >= this.offset[0] && this.xcomp < this.offset[0] + element.offsetWidth); }, // within must be called directly before overlap: function(mode, element) { if (!mode) return 0; if (mode == 'vertical') return ((this.offset[1] + element.offsetHeight) - this.ycomp) / element.offsetHeight; if (mode == 'horizontal') return ((this.offset[0] + element.offsetWidth) - this.xcomp) / element.offsetWidth; }, page: function(forElement) { var valueT = 0, valueL = 0; var element = forElement; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; // Safari fix if (element.offsetParent==document.body) if (Element.getStyle(element,'position')=='absolute') break; } while (element = element.offsetParent); element = forElement; do { if (!window.opera || element.tagName=='BODY') { valueT -= element.scrollTop || 0; valueL -= element.scrollLeft || 0; } } while (element = element.parentNode); return [valueL, valueT]; }, clone: function(source, target) { var options = Object.extend({ setLeft: true, setTop: true, setWidth: true, setHeight: true, offsetTop: 0, offsetLeft: 0 }, arguments[2] || {}) // find page position of source source = $(source); var p = Position.page(source); // find coordinate system to use target = $(target); var delta = [0, 0]; var parent = null; // delta [0,0] will do fine with position: fixed elements, // position:absolute needs offsetParent deltas if (Element.getStyle(target,'position') == 'absolute') { parent = Position.offsetParent(target); delta = Position.page(parent); } // correct by body offsets (fixes Safari) if (parent == document.body) { delta[0] -= document.body.offsetLeft; delta[1] -= document.body.offsetTop; } // set position if(options.setLeft) target.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; if(options.setTop) target.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; if(options.setWidth) target.style.width = source.offsetWidth + 'px'; if(options.setHeight) target.style.height = source.offsetHeight + 'px'; }, absolutize: function(element) { element = $(element); if (element.style.position == 'absolute') return; Position.prepare(); var offsets = Position.positionedOffset(element); var top = offsets[1]; var left = offsets[0]; var width = element.clientWidth; var height = element.clientHeight; element._originalLeft = left - parseFloat(element.style.left || 0); element._originalTop = top - parseFloat(element.style.top || 0); element._originalWidth = element.style.width; element._originalHeight = element.style.height; element.style.position = 'absolute'; element.style.top = top + 'px'; element.style.left = left + 'px'; element.style.width = width + 'px'; element.style.height = height + 'px'; }, relativize: function(element) { element = $(element); if (element.style.position == 'relative') return; Position.prepare(); element.style.position = 'relative'; var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); element.style.top = top + 'px'; element.style.left = left + 'px'; element.style.height = element._originalHeight; element.style.width = element._originalWidth; } } // Safari returns margins on body which is incorrect if the child is absolutely // positioned. For performance reasons, redefine Position.cumulativeOffset for // KHTML/WebKit only. if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) { Position.cumulativeOffset = function(element) { var valueT = 0, valueL = 0; do { valueT += element.offsetTop || 0; valueL += element.offsetLeft || 0; if (element.offsetParent == document.body) if (Element.getStyle(element, 'position') == 'absolute') break; element = element.offsetParent; } while (element); return [valueL, valueT]; } } Element.addMethods(); // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ // The rest of this file is the actual ray tracer written by Adam // Burmister. It's a concatenation of the following files: // // flog/color.js // flog/light.js // flog/vector.js // flog/ray.js // flog/scene.js // flog/material/basematerial.js // flog/material/solid.js // flog/material/chessboard.js // flog/shape/baseshape.js // flog/shape/sphere.js // flog/shape/plane.js // flog/intersectioninfo.js // flog/camera.js // flog/background.js // flog/engine.js /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Color = Class.create(); Flog.RayTracer.Color.prototype = { red : 0.0, green : 0.0, blue : 0.0, initialize : function(r, g, b) { if(!r) r = 0.0; if(!g) g = 0.0; if(!b) b = 0.0; this.red = r; this.green = g; this.blue = b; }, add : function(c1, c2){ var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red + c2.red; result.green = c1.green + c2.green; result.blue = c1.blue + c2.blue; return result; }, addScalar: function(c1, s){ var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red + s; result.green = c1.green + s; result.blue = c1.blue + s; result.limit(); return result; }, subtract: function(c1, c2){ var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red - c2.red; result.green = c1.green - c2.green; result.blue = c1.blue - c2.blue; return result; }, multiply : function(c1, c2) { var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red * c2.red; result.green = c1.green * c2.green; result.blue = c1.blue * c2.blue; return result; }, multiplyScalar : function(c1, f) { var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red * f; result.green = c1.green * f; result.blue = c1.blue * f; return result; }, divideFactor : function(c1, f) { var result = new Flog.RayTracer.Color(0,0,0); result.red = c1.red / f; result.green = c1.green / f; result.blue = c1.blue / f; return result; }, limit: function(){ this.red = (this.red > 0.0) ? ( (this.red > 1.0) ? 1.0 : this.red ) : 0.0; this.green = (this.green > 0.0) ? ( (this.green > 1.0) ? 1.0 : this.green ) : 0.0; this.blue = (this.blue > 0.0) ? ( (this.blue > 1.0) ? 1.0 : this.blue ) : 0.0; }, distance : function(color) { var d = Math.abs(this.red - color.red) + Math.abs(this.green - color.green) + Math.abs(this.blue - color.blue); return d; }, blend: function(c1, c2, w){ var result = new Flog.RayTracer.Color(0,0,0); result = Flog.RayTracer.Color.prototype.add( Flog.RayTracer.Color.prototype.multiplyScalar(c1, 1 - w), Flog.RayTracer.Color.prototype.multiplyScalar(c2, w) ); return result; }, toString : function () { var r = Math.floor(this.red*255); var g = Math.floor(this.green*255); var b = Math.floor(this.blue*255); return "rgb("+ r +","+ g +","+ b +")"; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Light = Class.create(); Flog.RayTracer.Light.prototype = { position: null, color: null, intensity: 10.0, initialize : function(pos, color, intensity) { this.position = pos; this.color = color; this.intensity = (intensity ? intensity : 10.0); }, getIntensity: function(distance){ if(distance >= intensity) return 0; return Math.pow((intensity - distance) / strength, 0.2); }, toString : function () { return 'Light [' + this.position.x + ',' + this.position.y + ',' + this.position.z + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Vector = Class.create(); Flog.RayTracer.Vector.prototype = { x : 0.0, y : 0.0, z : 0.0, initialize : function(x, y, z) { this.x = (x ? x : 0); this.y = (y ? y : 0); this.z = (z ? z : 0); }, copy: function(vector){ this.x = vector.x; this.y = vector.y; this.z = vector.z; }, normalize : function() { var m = this.magnitude(); return new Flog.RayTracer.Vector(this.x / m, this.y / m, this.z / m); }, magnitude : function() { return Math.sqrt((this.x * this.x) + (this.y * this.y) + (this.z * this.z)); }, cross : function(w) { return new Flog.RayTracer.Vector( -this.z * w.y + this.y * w.z, this.z * w.x - this.x * w.z, -this.y * w.x + this.x * w.y); }, dot : function(w) { return this.x * w.x + this.y * w.y + this.z * w.z; }, add : function(v, w) { return new Flog.RayTracer.Vector(w.x + v.x, w.y + v.y, w.z + v.z); }, subtract : function(v, w) { if(!w || !v) throw 'Vectors must be defined [' + v + ',' + w + ']'; return new Flog.RayTracer.Vector(v.x - w.x, v.y - w.y, v.z - w.z); }, multiplyVector : function(v, w) { return new Flog.RayTracer.Vector(v.x * w.x, v.y * w.y, v.z * w.z); }, multiplyScalar : function(v, w) { return new Flog.RayTracer.Vector(v.x * w, v.y * w, v.z * w); }, toString : function () { return 'Vector [' + this.x + ',' + this.y + ',' + this.z + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Ray = Class.create(); Flog.RayTracer.Ray.prototype = { position : null, direction : null, initialize : function(pos, dir) { this.position = pos; this.direction = dir; }, toString : function () { return 'Ray [' + this.position + ',' + this.direction + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Scene = Class.create(); Flog.RayTracer.Scene.prototype = { camera : null, shapes : [], lights : [], background : null, initialize : function() { this.camera = new Flog.RayTracer.Camera( new Flog.RayTracer.Vector(0,0,-5), new Flog.RayTracer.Vector(0,0,1), new Flog.RayTracer.Vector(0,1,0) ); this.shapes = new Array(); this.lights = new Array(); this.background = new Flog.RayTracer.Background(new Flog.RayTracer.Color(0,0,0.5), 0.2); } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Material) == 'undefined') Flog.RayTracer.Material = {}; Flog.RayTracer.Material.BaseMaterial = Class.create(); Flog.RayTracer.Material.BaseMaterial.prototype = { gloss: 2.0, // [0...infinity] 0 = matt transparency: 0.0, // 0=opaque reflection: 0.0, // [0...infinity] 0 = no reflection refraction: 0.50, hasTexture: false, initialize : function() { }, getColor: function(u, v){ }, wrapUp: function(t){ t = t % 2.0; if(t < -1) t += 2.0; if(t >= 1) t -= 2.0; return t; }, toString : function () { return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Material.Solid = Class.create(); Flog.RayTracer.Material.Solid.prototype = Object.extend( new Flog.RayTracer.Material.BaseMaterial(), { initialize : function(color, reflection, refraction, transparency, gloss) { this.color = color; this.reflection = reflection; this.transparency = transparency; this.gloss = gloss; this.hasTexture = false; }, getColor: function(u, v){ return this.color; }, toString : function () { return 'SolidMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } ); /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Material.Chessboard = Class.create(); Flog.RayTracer.Material.Chessboard.prototype = Object.extend( new Flog.RayTracer.Material.BaseMaterial(), { colorEven: null, colorOdd: null, density: 0.5, initialize : function(colorEven, colorOdd, reflection, transparency, gloss, density) { this.colorEven = colorEven; this.colorOdd = colorOdd; this.reflection = reflection; this.transparency = transparency; this.gloss = gloss; this.density = density; this.hasTexture = true; }, getColor: function(u, v){ var t = this.wrapUp(u * this.density) * this.wrapUp(v * this.density); if(t < 0.0) return this.colorEven; else return this.colorOdd; }, toString : function () { return 'ChessMaterial [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } ); /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.BaseShape = Class.create(); Flog.RayTracer.Shape.BaseShape.prototype = { position: null, material: null, initialize : function() { this.position = new Vector(0,0,0); this.material = new Flog.RayTracer.Material.SolidMaterial( new Flog.RayTracer.Color(1,0,1), 0, 0, 0 ); }, toString : function () { return 'Material [gloss=' + this.gloss + ', transparency=' + this.transparency + ', hasTexture=' + this.hasTexture +']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.Sphere = Class.create(); Flog.RayTracer.Shape.Sphere.prototype = { initialize : function(pos, radius, material) { this.radius = radius; this.position = pos; this.material = material; }, intersect: function(ray){ var info = new Flog.RayTracer.IntersectionInfo(); info.shape = this; var dst = Flog.RayTracer.Vector.prototype.subtract(ray.position, this.position); var B = dst.dot(ray.direction); var C = dst.dot(dst) - (this.radius * this.radius); var D = (B * B) - C; if(D > 0){ // intersection! info.isHit = true; info.distance = (-B) - Math.sqrt(D); info.position = Flog.RayTracer.Vector.prototype.add( ray.position, Flog.RayTracer.Vector.prototype.multiplyScalar( ray.direction, info.distance ) ); info.normal = Flog.RayTracer.Vector.prototype.subtract( info.position, this.position ).normalize(); info.color = this.material.getColor(0,0); } else { info.isHit = false; } return info; }, toString : function () { return 'Sphere [position=' + this.position + ', radius=' + this.radius + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; if(typeof(Flog.RayTracer.Shape) == 'undefined') Flog.RayTracer.Shape = {}; Flog.RayTracer.Shape.Plane = Class.create(); Flog.RayTracer.Shape.Plane.prototype = { d: 0.0, initialize : function(pos, d, material) { this.position = pos; this.d = d; this.material = material; }, intersect: function(ray){ var info = new Flog.RayTracer.IntersectionInfo(); var Vd = this.position.dot(ray.direction); if(Vd == 0) return info; // no intersection var t = -(this.position.dot(ray.position) + this.d) / Vd; if(t <= 0) return info; info.shape = this; info.isHit = true; info.position = Flog.RayTracer.Vector.prototype.add( ray.position, Flog.RayTracer.Vector.prototype.multiplyScalar( ray.direction, t ) ); info.normal = this.position; info.distance = t; if(this.material.hasTexture){ var vU = new Flog.RayTracer.Vector(this.position.y, this.position.z, -this.position.x); var vV = vU.cross(this.position); var u = info.position.dot(vU); var v = info.position.dot(vV); info.color = this.material.getColor(u,v); } else { info.color = this.material.getColor(0,0); } return info; }, toString : function () { return 'Plane [' + this.position + ', d=' + this.d + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.IntersectionInfo = Class.create(); Flog.RayTracer.IntersectionInfo.prototype = { isHit: false, hitCount: 0, shape: null, position: null, normal: null, color: null, distance: null, initialize : function() { this.color = new Flog.RayTracer.Color(0,0,0); }, toString : function () { return 'Intersection [' + this.position + ']'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Camera = Class.create(); Flog.RayTracer.Camera.prototype = { position: null, lookAt: null, equator: null, up: null, screen: null, initialize : function(pos, lookAt, up) { this.position = pos; this.lookAt = lookAt; this.up = up; this.equator = lookAt.normalize().cross(this.up); this.screen = Flog.RayTracer.Vector.prototype.add(this.position, this.lookAt); }, getRay: function(vx, vy){ var pos = Flog.RayTracer.Vector.prototype.subtract( this.screen, Flog.RayTracer.Vector.prototype.subtract( Flog.RayTracer.Vector.prototype.multiplyScalar(this.equator, vx), Flog.RayTracer.Vector.prototype.multiplyScalar(this.up, vy) ) ); pos.y = pos.y * -1; var dir = Flog.RayTracer.Vector.prototype.subtract( pos, this.position ); var ray = new Flog.RayTracer.Ray(pos, dir.normalize()); return ray; }, toString : function () { return 'Ray []'; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Background = Class.create(); Flog.RayTracer.Background.prototype = { color : null, ambience : 0.0, initialize : function(color, ambience) { this.color = color; this.ambience = ambience; } } /* Fake a Flog.* namespace */ if(typeof(Flog) == 'undefined') var Flog = {}; if(typeof(Flog.RayTracer) == 'undefined') Flog.RayTracer = {}; Flog.RayTracer.Engine = Class.create(); Flog.RayTracer.Engine.prototype = { canvas: null, /* 2d context we can render to */ initialize: function(options){ this.options = Object.extend({ canvasHeight: 100, canvasWidth: 100, pixelWidth: 2, pixelHeight: 2, renderDiffuse: false, renderShadows: false, renderHighlights: false, renderReflections: false, rayDepth: 2 }, options || {}); this.options.canvasHeight /= this.options.pixelHeight; this.options.canvasWidth /= this.options.pixelWidth; /* TODO: dynamically include other scripts */ }, setPixel: function(x, y, color){ var pxW, pxH; pxW = this.options.pixelWidth; pxH = this.options.pixelHeight; if (this.canvas) { this.canvas.fillStyle = color.toString(); this.canvas.fillRect (x * pxW, y * pxH, pxW, pxH); } else { // print(x * pxW, y * pxH, pxW, pxH); } }, renderScene: function(scene, canvas){ /* Get canvas */ if (canvas) { this.canvas = canvas.getContext("2d"); } else { this.canvas = null; } var canvasHeight = this.options.canvasHeight; var canvasWidth = this.options.canvasWidth; for(var y=0; y < canvasHeight; y++){ for(var x=0; x < canvasWidth; x++){ var yp = y * 1.0 / canvasHeight * 2 - 1; var xp = x * 1.0 / canvasWidth * 2 - 1; var ray = scene.camera.getRay(xp, yp); var color = this.getPixelColor(ray, scene); this.setPixel(x, y, color); } } }, getPixelColor: function(ray, scene){ var info = this.testIntersection(ray, scene, null); if(info.isHit){ var color = this.rayTrace(info, ray, scene, 0); return color; } return scene.background.color; }, testIntersection: function(ray, scene, exclude){ var hits = 0; var best = new Flog.RayTracer.IntersectionInfo(); best.distance = 2000; for(var i=0; i= 0 && info.distance < best.distance){ best = info; hits++; } } } best.hitCount = hits; return best; }, getReflectionRay: function(P,N,V){ var c1 = -N.dot(V); var R1 = Flog.RayTracer.Vector.prototype.add( Flog.RayTracer.Vector.prototype.multiplyScalar(N, 2*c1), V ); return new Flog.RayTracer.Ray(P, R1); }, rayTrace: function(info, ray, scene, depth){ // Calc ambient var color = Flog.RayTracer.Color.prototype.multiplyScalar(info.color, scene.background.ambience); var oldColor = color; var shininess = Math.pow(10, info.shape.material.gloss + 1); for(var i=0; i 0.0){ color = Flog.RayTracer.Color.prototype.add( color, Flog.RayTracer.Color.prototype.multiply( info.color, Flog.RayTracer.Color.prototype.multiplyScalar( light.color, L ) ) ); } } // The greater the depth the more accurate the colours, but // this is exponentially (!) expensive if(depth <= this.options.rayDepth){ // calculate reflection ray if(this.options.renderReflections && info.shape.material.reflection > 0) { var reflectionRay = this.getReflectionRay(info.position, info.normal, ray.direction); var refl = this.testIntersection(reflectionRay, scene, info.shape); if (refl.isHit && refl.distance > 0){ refl.color = this.rayTrace(refl, reflectionRay, scene, depth + 1); } else { refl.color = scene.background.color; } color = Flog.RayTracer.Color.prototype.blend( color, refl.color, info.shape.material.reflection ); } // Refraction /* TODO */ } /* Render shadows and highlights */ var shadowInfo = new Flog.RayTracer.IntersectionInfo(); if(this.options.renderShadows){ var shadowRay = new Flog.RayTracer.Ray(info.position, v); shadowInfo = this.testIntersection(shadowRay, scene, info.shape); if(shadowInfo.isHit && shadowInfo.shape != info.shape /*&& shadowInfo.shape.type != 'PLANE'*/){ var vA = Flog.RayTracer.Color.prototype.multiplyScalar(color, 0.5); var dB = (0.5 * Math.pow(shadowInfo.shape.material.transparency, 0.5)); color = Flog.RayTracer.Color.prototype.addScalar(vA,dB); } } // Phong specular highlights if(this.options.renderHighlights && !shadowInfo.isHit && info.shape.material.gloss > 0){ var Lv = Flog.RayTracer.Vector.prototype.subtract( info.shape.position, light.position ).normalize(); var E = Flog.RayTracer.Vector.prototype.subtract( scene.camera.position, info.shape.position ).normalize(); var H = Flog.RayTracer.Vector.prototype.subtract( E, Lv ).normalize(); var glossWeight = Math.pow(Math.max(info.normal.dot(H), 0), shininess); color = Flog.RayTracer.Color.prototype.add( Flog.RayTracer.Color.prototype.multiplyScalar(light.color, glossWeight), color ); } } color.limit(); return color; } }; function renderScene(){ var scene = new Flog.RayTracer.Scene(); scene.camera = new Flog.RayTracer.Camera( new Flog.RayTracer.Vector(0, 0, -15), new Flog.RayTracer.Vector(-0.2, 0, 5), new Flog.RayTracer.Vector(0, 1, 0) ); scene.background = new Flog.RayTracer.Background( new Flog.RayTracer.Color(0.5, 0.5, 0.5), 0.4 ); var sphere = new Flog.RayTracer.Shape.Sphere( new Flog.RayTracer.Vector(-1.5, 1.5, 2), 1.5, new Flog.RayTracer.Material.Solid( new Flog.RayTracer.Color(0,0.5,0.5), 0.3, 0.0, 0.0, 2.0 ) ); var sphere1 = new Flog.RayTracer.Shape.Sphere( new Flog.RayTracer.Vector(1, 0.25, 1), 0.5, new Flog.RayTracer.Material.Solid( new Flog.RayTracer.Color(0.9,0.9,0.9), 0.1, 0.0, 0.0, 1.5 ) ); var plane = new Flog.RayTracer.Shape.Plane( new Flog.RayTracer.Vector(0.1, 0.9, -0.5).normalize(), 1.2, new Flog.RayTracer.Material.Chessboard( new Flog.RayTracer.Color(1,1,1), new Flog.RayTracer.Color(0,0,0), 0.2, 0.0, 1.0, 0.7 ) ); scene.shapes.push(plane); scene.shapes.push(sphere); scene.shapes.push(sphere1); var light = new Flog.RayTracer.Light( new Flog.RayTracer.Vector(5, 10, -1), new Flog.RayTracer.Color(0.8, 0.8, 0.8) ); var light1 = new Flog.RayTracer.Light( new Flog.RayTracer.Vector(-3, 5, -15), new Flog.RayTracer.Color(0.8, 0.8, 0.8), 100 ); scene.lights.push(light); scene.lights.push(light1); var imageWidth = 100; // $F('imageWidth'); var imageHeight = 100; // $F('imageHeight'); var pixelSize = "5,5".split(','); // $F('pixelSize').split(','); var renderDiffuse = true; // $F('renderDiffuse'); var renderShadows = true; // $F('renderShadows'); var renderHighlights = true; // $F('renderHighlights'); var renderReflections = true; // $F('renderReflections'); var rayDepth = 2;//$F('rayDepth'); var raytracer = new Flog.RayTracer.Engine( { canvasWidth: imageWidth, canvasHeight: imageHeight, pixelWidth: pixelSize[0], pixelHeight: pixelSize[1], "renderDiffuse": renderDiffuse, "renderHighlights": renderHighlights, "renderShadows": renderShadows, "renderReflections": renderReflections, "rayDepth": rayDepth } ); raytracer.renderScene(scene, null, 0); } mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/v8/richards.js0000644000175000017500000003660611545150464021411 0ustar chr1schr1s// Copyright 2007 Google Inc. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // This is a JavaScript implementation of the Richards // benchmark from: // // http://www.cl.cam.ac.uk/~mr10/Bench.html // // The benchmark was originally implemented in BCPL by // Martin Richards. var Richards = new BenchmarkSuite('Richards', 34886, [ new Benchmark("Richards", runRichards) ]); /** * The Richards benchmark simulates the task dispatcher of an * operating system. **/ function runRichards() { var scheduler = new Scheduler(); scheduler.addIdleTask(ID_IDLE, 0, null, COUNT); var queue = new Packet(null, ID_WORKER, KIND_WORK); queue = new Packet(queue, ID_WORKER, KIND_WORK); scheduler.addWorkerTask(ID_WORKER, 1000, queue); queue = new Packet(null, ID_DEVICE_A, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_A, KIND_DEVICE); scheduler.addHandlerTask(ID_HANDLER_A, 2000, queue); queue = new Packet(null, ID_DEVICE_B, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE); queue = new Packet(queue, ID_DEVICE_B, KIND_DEVICE); scheduler.addHandlerTask(ID_HANDLER_B, 3000, queue); scheduler.addDeviceTask(ID_DEVICE_A, 4000, null); scheduler.addDeviceTask(ID_DEVICE_B, 5000, null); scheduler.schedule(); if (scheduler.queueCount != EXPECTED_QUEUE_COUNT || scheduler.holdCount != EXPECTED_HOLD_COUNT) { var msg = "Error during execution: queueCount = " + scheduler.queueCount + ", holdCount = " + scheduler.holdCount + "."; print(msg); } } var COUNT = 1000; /** * These two constants specify how many times a packet is queued and * how many times a task is put on hold in a correct run of richards. * They don't have any meaning a such but are characteristic of a * correct run so if the actual queue or hold count is different from * the expected there must be a bug in the implementation. **/ var EXPECTED_QUEUE_COUNT = 2322; var EXPECTED_HOLD_COUNT = 928; /** * A scheduler can be used to schedule a set of tasks based on their relative * priorities. Scheduling is done by maintaining a list of task control blocks * which holds tasks and the data queue they are processing. * @constructor */ function Scheduler() { this.queueCount = 0; this.holdCount = 0; this.blocks = new Array(NUMBER_OF_IDS); this.list = null; this.currentTcb = null; this.currentId = null; } var ID_IDLE = 0; var ID_WORKER = 1; var ID_HANDLER_A = 2; var ID_HANDLER_B = 3; var ID_DEVICE_A = 4; var ID_DEVICE_B = 5; var NUMBER_OF_IDS = 6; var KIND_DEVICE = 0; var KIND_WORK = 1; /** * Add an idle task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task * @param {int} count the number of times to schedule the task */ Scheduler.prototype.addIdleTask = function (id, priority, queue, count) { this.addRunningTask(id, priority, queue, new IdleTask(this, 1, count)); }; /** * Add a work task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task */ Scheduler.prototype.addWorkerTask = function (id, priority, queue) { this.addTask(id, priority, queue, new WorkerTask(this, ID_HANDLER_A, 0)); }; /** * Add a handler task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task */ Scheduler.prototype.addHandlerTask = function (id, priority, queue) { this.addTask(id, priority, queue, new HandlerTask(this)); }; /** * Add a handler task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task */ Scheduler.prototype.addDeviceTask = function (id, priority, queue) { this.addTask(id, priority, queue, new DeviceTask(this)) }; /** * Add the specified task and mark it as running. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task * @param {Task} task the task to add */ Scheduler.prototype.addRunningTask = function (id, priority, queue, task) { this.addTask(id, priority, queue, task); this.currentTcb.setRunning(); }; /** * Add the specified task to this scheduler. * @param {int} id the identity of the task * @param {int} priority the task's priority * @param {Packet} queue the queue of work to be processed by the task * @param {Task} task the task to add */ Scheduler.prototype.addTask = function (id, priority, queue, task) { this.currentTcb = new TaskControlBlock(this.list, id, priority, queue, task); this.list = this.currentTcb; this.blocks[id] = this.currentTcb; }; /** * Execute the tasks managed by this scheduler. */ Scheduler.prototype.schedule = function () { this.currentTcb = this.list; while (this.currentTcb != null) { if (this.currentTcb.isHeldOrSuspended()) { this.currentTcb = this.currentTcb.link; } else { this.currentId = this.currentTcb.id; this.currentTcb = this.currentTcb.run(); } } }; /** * Release a task that is currently blocked and return the next block to run. * @param {int} id the id of the task to suspend */ Scheduler.prototype.release = function (id) { var tcb = this.blocks[id]; if (tcb == null) return tcb; tcb.markAsNotHeld(); if (tcb.priority > this.currentTcb.priority) { return tcb; } else { return this.currentTcb; } }; /** * Block the currently executing task and return the next task control block * to run. The blocked task will not be made runnable until it is explicitly * released, even if new work is added to it. */ Scheduler.prototype.holdCurrent = function () { this.holdCount++; this.currentTcb.markAsHeld(); return this.currentTcb.link; }; /** * Suspend the currently executing task and return the next task control block * to run. If new work is added to the suspended task it will be made runnable. */ Scheduler.prototype.suspendCurrent = function () { this.currentTcb.markAsSuspended(); return this.currentTcb; }; /** * Add the specified packet to the end of the worklist used by the task * associated with the packet and make the task runnable if it is currently * suspended. * @param {Packet} packet the packet to add */ Scheduler.prototype.queue = function (packet) { var t = this.blocks[packet.id]; if (t == null) return t; this.queueCount++; packet.link = null; packet.id = this.currentId; return t.checkPriorityAdd(this.currentTcb, packet); }; /** * A task control block manages a task and the queue of work packages associated * with it. * @param {TaskControlBlock} link the preceding block in the linked block list * @param {int} id the id of this block * @param {int} priority the priority of this block * @param {Packet} queue the queue of packages to be processed by the task * @param {Task} task the task * @constructor */ function TaskControlBlock(link, id, priority, queue, task) { this.link = link; this.id = id; this.priority = priority; this.queue = queue; this.task = task; if (queue == null) { this.state = STATE_SUSPENDED; } else { this.state = STATE_SUSPENDED_RUNNABLE; } } /** * The task is running and is currently scheduled. */ var STATE_RUNNING = 0; /** * The task has packets left to process. */ var STATE_RUNNABLE = 1; /** * The task is not currently running. The task is not blocked as such and may * be started by the scheduler. */ var STATE_SUSPENDED = 2; /** * The task is blocked and cannot be run until it is explicitly released. */ var STATE_HELD = 4; var STATE_SUSPENDED_RUNNABLE = STATE_SUSPENDED | STATE_RUNNABLE; var STATE_NOT_HELD = ~STATE_HELD; TaskControlBlock.prototype.setRunning = function () { this.state = STATE_RUNNING; }; TaskControlBlock.prototype.markAsNotHeld = function () { this.state = this.state & STATE_NOT_HELD; }; TaskControlBlock.prototype.markAsHeld = function () { this.state = this.state | STATE_HELD; }; TaskControlBlock.prototype.isHeldOrSuspended = function () { return (this.state & STATE_HELD) != 0 || (this.state == STATE_SUSPENDED); }; TaskControlBlock.prototype.markAsSuspended = function () { this.state = this.state | STATE_SUSPENDED; }; TaskControlBlock.prototype.markAsRunnable = function () { this.state = this.state | STATE_RUNNABLE; }; /** * Runs this task, if it is ready to be run, and returns the next task to run. */ TaskControlBlock.prototype.run = function () { var packet; if (this.state == STATE_SUSPENDED_RUNNABLE) { packet = this.queue; this.queue = packet.link; if (this.queue == null) { this.state = STATE_RUNNING; } else { this.state = STATE_RUNNABLE; } } else { packet = null; } return this.task.run(packet); }; /** * Adds a packet to the worklist of this block's task, marks this as runnable if * necessary, and returns the next runnable object to run (the one * with the highest priority). */ TaskControlBlock.prototype.checkPriorityAdd = function (task, packet) { if (this.queue == null) { this.queue = packet; this.markAsRunnable(); if (this.priority > task.priority) return this; } else { this.queue = packet.addTo(this.queue); } return task; }; TaskControlBlock.prototype.toString = function () { return "tcb { " + this.task + "@" + this.state + " }"; }; /** * An idle task doesn't do any work itself but cycles control between the two * device tasks. * @param {Scheduler} scheduler the scheduler that manages this task * @param {int} v1 a seed value that controls how the device tasks are scheduled * @param {int} count the number of times this task should be scheduled * @constructor */ function IdleTask(scheduler, v1, count) { this.scheduler = scheduler; this.v1 = v1; this.count = count; } IdleTask.prototype.run = function (packet) { this.count--; if (this.count == 0) return this.scheduler.holdCurrent(); if ((this.v1 & 1) == 0) { this.v1 = this.v1 >> 1; return this.scheduler.release(ID_DEVICE_A); } else { this.v1 = (this.v1 >> 1) ^ 0xD008; return this.scheduler.release(ID_DEVICE_B); } }; IdleTask.prototype.toString = function () { return "IdleTask" }; /** * A task that suspends itself after each time it has been run to simulate * waiting for data from an external device. * @param {Scheduler} scheduler the scheduler that manages this task * @constructor */ function DeviceTask(scheduler) { this.scheduler = scheduler; this.v1 = null; } DeviceTask.prototype.run = function (packet) { if (packet == null) { if (this.v1 == null) return this.scheduler.suspendCurrent(); var v = this.v1; this.v1 = null; return this.scheduler.queue(v); } else { this.v1 = packet; return this.scheduler.holdCurrent(); } }; DeviceTask.prototype.toString = function () { return "DeviceTask"; }; /** * A task that manipulates work packets. * @param {Scheduler} scheduler the scheduler that manages this task * @param {int} v1 a seed used to specify how work packets are manipulated * @param {int} v2 another seed used to specify how work packets are manipulated * @constructor */ function WorkerTask(scheduler, v1, v2) { this.scheduler = scheduler; this.v1 = v1; this.v2 = v2; } WorkerTask.prototype.run = function (packet) { if (packet == null) { return this.scheduler.suspendCurrent(); } else { if (this.v1 == ID_HANDLER_A) { this.v1 = ID_HANDLER_B; } else { this.v1 = ID_HANDLER_A; } packet.id = this.v1; packet.a1 = 0; for (var i = 0; i < DATA_SIZE; i++) { this.v2++; if (this.v2 > 26) this.v2 = 1; packet.a2[i] = this.v2; } return this.scheduler.queue(packet); } }; WorkerTask.prototype.toString = function () { return "WorkerTask"; }; /** * A task that manipulates work packets and then suspends itself. * @param {Scheduler} scheduler the scheduler that manages this task * @constructor */ function HandlerTask(scheduler) { this.scheduler = scheduler; this.v1 = null; this.v2 = null; } HandlerTask.prototype.run = function (packet) { if (packet != null) { if (packet.kind == KIND_WORK) { this.v1 = packet.addTo(this.v1); } else { this.v2 = packet.addTo(this.v2); } } if (this.v1 != null) { var count = this.v1.a1; var v; if (count < DATA_SIZE) { if (this.v2 != null) { v = this.v2; this.v2 = this.v2.link; v.a1 = this.v1.a2[count]; this.v1.a1 = count + 1; return this.scheduler.queue(v); } } else { v = this.v1; this.v1 = this.v1.link; return this.scheduler.queue(v); } } return this.scheduler.suspendCurrent(); }; HandlerTask.prototype.toString = function () { return "HandlerTask"; }; /* --- * * P a c k e t * --- */ var DATA_SIZE = 4; /** * A simple package of data that is manipulated by the tasks. The exact layout * of the payload data carried by a packet is not importaint, and neither is the * nature of the work performed on packets by the tasks. * * Besides carrying data, packets form linked lists and are hence used both as * data and worklists. * @param {Packet} link the tail of the linked list of packets * @param {int} id an ID for this packet * @param {int} kind the type of this packet * @constructor */ function Packet(link, id, kind) { this.link = link; this.id = id; this.kind = kind; this.a1 = 0; this.a2 = new Array(DATA_SIZE); } /** * Add this packet to the end of a worklist, and return the worklist. * @param {Packet} queue the worklist to add this packet to */ Packet.prototype.addTo = function (queue) { this.link = null; if (queue == null) return this; var peek, next = queue; while ((peek = next.link) != null) next = peek; next.link = this; return queue; }; Packet.prototype.toString = function () { return "Packet"; }; mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/v8/run-earley-boyer.js0000644000175000017500000000354111545150464023003 0ustar chr1schr1s// Copyright 2008 Google Inc. All Rights Reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. load('base.js'); load('earley-boyer.js'); function PrintResult(name, result) { print(name + ': ' + result); } function PrintScore(score) { print('----'); print('Score: ' + score); } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/v8/run-raytrace.js0000644000175000017500000000353511545150464022221 0ustar chr1schr1s// Copyright 2008 Google Inc. All Rights Reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. load('base.js'); load('raytrace.js'); function PrintResult(name, result) { print(name + ': ' + result); } function PrintScore(score) { print('----'); print('Score: ' + score); } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/v8/run-richards.js0000644000175000017500000000353511545150464022206 0ustar chr1schr1s// Copyright 2008 Google Inc. All Rights Reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. load('base.js'); load('richards.js'); function PrintResult(name, result) { print(name + ': ' + result); } function PrintScore(score) { print('----'); print('Score: ' + score); } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs-1.8.5-1.0.0+dfsg/js/src/metrics/jint/v8/run.js0000644000175000017500000000366511545150464020415 0ustar chr1schr1s// Copyright 2008 Google Inc. All Rights Reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. load('base.js'); load('richards.js'); load('deltablue.js'); load('crypto.js'); load('raytrace.js'); load('earley-boyer.js'); function PrintResult(name, result) { print(name + ': ' + result); } function PrintScore(score) { print('----'); print('Score: ' + score); } BenchmarkSuite.RunSuites({ NotifyResult: PrintResult, NotifyScore: PrintScore }); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/browser.js0000644000175000017500000000000011545150464022772 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/decompile-xml-escapes.js0000644000175000017500000000526011545150464025504 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Jeff Walden . * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = "352285"; var summary = "Decompiler escapes line breaks/backslashes in E4X literals"; var actual, expect; printBugNumber(BUGNUMBER); START(summary); /************** * BEGIN TEST * **************/ var failed = false; function assertCorrectDecompilation(xmlInitializer) { var func = new Function("return " + xmlInitializer); var funcStr = func.toString(); if (funcStr.indexOf(xmlInitializer) < 0) throw "'" + funcStr + "' does not contain '" + xmlInitializer + "'!"; } try { assertCorrectDecompilation(""); assertCorrectDecompilation(""); assertCorrectDecompilation(""); assertCorrectDecompilation(""); assertCorrectDecompilation(""); } catch (ex) { failed = ex; } expect = false; actual = failed; TEST(1, expect, actual); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/jstests.list0000644000175000017500000000107511545150464023362 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/decompilation/ fails script decompile-xml-escapes.js script regress-349814.js script regress-349815.js script regress-349822.js script regress-349956.js script regress-350226.js script regress-350531.js script regress-351706.js script regress-351988.js script regress-352013.js script regress-352459.js script regress-352649.js script regress-352789.js script regress-355101.js script regress-355474-01.js skip script regress-373678.js # obsolete test skip script regress-429249.js script regress-461233.js script regress-463360.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-349814.js0000644000175000017500000000412011545150464023542 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 349814; var summary = 'decompilation of e4x literals'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var z = function () { a = ; }; expect = z + ''; actual = (eval("(" + z + ")")) + ''; compareSource(expect, actual, inSection(1) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-349815.js0000644000175000017500000000417611545150464023556 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 349815; var summary = 'decompilation of parameterized e4x xmllist literal'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f = function (tag) { return <><{tag}>; } expect = 'function (tag) {\n return <><{tag}>;\n}'; actual = f + ''; compareSource(expect, actual, inSection(1) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-349822.js0000644000175000017500000000420011545150464023540 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 349822; var summary = 'decompilation of x.@[2]'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'function () {\n return x.@[2];\n}'; try { var f = eval('(function () { return x.@[2]; })'); actual = f + ''; } catch(ex) { actual = ex + ''; } compareSource(expect, actual, inSection(1) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-349956.js0000644000175000017500000000410011545150464023547 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 349956; var summary = 'decompilation of .@*'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f; var g; f = function () { .@* }; g = eval('(' + f + ')'); expect = f + ''; actual = g + ''; compareSource(expect, actual, inSection(1) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-350226.js0000644000175000017500000000407511545150464023540 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 350226; var summary = 'decompilation of .@[*]'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f = function () { [@[*]]; } expect = 'function () {\n [@[*]];\n}'; actual = f + ''; compareSource(expect, actual, inSection(1) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-350531.js0000644000175000017500000000443111545150464023533 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Biju * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 350531; var summary = "decompilation of function (){ return (@['a'])=='b'}"; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f; f = function (){ return (@['a'])=='b'} expect = 'function () {\n return @["a"] == "b";\n}'; actual = f + ''; compareSource(expect, actual, inSection(1) + summary); f = function (){ return (@['a']).toXMLString() } expect = 'function () {\n return @["a"].toXMLString();\n}'; actual = f + ''; compareSource(expect, actual, inSection(2) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-351706.js0000644000175000017500000000436611545150464023547 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 351706; var summary = 'decompilation of E4X literals with parens'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f; f = function() { return <{m}/>.(y) } expect = 'function() { return (<{m}/>).(y); }'; actual = f + ''; compareSource(expect, actual, inSection(1) + summary); f = function() { return (<{m}/>).(y) } expect = 'function() { return (<{m}/>).(y); }'; actual = f + ''; compareSource(expect, actual, inSection(2) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-351988.js0000644000175000017500000000107011545150464023550 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Robert Sayre */ var summary = 'decompilation of XMLPI object initializer'; var BUGNUMBER = 351988; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f; f = function() { var y = ; } actual = f + ''; expect = 'function () {\n var y = ;\n}'; compareSource(expect, actual, inSection(1) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-352013.js0000644000175000017500000001125311545150464023530 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 352013; var summary = 'Decompilation with new operator redeaux'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var l, m, r; var nTests = 0; // --------------------------------------------------------------- l = function () { (new x(y))[z]; }; expect = 'function () { (new x(y))[z]; }'; actual = l + ''; compareSource(expect, actual, inSection(++nTests) + summary); m = function () { new (x(y))[z]; }; expect = 'function () { new (x(y)[z]); }'; actual = m + ''; compareSource(expect, actual, inSection(++nTests) + summary); r = function () { new (x(y)[z]); }; expect = 'function () { new (x(y)[z]); }'; actual = r + ''; compareSource(expect, actual, inSection(++nTests) + summary); // --------------------------------------------------------------- l = function () { (new x(y)).@a; }; expect = 'function () { (new x(y)).@a; }'; actual = l + ''; compareSource(expect, actual, inSection(++nTests) + summary); m = function () { new (x(y)).@a; }; expect = 'function () { new (x(y).@a); }'; actual = m + ''; compareSource(expect, actual, inSection(++nTests) + summary); r = function () { new (x(y).@a); }; expect = 'function () { new (x(y).@a); }'; actual = r + ''; compareSource(expect, actual, inSection(++nTests) + summary); // --------------------------------------------------------------- l = function () { (new x(y)).@n::a; }; expect = 'function () { (new x(y)).@[n::a]; }'; actual = l + ''; compareSource(expect, actual, inSection(++nTests) + summary); m = function () { new (x(y)).@n::a; }; expect = 'function () { new (x(y).@[n::a]); }'; actual = m + ''; compareSource(expect, actual, inSection(++nTests) + summary); r = function () { new (x(y).@n::a); }; expect = 'function () { new (x(y).@[n::a]); }'; actual = r + ''; compareSource(expect, actual, inSection(++nTests) + summary); // --------------------------------------------------------------- l = function () { (new x(y)).n::z; }; expect = 'function () { (new x(y)).n::z; }'; actual = l + ''; compareSource(expect, actual, inSection(++nTests) + summary); m = function () { new (x(y)).n::z; }; expect = 'function () { new (x(y).n::z); }'; actual = m + ''; compareSource(expect, actual, inSection(++nTests) + summary); r = function () { new (x(y).n::z); }; expect = 'function () { new (x(y).n::z); }'; actual = r + ''; compareSource(expect, actual, inSection(++nTests) + summary); // --------------------------------------------------------------- l = function () { (new x(y)).n::[z]; }; expect = 'function () { (new x(y)).n::[z]; }'; actual = l + ''; compareSource(expect, actual, inSection(++nTests) + summary); m = function () { new (x(y)).n::[z]; }; expect = 'function () { new (x(y).n::[z]); }'; actual = m + ''; compareSource(expect, actual, inSection(++nTests) + summary); r = function () { new (x(y).n::[z]); }; expect = 'function () { new (x(y).n::[z]); }'; actual = r + ''; compareSource(expect, actual, inSection(++nTests) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-352459.js0000644000175000017500000000410011545150464023537 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 352459; var summary = 'decompilation for 4..@x++'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f = (function() { return 4..@x++; } ); expect = 'function() { return (4).@x++; }'; actual = f + ''; compareSource(expect, actual, inSection(1) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-352649.js0000644000175000017500000000412411545150464023546 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 352649; var summary = 'decompilation of e4x literal after |if| block'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f = function() { if(g) p; (.i) } expect = 'function() { if(g) {p;} .i; }'; actual = f + ''; compareSource(expect, actual, inSection(1) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-352789.js0000644000175000017500000000461411545150464023557 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 352789; var summary = 'Decompilation of new and .@'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f; f = function() { return new (a()).@z; }; expect = 'function() { return new (a().@z); }'; actual = f + ''; compareSource(expect, actual, inSection(1) + summary); f = function () { return new a().@z; }; expect = 'function () { return (new a).@z; }'; actual = f + ''; compareSource(expect, actual, inSection(2) + summary); f = function () { return (new a).@z; }; expect = 'function () { return (new a).@z; }'; actual = f + ''; compareSource(expect, actual, inSection(3) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-355101.js0000644000175000017500000000410611545150464023530 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 355101; var summary = 'XML Filtering predicate operator'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f = function () { return i.(true); } expect = 'function () { return i.(true); }'; actual = f + ''; compareSource(expect, actual, inSection(1) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-355474-01.js0000644000175000017500000000427511545150464023772 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 355474; var summary = 'Iterating over XML with WAY_TOO_MUCH_GC'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f = function () { for each (var z in ) { print(z); } }; expect = 'function () { for each (var z in ) { print(z); } }'; actual = f + ''; compareSource(expect, actual, inSection(1) + summary); expect = actual = 'No Hang'; f(); f(); TEST(2, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-373678.js0000644000175000017500000000424711545150464023561 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 373678; var summary = 'Missing quotes around string in decompilation, ' + 'with for..in and do..while'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f = function() { do {for(a.b in []) { } } while("c\\d"); }; expect = 'function() { do {for(a.b in []) { } } while("c\\\\d"); }'; actual = f + ''; compareSource(expect, actual, inSection(1) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-429249.js0000644000175000017500000000441111545150464023546 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'trap should not change decompilation '; var BUGNUMBER = 429249 var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function g() { return ; } expect = 'function g() { return ; }'; actual = g + ''; compareSource(expect, actual, summary + ' : before trap'); if (typeof trap == 'function' && typeof setDebug == 'function') { setDebug(true); trap(g, 0, ""); actual = g + ''; compareSource(expect, actual, summary + ' : after trap'); } END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-461233.js0000644000175000017500000000411411545150464023533 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Decompilation of ({0: (4, <>)})'; var BUGNUMBER = 461233; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var f = (function() { return ({0: (4, <>) }); }); expect = 'function() { return {0: (4, <>) }; }'; actual = f + ''; compareSource(expect, actual, expect) END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/regress-463360.js0000644000175000017500000000103511545150464023535 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Rasmus Jensen */ var summary = 'Uneval+eval of XML containing string with {'; var BUGNUMBER = 463360; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); actual = eval(uneval(XML("{"))); expect = XML("{"); compareSource(expect, actual, inSection(1) + summary); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/decompilation/shell.js0000644000175000017500000000000011545150464022416 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.1.js0000644000175000017500000000550011545150464021533 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.1.1 - Attribute Identifiers"); x = TEST_XML(1, "value1", x.bravo.@attr1); TEST_XML(2, "value2", x.bravo.charlie.@attr1); correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); TEST(3, correct, x..@attr1); n = new Namespace("http://someuri"); TEST_XML(4, "value3", x.bravo.@n::attr1); TEST_XML(5, "value4", x.bravo.charlie.@n::attr1); correct = new XMLList(); correct += new XML("value3"); correct += new XML("value4"); TEST(6, correct, x..@n::attr1); q = new QName(n, "attr1"); TEST(7, correct, x..@[q]); correct = new XMLList(); correct += new XML("value1"); correct += new XML("value3"); correct += new XML("value2"); correct += new XML("value4"); TEST(8, correct, x..@*::attr1); TEST_XML(9, "value1", x.bravo.@["attr1"]); TEST_XML(10, "value3", x.bravo.@n::["attr1"]); TEST_XML(11, "value3", x.bravo.@[q]); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.2.js0000644000175000017500000000613611545150464021542 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.1.2 - Qualified Identifiers"); x = DIS ; soap = new Namespace("http://schemas.xmlsoap.org/soap/envelope/"); stock = new Namespace("http://mycompany.com/stocks"); encodingStyle = x.@soap::encodingStyle; TEST_XML(1, "http://schemas.xmlsoap.org/soap/encoding/", encodingStyle); correct = DIS ; body = x.soap::Body; TEST_XML(2, correct.toXMLString(), body); body = x.soap::["Body"]; TEST_XML(3, correct.toXMLString(), body); q = new QName(soap, "Body"); body = x[q]; TEST_XML(4, correct.toXMLString(), body); correct = MYCO; x.soap::Body.stock::getLastTradePrice.symbol = "MYCO"; TEST_XML(5, correct.toXMLString(), x.soap::Body.stock::getLastTradePrice.symbol); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.3.js0000644000175000017500000000401311545150464021533 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.1.3 - Wildcard Identifiers"); x = one two correct = <>onetwo; TEST(1, correct, x.*); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.4-01.js0000644000175000017500000000435511545150464021763 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = '11.1.4 - XML Initializer should accept single processing ' + 'instruction'; var BUGNUMBER = 257679; var actual = ''; var expect = 'processing-instruction'; printBugNumber(BUGNUMBER); START(summary); XML.ignoreProcessingInstructions = false; print("XML.ignoreProcessingInstructions: " + XML.ignoreProcessingInstructions); var pi = ; if (pi) { actual = pi.nodeKind(); } else { actual = 'undefined'; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.4-02.js0000644000175000017500000000417511545150464021764 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "11.1.4 - XML Initializer should accept single CDATA Section"; var BUGNUMBER = 257679; var actual = ''; var expect = 'text'; printBugNumber(BUGNUMBER); START(summary); var cdataText = All for Kibology.]]>; if (cdataText) { actual = cdataText.nodeKind(); } else { actual = 'undefined'; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.4-03.js0000644000175000017500000000424211545150464021760 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = '11.1.4 - XML Initializer should accept single comment'; var BUGNUMBER = 257679; var actual = ''; var expect = 'comment'; printBugNumber(BUGNUMBER); START(summary); XML.ignoreComments = false; print("XML.ignoreComments: " + XML.ignoreComments); var comment = ; if (comment) { actual = comment.nodeKind(); } else { actual = 'undefined'; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.4-04.js0000644000175000017500000000405411545150464021762 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "11.1.4 - XML Initializer - Comment hiding parsing/scanning"; var BUGNUMBER = 311157; var actual; var expect; printBugNumber(BUGNUMBER); START(summary); var x = there ; actual = x.toString(); expect = '\n there '; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.4-05.js0000644000175000017500000000412711545150464021764 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "11.1.4 - XML Initializer - Comment hiding parsing/scanning"; var BUGNUMBER = 311157; var actual; var expect; printBugNumber(BUGNUMBER); START(summary); XML.ignoreWhitespace = false; var x = there ; actual = x.toString(); expect = ' duh \n there '; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.4-06.js0000644000175000017500000000414111545150464021761 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Seno Aiko * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "11.1.4 - ]] should be allowed in CDATA Section"; var BUGNUMBER = 313929; var actual = 'No error'; var expect = 'No error'; printBugNumber(BUGNUMBER); START(summary); try { actual = XML("").toString(); } catch(e) { actual = e + ''; } expect = ( ]] ).toString(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.4-07.js0000644000175000017500000000460411545150464021766 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Biju * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "11.1.4 - XML Initializer - x"; var BUGNUMBER = 321549; var actual = 'No error'; var expect = 'No error'; printBugNumber(BUGNUMBER); START(summary); var b = 'b'; try { actual = (x). toString(); } catch(e) { actual = e + ''; } expect = (x).toString(); TEST(1, expect, actual); try { actual = (x). toString(); } catch(e) { actual = e + ''; } expect = (x).toString(); TEST(2, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.4-08.js0000644000175000017500000002060311545150464021764 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Biju * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "11.1.4 - XML Initializer - {} Expressions - 08"; var BUGNUMBER = 325750; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); printStatus('E4X: inconsistencies in the use of {} syntax Part Deux'); // https://bugzilla.mozilla.org/show_bug.cgi?id=318922 // https://bugzilla.mozilla.org/show_bug.cgi?id=321549 var exprs = []; var iexpr; exprs.push({expr: 'b=\'\\\'\';\na=\n x\n;', valid: false}); exprs.push({expr: 'b=\'\\\'\';\na=\n x\n;', valid: false}); exprs.push({expr: 'b=\'b\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n <{b}b>x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n <{b+\'b\'}>x\n;', valid: true}); exprs.push({expr: 'b=\'b\';\na=\n <{b}b>x\n;', valid: true}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: false}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: false}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: true}); exprs.push({expr: 'b=\'c\';\na=\n x\n;', valid: true}); exprs.push({expr: 'm=1;\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm=1;\na=new XML(m);', valid: true}); exprs.push({expr: 'm=o;\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm=o;\na=\n <{m}>x z\n;', valid: false}); exprs.push({expr: 'm=o;\na=\n <{m}>x z\n;', valid: true}); exprs.push({expr: 'm=[1,\'x\'];\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm=[1,\'x\'];\na=new XML(m);', valid: false}); exprs.push({expr: 'm=[1];\na=new XML(m);', valid: false}); exprs.push({expr: 'm=\'o\';\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm=\'o\';\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm=\'x\';\na=new XML(m);', valid: true}); exprs.push({expr: 'm=new Date();\na=new XML(m);', valid: false}); exprs.push({expr: 'm=new Number(\'1\');\na=new XML(m);', valid: true}); exprs.push({expr: 'm=new String(\'x\');\na=new XML(\'\\n {m}\\n\');', valid: true}); exprs.push({expr: 'm=new String(\'x\');\na=new XML(m);', valid: true}); exprs.push({expr: 'm={a:1,b:\'x\'};\na=\n x {m} z\n;', valid: true}); exprs.push({expr: 'm={a:1,b:\'x\'};\na=new XML(m);', valid: false}); exprs.push({expr: 'p="p";\nu=\'http://a.uri/\';\na=\n x\n;', valid: true}); exprs.push({expr: 'p="p";\nu=\'http://a.uri/\';\na=\n x\n;', valid: true}); exprs.push({expr: 'p="pp";\nu=\'http://a.uri/\';\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\na=\n <{u}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\na=\n x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace("p",u);\na=\n <{u}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace("p",u);\na=\n <{u}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace("p",u);\na=\n x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace("p",u);\na=\n <{n}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace(u);\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace(u);\na=\n <{n}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace(u);\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace(u);\na=\n <{n}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\nn=new Namespace(u);\na=\n <{n}:b>x\n;', valid: false}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\na=\n <{p}:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\na=\n x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\na=\n <{p}p:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\nns="ns";\na=\n <{p}p:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\nns="xmlns";\na=\n <{p}p:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'p\';\nxml="xml";\na=\n <{p}p:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\np=\'pp\';\na=\n <{p}:b>x\n;', valid: true}); exprs.push({expr: 'u=\'http://a.uri/\';\nu2=\'http://uri2.sameprefix/\';\nn=new Namespace(\'p\',u2);\na=\n <{n}:b>x\n;', valid: false}); // This should always fail for (iexpr = 0; iexpr < exprs.length; ++iexpr) { evalStr(exprs, iexpr); } END(); function evalStr(exprs, iexpr) { var value; var valid; var passfail; var obj = exprs[iexpr]; try { value = eval(obj.expr).toXMLString(); valid = true; } catch(ex) { value = ex + ''; valid = false; } passfail = (valid === obj.valid); msg = iexpr + ': ' + (passfail ? 'PASS':'FAIL') + ' expected: ' + (obj.valid ? 'valid':'invalid') + ', actual: ' + (valid ? 'valid':'invalid') + '\n' + 'input: ' + '\n' + obj.expr + '\n' + 'output: ' + '\n' + value + '\n\n'; printStatus(msg); TEST(iexpr, obj.valid, valid); return passfail; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.4.js0000644000175000017500000000776211545150464021552 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.1.4 - XML Initializer"); person = John25; TEST(1, John25, person); e = Joe20 Sue30 ; TEST_XML(2, 1, e.employee[0].@id); correct = Sue; TEST(3, correct, e.employee[1].name); names = new Array(); names[0] = "Alpha"; names[1] = "Bravo"; names[2] = "Charlie"; names[3] = "Delta"; names[4] = "Echo"; names[5] = "Golf"; names[6] = "Hotel"; names[7] = "India"; names[8] = "Juliet"; names[9] = "Kilo"; ages = new Array(); ages[0] = "20"; ages[1] = "21"; ages[2] = "22"; ages[3] = "23"; ages[4] = "24"; ages[5] = "25"; ages[6] = "26"; ages[7] = "27"; ages[8] = "28"; ages[9] = "29"; for (i = 0; i < 10; i++) { e.*[i] = {names[i].toUpperCase()} {ages[i]} ; correct = new XML("" + names[i].toUpperCase() + "" + ages[i] + ""); TEST(4 + i, correct, e.*[i]); } tagName = "name"; attributeName = "id"; attributeValue = 5; content = "Fred"; x = <{tagName} {attributeName}={attributeValue}>{content}; TEST(14, "Fred", x.toXMLString()); // Test {} on XML and XMLList types x = 30 50 ; correct = 50 30 ; x = {x.width}{x.length}; TEST(15, correct, x); var content = "bar"; x = {content}; correct = ; correct.a = content; TEST(16, correct, x); x = ; correct = ; correct.@a = content; TEST(17, correct, x); a = 5; b = 3; c = "x"; x = <{c} a={a + " < " + b + " is " + (a < b)}>{a + " < " + b + " is " + (a < b)}; TEST(18, "5 < 3 is false", x.toXMLString()); x = <{c} a={a + " > " + b + " is " + (a > b)}>{a + " > " + b + " is " + (a > b)}; TEST(19, " 3 is true\">5 > 3 is true", x.toXMLString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.1.5.js0000644000175000017500000000451011545150464021537 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.1.5 - XMLList Initializer"); docfrag = <>Phil35skiing; TEST(1, "xml", typeof(docfrag)); correct = Phil; TEST(2, correct, docfrag[0]); emplist = <> Jim25 Joe20 Sue30 ; TEST(3, "xml", typeof(emplist)); TEST_XML(4, 2, emplist[2].@id); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.2.1.js0000644000175000017500000001170111545150464021534 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.2.1 - Property Accessors"); order = John Doe Big Screen Television 1299.99 1 ; correct = John Doe ; TEST(1, correct, order.customer); TEST_XML(2, 123456, order.@id); correct = Big Screen Television 1299.99 1 TEST(3, correct, order.children()[1]); correct = John Doe + Big Screen Television 1299.99 1 ; TEST(4, correct, order.*); correct = new XMLList(); correct += new XML("123456"); correct += new XML("Mon Mar 10 2003 16:03:25 GMT-0800 (PST)"); TEST(5, correct, order.@*); order = John Doe Big Screen Television 1299.99 1 DVD Player 399.99 1 ; correct = Big Screen Television + DVD Player; TEST(6, correct, order.item.description); correct = new XMLList(); correct += new XML("3456"); correct += new XML("56789"); TEST(7, correct, order.item.@id); correct = DVD Player 399.99 1 TEST(8, correct, order.item[1]); correct = Big Screen Television + 1299.99 + 1 + DVD Player + 399.99 + 1; TEST(9, correct, order.item.*); correct= 1299.99; TEST(10, correct, order.item.*[1]); // The spec requires that we get the first (and only) order [treating single element as a list]. // We ignore this for xml objects that can have children and always return children for numeric // property names. // order = // // John // Doe // // // Big Screen Television // 1299.99 // 1 // // // DVD Player // 399.99 // 1 // // ; // TEST(11, order, order[0]); // Any other index should return undefined, but we return the other child. // TEST(12, undefined, order[1]); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.2.2.js0000644000175000017500000000623011545150464021536 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.2.2 - Function Calls"); rectangle = 50 75 20 30 ; TEST(1, 1, rectangle.length()); TEST(2, 20, rectangle.length); shipto = Fred Jones 123 Foobar Ave. Redmond, WA, 98008 ; upperName = shipto.name.toUpperCase(); TEST(3, "FRED JONES", upperName); upperName = shipto.name.toString().toUpperCase(); TEST(4, "FRED JONES", upperName); upperName = shipto.name.toUpperCase(); TEST(5, "FRED JONES", upperName); citystatezip = shipto.citystatezip.split(", "); state = citystatezip[1]; TEST(6, "WA", state); zip = citystatezip[2]; TEST(7, "98008", zip); citystatezip = shipto.citystatezip.toString().split(", "); state = citystatezip[1]; TEST(8, "WA", state); zip = citystatezip[2]; TEST(9, "98008", zip); // Test method name/element name conflicts x = Foo Bar ; TEST(10, Foo, x.name); TEST(11, QName("alpha"), x.name()); TEST(12, Bar, x.length); TEST(13, 1, x.length()); TEST(14, x, x.(name == "Foo")); x.name = "foobar"; TEST(15, foobar, x.name); TEST(16, QName("alpha"), x.name()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.2.3.js0000644000175000017500000000415611545150464021544 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.2.3 - XML Descendant Accessor"); e = Joe20 Sue30 names = e..name; correct = Joe + Sue; TEST(1, correct, names); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.2.4.js0000644000175000017500000000661411545150464021546 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.2.4 - XML Filtering Predicate Operator"); e = John20 Sue30 ; correct = John20; john = e.employee.(name == "John"); TEST(1, correct, john); john = e.employee.(name == "John"); TEST(2, correct, john); correct = John20 + Sue30; twoEmployees = e.employee.(@id == 0 || @id == 1); TEST(3, correct, twoEmployees); twoEmployees = e.employee.(@id == 0 || @id == 1); TEST(4, correct, twoEmployees); i = 0; twoEmployees = new XMLList(); for each (var p in e..employee) { if (p.@id == 0 || p.@id == 1) { twoEmployees += p; } } TEST(5, correct, twoEmployees); i = 0; twoEmployees = new XMLList(); for each (var p in e..employee) { if (p.@id == 0 || p.@id == 1) { twoEmployees[i++] = p; } } TEST(6, correct, twoEmployees); // test with syntax e = John20 Sue30 ; correct = John20 + Sue30; i = 0; twoEmployees = new XMLList(); for each (var p in e..employee) { with (p) { if (@id == 0 || @id == 1) { twoEmployees[i++] = p; } } } TEST(7, correct, twoEmployees); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.3.1.js0000644000175000017500000001675111545150464021547 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.3.1 - Delete Operator"); order = John Doe
123 Foobar Ave.
Bellevue WA
Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
; // Delete the customer address correct = John Doe Bellevue WA Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1 ; delete order.customer.address; TEST_XML(1, "", order.customer.address); TEST(2, correct, order); order = John Doe
123 Foobar Ave.
Bellevue WA
Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
; // delete the custmomer ID correct = John Doe
123 Foobar Ave.
Bellevue WA
Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
; delete order.customer.@id; TEST_XML(3, "", order.customer.@id); TEST(4, correct, order); order = John Doe
123 Foobar Ave.
Bellevue WA
Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
; // delete the first item price correct = John Doe
123 Foobar Ave.
Bellevue WA
Big Screen Television 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
; delete order.item.price[0]; TEST_XML(5, "", order.item[0].price); TEST(6, 1299.99, order.item.price[0]); TEST(7, order, correct); order = John Doe
123 Foobar Ave.
Bellevue WA
Big Screen Television 1299.99 1 Big Screen Television 1299.99 1 DVD Player 399.99 1
; // delete all the items correct = John Doe
123 Foobar Ave.
Bellevue WA
; delete order.item; TEST_XML(8, "", order.item); TEST(9, correct, order); default xml namespace = "http://someuri"; x = ; x.a.b = "foo"; delete x.a.b; TEST_XML(10, "", x.a.b); var ns = new Namespace(""); x.a.b = foo; delete x.a.b; TEST(11, "foo", x.a.ns::b.toString()); delete x.a.ns::b; TEST_XML(12, "", x.a.ns::b); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.3.2.js0000644000175000017500000000370611545150464021544 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.3.2 - Typeof Operator"); x = new XML(); TEST(1, "xml", typeof(x)); x = new XMLList(); TEST(2, "xml", typeof(x)); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.4.1.js0000644000175000017500000001053011545150464021535 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.4.1 - Addition Operator"); employeeData = Fred + 28 + skiing; TEST(1, "xml", typeof(employeeData)); correct = <>Fred28skiing; TEST(2, correct, employeeData); order = Big Screen Television DVD Player CD Player 8-Track Player ; correct = Big Screen Television + CD Player + 8-Track Player; myItems = order.item[0] + order.item[2] + order.item[3]; TEST(3, "xml", typeof(myItems)); TEST(4, correct, myItems); correct = Big Screen Television + DVD Player + CD Player + 8-Track Player + New Item; newItems = order.item + New Item; TEST(5, "xml", typeof(newItems)); TEST(6, correct, newItems); order = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; totalPrice = +order.item[0].price + +order.item[1].price; TEST(7, "number", typeof(totalPrice)); TEST(8, 1699.98, totalPrice); totalPrice = Number(order.item[1].price) + Number(order.item[3].price); TEST(9, 469.98, totalPrice); order =
123 Foobar Ave. Bellevue WA 98008
; streetCity = "" + order.customer.address.street + order.customer.address.city; TEST(10, "string", typeof(streetCity)); TEST(11, "123 Foobar Ave.Bellevue", streetCity); statezip = String(order.customer.address.state) + order.customer.address.zip; TEST(12, "string", typeof(statezip)); TEST(13, "WA98008", statezip); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.5.1.js0000644000175000017500000000604311545150464021542 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.5.1 - Equality Operators"); x = one; y = one; TEST(1, true, (x == y) && (y == x)); // Should return false if comparison is not XML y = "one"; TEST(2, false, (x == y) || (y == x)); y = undefined TEST(3, false, (x == y) || (y == x)); y = null TEST(4, false, (x == y) || (y == x)); // Should check logical equiv. x = onetwo; y = onetwo; TEST(5, true, (x == y) && (y == x)); y = onetwo; TEST(6, false, (x == y) || (y == x)); m = new Namespace(); n = new Namespace(); TEST(7, true, m == n); m = new Namespace("uri"); TEST(8, false, m == n); n = new Namespace("ns", "uri"); TEST(9, true, m == n); m = new Namespace(n); TEST(10, true, m == n); TEST(11, false, m == null); TEST(12, false, null == m); m = new Namespace("ns", "http://anotheruri"); TEST(13, false, m == n); p = new QName("a"); q = new QName("b"); TEST(14, false, p == q); q = new QName("a"); TEST(15, true, p == q); q = new QName("http://someuri", "a"); TEST(16, false, p == q); q = new QName(null, "a"); TEST(16, false, p == q); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.6.1.js0000644000175000017500000002502211545150464021541 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.6.1 - XML Assignment"); // Change the value of the id attribute on the second item order = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; correct = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; order.item[1].@id = 1.23; TEST(1, correct, order); // Add a new attribute to the second item order = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; correct = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; order.item[1].@newattr = "new value"; TEST(2, correct, order); // Construct an attribute list containing all the ids in this order order = Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 ; order.@allids = order.item.@id; TEST_XML(3, "1 2 3 4", order.@allids); // Replace first child of the order element with an XML value order = John
948 Ranier Ave.
Portland OR
Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
; order.*[0] = Fred
123 Foobar Ave.
Bellevue WA
; correct = Fred
123 Foobar Ave.
Bellevue WA
Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
; TEST(4, correct, order); // Replace the second child of the order element with a list of items order = John
948 Ranier Ave.
Portland OR
Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
; correct = John
948 Ranier Ave.
Portland OR
item one item two item three DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
; order.item[0] = item one + item two + item three; TEST(5, correct, order); // Replace the third child of the order with a text node order = John
948 Ranier Ave.
Portland OR
Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
; correct = John
948 Ranier Ave.
Portland OR
Big Screen Television 1299.99 A Text Node CD Player 199.99 8-Track Player 69.99
; order.item[1] = "A Text Node"; TEST(6, correct, order); // append a new item to the end of the order order = John
948 Ranier Ave.
Portland OR
Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99
; correct = John
948 Ranier Ave.
Portland OR
Big Screen Television 1299.99 DVD Player 399.99 CD Player 199.99 8-Track Player 69.99 new item
; order.*[order.*.length()] = new item; TEST(7, correct, order); // Change the price of the item item = Big Screen Television 1299.99 correct = Big Screen Television 99.95 item.price = 99.95; TEST(8, item, correct); // Change the description of the item item = Big Screen Television 1299.99 correct = Mobile Phone 1299.99 item.description = "Mobile Phone"; TEST(9, item, correct); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.6.2.js0000644000175000017500000001742411545150464021551 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.6.2 - XMLList Assignment"); // Set the name of the only customer in the order to Fred Jones order = John Smith Big Screen Television 1299.99 DVD Player 399.99 ; correct = Fred Jones Big Screen Television 1299.99 DVD Player 399.99 ; order.customer.name = "Fred Jones"; TEST(1, correct, order); // Replace all the hobbies for the only customer in the order order = John Smith Biking Big Screen Television 1299.99 DVD Player 399.99 ; correct = John Smith shopping Big Screen Television 1299.99 DVD Player 399.99 ; order.customer.hobby = "shopping" TEST(2, correct, order); // Attempt to set the sale date of the item. Throw an exception if more than 1 item exists. order = John Smith Big Screen Television 1299.99 01-05-2002 ; correct = John Smith Big Screen Television 1299.99 05-07-2002 ; order.item.saledate = "05-07-2002" TEST(3, correct, order); order = John Smith Biking Big Screen Television 1299.99 DVD Player 399.99 ; try { order.item.saledate = "05-07-2002"; SHOULD_THROW(4); } catch (ex) { TEST(4, "TypeError", ex.name); } // Replace all the employee's hobbies with their new favorite pastime emps = John 20 skiing Sue 30 running Ted 35 Biking ; correct = John 20 skiing Sue 30 running Ted 35 working ; emps.employee.(@id == 3).hobby = "working"; TEST(5, correct, emps); // Replace the first employee with George emps = John 20 Sue 30 Ted 35 ; correct = George 27 Sue 30 Ted 35 ; emps.employee[0] = George27; TEST(6, emps, correct); // Add a new employee to the end of the employee list emps = John 20 Sue 30 Ted 35 ; correct = John 20 Sue 30 Ted 35 Frank 39 ; emps.employee += Frank39; TEST(7, correct, emps); // Add a new employee to the end of the employee list emps = John 20 Sue 30 Ted 35 ; correct = John 20 Sue 30 Ted 35 Frank 39 ; emps.employee[emps.employee.length()] = Frank39; TEST(7, correct, emps); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/11.6.3.js0000644000175000017500000000647011545150464021551 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("11.6.3 - Compound Assignment"); // Insert employee 3 and 4 after the first employee e = Joe 20 Sue 30 ; correct = Joe 20 Fred Carol Sue 30 ; e.employee[0] += Fred + Carol; TEST(1, correct, e); // Append employees 3 and 4 to the end of the employee list e = Joe 20 Sue 30 ; correct = Joe 20 Sue 30 Fred Carol ; e.employee[1] += Fred + Carol; TEST(2, correct, e); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/browser.js0000644000175000017500000000000011545150464022465 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/jstests.list0000644000175000017500000000115111545150464023050 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/Expressions/ script 11.1.1.js script 11.1.2.js script 11.1.3.js script 11.1.4-01.js script 11.1.4-02.js script 11.1.4-03.js script 11.1.4-04.js script 11.1.4-05.js script 11.1.4-06.js script 11.1.4-07.js fails script 11.1.4-08.js script 11.1.4.js script 11.1.5.js script 11.2.1.js script 11.2.2.js script 11.2.3.js script 11.2.4.js script 11.3.1.js script 11.3.2.js script 11.4.1.js script 11.5.1.js script 11.6.1.js script 11.6.2.js script 11.6.3.js script regress-301545.js script regress-302531.js script regress-340024.js script regress-366123.js script regress-496113.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/regress-301545.js0000644000175000017500000000412511545150464023227 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Axel Hecht * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "11.1.1 - Attribute Identifiers Do not crash when " + "attribute-op name collides with local var"; var BUGNUMBER = 301545; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function TOCParser(aElement) { var href = aElement.@href; } TEST(summary, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/regress-302531.js0000644000175000017500000000121211545150464023215 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Blake Kaplan */ var summary = "E4X QuoteString should deal with empty string"; var BUGNUMBER = 302531; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function f(e) { return ; } XML.ignoreWhitespace = true; XML.prettyPrinting = true; expect = ( ).toXMLString().replace(/.toXMLString()); } catch(E) { actual = E + ''; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/regress-366123.js0000644000175000017500000000422411545150464023232 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): shutdown * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 366123; var summary = 'Compiling long XML filtering predicate'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function exploit() { var code = "foo = .(", obj = {}; for(var i = 0; i < 0x10000; i++) { code += "0, "; } code += "0);"; Function(code); } try { exploit(); } catch(ex) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/regress-496113.js0000644000175000017500000000444511545150464023242 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): developer.mozilla.org * Masakazu Takahashi * Wesley Garland * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // See https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Processing_XML_with_E4X#section_7 var summary = 'simple filter'; var BUGNUMBER = 496113; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var people = Joe ; expect = Joe.toXMLString(); print(actual = people.person.(name == "Joe").toXMLString()); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Expressions/shell.js0000644000175000017500000000000011545150464022111 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/browser.js0000644000175000017500000000000011545150464022342 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/extensibility.js0000644000175000017500000000165611545150464023575 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ var gTestfile = 'extensibility.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 492849; var summary = 'XML values cannot have their [[Extensible]] property changed'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = ; assertEq(Object.isExtensible(x), true); try { Object.preventExtensions(x); throw new Error("didn't throw"); } catch (e) { assertEq(e instanceof TypeError, true, "xmlValue.[[Extensible]] cannot be changed"); } assertEq(Object.isExtensible(x), true); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/jstests.list0000644000175000017500000000121611545150464022727 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/extensions/ script regress-305335.js script regress-312196.js script regress-313080.js script regress-321547.js script regress-327534.js script regress-327897.js script regress-335051.js script regress-337226.js script regress-352846-01.js script regress-352846-02.js script regress-352846-03.js script regress-353165.js script regress-354145-06.js script regress-354151-01.js script regress-354151-02.js script regress-374025.js script regress-374163.js script regress-410192.js script regress-450871-01.js script regress-450871-02.js script regress-462734-01.js script extensibility.js script regress-595207.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-305335.js0000644000175000017500000000417711545150464023114 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): shutdown@flashmail.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Regression - XML instance methods should type check in " + "JS_GetPrivate()"; var BUGNUMBER = 305335; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var o = new Number(0); o.__proto__ = XML(); try { o.parent(); } catch(e) { printStatus('Exception: ' + e); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-312196.js0000644000175000017500000000631111545150464023107 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Sean McMurray * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Extending E4X XML objects with __noSuchMethod__"; var BUGNUMBER = 312196; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); XML.ignoreWhitespace = true; XML.prettyPrint = false; function ajaxObj(content){ var ajax = new XML(content); ajax.function::__noSuchMethod__ = autoDispatch; return ajax; } function autoDispatch(id){ if (! this.@uri) return; var request = ; for(var i=0; i{arguments[1][i]}; } var xml = this; xml.request = request; return(xml.toString()); } var ws = new ajaxObj(''); try { actual = ws.function::sample('this', 'is', 'a', 'test'); } catch(e) { actual = e + ''; } expect = ( this is a test ).toString(); TEST(1, expect, actual); try { actual = ws.sample('this', 'is', 'a', 'test'); } catch(e) { actual = e + ''; } expect = ( this is a test this is a test ).toString(); TEST(2, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-313080.js0000644000175000017500000000412311545150464023077 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): nanto_vi (TOYAMA Nao) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Regression - Do not crash calling __proto__"; var BUGNUMBER = 313080; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); try { .__proto__(); .function::__proto__(); } catch(e) { printStatus(e + ''); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-321547.js0000644000175000017500000000431711545150464023113 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Biju * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Operator .. should not implicitly quote its right operand"; var BUGNUMBER = 321547; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function a(){ var x=value c; return x..c; } actual = a.toSource(); expect = 'function a() {var x = value c;return x..c;}'; actual = actual.replace(/[\n ]+/mg, ' '); expect = expect.replace(/[\n ]+/mg, ' '); TEST(2, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-327534.js0000644000175000017500000000410511545150464023110 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "uneval on E4X gives Error: xml is not a function"; var BUGNUMBER = 327534; var actual = ''; var expect = 'No Error'; printBugNumber(BUGNUMBER); START(summary); try { uneval(); actual = 'No Error'; } catch(ex) { printStatus(ex); actual = ex + ''; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-327897.js0000644000175000017500000000435111545150464023127 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Crash in js_GetStringBytes"; var BUGNUMBER = 327897; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); printStatus('This test runs only in the browser'); if (typeof XMLSerializer != 'undefined') { try { var a = XMLSerializer; a.foo = (function(){}).apply; a.__proto__ = ; a.foo(); } catch(ex) { printStatus(ex + ''); } } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-335051.js0000644000175000017500000000317311545150464023105 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * rje(a)dbc.dk */ //----------------------------------------------------------------------------- var BUGNUMBER = 335051; var summary = ''; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function testSyntax(syntax, isValid) { var result; try { eval(syntax); result = true; } catch(exception) { if (SyntaxError.prototype.isPrototypeOf(exception)) { result = false; } } reportCompare(isValid, result, "test " + (isValid?"":"in") + "valid syntax: " + syntax); } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var oldVersion = false; testSyntax("#1={}", true); testSyntax("#1=[]", true); testSyntax("#1=([])", true); testSyntax("#1=[1, 2, 3]", true); testSyntax("#1={a:1, b:2}", true); testSyntax("#1=function() { }", true); testSyntax("#1=(new Date())", true); testSyntax("#1=", true); testSyntax("#1=", true); testSyntax("#1=b", true); testSyntax("[#1=b, #1#]", true); testSyntax("#1=()", true); testSyntax("#1=()", true); testSyntax("#1=123", false); testSyntax("#1='foo'", false); testSyntax("#1=1+2", false); testSyntax("#1=-1", false); testSyntax("#1=(123)", false); testSyntax("#1=true", false); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-337226.js0000644000175000017500000000374311545150464023116 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 337226; var summary = 'function::globalfunction'; var actual = 'No Error'; var expect = 'No Error'; printBugNumber(BUGNUMBER); START(summary); var s = function::parseInt; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-352846-01.js0000644000175000017500000000547211545150464023342 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 352846; var summary = 'Passing unrooted value to OBJ_DEFAULT_VALUE is GC hazard'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function prepare_xml() { delete XML.prototype.function::toString; Object.defineProperty(Object.prototype, "toString", { get: toSource_getter, enumerable: true, configurable: true }); return new XML("xml_text"); } var counter = 0; function toSource_getter() { // Make sure that lastInternalResult does not contain prepare_xml var tmp = { toSource: function() { return [1,2,3]; } }; uneval(tmp); if (counter++ < 2) return undefined; // run GC onr overwrite the heap if (typeof gc == "function") gc(); var x = 1e-100; for (var i = 0; i != 50000; ++i) var x2 = x / 4; // Return a function that would access this in non-trivial way to // check if prepare_xml() was rooted. return function() { return this.toXMLString(); }; } uneval({ toSource: prepare_xml }); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-352846-02.js0000644000175000017500000000552511545150464023342 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 352846; var summary = 'Passing unrooted value to OBJ_DEFAULT_VALUE is GC hazard'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var counter = 0; function prepare_xml() { delete XML.prototype.function::toString; Object.defineProperty(Object.prototype, "toString", { get: toSource_getter, enumerable: true, configurable: true }); return new XML("xml_text"); } function toSource_getter() { // Make sure that lastInternalResult does not contain prepare_xml var tmp = { toSource: function() { return [1,2,3]; } }; uneval(tmp); if (counter++ < 2) return undefined; // run GC onr overwrite the heap if (typeof gc == "function") gc(); var x = 1e-100; for (var i = 0; i != 50000; ++i) var x2 = x / 4; // Return a function that would access this in non-trivial way to // check if prepare_xml() was rooted. return function() { print("xxx"); return this.toXMLString(); }; } var a = [1, 2]; a.sort(prepare_xml); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-352846-03.js0000644000175000017500000000567211545150464023346 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 352846; var summary = 'Passing unrooted value to OBJ_DEFAULT_VALUE is GC hazard'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var counter = 0; function prepare_xml() { delete XML.prototype.function::toString; Object.defineProperty(Object.prototype, "toString", { get: toSource_getter, enumerable: true, configurable: true }); return new XML("xml_text"); } function toSource_getter() { // Make sure that lastInternalResult does not contain prepare_xml var tmp = { toSource: function() { return [1,2,3]; } }; uneval(tmp); if (counter++ < 2) return undefined; // run GC onr overwrite the heap if (typeof gc == "function") gc(); var x = 1e-100; for (var i = 0; i != 50000; ++i) var x2 = x / 4; // Return a function that would access this in non-trivial way to // check if prepare_xml() was rooted. return function() { print("xxx"); return this.toXMLString(); }; } var obj = { }; Object.defineProperty(obj, "length", { get: prepare_xml, enumerable: true, configurable: true }); Array.reverse(obj); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-353165.js0000644000175000017500000000714211545150464023113 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 353165; var summary = 'Do not crash with xml_getMethod'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); crash1(); crash2(); END(); function crash1() { try { var set = new XML('text').children('b'); var counter = 0; Object.defineProperty(Object.prototype, "unrooter", { enumerable: true, configurable: true, get: function() { ++counter; if (counter == 5) { set[0] = new XML(''); if (typeof gc == "function") { gc(); var tmp = Math.sqrt(2), tmp2; for (i = 0; i != 50000; ++i) tmp2 = tmp / 2; } } return undefined; } }); set.unrooter(); } catch(ex) { print('1: ' + ex); } TEST(1, expect, actual); } function crash2() { try { var expected = "SOME RANDOM TEXT"; var set = {expected}.children('b'); var counter = 0; function unrooter_impl() { return String(this); } Object.defineProperty(Object.prototype, "unrooter", { enumerable: true, configurable: true, get: function() { ++counter; if (counter == 7) return unrooter_impl; if (counter == 5) { set[0] = new XML(''); if (typeof gc == "function") { gc(); var tmp = 1e500, tmp2; for (i = 0; i != 50000; ++i) tmp2 = tmp / 1.1; } } return undefined; } }); set.unrooter(); } catch(ex) { print('2: ' + ex); } TEST(2, expect, actual); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-354145-06.js0000644000175000017500000000422311545150464023332 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var list = <> function a() { delete list[1]; delete list[0]; gc(); for (var i = 0; i != 50000; ++i) var tmp = ""+i; return true; } var list2 = list.(a()); print(uneval(list2)) TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-354151-01.js0000644000175000017500000000427711545150464023333 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 354151; var summary = 'Bad assumptions about Array elements'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function getter() { return 1; } function setter(v) { return v; } var xml = ; Array.prototype.__defineGetter__(0, getter); Array.prototype.__defineSetter__(0, setter); xml.namespace(); delete Array.prototype[0]; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-354151-02.js0000644000175000017500000000443011545150464023323 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 354151; var summary = 'Bad assumptions about Array elements'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = ; function getter() { } function setter(v) { delete xml.@*::a; xml.removeNamespace("uri:2"); gc(); } Array.prototype.__defineGetter__(0, getter); Array.prototype.__defineSetter__(0, setter); xml.namespaceDeclarations(); delete Array.prototype[0]; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-374025.js0000644000175000017500000000402611545150464023107 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not crash with XML.prettyIndent = 2147483648'; var BUGNUMBER = 374025; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); XML.prettyIndent = 2147483648; uneval(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-374163.js0000644000175000017500000000425311545150464023114 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 374163; var summary = 'Set E4X xml.function::__proto__ = null causes toString to throw'; var actual = ''; var expect = 'TypeError: String.prototype.toString called on incompatible XML'; printBugNumber(BUGNUMBER); START(summary); try { var a = ; a.function::__proto__ = null; "" + a; } catch(ex) { actual = ex + ''; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-410192.js0000644000175000017500000000402611545150464023103 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Biju * Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Proper quoting of attribute by uneval/toSource'; var BUGNUMBER = 410192; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = '"v"'; actual = uneval(.@a); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-450871-01.js0000644000175000017500000000434611545150464023336 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Gary Kwong * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not crash: __proto__ = ; .lastIndexOf(this, false)'; var BUGNUMBER = 450871; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); if (typeof window == 'object') { actual = expect = 'Test skipped for browser based tests due destruction of the prototype'; } else { try { __proto__ = ; .lastIndexOf(this, false); } catch(ex) { } } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-450871-02.js0000644000175000017500000000432111545150464023330 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Gary Kwong * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not crash: __proto__ = ; .indexOf(this)'; var BUGNUMBER = 450871; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); if (typeof window == 'object') { actual = expect = 'Test skipped for browser based tests due destruction of the prototype'; } else { try { __proto__ = ; .indexOf(this); } catch(ex) { } } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-462734-01.js0000644000175000017500000000425311545150464023334 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Gary Kwong * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not assert: pobj_ == obj2'; var BUGNUMBER = 462734; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var save__proto__ = this.__proto__; try { for (x in function(){}) (); this.__defineGetter__("x", Function); __proto__ = x; prototype += ; } catch(ex) { print(ex + ''); } __proto__ = save__proto__; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/regress-595207.js0000644000175000017500000000074211545150464023117 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var summary = "Recognize the function namespace anti-URI"; var expect = "1"; var actual; function alert(s) { actual = String(s); } var a = "@mozilla.org/js/function"; try { a::alert("1"); } catch (e) { <>.function::['x']; try { a::alert("2 " + e); } catch (e) { alert("3 " + e); } } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/extensions/shell.js0000644000175000017500000000000011545150464021766 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/browser.js0000644000175000017500000000000011545150464020434 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/jstests.list0000644000175000017500000000057611545150464021031 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/GC/ script regress-280844-1.js script regress-280844-2.js skip-if(!xulRuntime.shell) script regress-292455.js # does not always dismiss alert script regress-313952-01.js script regress-313952-02.js script regress-324117.js skip script regress-324278.js # slow script regress-339785.js script regress-357063-01.js script regress-357063-02.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/regress-280844-1.js0000644000175000017500000000425111545150464021344 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Uncontrolled recursion in js_MarkXML during GC'; var BUGNUMBER = 280844; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var N = 5 * 1000; var x = ; for (var i = 1; i <= N; ++i) { x.appendChild(); x = x.x[0]; } printStatus(x.toXMLString()); gc(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/regress-280844-2.js0000644000175000017500000000453311545150464021350 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Uncontrolled recursion in js_MarkXML during GC'; var BUGNUMBER = 280844; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var N = 100 * 1000; function prepare_list(N) { var head = {}; var cursor = head; for (var i = 0; i != N; ++i) { var ns = new Namespace(); var x = ; x.addNamespace(ns); cursor.next = x; cursor = ns; } return head; } var head = prepare_list(N); gc(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/regress-292455.js0000644000175000017500000000474611545150464021220 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Regress - Do not crash on gc"; var BUGNUMBER = 292455; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function output (text) { if (typeof alert != 'undefined') { alert(text); } else if (typeof print != 'undefined') { print(text); } } function doTest () { var html =

Kibology for all

Kibology for all. All for Kibology.

; // insert new child as last child html.* +=

All for Kibology

; gc(); output(html); html.* +=

All for Kibology. Kibology for all.

; gc(); output(html); } doTest(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/regress-313952-01.js0000644000175000017500000000450111545150464021417 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "13.3.5.2 - root QName.uri"; var BUGNUMBER = 313952; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); printStatus("This test requires TOO_MUCH_GC"); var str = " foo:bar".substring(1); expect = new QName(" foo:bar".substring(2), "a").uri; var likeString = { toString: function() { var tmp = str; str = null; return tmp; } }; actual = new QName(likeString, "a").uri; printStatus(actual.length); printStatus(expect === actual); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/regress-313952-02.js0000644000175000017500000000501611545150464021422 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "13.3.5.2 - root QName.uri"; var BUGNUMBER = 313952; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var str = String(1); var expected = String(1); var x = new XML("text"); x.function::toString = function() { var tmp = str; str = null; return tmp; } var TWO = 2.0; var likeString = { toString: function() { var tmp = new XML(""); tmp = (tmp == "string"); if (typeof gc == "function") gc(); for (var i = 0; i != 40000; ++i) { tmp = 1e100 * TWO; tmp = null; } return expected; } } TEST(1, true, x == likeString); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/regress-324117.js0000644000175000017500000000567111545150464021205 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "GC hazard during namespace scanning"; var BUGNUMBER = 324117; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function prepare(N) { var xml = ; var ns1 = new Namespace("text1"); var ns2 = new Namespace("text2"); xml.addNamespace(ns1); xml.addNamespace(ns2); // Prepare list to trigger DeutschSchorrWaite call during GC cursor = xml; for (var i = 0; i != N; ++i) { if (i % 2 == 0) cursor = [ {a: 1}, cursor ]; else cursor = [ cursor, {a: 1} ]; } return cursor; } function check(list, N) { // Extract xml to verify for (var i = N; i != 0; --i) { list = list[i % 2]; } var xml = list; if (typeof xml != "xml") return false; var array = xml.inScopeNamespaces(); if (array.length !== 3) return false; if (array[0].uri !== "") return false; if (array[1].uri !== "text1") return false; if (array[2].uri !== "text2") return false; return true; } var N = 64000; var list = prepare(N); gc(); var ok = check(list, N); printStatus(ok); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/regress-324278.js0000644000175000017500000000515711545150464021214 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 324278; var summary = 'GC without recursion'; var actual; var expect; printBugNumber(BUGNUMBER); START(summary); var N = 1000 * 1000; print("N = " + N); function prepare_list(N) { var cursor = null; for (var i = 0; i != N; ++i) { var ns = new Namespace("protocol:address"); ns.property = cursor; var xml = ; xml.addNamespace(ns); cursor = {xml: xml}; } return cursor; } print("preparing..."); var list = prepare_list(N); print("prepared for "+N); gc(); var count = 0; while (list && list.xml.inScopeNamespaces().length > 0 && list.xml.inScopeNamespaces()[1]) { list = list.xml.inScopeNamespaces()[1].property; ++count; } expect = N; actual = count; TEST(1, expect, actual); gc(); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/regress-339785.js0000644000175000017500000000557711545150464021233 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "scanner: memory exposure to scripts"; var BUGNUMBER = 339785; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function evalXML(N) { var str = Array(N + 1).join('a'); // str is string of N a src = "var x = &"+str+";;"; try { eval(src); return "Should have thrown unknown entity error"; } catch (e) { return e.message; } return "Unexpected"; } var N1 = 1; var must_be_good = evalXML(N1); expect = 'unknown XML entity a'; actual = must_be_good; TEST(1, expect, actual); function testScanner() { for (var power = 2; power != 15; ++power) { var N2 = (1 << power) - 2; var can_be_bad = evalXML(N2); var diff = can_be_bad.length - must_be_good.length; if (diff != 0 && diff != N2 - N1) { return "Detected memory exposure at entity length of "+(N2+2); } } return "Ok"; } expect = "Ok"; // repeat test since test does not always fail for (var iTestScanner = 0; iTestScanner < 100; ++iTestScanner) { actual = testScanner(); TEST(iTestScanner+1, expect, actual); } END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/regress-357063-01.js0000644000175000017500000000461511545150464021426 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 357063; var summary = 'GC hazard in XMLEquality'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = new XML("
texttext"); var xml2 = new XML("texttext"); var list1 = xml.a; var list2 = xml2.a; XML.prototype.function::toString = function() { if (xml2) { delete list2[1]; delete list2[0]; xml2 = null; gc(); } return "text"; } var value = list1 == list2; print('list1: ' + list1.toXMLString()); print('list2: ' + list2.toXMLString()); print('list1 == list2: ' + value); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/regress-357063-02.js0000644000175000017500000000441311545150464021423 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 357063; var summary = 'GC hazard in XMLEquality'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml1 = new XML("textB"); var xml2 = new XML("textC"); XML.prototype.function::toString = function() { if (xml2) { delete xml2.*; xml2 = null; gc(); } return "text"; } print('xml1: ' + xml1); print('xml2: ' + xml2); if (xml1 == xml2) throw "unexpected result"; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/GC/shell.js0000644000175000017500000000000011545150464020060 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Global/13.1.2.1.js0000644000175000017500000004566411545150464020572 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.1.2.1 - isXMLName()"); var BUGNUMBER = 289630; printBugNumber(BUGNUMBER); TEST(1, true, typeof isXMLName == "function"); // Check converting to string var object = { toString: function() { return "text"; } }; TEST(2, true, isXMLName(object)); // This throws TypeError => isXMLName should give false var object2 = { toString: function() { return this; } }; TEST(3, false, isXMLName(object2)); // Check indirect throw of TypeError var object3 = { toString: function() { return String(object2); } }; TEST(3, false, isXMLName(object3)); var object4 = { toString: function() { throw 1; } }; try { isXMLName(object4); SHOULD_THROW(4); } catch (e) { TEST(4, 1, e); } // Check various cases of http://w3.org/TR/xml-names11/#NT-NCName TEST(5, false, isXMLName("")); var START = 0x1; var OTHER = 0x2; var chars = init(); var marker; // Letter // Letter::= BaseChar | Ideographic marker = START | OTHER; // BaseChar markRange(chars, 0x0041, 0x005A, marker); markRange(chars, 0x0061, 0x007A, marker); markRange(chars, 0x00C0, 0x00D6, marker); markRange(chars, 0x00D8, 0x00F6, marker); markRange(chars, 0x00F8, 0x00FF, marker); markRange(chars, 0x0100, 0x0131, marker); markRange(chars, 0x0134, 0x013E, marker); markRange(chars, 0x0141, 0x0148, marker); markRange(chars, 0x014A, 0x017E, marker); markRange(chars, 0x0180, 0x01C3, marker); markRange(chars, 0x01CD, 0x01F0, marker); markRange(chars, 0x01F4, 0x01F5, marker); markRange(chars, 0x01FA, 0x0217, marker); markRange(chars, 0x0250, 0x02A8, marker); markRange(chars, 0x02BB, 0x02C1, marker); markRange(chars, 0x0386, 0x0386, marker); markRange(chars, 0x0388, 0x038A, marker); markRange(chars, 0x038C, 0x038C, marker); markRange(chars, 0x038E, 0x03A1, marker); markRange(chars, 0x03A3, 0x03CE, marker); markRange(chars, 0x03D0, 0x03D6, marker); markRange(chars, 0x03DA, 0x03DA, marker); markRange(chars, 0x03DC, 0x03DC, marker); markRange(chars, 0x03DE, 0x03DE, marker); markRange(chars, 0x03E0, 0x03E0, marker); markRange(chars, 0x03E2, 0x03F3, marker); markRange(chars, 0x0401, 0x040C, marker); markRange(chars, 0x040E, 0x044F, marker); markRange(chars, 0x0451, 0x045C, marker); markRange(chars, 0x045E, 0x0481, marker); markRange(chars, 0x0490, 0x04C4, marker); markRange(chars, 0x04C7, 0x04C8, marker); markRange(chars, 0x04CB, 0x04CC, marker); markRange(chars, 0x04D0, 0x04EB, marker); markRange(chars, 0x04EE, 0x04F5, marker); markRange(chars, 0x04F8, 0x04F9, marker); markRange(chars, 0x0531, 0x0556, marker); markRange(chars, 0x0559, 0x0559, marker); markRange(chars, 0x0561, 0x0586, marker); markRange(chars, 0x05D0, 0x05EA, marker); markRange(chars, 0x05F0, 0x05F2, marker); markRange(chars, 0x0621, 0x063A, marker); markRange(chars, 0x0641, 0x064A, marker); markRange(chars, 0x0671, 0x06B7, marker); markRange(chars, 0x06BA, 0x06BE, marker); markRange(chars, 0x06C0, 0x06CE, marker); markRange(chars, 0x06D0, 0x06D3, marker); markRange(chars, 0x06D5, 0x06D5, marker); markRange(chars, 0x06E5, 0x06E6, marker); markRange(chars, 0x0905, 0x0939, marker); markRange(chars, 0x093D, 0x093D, marker); markRange(chars, 0x0958, 0x0961, marker); markRange(chars, 0x0985, 0x098C, marker); markRange(chars, 0x098F, 0x0990, marker); markRange(chars, 0x0993, 0x09A8, marker); markRange(chars, 0x09AA, 0x09B0, marker); markRange(chars, 0x09B2, 0x09B2, marker); markRange(chars, 0x09B6, 0x09B9, marker); markRange(chars, 0x09DC, 0x09DD, marker); markRange(chars, 0x09DF, 0x09E1, marker); markRange(chars, 0x09F0, 0x09F1, marker); markRange(chars, 0x0A05, 0x0A0A, marker); markRange(chars, 0x0A0F, 0x0A10, marker); markRange(chars, 0x0A13, 0x0A28, marker); markRange(chars, 0x0A2A, 0x0A30, marker); markRange(chars, 0x0A32, 0x0A33, marker); markRange(chars, 0x0A35, 0x0A36, marker); markRange(chars, 0x0A38, 0x0A39, marker); markRange(chars, 0x0A59, 0x0A5C, marker); markRange(chars, 0x0A5E, 0x0A5E, marker); markRange(chars, 0x0A72, 0x0A74, marker); markRange(chars, 0x0A85, 0x0A8B, marker); markRange(chars, 0x0A8D, 0x0A8D, marker); markRange(chars, 0x0A8F, 0x0A91, marker); markRange(chars, 0x0A93, 0x0AA8, marker); markRange(chars, 0x0AAA, 0x0AB0, marker); markRange(chars, 0x0AB2, 0x0AB3, marker); markRange(chars, 0x0AB5, 0x0AB9, marker); markRange(chars, 0x0ABD, 0x0ABD, marker); markRange(chars, 0x0AE0, 0x0AE0, marker); markRange(chars, 0x0B05, 0x0B0C, marker); markRange(chars, 0x0B0F, 0x0B10, marker); markRange(chars, 0x0B13, 0x0B28, marker); markRange(chars, 0x0B2A, 0x0B30, marker); markRange(chars, 0x0B32, 0x0B33, marker); markRange(chars, 0x0B36, 0x0B39, marker); markRange(chars, 0x0B3D, 0x0B3D, marker); markRange(chars, 0x0B5C, 0x0B5D, marker); markRange(chars, 0x0B5F, 0x0B61, marker); markRange(chars, 0x0B85, 0x0B8A, marker); markRange(chars, 0x0B8E, 0x0B90, marker); markRange(chars, 0x0B92, 0x0B95, marker); markRange(chars, 0x0B99, 0x0B9A, marker); markRange(chars, 0x0B9C, 0x0B9C, marker); markRange(chars, 0x0B9E, 0x0B9F, marker); markRange(chars, 0x0BA3, 0x0BA4, marker); markRange(chars, 0x0BA8, 0x0BAA, marker); markRange(chars, 0x0BAE, 0x0BB5, marker); markRange(chars, 0x0BB7, 0x0BB9, marker); markRange(chars, 0x0C05, 0x0C0C, marker); markRange(chars, 0x0C0E, 0x0C10, marker); markRange(chars, 0x0C12, 0x0C28, marker); markRange(chars, 0x0C2A, 0x0C33, marker); markRange(chars, 0x0C35, 0x0C39, marker); markRange(chars, 0x0C60, 0x0C61, marker); markRange(chars, 0x0C85, 0x0C8C, marker); markRange(chars, 0x0C8E, 0x0C90, marker); markRange(chars, 0x0C92, 0x0CA8, marker); markRange(chars, 0x0CAA, 0x0CB3, marker); markRange(chars, 0x0CB5, 0x0CB9, marker); markRange(chars, 0x0CDE, 0x0CDE, marker); markRange(chars, 0x0CE0, 0x0CE1, marker); markRange(chars, 0x0D05, 0x0D0C, marker); markRange(chars, 0x0D0E, 0x0D10, marker); markRange(chars, 0x0D12, 0x0D28, marker); markRange(chars, 0x0D2A, 0x0D39, marker); markRange(chars, 0x0D60, 0x0D61, marker); markRange(chars, 0x0E01, 0x0E2E, marker); markRange(chars, 0x0E30, 0x0E30, marker); markRange(chars, 0x0E32, 0x0E33, marker); markRange(chars, 0x0E40, 0x0E45, marker); markRange(chars, 0x0E81, 0x0E82, marker); markRange(chars, 0x0E84, 0x0E84, marker); markRange(chars, 0x0E87, 0x0E88, marker); markRange(chars, 0x0E8A, 0x0E8A, marker); markRange(chars, 0x0E8D, 0x0E8D, marker); markRange(chars, 0x0E94, 0x0E97, marker); markRange(chars, 0x0E99, 0x0E9F, marker); markRange(chars, 0x0EA1, 0x0EA3, marker); markRange(chars, 0x0EA5, 0x0EA5, marker); markRange(chars, 0x0EA7, 0x0EA7, marker); markRange(chars, 0x0EAA, 0x0EAB, marker); markRange(chars, 0x0EAD, 0x0EAE, marker); markRange(chars, 0x0EB0, 0x0EB0, marker); markRange(chars, 0x0EB2, 0x0EB3, marker); markRange(chars, 0x0EBD, 0x0EBD, marker); markRange(chars, 0x0EC0, 0x0EC4, marker); markRange(chars, 0x0F40, 0x0F47, marker); markRange(chars, 0x0F49, 0x0F69, marker); markRange(chars, 0x10A0, 0x10C5, marker); markRange(chars, 0x10D0, 0x10F6, marker); markRange(chars, 0x1100, 0x1100, marker); markRange(chars, 0x1102, 0x1103, marker); markRange(chars, 0x1105, 0x1107, marker); markRange(chars, 0x1109, 0x1109, marker); markRange(chars, 0x110B, 0x110C, marker); markRange(chars, 0x110E, 0x1112, marker); markRange(chars, 0x113C, 0x113C, marker); markRange(chars, 0x113E, 0x113E, marker); markRange(chars, 0x1140, 0x1140, marker); markRange(chars, 0x114C, 0x114C, marker); markRange(chars, 0x114E, 0x114E, marker); markRange(chars, 0x1150, 0x1150, marker); markRange(chars, 0x1154, 0x1155, marker); markRange(chars, 0x1159, 0x1159, marker); markRange(chars, 0x115F, 0x1161, marker); markRange(chars, 0x1163, 0x1163, marker); markRange(chars, 0x1165, 0x1165, marker); markRange(chars, 0x1167, 0x1167, marker); markRange(chars, 0x1169, 0x1169, marker); markRange(chars, 0x116D, 0x116E, marker); markRange(chars, 0x1172, 0x1173, marker); markRange(chars, 0x1175, 0x1175, marker); markRange(chars, 0x119E, 0x119E, marker); markRange(chars, 0x11A8, 0x11A8, marker); markRange(chars, 0x11AB, 0x11AB, marker); markRange(chars, 0x11AE, 0x11AF, marker); markRange(chars, 0x11B7, 0x11B8, marker); markRange(chars, 0x11BA, 0x11BA, marker); markRange(chars, 0x11BC, 0x11C2, marker); markRange(chars, 0x11EB, 0x11EB, marker); markRange(chars, 0x11F0, 0x11F0, marker); markRange(chars, 0x11F9, 0x11F9, marker); markRange(chars, 0x1E00, 0x1E9B, marker); markRange(chars, 0x1EA0, 0x1EF9, marker); markRange(chars, 0x1F00, 0x1F15, marker); markRange(chars, 0x1F18, 0x1F1D, marker); markRange(chars, 0x1F20, 0x1F45, marker); markRange(chars, 0x1F48, 0x1F4D, marker); markRange(chars, 0x1F50, 0x1F57, marker); markRange(chars, 0x1F59, 0x1F59, marker); markRange(chars, 0x1F5B, 0x1F5B, marker); markRange(chars, 0x1F5D, 0x1F5D, marker); markRange(chars, 0x1F5F, 0x1F7D, marker); markRange(chars, 0x1F80, 0x1FB4, marker); markRange(chars, 0x1FB6, 0x1FBC, marker); markRange(chars, 0x1FBE, 0x1FBE, marker); markRange(chars, 0x1FC2, 0x1FC4, marker); markRange(chars, 0x1FC6, 0x1FCC, marker); markRange(chars, 0x1FD0, 0x1FD3, marker); markRange(chars, 0x1FD6, 0x1FDB, marker); markRange(chars, 0x1FE0, 0x1FEC, marker); markRange(chars, 0x1FF2, 0x1FF4, marker); markRange(chars, 0x1FF6, 0x1FFC, marker); markRange(chars, 0x2126, 0x2126, marker); markRange(chars, 0x212A, 0x212B, marker); markRange(chars, 0x212E, 0x212E, marker); markRange(chars, 0x2180, 0x2182, marker); markRange(chars, 0x3041, 0x3094, marker); markRange(chars, 0x30A1, 0x30FA, marker); markRange(chars, 0x3105, 0x312C, marker); markRange(chars, 0xAC00, 0xD7A3, marker); // Ideographic markRange(chars, 0x4E00, 0x9FA5, marker); markRange(chars, 0x3007, 0x3007, marker); markRange(chars, 0x3021, 0x3029, marker); // Digit marker = OTHER; markRange(chars, 0x0030, 0x0039, marker); markRange(chars, 0x0660, 0x0669, marker); markRange(chars, 0x06F0, 0x06F9, marker); markRange(chars, 0x0966, 0x096F, marker); markRange(chars, 0x09E6, 0x09EF, marker); markRange(chars, 0x0A66, 0x0A6F, marker); markRange(chars, 0x0AE6, 0x0AEF, marker); markRange(chars, 0x0B66, 0x0B6F, marker); markRange(chars, 0x0BE7, 0x0BEF, marker); markRange(chars, 0x0C66, 0x0C6F, marker); markRange(chars, 0x0CE6, 0x0CEF, marker); markRange(chars, 0x0D66, 0x0D6F, marker); markRange(chars, 0x0E50, 0x0E59, marker); markRange(chars, 0x0ED0, 0x0ED9, marker); markRange(chars, 0x0F20, 0x0F29, marker); // "Other NameChars" markRange(chars, 0x2e, 0x2e, marker); markRange(chars, 0x2d, 0x2d, marker); marker = START | OTHER; markRange(chars, 0x5f, 0x5f, marker); // e4x excludes ':' // CombiningChar marker = OTHER; markRange(chars, 0x0300, 0x0345, marker); markRange(chars, 0x0360, 0x0361, marker); markRange(chars, 0x0483, 0x0486, marker); markRange(chars, 0x0591, 0x05A1, marker); markRange(chars, 0x05A3, 0x05B9, marker); markRange(chars, 0x05BB, 0x05BD, marker); markRange(chars, 0x05BF, 0x05BF, marker); markRange(chars, 0x05C1, 0x05C2, marker); markRange(chars, 0x05C4, 0x05C4, marker); markRange(chars, 0x064B, 0x0652, marker); markRange(chars, 0x0670, 0x0670, marker); markRange(chars, 0x06D6, 0x06DC, marker); markRange(chars, 0x06DD, 0x06DF, marker); markRange(chars, 0x06E0, 0x06E4, marker); markRange(chars, 0x06E7, 0x06E8, marker); markRange(chars, 0x06EA, 0x06ED, marker); markRange(chars, 0x0901, 0x0903, marker); markRange(chars, 0x093C, 0x093C, marker); markRange(chars, 0x093E, 0x094C, marker); markRange(chars, 0x094D, 0x094D, marker); markRange(chars, 0x0951, 0x0954, marker); markRange(chars, 0x0962, 0x0963, marker); markRange(chars, 0x0981, 0x0983, marker); markRange(chars, 0x09BC, 0x09BC, marker); markRange(chars, 0x09BE, 0x09BE, marker); markRange(chars, 0x09BF, 0x09BF, marker); markRange(chars, 0x09C0, 0x09C4, marker); markRange(chars, 0x09C7, 0x09C8, marker); markRange(chars, 0x09CB, 0x09CD, marker); markRange(chars, 0x09D7, 0x09D7, marker); markRange(chars, 0x09E2, 0x09E3, marker); markRange(chars, 0x0A02, 0x0A02, marker); markRange(chars, 0x0A3C, 0x0A3C, marker); markRange(chars, 0x0A3E, 0x0A3E, marker); markRange(chars, 0x0A3F, 0x0A3F, marker); markRange(chars, 0x0A40, 0x0A42, marker); markRange(chars, 0x0A47, 0x0A48, marker); markRange(chars, 0x0A4B, 0x0A4D, marker); markRange(chars, 0x0A70, 0x0A71, marker); markRange(chars, 0x0A81, 0x0A83, marker); markRange(chars, 0x0ABC, 0x0ABC, marker); markRange(chars, 0x0ABE, 0x0AC5, marker); markRange(chars, 0x0AC7, 0x0AC9, marker); markRange(chars, 0x0ACB, 0x0ACD, marker); markRange(chars, 0x0B01, 0x0B03, marker); markRange(chars, 0x0B3C, 0x0B3C, marker); markRange(chars, 0x0B3E, 0x0B43, marker); markRange(chars, 0x0B47, 0x0B48, marker); markRange(chars, 0x0B4B, 0x0B4D, marker); markRange(chars, 0x0B56, 0x0B57, marker); markRange(chars, 0x0B82, 0x0B83, marker); markRange(chars, 0x0BBE, 0x0BC2, marker); markRange(chars, 0x0BC6, 0x0BC8, marker); markRange(chars, 0x0BCA, 0x0BCD, marker); markRange(chars, 0x0BD7, 0x0BD7, marker); markRange(chars, 0x0C01, 0x0C03, marker); markRange(chars, 0x0C3E, 0x0C44, marker); markRange(chars, 0x0C46, 0x0C48, marker); markRange(chars, 0x0C4A, 0x0C4D, marker); markRange(chars, 0x0C55, 0x0C56, marker); markRange(chars, 0x0C82, 0x0C83, marker); markRange(chars, 0x0CBE, 0x0CC4, marker); markRange(chars, 0x0CC6, 0x0CC8, marker); markRange(chars, 0x0CCA, 0x0CCD, marker); markRange(chars, 0x0CD5, 0x0CD6, marker); markRange(chars, 0x0D02, 0x0D03, marker); markRange(chars, 0x0D3E, 0x0D43, marker); markRange(chars, 0x0D46, 0x0D48, marker); markRange(chars, 0x0D4A, 0x0D4D, marker); markRange(chars, 0x0D57, 0x0D57, marker); markRange(chars, 0x0E31, 0x0E31, marker); markRange(chars, 0x0E34, 0x0E3A, marker); markRange(chars, 0x0E47, 0x0E4E, marker); markRange(chars, 0x0EB1, 0x0EB1, marker); markRange(chars, 0x0EB4, 0x0EB9, marker); markRange(chars, 0x0EBB, 0x0EBC, marker); markRange(chars, 0x0EC8, 0x0ECD, marker); markRange(chars, 0x0F18, 0x0F19, marker); markRange(chars, 0x0F35, 0x0F35, marker); markRange(chars, 0x0F37, 0x0F37, marker); markRange(chars, 0x0F39, 0x0F39, marker); markRange(chars, 0x0F3E, 0x0F3E, marker); markRange(chars, 0x0F3F, 0x0F3F, marker); markRange(chars, 0x0F71, 0x0F84, marker); markRange(chars, 0x0F86, 0x0F8B, marker); markRange(chars, 0x0F90, 0x0F95, marker); markRange(chars, 0x0F97, 0x0F97, marker); markRange(chars, 0x0F99, 0x0FAD, marker); markRange(chars, 0x0FB1, 0x0FB7, marker); markRange(chars, 0x0FB9, 0x0FB9, marker); markRange(chars, 0x20D0, 0x20DC, marker); markRange(chars, 0x20E1, 0x20E1, marker); markRange(chars, 0x302A, 0x302F, marker); markRange(chars, 0x3099, 0x3099, marker); markRange(chars, 0x309A, 0x309A, marker); // Extender markRange(chars, 0x00B7, 0x00B7, marker); markRange(chars, 0x02D0, 0x02D0, marker); markRange(chars, 0x02D1, 0x02D1, marker); markRange(chars, 0x0387, 0x0387, marker); markRange(chars, 0x0640, 0x0640, marker); markRange(chars, 0x0E46, 0x0E46, marker); markRange(chars, 0x0EC6, 0x0EC6, marker); markRange(chars, 0x3005, 0x3005, marker); markRange(chars, 0x3031, 0x3035, marker); markRange(chars, 0x309D, 0x309E, marker); markRange(chars, 0x30FC, 0x30FE, marker); TEST(6, '', testIsXMLName(chars)); END(); // Utilities function markRange(buffer, start, end, marker) { for (var i = start; i <= end; i++) { buffer[i] |= marker; } } function init() { var length = 0xFFFF + 1; var chars = new Array(length); for (var i = 0; i < length; i++) { chars[i] = 0; } return chars; } function testIsXMLName(buffer) { var nl = "\n"; var result = ''; var length = buffer.length; var rangestart = null; var rangeend = null; var rangemessage = ''; for (var i = 0; i < length; i++) { var message = ''; var c = String.fromCharCode(i); var marker = buffer[i]; var namestart = isXMLName(c + 'x'); var nameother = isXMLName('x' + c); if (marker == 0 && namestart) { message += ': Invalid char accepted as start '; } if (marker == 0 && nameother) { message += ': Invalid Char accepted as other '; } if ((marker & START) && !namestart) { message += ': Start char not accepted'; } if ((marker & OTHER) && !nameother) { message += ': Other char not accepted'; } if (rangemessage && !message) { // no current error, previous error // output previous error range result += rangestart + '-' + rangeend + ' ' + rangemessage + nl; rangemessage = rangestart = rangeend = null; } else if (!rangemessage && message) { // current error, no previous error // start new error range rangemessage = message; rangestart = rangeend = formatChar(c); } else if (rangemessage && message) { if (rangemessage == message) { // current error same as previous // continue previous error range rangeend = formatChar(c); } else { // different error, output range result += rangestart + '-' + rangeend + ' ' + rangemessage + nl; rangemessage = message; rangestart = rangeend = formatChar(c); } } } if (rangemessage) { result += rangestart + '-' + rangeend + ' ' + rangemessage + nl; } return result; } function formatChar(c) { var s = '0x' + c.charCodeAt(0).toString(16).toUpperCase(); return s; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Global/browser.js0000644000175000017500000000000011545150464021343 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Global/jstests.list0000644000175000017500000000011211545150464021722 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/Global/ fails script 13.1.2.1.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Global/shell.js0000644000175000017500000000000011545150464020767 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Namespace/13.2.1.js0000644000175000017500000000454411545150464021117 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.2.1 - Namespace Constructor as Function"); n = Namespace(); m = new Namespace(); TEST(1, typeof(m), typeof(n)); TEST(2, m.prefix, n.prefix); TEST(3, m.uri, n.uri); n = Namespace("http://foobar/"); m = new Namespace("http://foobar/"); TEST(4, typeof(m), typeof(n)); TEST(5, m.prefix, n.prefix); TEST(6, m.uri, n.uri); n = Namespace("foobar", "http://foobar/"); m = new Namespace("foobar", "http://foobar/"); TEST(7, typeof(m), typeof(n)); TEST(8, m.prefix, n.prefix); TEST(9, m.uri, n.uri); n = Namespace(m); TEST(10, m, n); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Namespace/13.2.2.js0000644000175000017500000000541011545150464021111 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.2.2 - Namespace Constructor"); n = new Namespace(); TEST(1, "object", typeof(n)); TEST(2, "", n.prefix); TEST(3, "", n.uri); n = new Namespace(""); TEST(4, "object", typeof(n)); TEST(5, "", n.prefix); TEST(6, "", n.uri); n = new Namespace("http://foobar/"); TEST(7, "object", typeof(n)); TEST(8, "undefined", typeof(n.prefix)); TEST(9, "http://foobar/", n.uri); // Check if the undefined prefix is getting set properly m = new Namespace(n); TEST(10, typeof(n), typeof(m)); TEST(11, n.prefix, m.prefix); TEST(12, n.uri, m.uri); n = new Namespace("foobar", "http://foobar/"); TEST(13, "object", typeof(n)); TEST(14, "foobar", n.prefix); TEST(15, "http://foobar/", n.uri); // Check if all the properties are getting copied m = new Namespace(n); TEST(16, typeof(n), typeof(m)); TEST(17, n.prefix, m.prefix); TEST(18, n.uri, m.uri); try { n = new Namespace("ns", ""); SHOULD_THROW(19); } catch(ex) { TEST(19, "TypeError", ex.name); } END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Namespace/13.2.5.js0000644000175000017500000000451311545150464021117 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.2.5 - Properties of Namespace Instances"); n = new Namespace("ns", "http://someuri"); TEST(1, true, n.hasOwnProperty("prefix")); TEST(2, true, n.hasOwnProperty("uri")); TEST(3, true, n.propertyIsEnumerable("prefix")); TEST(4, true, n.propertyIsEnumerable("uri")); var prefixCount = 0; var uriCount = 0; var p; for(p in n) { if(p == "prefix") prefixCount++; if(p == "uri") uriCount++; } TEST(5, 1, prefixCount); TEST(6, 1, uriCount); TEST(7, "ns", n.prefix); TEST(8, "http://someuri", n.uri); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Namespace/browser.js0000644000175000017500000000000011545150464022037 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Namespace/jstests.list0000644000175000017500000000035511545150464022427 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/Namespace/ script 13.2.1.js script 13.2.2.js script 13.2.5.js script regress-283972.js fails script regress-292863.js script regress-350442.js script regress-444608-02.js script regress-444608.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Namespace/regress-283972.js0000644000175000017500000000447711545150464022630 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'throw error when two attributes with the same local name and ' + 'the same namespace'; var BUGNUMBER = 283972; var actual = 'no error'; var expect = 'error'; printBugNumber(BUGNUMBER); START(summary); try { var xml = ; printStatus(xml.toXMLString()); } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Namespace/regress-292863.js0000644000175000017500000000427711545150464022625 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Undeclaring namespace prefix should cause parse error"; var BUGNUMBER = 292863; var actual = 'no error'; var expect = 'error'; printBugNumber(BUGNUMBER); START(summary); try { var godList = Kibo ; printStatus(godList.toXMLString()); } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Namespace/regress-350442.js0000644000175000017500000000465611545150464022612 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Lubos Ures * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 350442; var summary = 'toXMLString with namespace definitions'; var actual, expect; printBugNumber(BUGNUMBER); START(summary); expect = false; actual = false; try { var t1 = ; var n2 = new Namespace("http://ns2"); t1.@n2::a1="a1 from ns2"; var t1XMLString = t1.toXMLString(); var attrMatch = /xmlns:([^=]+)="http:\/\/ns2"/.exec(t1XMLString); if (!attrMatch) throw "No @n2::a1 attribute present"; var nsRegexp = new RegExp(attrMatch[1] + ':a1="a1 from ns2"'); if (!nsRegexp.test(t1XMLString)) throw "No namespace declaration present for @ns2::a1"; } catch (e) { actual = e; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Namespace/regress-444608-02.js0000644000175000017500000000405311545150464023030 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = '13.2 Namespaces - call constructors directly'; var BUGNUMBER = 444608; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var x = ; Namespace = function() { return 10; }; x.removeNamespace("x"); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Namespace/regress-444608.js0000644000175000017500000000405011545150464022606 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = '13.2 Namespaces - call constructors directly'; var BUGNUMBER = 444608; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var x = ; Namespace = function() { return 10; }; x.addNamespace("x"); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Namespace/shell.js0000644000175000017500000000000011545150464021463 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/QName/13.3.1.js0000644000175000017500000000500411545150464020215 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.3.1 - QName Constructor as a Function"); q = QName("foobar"); p = new QName("foobar"); TEST(1, typeof(p), typeof(q)); TEST(2, p.localName, q.localName); TEST(3, p.uri, q.uri); q = QName("http://foobar/", "foobar"); p = new QName("http://foobar/", "foobar"); TEST(4, typeof(p), typeof(q)); TEST(5, p.localName, q.localName); TEST(6, p.uri, q.uri); p1 = QName(q); p2 = new QName(q); TEST(7, typeof(p2), typeof(p1)); TEST(8, p2.localName, p1.localName); TEST(9, p2.uri, p1.uri); n = new Namespace("http://foobar/"); q = QName(n, "foobar"); p = QName(n, "foobar"); TEST(10, typeof(p), typeof(q)); TEST(11, p.localName, q.localName); TEST(12, p.uri, q.uri); p = QName(q); TEST(13, p, q); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/QName/13.3.2.js0000644000175000017500000000550111545150464020220 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.3.2 - QName Constructor"); q = new QName("*"); TEST(1, "object", typeof(q)); TEST(2, "*", q.localName); TEST(3, null, q.uri); TEST(4, "*::*", q.toString()); // Default namespace q = new QName("foobar"); TEST(5, "object", typeof(q)); TEST(6, "foobar", q.localName); TEST(7, "", q.uri); TEST(8, "foobar", q.toString()); q = new QName("http://foobar/", "foobar"); TEST(9, "object", typeof(q)); TEST(10, "foobar", q.localName); TEST(11, "http://foobar/", q.uri); TEST(12, "http://foobar/::foobar", q.toString()); p = new QName(q); TEST(13, typeof(p), typeof(q)); TEST(14, q.localName, p.localName); TEST(15, q.uri, p.uri); n = new Namespace("http://foobar/"); q = new QName(n, "foobar"); TEST(16, "object", typeof(q)); q = new QName(null); TEST(17, "object", typeof(q)); TEST(18, "null", q.localName); TEST(19, "", q.uri); TEST(20, "null", q.toString()); q = new QName(null, null); TEST(21, "object", typeof(q)); TEST(22, "null", q.localName); TEST(23, null, q.uri); TEST(24, "*::null", q.toString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/QName/13.3.5.js0000644000175000017500000000453211545150464020226 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.3.5 - Properties of QName Instances"); q = new QName("http://someuri", "foo"); TEST(1, true, q.hasOwnProperty("localName")); TEST(2, true, q.hasOwnProperty("uri")); TEST(3, true, q.propertyIsEnumerable("localName")); TEST(4, true, q.propertyIsEnumerable("uri")); var localNameCount = 0; var uriCount = 0; var p; for(p in q) { if(p == "localName") localNameCount++; if(p == "uri") uriCount++; } TEST(5, 1, localNameCount); TEST(6, 1, uriCount); TEST(7, "http://someuri", q.uri); TEST(8, "foo", q.localName); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/QName/browser.js0000644000175000017500000000000011545150464021144 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/QName/jstests.list0000644000175000017500000000035111545150464021530 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/QName/ script 13.3.1.js script 13.3.2.js script 13.3.5.js script regress-373595-01.js script regress-373595-02.js script regress-373595-03.js script regress-444608.js script regress-619529.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/QName/regress-373595-01.js0000644000175000017500000000401711545150464022142 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = '13.3 QName Objects - Do not assert: op == JSOP_ADD'; var BUGNUMBER = 373595; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); "" + (function () { return 1 / 2 .. y; }); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/QName/regress-373595-02.js0000644000175000017500000000411711545150464022144 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = '13.3 QName Objects - Do not assert: op == JSOP_ADD'; var BUGNUMBER = 373595; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); print('This testcase does not reproduce the original issue'); "" + (function () { x %= y.@foo; const x;}) TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/QName/regress-373595-03.js0000644000175000017500000000410611545150464022143 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = '13.3 QName Objects - Do not assert: op == JSOP_ADD'; var BUGNUMBER = 373595; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); print('This testcase does not reproduce the original issue'); "" + (function () { x.@foo < 1;}); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/QName/regress-444608.js0000644000175000017500000000404511545150464021717 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = '13.3 QNames - call constructors directly'; var BUGNUMBER = 444608; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var x = ; QName = function() { return 10; }; x.replace("b", 10); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/QName/regress-619529.js0000644000175000017500000000064411545150464021726 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var b = Proxy.create({ enumerateOwn: function () { @f; }}); Object.freeze(this); try { @r; throw 1; // should not be reached } catch (e) { assertEq(e instanceof ReferenceError, true); } reportCompare(0, 0, "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/QName/shell.js0000644000175000017500000000000011545150464020570 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/browser.js0000644000175000017500000000000011545150464021555 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/jstests.list0000644000175000017500000000506311545150464022146 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/Regress/ script regress-257679.js script regress-263934.js script regress-263935.js script regress-263936.js script regress-264369.js script regress-271545.js script regress-277650.js script regress-277664.js script regress-277683.js script regress-277779.js script regress-277935.js skip script regress-278112.js # obsolete test script regress-283349.js script regress-290056.js script regress-290499.js script regress-301553.js script regress-301573.js script regress-301596.js script regress-301692.js skip-if(!xulRuntime.shell&&isDebugBuild) slow script regress-308111.js script regress-309897.js script regress-311580.js script regress-313799.js script regress-318922.js skip script regress-319872.js # slow script regress-321547.js script regress-322499.js script regress-323338-1.js script regress-323338-2.js script regress-325425.js script regress-327564.js script regress-327691-01.js script regress-327691-02.js script regress-327697.js script regress-328249.js script regress-329257.js script regress-331558.js script regress-331664.js script regress-344455.js script regress-347155.js script regress-350206-1.js script regress-350206.js skip-if(!xulRuntime.shell) slow script regress-350238.js script regress-350629.js script regress-352097.js script regress-352103.js script regress-352223.js script regress-354145-01.js script regress-354145-02.js script regress-354145-03.js script regress-354145-04.js script regress-354145-05.js script regress-354145-07.js script regress-354998.js script regress-355474-02.js script regress-355478.js script regress-355569.js script regress-356238-01.js script regress-356238-02.js script regress-356238-03.js skip script regress-361451.js # obsolete test script regress-364017.js script regress-369032.js script regress-369536.js script regress-369740.js script regress-370016.js script regress-370048-01.js script regress-370048-02.js script regress-370372.js script regress-371369.js script regress-372563.js script regress-372564.js script regress-373082.js script regress-374106.js script regress-374112.js script regress-374116.js script regress-374160.js script regress-375406.js script regress-378492.js script regress-380833.js script regress-383255.js script regress-394941.js script regress-407323.js script regress-426520.js script regress-453915.js script regress-458679-01.js script regress-458679-02.js script regress-460180.js script regress-465063.js script regress-470619.js script regress-473709.js script regress-474319.js script regress-477053.js script regress-561031.js script regress-587434.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-257679.js0000644000175000017500000000400711545150464022340 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("Standalone should be allowed"); printBugNumber(257679); var x = arbitrary text ]]>; var expected = new XML(" arbitrary text ]]>"); TEST(1, expected, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-263934.js0000644000175000017500000000421311545150464022326 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * John Schneider * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("Testing that replacing a list item with a new list that contains that item works"); printBugNumber(263934); var x = two three ; // insert element in from of first element x.b[0] = one + x.b[0]; var expected = one two three ; TEST(1, expected, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-263935.js0000644000175000017500000000437711545150464022342 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * John Schneider * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("Qualified names specifying all names in no namespace should only match names without namespaces"); printBugNumber(263935); var ns1 = new Namespace("http://www.ns1.com"); var ns2 = new Namespace("http://www.ns2.com"); var none = new Namespace(); var x = x.foo = "one"; x.ns1::foo = "two"; x.ns2::foo = "three"; x.bar = "four"; var actual = x.none::*; var expected = <> one four TEST(1, expected, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-263936.js0000644000175000017500000000416011545150464022331 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * John Schneider * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("Testing replacing an element with a list that contains a text node"); printBugNumber(263936); var x = one three ; // insert a text node "two" between elements and x.a += XML("two"); var expected = one two three ; TEST(1, expected, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-264369.js0000644000175000017500000000374211545150464022337 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * John Schneider * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("toXMLString() should escape '>'"); printBugNumber(264369); var x = ; var chars = "<>&"; x.b = chars; TEST(1, "<>&", x.b.toXMLString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-271545.js0000644000175000017500000000446511545150464022334 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Werner Sharp, * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START('XML("") should create empty text node'); printBugNumber(271545); // Check that text node should ignore any attempt to add a child to it var x; x = new XML(); x.a = "foo"; TEST_XML(1, "", x); x = new XML(""); x.a = "foo"; TEST_XML(2, "", x); x = new XML(null); x.a = "foo"; TEST_XML(3, "", x); x = new XML(undefined); x.a = "foo"; TEST_XML(4, "", x); var textNodeContent = "some arbitrary text without XML markup"; x = new XML(textNodeContent); x.a = "foo"; TEST_XML(5, textNodeContent, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-277650.js0000644000175000017500000000432411545150464022331 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // testcase from Martin.Honnen@arcor.de var summary = 'xml:lang attribute in XML literal'; var BUGNUMBER = 277650; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'no error'; try { var xml = ECMAScript for XML; actual = 'no error'; } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-277664.js0000644000175000017500000000425611545150464022342 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // testcase from Martin.Honnen@arcor.de var summary = 'duplicate attribute names'; var BUGNUMBER = 277664; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'error'; try { var god = ; actual = 'no error'; } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-277683.js0000644000175000017500000000440411545150464022336 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // testcase from Martin.Honnen@arcor.de var summary = 'processing instruction with target name XML'; var BUGNUMBER = 277683; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'error'; try { XML.ignoreProcessingInstructions = false; var xml = Kibo; actual = 'no error'; } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-277779.js0000644000175000017500000000447611545150464022355 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // testcase from Martin.Honnen@arcor.de var summary = 'call setNamespace on element with already existing default namespace'; var BUGNUMBER = 277779; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var xhtml2NS = new Namespace('http://www.w3.org/2002/06/xhtml2'); var xml = ; xml.setNamespace(xhtml2NS); expect = 'http://www.w3.org/2002/06/xhtml2'; actual = xml.namespace().toString(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-277935.js0000644000175000017500000000432611545150464022341 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START('XML("") should create empty text node'); printBugNumber(277935); // Check that assignments like "a..b = c" causes proper error var expect = 'PASS1,PASS2'; var actual = ''; var msg = ; try { eval('msg..s = 0'); SHOULD_THROW(1); } catch (e) { actual += 'PASS1'; } try { eval('msg..s += 0'); SHOULD_THROW(2); } catch (e) { actual += ',PASS2'; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-278112.js0000644000175000017500000000414511545150464022324 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Werner Sharp, * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START('setNamespace() should not affect namespaceDeclarations()'); printBugNumber('278112'); var xhtml1NS = new Namespace('http://www.w3.org/1999/xhtml'); var xhtml = ; xhtml.setNamespace(xhtml1NS); TEST(1, 0, xhtml.namespaceDeclarations().length); TEST(2, xhtml1NS, xhtml.namespace()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-283349.js0000644000175000017500000000417711545150464022341 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "13.3.5.4 - [[GetNamespace]]"; var BUGNUMBER = 283349; var actual = 'Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var x = text; var ns = new Namespace("http://foo.com/bar"); x.addNamespace(ns); printStatus(x.toXMLString()); actual = 'No Crash'; TEST("13.3.5.4 - [[GetNamespace]]", expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-290056.js0000644000175000017500000000465511545150464022333 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Dont crash when serializing an XML object where the name ' + 'of an attribute was changed with setName'; var BUGNUMBER = 290056; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var link = ; var xlinkNamespace = new Namespace('xlink', 'http://www.w3.org/1999/xlink'); link.addNamespace(xlinkNamespace); printStatus('In scope namespace: ' + link.inScopeNamespaces()); printStatus('XML markup: ' + link.toXMLString()); link.@type.setName(new QName(xlinkNamespace.uri, 'type')); printStatus('name(): ' + link.@*::*[0].name()); printStatus(link.toXMLString()); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-290499.js0000644000175000017500000000400511545150464022333 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "11.1.5 XMLList Initialiser Don't Crash with empty Initializer"; var BUGNUMBER = 290499; var actual = "No Crash"; var expect = "No Crash"; printBugNumber(BUGNUMBER); START(summary); var emptyList = <>; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-301553.js0000644000175000017500000000417111545150464022317 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Wladimir Palant * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "E4X - Should not repress exceptions"; var BUGNUMBER = 301553; var actual = 'No exception'; var expect = 'exception'; printBugNumber(BUGNUMBER); START(summary); try { var x = ; Object.toString.call(x); } catch(e) { actual = 'exception'; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-301573.js0000644000175000017500000000410311545150464022314 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Seno.Aiko@gmail.com * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "E4X - Entities"; var BUGNUMBER = 301573; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); actual = <; TEST(1, '<', actual.toString()); actual = &; TEST(2, '&', actual.toString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-301596.js0000644000175000017500000000412211545150464022322 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Mike Shaver * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "E4X - Do not crash with XMLList filters"; var BUGNUMBER = 301596; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); try { .(@a == 1); throw 5; } catch (e) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-301692.js0000644000175000017500000000615411545150464022326 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Seno Aiko * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Function.prototype.toString should not quote XML literals"; var BUGNUMBER = 301692; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); actual = ConvertToString((function () { return ; })); expect = 'function () { return ;}'; TEST(1, expect, actual); actual = ConvertToString((function () { return ; })); expect = 'function () { return ;}'; TEST(2, expect, actual); actual = ConvertToString((function () { return ; })); expect = 'function () { return ;}'; TEST(3, expect, actual); actual = ConvertToString((function (k) { return {k}; })); expect = 'function (k) { return {k};}'; TEST(4, expect, actual); actual = ConvertToString((function (k) { return <{k}/>; })); expect = 'function (k) { return <{k}/>;}'; TEST(5, expect, actual); actual = ConvertToString((function (k) { return <{k}>{k}; })); expect = 'function (k) { return <{k}>{k};}'; TEST(6, expect, actual); actual = ConvertToString((function (k) { return <{k} {k}={k} {"k"}={k + "world"}><{k + "k"}/>; })); expect = 'function (k) ' + '{ return <{k} {k}={k} {"k"}={k + "world"}><{k + "k"}/>;}'; TEST(7, expect, actual); END(); function ConvertToString(f) { return f.toString().replace(/\n/g, '').replace(/[ ]+/g, ' '); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-308111.js0000644000175000017500000015145311545150464022322 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Aaron Boodman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Regression - Do not crash when searching large e4x tree"; var BUGNUMBER = 308111; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = sessionsaver.settings.shutdown network.http.max-persistent-connections-per-proxy font.default.x-baltic plugin.scan.Quicktime capability.policy.default.DOMException.code capability.policy.mailnews.*.innerHTML.get capability.policy.mailnews.WebServiceProxyFactory.createProxy capability.policy.mailnews.SchemaLoader.load mousewheel.withcontrolkey.action font.name.monospace.x-western javascript.options.showInConsole font.name.sans-serif.x-unicode capability.policy.mailnews.SOAPEncoding.setDecoder font.name-list.sans-serif.ko browser.chrome.site_icons app.update.auto security.ssl2.des_64 print.always_cache_old_pres security.ssl3.rsa_des_sha security.warn_entering_weak.show_once network.proxy.http_port browser.display.use_document_colors browser.preferences.animateFadeIn browser.search.defaultenginename capability.principal.codebase.p0.id config.use_system_prefs font.name.monospace.x-guru security.default_personal_cert bidi.controlstextmode print.show_print_progress network.http.max-connections-per-server profile.migration_behavior browser.chrome.image_icons.max_size mousewheel.horizscroll.withaltkey.action capability.policy.mailnews.XMLHttpRequest.onerror greasemonkey.version browser.search.order.Yahoo.2 font.name.sans-serif.ko network.proxy.type security.dialog_enable_delay network.prefetch-next alerts.slideIncrement browser.blink_allowed font.name.sans-serif.x-geor font.name-list.sans-serif.zh-HK print.print_footerright capability.policy.default.History.item browser.download.manager.showAlertOnComplete capability.policy.default.Location.reload.get network.IDN_show_punycode browser.startup.homepage network.protocol-handler.external.vbscript signon.expireMasterPassword capability.policy.mailnews.SchemaLoader.loadAsync capability.policy.default.DOMException.toString.get capability.policy.mailnews.XMLHttpRequest.readyState capability.policy.default.History.back.get slider.snapMultiplier capability.policy.mailnews.XMLHttpRequest.abort images.dither print.print_headercenter font.name.monospace.zh-HK capability.policy.mailnews.HTMLAnchorElement.toString font.name.serif.x-mlym font.name.monospace.tr advanced.mailftp security.ssl3.rsa_fips_des_ede3_sha application.use_ns_plugin_finder font.name-list.cursive.ko capability.policy.mailnews.*.data.get browser.forms.submit.backwards_compatible font.name.monospace.x-mlym ui.key.menuAccessKey capability.policy.mailnews.XMLHttpRequest.statusText font.name.sans-serif.x-tamil print.print_footercenter privacy.item.sessions network.ftp.idleConnectionTimeout mousewheel.withshiftkey.sysnumlines security.ssl2.rc4_40 font.size.variable.ko capability.policy.default.Window.focus.get font.size.fixed.ja browser.display.focus_ring_on_anything capability.policy.default_policynames network.IDN.whitelist.kr network.IDN.whitelist.br network.cookie.alwaysAcceptSessionCookies dom.disable_window_status_change app.update.channel network.proxy.ssl_port xpinstall.whitelist.required browser.tabs.opentabfor.middleclick font.size.variable.x-tamil layout.word_select.eat_space_to_next_word security.warn_submit_insecure network.negotiate-auth.gsslib mousewheel.withaltkey.action capability.policy.default.Window.top font.name.cursive.x-ethi browser.goBrowsing.enabled capability.policy.mailnews.SOAPEncoding.encode font.name.sans-serif.x-guru plugin.expose_full_path capability.policy.default.Window.closed font.default.x-armn capability.policy.mailnews.SOAPEncoding.styleURI font.name.sans-serif.x-mlym security.ssl3.rsa_null_sha capability.policy.default.Window.opener extensions.dss.switchPending roaming.showInitialWarning security.ssl3.dhe_dss_des_sha network.protocol-handler.external.disk font.name.serif.ja custtoolbar.personal_toolbar_folder capability.policy.mailnews.Window.sizeToContent capability.policy.default.XMLHttpRequest.channel capability.policy.mailnews.SOAPEncoding.schemaCollection browser.display.normal_lineheight_calc_control capability.policy.default.Location.replace.get font.name.cursive.ko accessibility.browsewithcaret browser.cache.disk.enable network.IDN.whitelist.de general.useragent.locale security.ssl2.rc2_40 network.cookie.prefsMigrated plugin.scan.SunJRE font.name.serif.x-armn network.protocol-handler.external.data nglayout.debug.disable_xul_cache ime.password.onBlur.dontCare capability.policy.mailnews.XMLHttpRequest.overrideMimeType network.protocol-handler.external.mailto print.use_global_printsettings capability.policy.mailnews.XMLHttpRequest.getAllResponseHeaders security.ssl3.rsa_aes_256_sha capability.policy.mailnews.SOAPResponse.fault mousewheel.withcontrolkey.sysnumlines font.name.sans-serif.x-baltic network.protocol-handler.expose.nntp mousewheel.horizscroll.withcontrolkey.numlines editor.htmlWrapColumn browser.helperApps.alwaysAsk.force security.ssl3.dhe_rsa_des_sha network.proxy.no_proxies_on network.protocol-handler.external.hcp font.name.monospace.x-cans browser.cache.disk_cache_ssl intl.charsetmenu.browser.more1 accessibility.typeaheadfind.startlinksonly editor.positioning.offset font.name-list.monospace.x-tamil network.proxy.gopher_port mousewheel.horizscroll.withnokey.numlines browser.history.grouping pfs.datasource.url network.http.max-persistent-connections-per-server accessibility.tabfocus network.cookie.p3plevel intl.charsetmenu.browser.static editor.css.default_length_unit intl.charset.default capability.policy.mailnews.SOAPPropertyBagMutator.addProperty browser.download.folderList font.name.sans-serif.tr font.name-list.monospace.x-devanagari font.name.sans-serif.x-devanagari capability.policy.mailnews.Window.innerHeight.set browser.tabs.warnOnClose security.ssl3.rsa_des_ede3_sha signed.applets.codebase_principal_support print.extend_native_print_dialog font.name-list.monospace.x-cans font.name-list.serif.x-khmr font.name.monospace.x-cyrillic network.protocol-handler.warn-external.snews permissions.default.image font.name.monospace.ko font.name-list.monospace.zh-TW general.smoothScroll font.name-list.serif.zh-CN font.name.sans-serif.zh-TW network.protocol-handler.warn-external.mailto capability.policy.default.DOMException.name font.name-list.serif.x-mlym network.http.sendSecureXSiteReferrer intl.charsetmenu.mailedit capability.policy.mailnews.*.src.get app.update.showInstalledUI font.default.x-devanagari dom.disable_window_open_feature.location capability.policy.default.DOMException.result font.name-list.monospace.x-beng capability.policy.mailnews.XMLHttpRequest.getResponseHeader accessibility.usebrailledisplay network.enableIDN font.name.cursive.tr capability.policy.default.Location.href.set font.size.fixed.zh-CN font.name-list.sans-serif.zh-TW network.protocol-handler.expose.snews capability.policy.mailnews.SchemaLoader.onError accessibility.typeaheadfind.timeout capability.policy.default.History.next font.size.fixed.x-geor print.print_headerleft browser.search.update middlemouse.scrollbarPosition capability.policy.mailnews.SOAPEncoding.decode dom.disable_window_open_feature.scrollbars security.ssl2.rc2_128 network.protocol-handler.external-default dom.disable_window_open_feature.titlebar startup.homepage_override_url dom.popup_allowed_events network.proxy.socks_port capability.policy.default.Location.hash.set browser.startup.page print.whileInPrintPreview font.default.x-khmr mousewheel.withshiftkey.action mousewheel.withaltkey.sysnumlines font.size.fixed.x-baltic capability.policy.mailnews.Window.moveBy network.http.pipelining plugin.override_internal_types font.size.fixed.x-gujr security.ssl2.des_ede3_192 browser.visited_color capability.policy.mailnews.*.nodeValue.get font.default.x-beng intl.charsetmenu.browser.more4 network.http.keep-alive ui.key.accelKey browser.fixup.alternate.enabled font.name-list.serif.x-cans security.enable_ssl3 print.print_headerright network.IDN.whitelist.th capability.policy.mailnews.SOAPEncoding.unmapSchemaURI capability.policy.mailnews.Range.toString print.print_edge_bottom network.IDN.blacklist_chars browser.display.foreground_color font.default.zh-CN network.cookie.cookieBehavior dom.disable_image_src_set font.default.x-cans capability.policy.mailnews.Window.screenY.set network.cookie.enableForCurrentSessionOnly app.update.timer layout.word_select.stop_at_punctuation browser.search.order.Yahoo middlemouse.paste font.name.sans-serif.zh-HK dom.disable_window_open_feature.toolbar dom.popup_maximum security.warn_entering_secure mousewheel.horizscroll.withaltkey.numlines browser.tabs.warnOnCloseOther intl.accept_charsets font.name.monospace.x-central-euro alerts.height font.name-list.serif.x-tamil capability.policy.mailnews.SchemaLoader.onLoad font.size.variable.x-western keyword.URL capability.policy.default.Window.self browser.dom.window.dump.enabled font.name.sans-serif.x-beng privacy.item.siteprefs font.name.cursive.x-baltic network.protocol-handler.external.nntp security.ssl3.dhe_dss_des_ede3_sha font.name.serif.x-western capability.policy.mailnews.sites font.name-list.serif.x-beng dom.event.contextmenu.enabled browser.urlbar.clickSelectsAll security.warn_entering_secure.show_once font.size.fixed.zh-HK capability.policy.mailnews.SOAPCall.invoke capability.policy.default.SOAPCall.invokeVerifySourceHeader font.size.fixed.x-guru viewmanager.do_doublebuffering font.name.sans-serif.x-cans capability.policy.mailnews.*.href.get font.size.fixed.he dom.max_script_run_time capability.policy.default.Navigator.preference security.ssl2.rc4_128 browser.link.open_newwindow accessibility.tabfocus_applies_to_xul security.ssl3.rsa_rc4_128_sha font.size.variable.x-unicode mousewheel.withcontrolkey.numlines font.name.monospace.x-ethi font.default.zh-HK browser.tabs.loadBookmarksInBackground browser.fixup.hide_user_pass capability.policy.mailnews.HTMLDocument.URL plugin.scan.Acrobat font.name.serif.x-cyrillic intl.accept_languages capability.policy.mailnews.*.host.get security.directory security.ssl3.dhe_rsa_aes_128_sha font.size.variable.zh-HK browser.display.use_focus_colors capability.policy.default.DOMException.message intl.charsetmenu.browser.unicode greasemonkey.editor intl.charsetmenu.composer.cache font.default.x-tamil capability.policy.default.DOMParser.parseFromStream network.http.version capability.policy.default.History.previous signon.SignonFileName font.name.monospace.zh-CN app.update.silent font.name-list.monospace.x-mlym browser.underline_anchors capability.policy.default.Navigator.preferenceinternal.set intl.jis0208.map network.automatic-ntlm-auth.trusted-uris browser.chrome.toolbar_tips mousewheel.withshiftkey.numlines font.name.sans-serif.x-western browser.download.manager.showWhenStarting browser.enable_automatic_image_resizing privacy.item.passwords app.update.incompatible.mode capability.policy.mailnews.WSDLLoader.loadAsync capability.policy.mailnews.SOAPEncoding.getAssociatedEncoding browser.sessionhistory.max_entries sessionsaver.windows.cookies network.image.warnAboutImages browser.cache.disk.capacity font.size.variable.ja plugin.scan.plid.all print.print_extra_margin browser.download.manager.focusWhenStarting capability.policy.mailnews.XMLHttpRequest.channel font.name.sans-serif.x-armn network.proxy.socks_version xpinstall.whitelist.add.103 browser.download.manager.alertOnEXEOpen network.IDN.whitelist.ch xpinstall.dialog.progress.chrome network.online capability.policy.default.HTMLDocument.open.get general.startup.browser security.OCSP.enabled font.size.fixed.x-khmr config.use_system_prefs.accessibility font.default.ja print.print_edge_top print.print_edge_left network.dns.ipv4OnlyDomains browser.tabs.autoHide browser.search.order.2 font.name.sans-serif.he browser.tabs.loadGroup font.name.monospace.x-beng intl.locale.matchOS font.name.serif.zh-CN capability.policy.mailnews.*.protocol.get network.IDN.whitelist.tm network.cookie.denyRemovedCookies browser.search.order.Yahoo.1 font.size.fixed.x-ethi sessionsaver.prefs_set alerts.totalOpenTime browser.tabs.loadInBackground mousewheel.horizscroll.withnokey.sysnumlines network.negotiate-auth.using-native-gsslib accessibility.warn_on_browsewithcaret security.ssl3.rsa_fips_des_sha network.protocol-handler.external.shell ui.key.generalAccessKey font.size.variable.zh-CN network.automatic-ntlm-auth.allow-proxies capability.policy.mailnews.Window.moveTo nglayout.events.dispatchLeftClickOnly font.name.serif.x-devanagari security.checkloaduri network.protocol-handler.external.javascript security.ssl3.rsa_rc2_40_md5 network.IDN.whitelist.dk mousewheel.horizscroll.withaltkey.sysnumlines nglayout.debug.enable_xbl_forms network.proxy.socks font.size.variable.x-central-euro network.IDN.whitelist.jp font.size.variable.zh-TW network.IDN.whitelist.museum font.name-list.serif.zh-TW browser.chrome.toolbar_style mousewheel.horizscroll.withshiftkey.numlines capability.policy.default.Window.close.get capability.policy.mailnews.SOAPEncoding.defaultEncoder browser.download.manager.retention capability.policy.mailnews.*.baseURI.get network.IDN.whitelist.fi capability.policy.mailnews.WSDLLoader.load network.protocol-handler.warn-external.news dom.disable_open_during_load general.useragent.extra.firefox font.size.variable.x-ethi font.default.tr dom.disable_window_open_feature.resizable sessionsaver.windows.session0 network.proxy.failover_timeout general.skins.selectedSkin font.name.monospace.x-unicode network.protocol-handler.expose-all privacy.item.downloads font.name.monospace.el browser.preferences.instantApply font.name-list.serif.ko editor.resizing.preserve_ratio font.default.x-ethi privacy.sanitize.promptOnSanitize font.name.serif.x-cans font.name-list.monospace.x-geor network.hosts.nntp_server font.size.variable.x-khmr capability.policy.mailnews.*.text.get network.protocol-handler.warn-external.nntp font.default.x-unicode capability.policy.mailnews.Window.resizeTo font.name.monospace.zh-TW font.default.ko network.IDN.whitelist.tw signon.rememberSignons profile.manage_only_at_launch security.warn_leaving_secure font.language.group network.http.pipelining.maxrequests capability.policy.mailnews.WSDLLoader.onError capability.policy.mailnews.Window.outerWidth.set security.ask_for_password capability.policy.mailnews.SOAPEncoding.defaultDecoder font.default.x-gujr capability.policy.mailnews.XMLSerializer.serializeToStream network.autodial-helper.enabled font.size.fixed.x-central-euro alerts.slideIncrementTime capability.policy.mailnews.Window.blur network.http.accept.default network.http.proxy.keep-alive privacy.sanitize.sanitizeOnShutdown capability.policy.mailnews.*.getNamedItemNS network.protocol-handler.external.snews layout.enable_japanese_specific_transform general.useragent.contentlocale ui.key.menuAccessKeyFocuses plugin.scan.WindowsMediaPlayer font.name.cursive.x-western intl.charset.detector browser.download.save_converter_index image.animation_mode network.http.sendRefererHeader font.default.x-central-euro network.protocol-handler.external.ms-help font.default.x-geor browser.download.manager.openDelay dom.disable_window_open_feature.personalbar capability.policy.mailnews.SOAPHeaderBlock.mustUnderstand intl.keyboard.per_window_layout network.dir.format capability.policy.default.Clipboard.cutcopy capability.policy.default.Window.window font.name.sans-serif.x-ethi print.use_native_print_dialog browser.search.defaulturl font.name-list.serif.zh-HK network.negotiate-auth.trusted-uris intl.charsetmenu.browser.cache intl.menuitems.insertseparatorbeforeaccesskeys network.protocol-handler.external.news greasemonkey.enabled capability.policy.mailnews.XMLHttpRequest.send capability.policy.mailnews.SOAPEncoding.getEncoder profile.seconds_until_defunct font.size.variable.x-beng mousewheel.horizscroll.withnokey.action bidi.texttype network.protocol-handler.expose.news network.negotiate-auth.delegation-uris font.name.serif.zh-TW network.IDN.whitelist.gr general.useragent.security extensions.disabledObsolete browser.download.manager.closeWhenDone network.proxy.ftp_port privacy.item.cookies capability.policy.mailnews.*.lowSrc.get font.name-list.serif.x-ethi font.name.serif.x-unicode pref.advanced.proxies.disable_button.reload capability.policy.mailnews.XMLHttpRequest.onload browser.download.show_plugins_in_list font.size.fixed.th font.size.fixed.zh-TW print.save_print_settings bidi.browser.ui extensions.update.url font.name-list.monospace.x-khmr intl.charsetmenu.browser.more2 security.ssl3.dhe_dss_aes_256_sha capability.policy.mailnews.document.load security.ssl3.rsa_rc4_40_md5 privacy.item.cache browser.search.param.Google.1.default browser.active_color font.name-list.monospace.zh-HK browser.display.show_image_placeholders ime.password.onFocus.dontCare middlemouse.contentLoadURL font.name-list.monospace.x-armn svg.enabled capability.policy.default.Window.location dom.disable_window_flip security.warn_submit_insecure.show_once font.size.variable.x-cyrillic font.size.fixed.x-western font.size.variable.x-devanagari capability.policy.mailnews.XMLSerializer.serializeToString bidi.support browser.display.background_color capability.policy.default.History.go.get font.size.variable.x-armn font.size.variable.el network.cookie.p3p mousewheel.horizscroll.withcontrolkey.sysnumlines app.update.url font.name.cursive.he network.http.redirection-limit network.ntlm.send-lm-response converter.html2txt.header_strategy browser.offline network.proxy.ftp dom.disable_window_open_feature.directories capability.policy.default.Clipboard.paste browser.related.disabledForDomains font.name.sans-serif.x-cyrillic intl.charsetmenu.browser.cache.size capability.policy.mailnews.SOAPCall.transportURI browser.shell.checkDefaultBrowser network.proxy.http capability.policy.default.History.current capability.policy.mailnews.SOAPFault.faultNamespaceURI capability.policy.mailnews.*.getAttribute capability.policy.mailnews.XMLHttpRequest.responseText network.IDN.whitelist.sh browser.cache.check_doc_frequency layout.frames.force_resizability capability.policy.default.Window.frames app.update.url.manual capability.policy.mailnews.SOAPFault.element browser.trim_user_and_password font.size.variable.tr browser.fixup.alternate.suffix browser.download.manager.showAlertInterval security.warn_viewing_mixed.show_once browser.helperApps.neverAsk.openFile font.name.sans-serif.x-central-euro capability.policy.mailnews.SOAPCall.asyncInvoke mousewheel.withnokey.numlines font.name.serif.tr privacy.popups.showBrowserMessage browser.feedview.showMenu font.name-list.serif.x-gujr browser.feedview.reloadInterval security.ui.enable editor.use_css network.IDN.whitelist.io browser.related.enabled browser.sessionhistory.max_viewers font.size.variable.x-guru font.size.variable.x-gujr network.protocol-handler.external.vnd.ms.radio advanced.system.supportDDEExec browser.tabs.opentabfor.urlbar font.name.sans-serif.x-khmr mousewheel.horizscroll.withshiftkey.sysnumlines network.protocol-handler.external.afp font.name-list.serif.x-guru intl.charsetmenu.browser.more5 security.ssl3.rsa_rc4_128_md5 font.default.he font.size.fixed.ko font.name-list.monospace.ko capability.policy.mailnews.XMLHttpRequest.onreadystatechange print.print_edge_right browser.popups.showPopupBlocker app.update.nagTimer.restart capability.policy.mailnews.Location.toString font.default.x-cyrillic font.size.fixed.x-unicode clipboard.autocopy font.name.monospace.ja browser.tabs.loadFolderAndReplace font.name.monospace.x-khmr font.size.variable.x-baltic font.name.serif.x-tamil font.name-list.monospace.x-gujr browser.urlbar.matchOnlyTyped capability.policy.mailnews.SOAPHeaderBlock.actorURI font.name-list.sans-serif.zh-CN extensions.update.interval network.IDN.whitelist.cn font.size.variable.he security.ssl3.dhe_rsa_des_ede3_sha dom.disable_window_open_feature.close font.name.cursive.el bidi.characterset font.name.cursive.x-unicode network.proxy.share_proxy_settings network.cookie.disableCookieForMailNews general.config.obscure_value capability.policy.mailnews.XMLHttpRequest.open dom.allow_scripts_to_close_windows network.IDN.whitelist.se mousewheel.horizscroll.withcontrolkey.action capability.policy.mailnews.WebServiceProxyFactory.onLoad browser.tabs.forceHide accessibility.typeaheadfind.enablesound font.size.fixed.x-cans capability.policy.default.HTMLDocument.close.get font.size.fixed.el font.name.cursive.x-cyrillic font.default.x-guru browser.chromeURL roaming.default.files profile.confirm_automigration browser.link.open_external font.name-list.serif.x-armn font.name.serif.el font.name-list.monospace.ja capability.policy.mailnews.SOAPEncoding.getInternalSchemaURI browser.bookmarks.sort.direction browser.download.manager.flashCount browser.formfill.enable font.size.fixed.x-beng print.print_footerleft capability.policy.default.Window.parent capability.policy.mailnews.SOAPCall.verifySourceHeader browser.download.lastDir sessionsaver.windows.zorder xpinstall.enabled capability.policy.mailnews.*.getAttributeNS capability.policy.mailnews.*.pathname.get xpinstall.dialog.progress.type.skin browser.windows.loadOnNewWindow font.name-list.serif.he browser.link.open_newwindow.restriction font.name-list.monospace.he font.name.sans-serif.ja editor.singleLine.pasteNewlines accessibility.typeaheadfind.soundURL capability.policy.mailnews.Window.outerHeight.set capability.policy.mailnews.SOAPFault.faultActor font.size.fixed.tr extensions.getMoreThemesURL browser.search.param.Google.1.custom extensions.logging.enabled browser.frames.enabled font.default.th network.IDN.whitelist.lt capability.policy.mailnews.SOAPEncoding.mapSchemaURI network.hosts.smtp_server mousewheel.withnokey.sysnumlines browser.tabs.loadOnNewTab font.name.sans-serif.el browser.display.focus_ring_width font.size.variable.x-mlym font.name.serif.x-khmr capability.policy.mailnews.XMLHttpRequest.status intl.charsetmenu.mailview.cache capability.policy.mailnews.SOAPEncoding.setEncoder privacy.popups.usecustom font.name-list.serif.x-geor capability.policy.mailnews.WSDLLoader.onLoad dom.disable_window_open_feature.minimizable accessibility.typeaheadfind capability.policy.mailnews.SOAPFault.detail capability.policy.default.Window.document font.size.variable.x-geor xpinstall.dialog.confirm intl.collationOption browser.cache.memory.enable font.size.variable.x-cans browser.hiddenWindowChromeURL font.name-list.serif.x-devanagari capability.principal.codebase.p0.subjectName capability.policy.mailnews.*.hostname.get intl.fallbackCharsetList.ISO-8859-1 network.IDN.whitelist.li javascript.options.strict font.name.cursive.ar browser.search.selectedEngine capability.policy.mailnews.SOAPEncoding.getDecoder general.autoScroll font.default.x-western browser.display.use_system_colors extensions.ignoreMTimeChanges network.hosts.pop_server privacy.item.history editor.quotesPreformatted security.password_lifetime security.ssl3.dhe_dss_aes_128_sha font.name.monospace.x-tamil xpinstall.dialog.progress.type.chrome capability.policy.mailnews.SchemaLoader.processSchemaElement capability.policy.mailnews.DOMParser,parseFromString network.http.proxy.pipelining security.ssl3.rsa_1024_rc4_56_sha browser.history_expire_days capability.policy.mailnews.DOMException.toString font.name.serif.x-gujr browser.display.force_inline_alttext security.ssl3.rsa_1024_des_cbc_sha mousewheel.horizscroll.withshiftkey.action font.size.fixed.x-mlym font.name-list.cursive.he capability.policy.mailnews.Window.screenX.set font.name.serif.x-ethi network.cookie.lifetime.days view_source.wrap_long_lines network.IDN.whitelist.hu browser.bookmarks.sort.resource capability.policy.mailnews.*.getNamedItem security.warn_viewing_mixed browser.xul.error_pages.enabled capability.policy.mailnews.WebServiceProxyFactory.createProxyAsync capability.policy.mailnews.DOMParser,parseFromStream network.proxy.autoconfig_url capability.policy.mailnews.SOAPPropertyBagMutator.propertyBag xpinstall.dialog.progress.skin browser.download.hide_plugins_without_extensions network.protocol-handler.warn-external-default font.name.serif.he font.name.cursive.th network.negotiate-auth.allow-proxies capability.policy.default.Window.Components font.name.serif.x-central-euro font.size.fixed.x-tamil capability.policy.mailnews.SOAPFault.faultString app.update.mode font.name.serif.x-guru capability.policy.mailnews.*.title.get font.name.monospace.x-gujr app.update.nagTimer.download dom.disable_window_move_resize browser.download.useDownloadDir font.name.sans-serif.ar network.IDN.whitelist.no browser.display.screen_resolution extensions.dss.enabled network.http.request.max-start-delay font.size.fixed.ar extensions.update.enabled network.auth.use-sspi sessionsaver.settings.dontwarn capability.policy.mailnews.Window.name.set security.enable_tls dom.disable_window_open_feature.menubar xpinstall.whitelist.add sessionsaver.settings.nofx font.name.serif.ar network.http.max-connections browser.fixup.alternate.prefix privacy.item.formdata network.dns.disableIPv6 network.protocol-handler.external.disks dom.disable_window_open_feature.status javascript.enabled prefs.converted-to-utf8 capability.policy.mailnews.SOAPEncoding.getExternalSchemaURI network.proxy.socks_remote_dns capability.policy.mailnews.HTMLDocument.domain font.name-list.monospace.zh-CN font.default.zh-TW capability.policy.mailnews.Window.resizeBy browser.tabs.loadDivertedInBackground app.update.interval browser.related.provider profile.allow_automigration browser.search.basic.min_ver network.proxy.ssl security.xpconnect.plugin.unrestricted middlemouse.openNewWindow dom.disable_open_click_delay network.enablePad font.name.serif.x-baltic privacy.popups.disable_from_plugins font.name-list.monospace.x-guru security.ssl3.rsa_aes_128_sha capability.policy.mailnews.Window.innerWidth.set security.enable_ssl2 font.name.monospace.th capability.policy.mailnews.WebServiceProxyFactory.onError network.protocol-handler.expose.mailto font.default.el network.http.default-socket-type browser.display.focus_background_color editor.use_custom_colors network.proxy.gopher ui.key.saveLink.shift font.name.serif.ko security.warn_entering_weak font.name.sans-serif.th capability.policy.mailnews.*.substringData.get font.name.cursive.x-central-euro browser.chrome.favicons font.size.variable.ar accessibility.typeaheadfind.autostart font.default.ar capability.policy.mailnews.SOAPFault.faultCode font.name.serif.th security.ssl3.dhe_rsa_aes_256_sha privacy.popups.policy font.name.monospace.he font.name.sans-serif.x-gujr browser.anchor_color network.http.keep-alive.timeout network.IDN.whitelist.cl browser.display.focus_text_color accessibility.typeaheadfind.linksonly mousewheel.withaltkey.numlines capability.policy.mailnews.Window.focus intl.content.langcode browser.helperApps.neverAsk.saveToDisk browser.throbber.url intl.menuitems.alwaysappendaccesskeys font.size.fixed.x-armn font.name.monospace.x-geor accessibility.typeaheadfind.flashBar font.name.monospace.x-devanagari font.name.serif.x-geor network.IDN.whitelist.ac browser.related.autoload intl.charsetmenu.browser.more3 font.name.monospace.x-baltic browser.download.manager.useWindow font.size.fixed.x-devanagari font.name-list.sans-serif.ja browser.search.order.1 capability.policy.mailnews.XMLHttpRequest.responseXML extensions.getMoreExtensionsURL font.name.serif.x-beng font.size.variable.th network.http.use-cache font.name.serif.zh-HK security.ssl3.rsa_null_md5 capability.policy.default.Window.blur.get extensions.lastAppVersion font.name.monospace.ar capability.policy.mailnews.SOAPParameter accessibility.accesskeycausesactivation security.warn_leaving_secure.show_once network.cookie.lifetimePolicy bidi.numeral capability.policy.default.History.toString view_source.syntax_highlight capability.principal.codebase.p0.granted font.name-list.monospace.x-ethi network.http.proxy.version converter.html2txt.structs accessibility.usetexttospeech capability.policy.default.Navigator.preferenceinternal.get font.size.fixed.x-cyrillic capability.policy.default.Window.history bidi.direction capability.policy.mailnews.*.attributes.get sessionsaver.settings.sync.machineid capability.policy.mailnews.XMLHttpRequest.setRequestHeader app.update.enabled network.IDN.whitelist.at accessibility.typeaheadfind.enabletimeout browser.display.use_document_fonts font.name.sans-serif.zh-CN browser.startup.homepage_override.mstone profile.migration_directory font.name-list.serif.ja mousewheel.withnokey.action network.http.accept-encoding capability.policy.default.Window.length font.default.x-mlym network.standard-url.escape-utf8 network.standard-url.encode-utf8 network.IDN.whitelist.info font.name.monospace.x-armn keyword.enabled capability.policy.default.History.forward.get ; var i = 0; for each (var pref in xml.pref) { printStatus(pref.name + ": " + xml.pref.(name == pref.name).length()); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-309897.js0000644000175000017500000000434211545150464022342 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): conor@the325project.org * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Regression - appending elements crashes mozilla"; var BUGNUMBER = 309897; var actual = "No Crash"; var expect = "No Crash"; printBugNumber(BUGNUMBER); START(summary); function crash() { try { var top = ; for (var i = 0; i < 1000; i++) { top.stuff += stuff; } } catch(e) { printStatus("Exception: " + e); } } crash(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-311580.js0000644000175000017500000000431511545150464022320 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Stephen Donner * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Regression - properly root stack in toXMLString"; var BUGNUMBER = 311580; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); // Not a performance problem. var xmlOl = new XML('
  1. Item 1<\/li>
  2. Item 2<\/li><\/ol>'); var list = xmlOl.li; for(i = 0; i < 30000; i++) { list[i+2] = "Item " + (i+3); // This code is slow. } var s = xmlOl.toXMLString(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-313799.js0000644000175000017500000000402311545150464022332 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Seno Aiko * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not crash on XMLListInitializer.child(0)'; var BUGNUMBER = 313799; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var val = <>.child(0); TEST(1, expect, actual); TEST(2, 'xml', typeof val); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-318922.js0000644000175000017500000000523011545150464022324 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Biju * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'E4X - Do not crash on XML initializer '; var BUGNUMBER = 318922; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var a, b, x; printStatus('b=2;a=x'); b=2; a=x; TEST(1, expect, actual); printStatus('b="c"; a=x; '); b="c"; a=x; TEST(2, expect, actual); try { a=''; b='"'; eval('a=x'); } catch(e) { printStatus(e); } TEST(3, expect, actual); try { a=''; b='"'; eval('a=x'); } catch(e) { printStatus(e); } TEST(5, expect, actual); try { a=''; b='x'; eval('a=x'); } catch(e) { printStatus(e); } TEST(6, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-319872.js0000644000175000017500000000511311545150464022331 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Georgi Guninski * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 319872; var summary = 'Do not Crash in jsxml.c'; var actual = 'No Crash'; var expect = /(No Crash|InternalError: script stack space quota is exhausted|InternalError: allocation size overflow)/; printBugNumber(BUGNUMBER); START(summary); printStatus ("Expect either no error, out of memory or catchable script stack " + "space quota is exhausted error"); expectExitCode(0); expectExitCode(3); expectExitCode(5); try { var i,m,str; str="f00k"; var xx = new XML(str); printStatus(xx.toXMLString()); } catch(ex) { actual = ex + ''; print(actual); } reportMatch(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-321547.js0000644000175000017500000000566711545150464022337 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Biju * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Operator .. should not implicitly quote its right operand"; var BUGNUMBER = 321547; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function a(){ var x=value c; return x..c; } actual = a.toString(); expect = 'function a() {\n' + ' var x = value c;\n' + ' return x..c;\n' + '}'; actual = actual.replace(/[\n ]+/mg, ' '); expect = expect.replace(/[\n ]+/mg, ' '); TEST(1, expect, actual); actual = String(a.valueOf()); expect = 'function a() {\n' + ' var x = value c;\n' + ' return x..c;\n' + '}'; actual = actual.replace(/[\n ]+/mg, ' '); expect = expect.replace(/[\n ]+/mg, ' '); TEST(3, expect, actual); actual = String(a); expect = 'function a() {\n' + ' var x = value c;\n' + ' return x..c;\n' + '}'; actual = actual.replace(/[\n ]+/mg, ' '); expect = expect.replace(/[\n ]+/mg, ' '); TEST(4, expect, actual); actual = a(); expect = value c; actual = actual.replace(/[\n ]+/mg, ' '); expect = expect.replace(/[\n ]+/mg, ' '); TEST(5, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-322499.js0000644000175000017500000000412711545150464022334 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Do not define AnyName"; var BUGNUMBER = 322499; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'ReferenceError'; try { AnyName; } catch(ex) { actual = ex.name; } TEST(1, expect, actual); try { *; } catch(ex) { actual = ex.name; } TEST(2, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-323338-1.js0000644000175000017500000000456111545150464022465 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Franky Braem * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Do not crash when qn->uri is null"; var BUGNUMBER = 323338; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); testFunc(); testFunc(); function testFunc() { var htmlXML =
    ; var childs = htmlXML.children(); var el = htmlXML.body.div..div.(function::attribute('id') == 'summary'); el.div +=
    Prototype: Test
    ; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-323338-2.js0000644000175000017500000000375211545150464022467 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Seno Aiko * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Do not crash when qn->uri is null"; var BUGNUMBER = 323338; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); .(function::children()); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-325425.js0000644000175000017500000000410511545150464022320 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 325425; var summary = 'jsxml.c: Bad assumptions about js_ConstructObject'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); try { QName = function() { }; .elements(""); } catch(ex) { printStatus(ex + ''); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-327564.js0000644000175000017500000000430611545150464022331 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Hang due to cycle in XML object"; var BUGNUMBER = 327564; printBugNumber(BUGNUMBER); START(summary); var p =

    ; p.c = 1; var c = p.c[0]; p.insertChildBefore(null,c); printStatus(p.toXMLString()); printStatus('p.c[1] === c'); TEST(1, true, p.c[1] === c); p.c = 2 try { c.appendChild(p) // iloop here } catch(ex) { actual = ex instanceof Error; } TEST(2, true, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-327691-01.js0000644000175000017500000000405111545150464022545 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Do not crash in js_IsXMLName"; var BUGNUMBER = 327691; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var A=; var B=A.h; var D=B.h; B.h=D.h; B[0]=B.h; B.h=D.h; // Crashes at js_IsXMLName. TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-327691-02.js0000644000175000017500000000400611545150464022546 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Do not crash during gc()"; var BUGNUMBER = 327691; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var A=; var B=A.h; var D=B.h; B.h=D.h; B[0]=B.h; gc(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-327697.js0000644000175000017500000000476011545150464022344 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Make XPConnect refuse to wrap e4x"; var BUGNUMBER = 327697; var actual = 'No Hang'; var expect = 'No Hang'; printBugNumber(BUGNUMBER); START(summary); printStatus('This test runs in the browser only'); function init() { try { var sel = document.getElementsByTagName("select")[0]; sel.add(document.createElement('foo'), ); } catch(ex) { printStatus(ex + ''); } TEST(1, expect, actual); END(); gDelayTestDriverEnd = false; jsTestDriverEnd(); } if (typeof window != 'undefined') { // delay test driver end gDelayTestDriverEnd = true; document.write(''); window.addEventListener("load", init, false); } else { TEST(1, expect, actual); END(); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-328249.js0000644000175000017500000000420411545150464022327 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Crash due to infinite recursion in js_IsXMLName"; var BUGNUMBER = 328249; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); try { var A = ; var B = A.p1; var C = B.p2; B.p3 = C; C.p4 = B; C.appendChild(B); C.p5 = C; } catch(ex) { printStatus(ex+''); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-329257.js0000644000175000017500000000527611545150464022341 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * David P. Caldwell. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Don Brown * David P. Caldwell * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 329257; var summary = "namespace prefix in E4X dot query"; printBugNumber(BUGNUMBER); START(summary); var ns12 = new Namespace("foo"); var nestInfo = 10 1 100 2 1000 3 ; var paramInfo = nestInfo.ns12::ParameterAvailabilityInfo; var paramInfo100 = nestInfo.ns12::ParameterAvailabilityInfo.(ns12::ParameterID == 100); TEST(1, 2, Number(paramInfo100.ns12::PowerOfTen)); default xml namespace = ns12; var paramInfo100 = nestInfo.ParameterAvailabilityInfo.(ParameterID == 100); TEST(2, 2, Number(paramInfo100.ns12::PowerOfTen)); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-331558.js0000644000175000017500000000413511545150464022327 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Erik Fabert * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 331558; var summary = 'Decompiler: Missing = in default xml namespace statement'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); actual = (function () { default xml namespace = 'abc' }).toString(); expect = 'function () {\n default xml namespace = "abc";\n}'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-331664.js0000644000175000017500000000377511545150464022336 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Null pointer deref crash deleting XML methods"; var BUGNUMBER = 331664; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); delete XML.prototype.attributes TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-344455.js0000644000175000017500000000411511545150464022325 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Error - tag name mismatch error message should include tag name"; var BUGNUMBER = 344455; var actual = ''; var expect = 'SyntaxError: XML tag name mismatch (expected foo)'; printBugNumber(BUGNUMBER); START(summary); try { eval('x = ;'); } catch(ex) { actual = ex + ''; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-347155.js0000644000175000017500000000423611545150464022331 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 347155; var summary = 'Do not crash with deeply nested e4x literal'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); function repeat(str, num) { var s="", i; for (i=0; i", n) + 3 + repeat("", n); try { eval(e4x); } catch(ex) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-350206-1.js0000644000175000017500000000453511545150464022460 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Jeff Walden . * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = "350206"; var summary = "Order of destructuring, destructuring in the presence of " + "exceptions"; var actual, expect; printBugNumber(BUGNUMBER); START(summary); /************** * BEGIN TEST * **************/ var failed = "No crash"; try { var t1 = ; var n2 = new Namespace("http://ns2"); t1.@n2::a1 = "a1 from ns2"; t1.toXMLString(); } catch (ex) { failed = ex; } expect = "No crash"; actual = failed; TEST(1, expect, actual); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-350206.js0000644000175000017500000000420611545150464022315 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Lubos Ures * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 350206; var summary = 'Do not assert: serial <= n in jsxml.c'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var pa = var ch = pa.appendChild(ch); pa.@msg = "Before assertion failure"; pa.toXMLString(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-350238.js0000644000175000017500000000463511545150464022330 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 350238; var summary = 'Do not assert .@*++'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); if (typeof document != 'undefined' && 'addEventListener' in document) { document.addEventListener('load', (function () { var iframe = document.createElement('iframe'); document.body.appendChild(iframe); iframe.contentDocument.location.href='javascript:.@*++;'; }), true); } else { .@*++; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-350629.js0000644000175000017500000001025311545150464022325 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Jeff Walden . * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = "350629"; var summary = ".toXMLString can include invalid generated prefixes"; var actual, expect; printBugNumber(BUGNUMBER); START(summary); /************** * BEGIN TEST * **************/ var failed = false; function extractPrefix(el, attrName, attrVal) { var str = el.toXMLString(); var regex = new RegExp(' (.+?):' + attrName + '="' + attrVal + '"'); return str.match(regex)[1]; } function assertValidPrefix(p, msg) { if (!isXMLName(p) || 0 == p.search(/xml/i)) throw msg; } var el, n, p; try { // last component is invalid prefix el = ; n = new Namespace("http://foo/bar.xml"); el.@n::fiz = "eit"; p = extractPrefix(el, "fiz", "eit"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); // last component is invalid prefix (different case) el = ; n = new Namespace("http://foo/bar.XML"); el.@n::fiz = "eit"; p = extractPrefix(el, "fiz", "eit"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); // last component is invalid prefix (but not "xml"/"xmlns") el = ; n = new Namespace("http://foo/bar.xmln"); el.@n::baz = "quux"; p = extractPrefix(el, "baz", "quux"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); // generated prefix with no valid prefix component in namespace URI el = ; n = new Namespace("xml:///"); el.@n::bike = "cycle"; p = extractPrefix(el, "bike", "cycle"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); // generated prefix with no valid prefix component in namespace URI w/further // collision el = ; n = new Namespace("xml:///"); el.@n::bike = "cycle"; p = extractPrefix(el, "bike", "cycle"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); // XXX this almost certainly shouldn't work, so if it fails at some time it // might not be a bug! it's only here because it *is* currently a // possible failure point for prefix generation el = ; n = new Namespace(".:/.././.:/:"); el.@n::biz = "17"; p = extractPrefix(el, "biz", "17"); assertValidPrefix(p, "namespace " + n.uri + " generated invalid prefix " + p); } catch (ex) { failed = ex; } expect = false; actual = failed; TEST(1, expect, actual); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-352097.js0000644000175000017500000000557411545150464022340 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Jeff Walden . * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * Jeff Walden * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = "352097"; var summary = "Avoid adding unnecessary spaces to PIs"; var actual, expect; printBugNumber(BUGNUMBER); START(summary); /************** * BEGIN TEST * **************/ var failed = false; function assertContains(func, str) { if (func.toString().indexOf(str) < 0) throw func.toString() + " does not contain " + str + "!"; } try { var f = new Function("return ;"); assertContains(f, ""); var g = new Function("return ;"); assertContains(g, ""); var h = new Function("return ;"); assertContains(h, ""); var i = new Function("return ;"); assertContains(i, ""); var j = new Function("return ;"); assertContains(j, ""); var k = new Function("return ;"); assertContains(k, ""); var m = new Function("return ;"); assertContains(m, ""); } catch (ex) { failed = ex; } expect = false; actual = failed; TEST(1, expect, actual); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-352103.js0000644000175000017500000000464511545150464022322 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Jeff Walden . * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * Jeff Walden * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = "352103"; var summary = " XML initializer should generate a SyntaxError"; var actual, expect; printBugNumber(BUGNUMBER); START(summary); /************** * BEGIN TEST * **************/ var failed = false; try { try { eval("var x = ;"); // force non-compile-time exception throw "No SyntaxError thrown!"; } catch (e) { if (!(e instanceof SyntaxError)) throw "Unexpected exception: " + e; } } catch (ex) { failed = ex; } expect = false; actual = failed; TEST(1, expect, actual); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-352223.js0000644000175000017500000000427311545150464022322 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jeff Walden * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 352223; var summary = 'Reject invalid spaces in tags'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'SyntaxError: invalid XML name'; try { eval('< foo>'); } catch(ex) { actual = ex + ''; } TEST(1, expect, actual); expect = 'SyntaxError: invalid XML tag syntax'; try { eval(''); } catch(ex) { actual = ex + ''; } TEST(2, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-354145-01.js0000644000175000017500000000423511545150464022543 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = <> var N = 10; for (var i = 0; i != N; ++i) { xml[i] = <{"a"+i}/>; } function prepare() { for (var i = N - 1; i >= 0; --i) delete xml[i]; gc(); return "test"; } xml[N - 1] = { toString: prepare }; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-354145-02.js0000644000175000017500000000423411545150464022543 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var list = <> var N = 10; for (var i = 0; i != N; ++i) list[i] = <{"a"+i}/>; function prepare() { for (var i = N - 1; i >= 0; --i) delete list[i]; gc(); return "test"; } list.child({ toString: prepare }); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-354145-03.js0000644000175000017500000000435711545150464022552 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var list = <> var N = 10; for (var i = 0; i != N; ++i) list[i] = <{"a"+i}/>; function prepare() { for (var i = N - 1; i >= 0; --i) delete list[i]; gc(); return "test"; } print("Before list.contains"); list.contains({ toString: prepare }); print("After list.contains"); TEST(1, expect, actual); print("After TEST"); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-354145-04.js0000644000175000017500000000424511545150464022547 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = ; var N = 10; for (var i = 0; i != N; ++i) xml.appendChild(<{'a'+i}/>); function prepare() { delete xml.*; gc(); return "test"; } var last = xml.*[N - 1]; xml.insertChildAfter(last, { toString: prepare }); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-354145-05.js0000644000175000017500000000424611545150464022551 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var xml = ; var N = 10; for (var i = 0; i != N; ++i) xml.appendChild(<{'a'+i}/>); function prepare() { delete xml.*; gc(); return "test"; } var last = xml.*[N - 1]; xml.insertChildBefore(last, { toString: prepare }); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-354145-07.js0000644000175000017500000000410611545150464022546 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 354145; var summary = 'Immutable XML'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var a = try { a.insertChildAfter(a.b[0], {toString: function() { throw 1; }}); } catch (e) { } for each (var i in a) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-354998.js0000644000175000017500000000555111545150464022347 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 354998; var summary = 'prototype should not be enumerated for XML objects.'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function test() { var list = <>; var count = 0; var now = Date.now; var time = now(); for (var i in list) { ++count; } time = now() - time; if (count != 2) { if (count < 2) throw "Enumerator has not looped over all properties, count="+count; throw "Enumerator has looped over prototype chain of xml, count="+count; } return time; } try { var time1 = test(); for (var i = 0; i != 1000*1000; ++i) Object.prototype[i] = i; var time2 = test(); // clean up Object prototype so it won't // hang enumerations in options()... for (var i = 0; i != 1000*1000; ++i) delete Object.prototype[i]; if (time1 * 10 + 1 < time2) { throw "Assigns to Object.prototype increased time of XML enumeration from "+ time1+"ms to "+time2+"ms"; } } catch(ex) { actual = ex = ''; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-355474-02.js0000644000175000017500000000411211545150464022544 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 355474; var summary = 'Iterating over XML with WAY_TOO_MUCH_GC'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'text'; for each (var i in <>text) { printStatus(i.toXMLString()); actual = i.toXMLString(); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-355478.js0000644000175000017500000000413511545150464022336 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 355478; var summary = 'Do not crash with hasOwnProperty'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); expect = 'TypeError: .hasOwnProperty is not a constructor'; actual = ''; try { new .hasOwnProperty("y"); } catch(ex) { actual = ex + ''; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-355569.js0000644000175000017500000001366111545150464022343 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): shutdown * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var bug = 355569; var actual = ''; var expect = ''; START('XML.prototype.hasOwnProperty foo'); printBugNumber (bug); printStatus (summary); var targetAddress = 0x12030010; var sprayParams = { chunkSize: 16 * 1024 * 1024, chunkCount: 16, chunkMarker: 0xdeadface, chunkAlign: 0x1000, reservedSize: 1024 }; function makeExploitCode() { /* mov eax, 0xdeadfeed; mov ebx, eax; mov ecx, eax; mov edx, eax; int3 */ return "\uEDB8\uADFE\u89DE\u89C3\u89C1\uCCC2"; } /*==========================================================================*/ /*==========================================================================*/ function packData(template, A) { var n = 0, result = "", vl; for(var i = 0; i < template.length; i++) { var ch = template.charAt(i); if(ch == "s" || ch == "S") { vl = A[n++] >>> 0; result += String.fromCharCode(vl & 0xffff); } else if(ch == "l" || ch == "L") { // XXX endian vl = A[n++] >>> 0; result += String.fromCharCode(vl & 0xffff, vl >> 16); } else if(ch == "=") { result += String(A[n++]); } } return result; } function buildStructure(worker, address) { var offs = {}, result = "", context = { append: function(k, v) { offs[k] = result.length * 2; result += v; }, address: function(k) { return address + ((k && offs[k]) || 0); } }; worker(context); result = ""; worker(context); return result; } function repeatToLength(s, L) { if(L <= s.length) { return s.substring(0, L); } while(s.length <= L/2) { s += s; } return s + s.substring(0, L - s.length); } function sprayData(data, params, rooter) { var marker = packData("L", [ params.chunkMarker ]); data += repeatToLength("\u9090", params.chunkAlign / 2 - data.length); data = repeatToLength(data, (params.chunkSize - params.reservedSize) / 2); for(var i = 0; i < params.chunkCount; i++) { rooter[i] = marker + data + i; } } function T_JSObject(map, slots) { return packData("LL", arguments); } function T_JSObjectMap(nrefs, ops, nslots, freeslot) { return packData("LLLL", arguments); } function T_JSObjectOps( newObjectMap, destroyObjectMap, lookupProperty, defineProperty, getProperty, setProperty, getAttributes, setAttributes, deleteProperty, defaultValue, enumerate, checkAccess, thisObject, dropProperty, call, construct, xdrObject, hasInstance, setProto, setParent, mark, clear, getRequiredSlot, setRequiredSlot ) { return packData("LLLLLLLL LLLLLLLL LLLLLLLL", arguments); } function T_JSXML_LIST( object, domnode, parent, name, xml_class, xml_flags, kids_length, kids_capacity, kids_vector, kids_cursors, xml_target, xml_targetprop ) { return packData("LLLLSS LLLL LL", arguments); } function T_JSXML_ELEMENT( object, domnode, parent, name, xml_class, xml_flags, kids_length, kids_capacity, kids_vector, kids_cursors, nses_length, nses_capacity, nses_vector, nses_cursors, atrs_length, atrs_capacity, atrs_vector, atrs_cursors ) { return packData("LLLLSS LLLL LLLL LLLL", arguments); } /*==========================================================================*/ /*==========================================================================*/ function makeExploitData(address) { return buildStructure(function(ctx) { ctx.append("xml-list", T_JSXML_LIST(0, 0, 0, 0, 0, 0, 1, 0, ctx.address("xml-kids-vector"), 0, 0, 0)); ctx.append("xml-kids-vector", packData("L", [ ctx.address("xml-element") ])); ctx.append("xml-element", T_JSXML_ELEMENT(ctx.address("object"), 0, 0, 0, 1, 0, 0, 0, 0, 0, /*c*/ 0, 0, 0, 0, /*d*/ 0, 0, 0, 0)); ctx.append("object", T_JSObject(ctx.address("object-map"), 0)); ctx.append("object-map", T_JSObjectMap(0, ctx.address("object-ops"), 0, 0)); ctx.append("object-ops", T_JSObjectOps(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ctx.address("exploit-code"), 0)); ctx.append("exploit-code", makeExploitCode(ctx)); }, address); } function exploit() { sprayData(makeExploitData(targetAddress), sprayParams, this.rooter = {}); var numobj = new Number(targetAddress >> 1); XML.prototype.function::hasOwnProperty.call(numobj); printStatus("probably not exploitable"); } try { exploit(); } catch(ex) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-356238-01.js0000644000175000017500000000374211545150464022552 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 356238; var summary = 'bug 356238'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); try { .replace(1); } catch(ex) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-356238-02.js0000644000175000017500000000433511545150464022552 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 356238; var summary = 'bug 356238'; var actual = 'No Duplicate'; var expect = 'No Duplicate'; printBugNumber(BUGNUMBER); START(summary); var xml = ; var child = xml.child[0]; try { child.insertChildAfter(null, xml.child); actual = "insertChildAfter succeeded when it should throw an exception"; } catch (e) { } if (child.a[0] === child.a[1]) actual = 'Duplicate detected'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-356238-03.js0000644000175000017500000000443411545150464022553 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 356238; var summary = 'bug 356238'; var actual = 'No Error'; var expect = 'No Error'; printBugNumber(BUGNUMBER); START(summary); var xml = ; var child = xml.child[0]; try { child.insertChildBefore(null, xml.child); actual = "insertChildBefore succeded when it should throw an exception"; } catch (e) { } var list = child.*; var text = uneval(list[1]); if (!/(undefined|\(void 0\))/.test(text)) throw "child got unexpected second element: "+text; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-361451.js0000644000175000017500000000410211545150464022314 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 361451; var summary = 'Do not crash with E4X, watch, import'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var obj = ; obj.watch('x', print); try { import obj.yyy; } catch(e) { } obj = undefined; gc(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-364017.js0000644000175000017500000000414511545150464022324 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jeff Walden * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 364017; var summary = 'Do not assert map->vector && i < map->length'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); if (typeof dis != 'undefined') { dis( function() { XML.prototype.function::toString = function() { return "foo"; }; }); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-369032.js0000644000175000017500000000432211545150464022323 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not assert: kid2->parent == xml || !kid2->parent'; var BUGNUMBER = 369032; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); var y = ; var b = y.b; b.a = 3; var x = .appendChild(b); y.b = 5; expect = '\n 5\n'; actual = y.toXMLString(); TEST(1, expect, actual); expect = '\n \n 3\n \n'; actual = x.toXMLString(); TEST(2, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-369536.js0000644000175000017500000000410511545150464022333 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * David P. Caldwell. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): * David P. Caldwell * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("Assignment to XML property removes attributes"); printBugNumber(369536); var x = bazOnebazTwo; TEST_XML(1, "bazTwo", x.bar[1]); x.bar[1] = "bazTwoChanged"; TEST_XML(2, "bazTwoChanged", x.bar[1]); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-369740.js0000644000175000017500000000473411545150464022340 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 369740; var summary = 'generic code for function::'; var actual = 'No Exception'; var expect = 'No Exception'; printBugNumber(BUGNUMBER); START(summary); actual = expect = Math.function::sin + ''; TEST(1, expect, actual); var x = ; x.function::toString = function(){return "moo"}; actual = x + ''; expect = 'moo'; TEST(2, expect, actual); x = <>; expect = 'test'; try { with (x) { function::toString = function() { return "test"; } } actual = x + ''; } catch(ex) { actual = ex + ''; } TEST(3, expect, actual); // test for regression caused by initial patch expect = actual = 'No Crash'; const xhtmlNS = null; this[xhtmlNS] = {}; TEST(4, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-370016.js0000644000175000017500000000376611545150464022330 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 370016; var summary = 'with (nonxmlobj) function::'; var actual = 'No Exception'; var expect = 'No Exception'; printBugNumber(BUGNUMBER); START(summary); with (Math) print(function::sin(0)) TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-370048-01.js0000644000175000017500000000422311545150464022540 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 370048; var summary = 'with (obj) function:: with xml lists'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var list = <>; expect = list.function::length; with (list) actual = function::length; if (expect !== actual) throw "function::length does not work under the with statement with an empty xml list"; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-370048-02.js0000644000175000017500000000423211545150464022541 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 370048; var summary = 'with (obj) function:: with xml lists'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var list = <>; expect = list.function::addNamespace; with (list) actual = function::addNamespace; if (actual !== expect) throw "Inconsistent xml list view through property access and with statement." TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-370372.js0000644000175000017500000000472311545150464022327 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 370372; var summary = 'with (xmllist) function::name assignments'; var actual = 'No Exception'; var expect = 'No Exception'; printBugNumber(BUGNUMBER); START(summary); var tests = [<>, <>, <>]; function do_one(x) { x.function::f = Math.sin; with (x) { function::toString = function::f = function() { return "test"; }; } if (String(x) !== "test") throw "Failed to set toString"; if (x.f() !== "test") throw "Failed to set set function f"; if (x.function::toString != x.function::f) throw "toString and f are different"; } for (var i = 0; i != tests.length; ++i) do_one(tests[i]); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-371369.js0000644000175000017500000000434411545150464022335 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 371369; var summary = 'delete xml.function::name does not work'; var actual = 'No Exception'; var expect = 'No Exception'; printBugNumber(BUGNUMBER); START(summary); var xml = ; xml.function::something = function() { }; delete xml.function::something; try { xml.something(); throw "Function can be called after delete"; } catch(e) { if (!(e instanceof TypeError)) throw "Unexpected exception: " + e; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-372563.js0000644000175000017500000000374211545150464022333 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 372563; var summary = 'Do not assert: ss->top >= 2'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); (function() { *() }); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-372564.js0000644000175000017500000000376611545150464022342 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 372564; var summary = 'Do not assert: op == JSOP_ADD'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); (function() { return {a: @foo} <= 3;}); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-373082.js0000644000175000017500000000564611545150464022335 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 373082; var summary = 'Simpler sharing of XML and XMLList functions'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var l; expect = ''; l = <>; actual = l.toXMLString(); TEST(1, expect, actual); expect = ''; l.setName('b'); actual = l.toXMLString(); TEST(2, expect, actual); expect = ''; XMLList.prototype.function::setName.call(l, 'c'); actual = l.toXMLString(); TEST(3, expect, actual); expect = 't'; l = <>text; actual = l.charAt(0); TEST(4, expect, actual); expect = 'TypeError: String.prototype.toString called on incompatible XML'; try { delete XML.prototype.function::toString; delete Object.prototype.toString; actual = TEXT.toString(); } catch(ex) { actual = ex + ''; } TEST(7, expect, actual); expect = 'TypeError: String.prototype.toString called on incompatible XML'; try { var x = ; x.(name == "Foo"); print(x.function::name()); } catch(ex) { actual = ex + ''; } TEST(8, expect, actual); try { x = ; x.(name == "Foo"); print(x.name()); } catch(ex) { actual = ex + ''; } TEST(9, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-374106.js0000644000175000017500000000402311545150464022317 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 374106; var summary = 'e4x XMLList.contains execution halts with complex match'; var actual = 'No Error'; var expect = 'No Error'; printBugNumber(BUGNUMBER); START(summary); <>.contains(); 3; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-374112.js0000644000175000017500000000376311545150464022326 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 374112; var summary = 'E4X Do not assert with xml.setName(...)'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); .setName(.name()); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-374116.js0000644000175000017500000000373311545150464022327 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 374116; var summary = 'Crash with .@b[1] = 2;'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); .@b[1] = 2; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-374160.js0000644000175000017500000000403411545150464022321 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 374160; var summary = 'Do not assert with ..@c[0]=3'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); ..@c[0] = 3; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-375406.js0000644000175000017500000000376511545150464022337 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not crash @ PutProperty setting .attribute("")[0]'; var BUGNUMBER = 375406; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); .attribute('')[0] = 1; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-378492.js0000644000175000017500000000403411545150464022335 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 378492; var summary = 'namespace_trace/qname_trace should check for null private, ' + 'WAY_TOO_MUCH_GC'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); try { eval(''); } catch(ex) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-380833.js0000644000175000017500000000377111545150464022334 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Crash during GC after uneval"; var BUGNUMBER = 380833; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var www = ; print(uneval(this) + "\n"); gc(); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-383255.js0000644000175000017500000000402011545150464022321 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not assert: JS_UPTRDIFF(fp->sp, fp->spbase) <= depthdiff'; var BUGNUMBER = 383255; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); try { [0]++; } catch(ex) { print(ex); } TEST(1, expect, actual) END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-394941.js0000644000175000017500000000455611545150464022343 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Infinite recursion should throw catchable exception'; var BUGNUMBER = 394941; var actual = ''; var expect = /InternalError: (script stack space quota is exhausted|too much recursion)/; /* * use the reportMatch so that the test will pass on 1.8 * where the error message is "too much recursion" and on 1.9.0 * where the error message is "script stack space quota is exhausted". */ printBugNumber(BUGNUMBER); START(summary); try { function f() { var z = ; f(); } f(); } catch(ex) { actual = ex + ''; print("Caught: " + ex); } reportMatch(expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-407323.js0000644000175000017500000000430711545150464022322 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'XML, XMLList, QName are mutable, Namespace is not.'; var BUGNUMBER = 407323; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var obj = {}; var saveQName = QName; var saveXML = XML; var saveXMLList = XMLList; var saveNamespace = Namespace; QName = obj; TEST(1, obj, QName); XML = obj; TEST(2, obj, XML); XMLList = obj; TEST(3, obj, XMLList); Namespace = obj; TEST(4, obj, Namespace); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-426520.js0000755000175000017500000000406111545150464022322 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Adam Hauner * Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not crash @ ParseXMLSource'; var BUGNUMBER = 426520; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); undefined = {}; try { with (this) { throw ; } } catch(ex) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-453915.js0000644000175000017500000000376411545150464022340 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Chris Evans * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'XML Injection possible via default xml namespace'; var BUGNUMBER = 453915; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); default xml namespace = '\''; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-458679-01.js0000644000175000017500000000411011545150464022554 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'GetXMLEntity should not assume FastAppendChar is infallible'; var BUGNUMBER = 458679; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); try { var x = "<"; while (x.length < 12000000) x += x; {x}; } catch(ex) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-458679-02.js0000644000175000017500000000452611545150464022570 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'GetXMLEntity should not assume FastAppendChar is infallible'; var BUGNUMBER = 458679; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function stringOfLength(n) { if (n == 0) { return ""; } else if (n == 1) { return "<"; } else { var r = n % 2; var d = (n - r) / 2; var y = stringOfLength(d); return y + y + stringOfLength(r); } } try { void stringOfLength(4435455); x = stringOfLength(14435455); {x}; } catch(ex) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-460180.js0000644000175000017500000000376211545150464022326 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not crash with if (false || false || ) {}'; var BUGNUMBER = 460180; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); if (false || false || ) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-465063.js0000755000175000017500000000402211545150464022324 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Gary Kwong * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not crash @ TraceRecorder::hasMethod'; var BUGNUMBER = 465063; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); jit(true); y = ; for (var z = 0; z < 2; ++z) { [] + y; }; jit(false); TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-470619.js0000755000175000017500000000405011545150464022330 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Gary Kwong * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not assert: regs.sp - 2 >= StackBase(fp)'; var BUGNUMBER = 470619; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); try { y = ; for (var z = 0; z < 2; ++z) { +y }; } catch(ex) { print(ex + ''); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-473709.js0000755000175000017500000000442011545150464022334 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Gary Kwong * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not assert: cursor == (uint8 *)copy->messageArgs[0] + argsCopySize'; var BUGNUMBER = 473709; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function f() { eval("(function() { switch(x, x) { default: for(x2; ;) (function(){}) ;break; case (+<>): break; }; })()"); } if (typeof gczeal == 'function') { gczeal(2); } try { f(); } catch(ex) { } if (typeof gczeal == 'function') { gczeal(0); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-474319.js0000755000175000017500000000434311545150464022336 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Gary Kwong * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not crash with e4x, map and concat'; var BUGNUMBER = 474319; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); if (typeof gczeal != 'function' || !('map' in Array.prototype)) { expect = actual = 'Test skipped due to lack of gczeal and Array.prototype.map'; } else { gczeal(2); try { (function(){[].map(''.concat)})(); } catch(ex) { } gczeal(0); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-477053.js0000644000175000017500000000402711545150464022330 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Gary Kwong * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'Do not assert: JSVAL_IS_STRING(v)'; var BUGNUMBER = 477053; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); try { function f() { eval("with(arguments)throw ;"); } f(); } catch(ex) { } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-561031.js0000644000175000017500000010376511545150464022327 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Gary Kwong */ try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try {} catch(e) {} try { if (2 == 0) { } else { [].(0); } } catch (e) {} reportCompare(0, 0, "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/regress-587434.js0000644000175000017500000000040711545150464022333 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ (function() { function::a(eval("false"), true); function a({}) {} })() /* Don't crash because of bad |this| value. */ reportCompare(0, 0, "ok"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Regress/shell.js0000644000175000017500000000000011545150464021201 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Statements/12.1.js0000644000175000017500000001050211545150464021200 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("12.1 - Default XML Namespace"); // Declare some namespaces ad a default namespace for the current block var soap = new Namespace("http://schemas.xmlsoap.org/soap/envelope/"); var stock = new Namespace("http://mycompany.com/stocks"); default xml namespace = soap; // Create an XML initializer in the default (i.e., soap) namespace message = DIS ; // Extract the soap encoding style using a QualifiedIdentifier encodingStyle = message.@soap::encodingStyle; TEST_XML(1, "http://schemas.xmlsoap.org/soap/encoding/", encodingStyle); // Extract the body from the soap message using the default namespace correct = DIS ; body = message.Body; TEST_XML(2, correct.toXMLString(), body); // Change the stock symbol using the default namespace and qualified names correct = MYCO ; message.Body.stock::GetLastTradePrice.stock::symbol = "MYCO"; TEST(3, correct, message); function scopeTest() { var x = ; TEST(4, soap.uri, x.namespace().uri); default xml namespace = "http://" + "someuri.org"; x = ; TEST(5, "http://someuri.org", x.namespace().uri); } scopeTest(); x = foo; TEST(6, soap.uri, x.namespace().uri); TEST(7, soap.uri, x.b.namespace().uri); ns = new Namespace(""); TEST(8, "foo", x.b.ns::c.toString()); x = ; TEST(9, soap.uri, x.namespace().uri); TEST(10, "", x.@foo.namespace().uri); TEST_XML(11, "bar", x.@foo); default xml namespace = ""; x = ; ns = new Namespace("http://someuri"); default xml namespace = ns; x.a = "foo"; TEST(12, "foo", x["a"].toString()); q = new QName("a"); TEST(13, "foo", x[q].toString()); default xml namespace = ""; x[q] = "bar"; TEST(14, "bar", x.ns::a.toString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Statements/12.2.js0000644000175000017500000000546511545150464021215 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("12.2 - For-in statement"); // All the employee names e = Joe 20 Sue 30 ; correct = new Array("Joe", "Sue", "Big Screen Television", "1299.99"); i = 0; for (var n in e..name) { TEST("1."+i, String(i), n); i++; } TEST("1.count", 2, i); // Each child of the first item order = John Smith Big Screen Television 1299.99 DVD Player 399.99 ; i = 0; for (var child in order.item) { TEST("2."+i, String(i), child); i++ } TEST("2.count", 2, i); i = 0; for (var child in order.item[0].*) { TEST("3."+i, String(i), child); i++ } TEST("3.count", 2, i); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Statements/12.3-01.js0000644000175000017500000000502711545150464021426 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jason * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = '12.3 - for-each-in should not affect for-in'; var BUGNUMBER = 292020; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); // test here function foreachbug() { var arryOuter = ["outervalue0", "outervalue1"]; var arryInner = ["innervalue1","innervalue2"]; for (var j in arryOuter) { var result = (j in arryOuter); if (!result) { return ("enumerated property not in object: (" + j + " in arryOuter) " + result); return result; } for each (k in arryInner) { // this for-each-in should not affect the outer for-in } } return ''; } TEST(1, '', foreachbug()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Statements/browser.js0000644000175000017500000000000011545150464022272 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Statements/jstests.list0000644000175000017500000000014511545150464022657 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/Statements/ script 12.1.js script 12.2.js script 12.3-01.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Statements/shell.js0000644000175000017500000000000011545150464021716 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/10.1.1.js0000644000175000017500000000742011545150464022202 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("10.1.1 - XML.toString"); var n = 0; var expect; var actual; var xml; // Example from ECMA 357 10.1.1 var order = John Doe Big Screen Television 1299.99 1 ; var name = order.customer.firstname + " " + order.customer.lastname; TEST(++n, "John Doe", name); var total = order.item.price * order.item.quantity; TEST(++n, 1299.99, total); // Semantics printStatus("test empty.toString()"); xml = new XML(); expect = ''; actual = xml.toString(); TEST(++n, expect, actual); printStatus("test attribute.toString()"); xml = ; var attr = xml.@bar; expect = "baz"; actual = attr.toString(); TEST(++n, expect, actual); printStatus("test text.toString()"); xml = new XML("this is text"); expect = "this is text"; actual = xml.toString(); TEST(++n, expect, actual); printStatus("test simpleContent.toString()"); xml = bar; expect = "bar"; actual = xml.toString(); TEST(++n, expect, actual); var truefalse = [true, false]; for (var ic = 0; ic < truefalse.length; ic++) { for (var ip = 0; ip < truefalse.length; ip++) { XML.ignoreComments = truefalse[ic]; XML.ignoreProcessingInstructions = truefalse[ip]; xml = bar; expect = "bar"; actual = xml.toString(); TEST(++n, expect, actual); } } printStatus("test nonSimpleContent.toString() == " + "nonSimpleContent.toXMLString()"); var indents = [0, 4]; for (var pp = 0; pp < truefalse.length; pp++) { XML.prettyPrinting = truefalse[pp]; for (var pi = 0; pi < indents.length; pi++) { XML.prettyIndent = indents[pi]; expect = order.toXMLString(); actual = order.toString(); TEST(++n, expect, actual); } } END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/10.1.2.js0000644000175000017500000000777111545150464022214 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("10.1.2 - XMLList.toString"); var n = 0; var expect; var actual; var xmllist; var xml; // Example from ECMA 357 10.1.1 var order = John Doe Big Screen Television 1299.99 1 ; // Semantics printStatus("test empty.toString()"); xmllist = new XMLList(); expect = ''; actual = xmllist.toString(); TEST(++n, expect, actual); printStatus("test [attribute].toString()"); xmllist = new XMLList(); xml = ; var attr = xml.@bar; xmllist[0] = attr; expect = "baz"; actual = xmllist.toString(); TEST(++n, expect, actual); printStatus("test [text].toString()"); xmllist = new XMLList(); xml = new XML("this is text"); xmllist[0] = xml; expect = "this is text"; actual = xmllist.toString(); TEST(++n, expect, actual); printStatus("test [simpleContent].toString()"); xmllist = new XMLList(); xml = bar; xmllist[0] = xml; expect = "bar"; actual = xmllist.toString(); TEST(++n, expect, actual); var truefalse = [true, false]; for (var ic = 0; ic < truefalse.length; ic++) { for (var ip = 0; ip < truefalse.length; ip++) { XML.ignoreComments = truefalse[ic]; XML.ignoreProcessingInstructions = truefalse[ip]; xmllist = new XMLList(); xml = bar; xmllist[0] = xml; expect = "bar"; actual = xmllist.toString(); TEST(++n, expect, actual); } } printStatus("test nonSimpleContent.toString() == " + "nonSimpleContent.toXMLString()"); var indents = [0, 4]; for (var pp = 0; pp < truefalse.length; pp++) { XML.prettyPrinting = truefalse[pp]; for (var pi = 0; pi < indents.length; pi++) { XML.prettyIndent = indents[pi]; xmllist = new XMLList(order); expect = order.toXMLString(); actual = order.toString(); TEST(++n, expect, actual); xmllist = order..*; expect = order.toXMLString(); actual = order.toString(); TEST(++n, expect, actual); } } END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/10.2.1.js0000644000175000017500000001137511545150464022207 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("10.2.1 - XML.toXMLString"); var BUGNUMBER = 297025; printBugNumber(BUGNUMBER); var n = 1; var actual; var expect; // Semantics var xml; // text 10.2.1 - Step 4 printStatus(inSection(n++) + ' testing text'); var text = 'this is text'; printStatus(inSection(n++) + ' testing text with pretty printing'); XML.prettyPrinting = true; XML.prettyIndent = 10; xml = new XML(text); expect = text; actual = xml.toXMLString(); TEST(n, expect, actual); printStatus(inSection(n++) + ' testing text with whitespace with pretty printing'); XML.prettyPrinting = true; XML.prettyIndent = 10; xml = new XML(' \t\r\n' + text + ' \t\r\n'); expect = text; actual = xml.toXMLString(); TEST(n, expect, actual); printStatus(inSection(n++) + ' testing text with whitespace without pretty printing'); XML.prettyPrinting = false; xml = new XML(' \t\r\n' + text + ' \t\r\n'); expect = ' \t\r\n' + text + ' \t\r\n'; actual = xml.toXMLString(); TEST(n, expect, actual); // EscapeElementValue - 10.2.1 Step 4.a.ii printStatus(inSection(n++) + ' testing text EscapeElementValue'); var alpha = 'abcdefghijklmnopqrstuvwxyz'; xml = {"< > &"}{alpha}; xml = xml.text(); expect = '< > &' + alpha actual = xml.toXMLString(); TEST(n, expect, actual); // attribute, EscapeAttributeValue - 10.2.1 Step 5 printStatus(inSection(n++) + ' testing attribute EscapeAttributeValue'); xml = ; xml.@bar = '"<&\u000A\u000D\u0009' + alpha; expect = ''; actual = xml.toXMLString(); TEST(n, expect, actual); // Comment - 10.2.1 Step 6 printStatus(inSection(n++) + ' testing Comment'); XML.ignoreComments = false; xml = ; expect = ''; actual = xml.toXMLString(); TEST(n, expect, actual); // Processing Instruction - 10.2.1 Step 7 printStatus(inSection(n++) + ' testing Processing Instruction'); XML.ignoreProcessingInstructions = false; xml = ; expect = ''; actual = xml.toXMLString(); TEST(n, expect, actual); // 10.2.1 Step 8+ // From Martin and Brendan var link; var xlinkNamespace; printStatus(inSection(n++)); expect = ''; link = ; xlinkNamespace = new Namespace('xlink', 'http://www.w3.org/1999/xlink'); link.addNamespace(xlinkNamespace); printStatus('In scope namespace: ' + link.inScopeNamespaces()); printStatus('XML markup: ' + link.toXMLString()); link.@type.setName(new QName(xlinkNamespace, 'type')); printStatus('name(): ' + link.@*::*[0].name()); actual = link.toXMLString(); printStatus(actual); TEST(n, expect, actual); printStatus(inSection(n++)); link = ; xlinkNamespace = new Namespace('xlink', 'http://www.w3.org/1999/xlink'); printStatus('XML markup: ' + link.toXMLString()); link.@type.setNamespace(xlinkNamespace); printStatus('name(): ' + link.@*::*[0].name()); actual = link.toXMLString(); printStatus(actual); TEST(n, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/10.3.1.js0000644000175000017500000000441411545150464022204 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("10.3.1 - toXML applied to String type"); john = "John25"; sue = "Sue32"; tagName = "employees"; employees = new XML("<" + tagName + ">" + john + sue + ""); correct = John25 Sue32 ; TEST(1, correct, employees); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/10.3.js0000644000175000017500000000475311545150464022053 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("10.3 - toXML"); var x; // boolean x = new Boolean(true); TEST_XML(1, "true", new XML(x)); // number x = new Number(123); TEST_XML(2, "123", new XML(x)); // String x = new String("one"); TEST(3, one, new XML(x)); // XML x = new XML(one); TEST(4, one, new XML(x)); // XMLList x = new XMLList(one); TEST(5, one, new XML(x)); try { x = new XMLList(one + two); new XML(x); SHOULD_THROW(6); } catch (ex) { TEST(6, "TypeError", ex.name); } END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/10.4.1.js0000644000175000017500000000603211545150464022203 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("10.4.1 - toXMLList Applied to String type"); var x, y, correct; x = <> one two ; TEST(1, "xml", typeof(x)); TEST(2, "one\ntwo", x.toXMLString()); // Load from another XMLList // Make sure it is copied if it's an XMLList y = new XMLList(x); x += three; TEST(3, "one\ntwo", y.toXMLString()); // Load from one XML type x = new XMLList(one); TEST(4, "one", x.toXMLString()); // Load from Anonymous x = new XMLList(<>onetwo); TEST(5, "one\ntwo", x.toXMLString()); // Load from Anonymous as string x = new XMLList("onetwo"); TEST(6, "one\ntwo", x.toXMLString()); // Load from illegal type //x = new XMLList("foobar"); //ADD(7, "", x); John = "John25"; Sue = "Sue32"; correct = <> John25 Sue32 ; var1 = new XMLList(John + Sue); TEST(8, correct, var1); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/10.4.js0000644000175000017500000000553411545150464022052 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("10.4 - toXMLList"); var x; // null try { x = null; x.toString(); SHOULD_THROW(1); } catch (ex) { TEST(1, "TypeError", ex.name); } // number x = new Number(123); TEST(2, "123", new XMLList(x).toXMLString()); // String x = new String("one"); TEST(3, one, new XMLList(x)); x = new String("onetwo"); TEST(4, "one\ntwo", new XMLList(x).toXMLString()); // XML x = new XML(one); TEST(5, one, new XMLList(x)); x = new XML(onetwo); TEST(6, one, new XMLList(x.alpha)); // XMLList x = new XMLList(one); TEST(7, one, new XMLList(x)); x = new XMLList(<>onetwo); TEST(8, "one\ntwo", new XMLList(x).toXMLString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/10.5.1.js0000644000175000017500000000373511545150464022213 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("10.5.1 - ToAttributeName applied to the String type"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/10.5.js0000644000175000017500000000367611545150464022060 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("10.5 ToAttributeName"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/10.6.1.js0000644000175000017500000000372711545150464022215 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("10.6.1 - ToXMLName applied to the String type"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/10.6.js0000644000175000017500000000367211545150464022055 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("10.6 - ToXMLName"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/browser.js0000644000175000017500000000000011545150464023132 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/jstests.list0000644000175000017500000000053711545150464023524 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/TypeConversion/ script 10.1.1.js script 10.1.2.js fails script 10.2.1.js script 10.3.1.js script 10.3.js script 10.4.1.js script 10.4.js skip script 10.5.1.js # obsolete test skip script 10.5.js # obsolete test skip script 10.6.1.js # obsolete test skip script 10.6.js # obsolete test script regress-302097.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/TypeConversion/regress-302097.js0000644000175000017500000000115111545150464023673 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributors: Blake Kaplan, Bob Clary */ var summary = 'E4X - Function.prototype.toString should not quote {} ' + 'attribute values'; var BUGNUMBER = 302097; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); function f(k) { return ; } actual = f.toString().replace(/ one two ; // . TEST(1, onetwo, x.bravo); TEST(2, two, x.bravo.charlie); TEST(3, two, x.bravo.charlie.parent().charlie); // .* var correct = <>onetwo; TEST(4, correct, x.bravo.*); TEST_XML(5, "two", x.bravo.charlie.*); TEST(6, onetwo, x.*[0]); // .@ TEST_XML(7, "value1", x.@attr1); TEST_XML(8, "value2", x.@attr2); // .. TEST(9, onetwo, x..bravo); TEST(10, two, x..charlie); // .@* correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); TEST(11, correct, x.@*); x = one two ; // ..* XML.prettyPrinting = false; correct = <>onetwoonetwotwo; TEST(12, correct, x..*); XML.prettyPrinting = true; x = one two ; // ..@ correct = new XMLList(); correct += new XML("value3"); correct += new XML("value4"); TEST(13, correct, x..@attr3) // ..@* correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); correct += new XML("value3"); correct += new XML("value4"); TEST(14, correct, x..@*); // Check reserved words x = one ; TEST(15, one, x.prototype); // Check method names x = one two ; TEST(16, one, x.name); TEST(17, QName("alpha"), x.name()); TEST(18, two, x.toString); TEST(19, x.toXMLString(), x.toString()); // Test super-expandos x = one ; correct = one two ; x.bravo.charlie.delta = two; TEST(20, correct, x); x = one ; correct = one two ; x.bravo.charlie.delta = "two"; TEST(21, correct, x); x = one ; correct = one two ; x.bravo.charlie.delta = two; TEST(22, correct, x); // Also ADD with *, children() and child() x = one ; correct = one two ; x.*.charlie.delta = two; TEST(23, correct, x); x = one ; correct = one two ; x.children().charlie.delta = two; TEST(24, correct, x); x = one ; correct = one two ; x.child("bravo").charlie.delta = two; TEST(25, correct, x); x = one ; correct = one two ; x.child("newChild").charlie.delta = two; TEST(26, correct, x); // These should fail because the XMLList is size > 1 x = one two ; try { x.*.charlie.delta = "more"; SHOULD_THROW(27); } catch (ex) { TEST(27, "TypeError", ex.name); } x = one two ; try { x.children().charlie.delta = "more"; SHOULD_THROW(28); } catch (ex) { TEST(28, "TypeError", ex.name); } x = one two ; try { x.child("bravo").charlie.delta = "more"; SHOULD_THROW(29); } catch (ex) { TEST(29, "TypeError", ex.name); } END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.10.js0000644000175000017500000000371111545150464020465 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.1.1.10 - XML [[ResolveValue]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.11.js0000644000175000017500000000370311545150464020467 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.1.1.11 - XML [[Insert]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.12.js0000644000175000017500000000370411545150464020471 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.1.1.12 - XML [[Replace]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.13.js0000644000175000017500000000372511545150464020475 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.1.1.13 - XML Type [[AddInScopeNamespace]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.2.js0000644000175000017500000000512111545150464020403 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START('9.1.1.2 - XML [[Put]]'); // . var x = one two ; var correct = new; x.bravo.charlie = "new" TEST(1, correct, x.bravo.charlie) x.bravo = three TEST(2, "three", x.delta.toString()) // .@ x = onetwo x.@attr1 = "newValue" TEST_XML(3, "newValue", x.@attr1) // From Martin XML.prettyPrinting = false; var god = Kibo; god.name = <>JamesKibo; var expect = 'JamesKibo'; actual = god; TEST_XML(4, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.3.js0000644000175000017500000000755711545150464020423 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Ethan Hugg * Milen Nankov * Seno Aiko * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.1.1.3 - XML [[Delete]]"); // .@ x = one; delete x.@attr1; TEST_XML(1, "", x.@attr1); TEST(2, one, x); // ..@ x = one two three ; correct = one two three ; delete x..@attr3; TEST(3, correct, x); // ..@* x = one two three ; correct = one two three ; delete x..@*; TEST(4, correct, x); x =





    ; correct = ; delete x..HR; TEST(5, correct, x); x = ECMA-357



    ; correct = ECMA-357 ; delete x..HR; TEST(6, correct.toXMLString(), x.toXMLString()); x = ECMA-357



    ; correct = ECMA-357; delete x.HR; TEST(7, correct, x); x = ECMA-357



    ; correct = ; delete x..*; TEST(8, correct, x); x = ECMA-357



    ; correct = ; delete x.*; TEST(9, correct, x); x =
    ; correct =
    ; delete x.LI; TEST(10, correct, x); x =
    ; correct =
      ; delete x..LI; TEST(11, correct, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.4.js0000644000175000017500000000364711545150464020420 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.1.1.4 - XML [[DeleteByIndex]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.5.js0000644000175000017500000000374711545150464020422 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // XML Type [[Default Value]] START("9.1.1.5 - XML [[Default Value]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.6.js0000644000175000017500000000435311545150464020415 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.1.1.6 - XML [[HasProperty]]"); x = onetwothree; TEST(1, true, "bravo" in x); TEST(2, true, 0 in x); TEST(3, true, "charlie" in x.bravo); TEST(4, true, 0 in x.bravo); TEST(5, false, 1 in x); TEST(6, false, 1 in x.bravo); TEST(7, false, 2 in x); TEST(8, false, 2 in x.bravo); TEST(9, false, "foobar" in x); TEST(10, false, "foobar" in x.bravo); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.7.js0000644000175000017500000000370511545150464020416 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.1.1.7 - XML [[DeepCopy]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.8.js0000644000175000017500000000374411545150464020422 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // XML Type [[Descendants]] START("9.1.1.8 - XML [[Descendants]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.1.1.9.js0000644000175000017500000001077111545150464020421 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.1.1.9 - XML [[Equals]]"); x = one; y = one; TEST(1, true, (x == y) && (y == x)); // Should return false if comparison is not XML y = "one"; TEST(2, false, (x == y) || (y == x)); y = undefined TEST(3, false, (x == y) || (y == x)); y = null TEST(4, false, (x == y) || (y == x)); y = new Object(); TEST(5, false, (x == y) || (y == x)); // Check with attributes x = onetwo; y = onetwo; TEST(6, true, (x == y) && (y == x)); y = onetwo; TEST(7, false, (x == y) || (y == x)); // Logical equality // Attribute order. x = onetwo; y = onetwo; TEST(8, true, (x == y) && (y == x)); // Skips empty text nodes if ignoring whitespace // XML.ignoreWhitespace = false; x = one ; y = one; TEST(9, true, (x == y) && (y == x)); // Doesn't trim text nodes. x = one ; y = one; TEST(10, false, (x == y) || (y == x)); // Compare comments XML.ignoreComments = false; x = one; y = one; TEST(11, false, (x == y) || (y == x)); one = x.*[0]; two = y.*[0]; TEST(12, false, (one == two) || (two == one)); one = x.*[0]; two = y.bravo.*[0]; TEST(13, true, (one == two) && (two == one)); // Compare processing instructions XML.ignoreProcessingInstructions = false; x = one; y = one; TEST(14, false, (x == y) || (y == x)); one = x.*[0]; two = y.*[0]; TEST(15, false, (one == two) || (two == one)); one = x.*[0]; two = y.bravo.*[0]; TEST(16, true, (one == two) && (two == one)); // Namepaces x = one; y = one; TEST(17, true, (x == y) && (y == x)); y = one; TEST(18, false, (x == y) || (y == x)); // Default namespace default xml namespace = "http://foo/"; x = one; y = one; TEST(19, true, (x == y) && (y == x)); // bug 358183 x = ; y = ; TEST(20, false,(x == y)); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.2.1.1.js0000644000175000017500000000751111545150464020410 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.2.1.1 XMLList [[Get]]"); var x = <> one two three four ; // . correct = <> one two three four ; TEST(1, correct, x.bravo); correct = <> two four ; TEST(2, correct, x.bravo.charlie); // .@ correct = new XMLList(); correct += new XML("value1"); correct += new XML("value3"); TEST(3, correct, x.@attr1); correct = new XMLList(); correct += new XML("value2"); correct += new XML("value4"); TEST(4, correct, x.bravo.@attr2); // .. correct = <> one two three four ; TEST(5, correct, x..bravo); correct = <> two four ; TEST(6, correct, x..charlie); // .@* correct = new XMLList(); correct += new XML("value1"); correct += new XML("value3"); TEST(7, correct, x.@*); x = one two ; // ..* correct = <>onetwoonetwotwo; XML.prettyPrinting = false; TEST(8, correct, x..*); XML.prettyPrinting = true; x = one two ; // ..@ correct = new XMLList(); correct += new XML("value2"); correct += new XML("value3"); TEST(9, correct, x..@attr2) // ..@* correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); correct += new XML("value3"); correct += new XML("value4"); TEST(10, correct, x..@*); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.2.1.10.js0000644000175000017500000000371411545150464020471 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.2.1.10 XMLList [[ResolveValue]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.2.1.2.js0000644000175000017500000000435511545150464020414 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.2.1.2 - XMLList [[Put]]"); var x = <> one two ; TEST(1, "one\ntwo", x.toXMLString()); x[0] = three; TEST(2, "three\ntwo", x.toXMLString()); x[0] = four + five; TEST(3, "four\nfive\ntwo", x.toXMLString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.2.1.3.js0000644000175000017500000000370411545150464020412 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.2.1.3 XMLList [[Delete]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.2.1.4.js0000644000175000017500000000371311545150464020413 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.2.1.4 XMLList [[DefaultValue]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.2.1.5.js0000644000175000017500000000371311545150464020414 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.2.1.5 XMLList [[HasProperty]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.2.1.6.js0000644000175000017500000000370511545150464020416 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.2.1.6 XMLList [[Append]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.2.1.7.js0000644000175000017500000000370711545150464020421 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.2.1.7 XMLList [[DeepCopy]]"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.2.1.8.js0000644000175000017500000000405211545150464020414 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.2.1.8 XMLList [[Descendants]]"); x = <> one two ; correct = <>onetwo; TEST(1, correct, x..bravo); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/9.2.1.9.js0000644000175000017500000000565711545150464020431 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("9.2.1.9 XMLList [[Equals]]"); // Empty list should equal undefined TEST(1, true, (new XMLList() == undefined) && (undefined == new XMLList())); // Compare two lists if all are equal x = one + two; y = one + two; TEST(2, true, (x == y) && (y == x)); y = one + two + three; TEST(3, false, (x == y) || (y == x)); y = one + not; TEST(4, false, (x == y) || (y == x)); // If XMLList has one argument should compare with just the 0th element. x = new XMLList(one); y = one; TEST(5, true, (x == y) && (y == x)); y = "one"; TEST(6, true, (x == y) && (y == x)); // Should return false even if list contains element equal to comparison x = one + two; y = one; TEST(7, false, (x == y) && (y == x)); y = "one"; TEST(8, false, (x == y) || (y == x)); // Try other types - should return false y = null; TEST(9, false, (x == y) || (y == x)); y = new Object(); TEST(10, false, (x == y) || (y == x)); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/browser.js0000644000175000017500000000000011545150464021247 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/jstests.list0000644000175000017500000000137111545150464021636 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/Types/ script 9.1.1.1.js skip script 9.1.1.10.js # obsolete test skip script 9.1.1.11.js # obsolete test skip script 9.1.1.12.js # obsolete test skip script 9.1.1.13.js # obsolete test script 9.1.1.2.js script 9.1.1.3.js skip script 9.1.1.4.js # obsolete test skip script 9.1.1.5.js # obsolete test script 9.1.1.6.js skip script 9.1.1.7.js # obsolete test skip script 9.1.1.8.js # obsolete test script 9.1.1.9.js script 9.2.1.1.js skip script 9.2.1.10.js # obsolete test script 9.2.1.2.js skip script 9.2.1.3.js # obsolete test skip script 9.2.1.4.js # obsolete test skip script 9.2.1.5.js # obsolete test skip script 9.2.1.6.js # obsolete test skip script 9.2.1.7.js # obsolete test script 9.2.1.8.js script 9.2.1.9.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/Types/shell.js0000644000175000017500000000000011545150464020673 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.1.js0000644000175000017500000000617311545150464017665 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.1 - XML Constructor as Function"); x = XML(); TEST(1, "xml", typeof(x)); TEST(2, true, x instanceof XML); correct = DIS ; x = XML(correct); TEST(3, correct, x); text = "" + " " + " " + " DIS" + " " + " " + ""; x = XML(text); TEST(4, correct, x); // Make sure it's not copied if it's XML x = two ; y = XML(x); x.bravo = "three"; correct = three ; TEST(5, correct, y); // Make text node x = XML("4"); TEST_XML(6, 4, x); x = XML(4); TEST_XML(7, 4, x); // Undefined and null should behave like "" x = XML(null); TEST_XML(8, "", x); x = XML(undefined); TEST_XML(9, "", x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.2.js0000644000175000017500000000641111545150464017661 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.2 - XML Constructor"); x = new XML(); TEST(1, "xml", typeof(x)); TEST(2, true, x instanceof XML); correct = DIS ; x = new XML(correct); TEST_XML(3, correct.toXMLString(), x); text = "" + " " + " " + " DIS" + " " + " " + ""; x = new XML(text); TEST(4, correct, x); // Make sure it's a copy x = one ; y = new XML(x); x.bravo.prependChild(two); correct = one ; TEST(5, correct, y); // Make text node x = new XML("4"); TEST_XML(6, "4", x); x = new XML(4); TEST_XML(7, "4", x); // Undefined and null should behave like "" x = new XML(null); TEST_XML(8, "", x); x = new XML(undefined); TEST_XML(9, "", x); // see bug 320008 x = new XML(""); TEST_XML(10, "", x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.3.10.js0000644000175000017500000000414611545150464020104 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * David P. Caldwell. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Martin Honnen * David P. Caldwell * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.3.10 - XML Constructor [[HasInstance]]"); printBugNumber(288027); var xmlListObject1 = new XMLList('Kibo'); var xmlListObject2 = new XMLList('KiboXibo'); TEST(1, true, xmlListObject1 instanceof XML); TEST(2, true, xmlListObject2 instanceof XML); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.3.js0000644000175000017500000001316511545150464017666 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.3 - XML Properties"); // Test defaults TEST(1, true, XML.ignoreComments); TEST(2, true, XML.ignoreProcessingInstructions); TEST(3, true, XML.ignoreWhitespace); TEST(4, true, XML.prettyPrinting); TEST(5, 2, XML.prettyIndent); // ignoreComments x = one; correct = one; TEST(6, correct, x); XML.ignoreComments = false; x = one; correct = "\n" + " \n" + " one\n" + ""; TEST_XML(7, correct, x); // ignoreProcessingInstructions XML.setSettings(); x = <> one ; correct = one ; TEST(8, correct, x); XML.ignoreProcessingInstructions = false; x = <> one ; correct = "\n" + " \n" + " one\n" + ""; TEST_XML(9, correct, x); // ignoreWhitespace XML.setSettings(); x = new XML(" \t\r\n\r\n \t\r\n\r\none \t\r\n\r\n"); correct = "\n" + " one\n" + ""; TEST_XML(10, correct, x); XML.ignoreWhitespace = false; XML.prettyPrinting = false; correct = " \n\n \n\none \n\n"; x = new XML(correct); TEST_XML(11, correct, x); // prettyPrinting XML.setSettings(); x = one two three four ; correct = "\n" + " one\n" + " two\n" + " \n" + " \n" + " three\n" + " four\n" + " \n" + ""; TEST(12, correct, x.toString()); TEST(13, correct, x.toXMLString()); XML.prettyPrinting = false; correct = "onetwothreefour"; TEST(14, correct, x.toString()); TEST(15, correct, x.toXMLString()); // prettyIndent XML.prettyPrinting = true; XML.prettyIndent = 3; correct = "\n" + " one\n" + " two\n" + " \n" + " \n" + " three\n" + " four\n" + " \n" + ""; TEST(16, correct, x.toString()); TEST(17, correct, x.toXMLString()); XML.prettyIndent = 0; correct = "\n" + "one\n" + "two\n" + "\n" + "\n" + "three\n" + "four\n" + "\n" + ""; TEST(18, correct, x.toString()); TEST(19, correct, x.toXMLString()); // settings() XML.setSettings(); o = XML.settings(); TEST(20, true, o.ignoreComments); TEST(21, true, o.ignoreProcessingInstructions); TEST(22, true, o.ignoreWhitespace); TEST(23, true, o.prettyPrinting); TEST(24, 2, o.prettyIndent); // setSettings() o = XML.settings(); o.ignoreComments = false; o.ignoreProcessingInstructions = false; o.ignoreWhitespace = false; o.prettyPrinting = false; o.prettyIndent = 7; XML.setSettings(o); o = XML.settings(); TEST(25, false, o.ignoreComments); TEST(26, false, o.ignoreProcessingInstructions); TEST(27, false, o.ignoreWhitespace); TEST(28, false, o.prettyPrinting); TEST(29, 7, o.prettyIndent); // setSettings() XML.setSettings(); o = XML.settings(); TEST(30, true, o.ignoreComments); TEST(31, true, o.ignoreProcessingInstructions); TEST(32, true, o.ignoreWhitespace); TEST(33, true, o.prettyPrinting); TEST(34, 2, o.prettyIndent); correct = new XML(''); // ignoreComments XML.ignoreComments = true; x = ; TEST(35, correct, x); // ignoreProcessingInstructions XML.ignoreProcessingInstructions = true; x = ; TEST(36, correct, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.1.js0000644000175000017500000000370411545150464020024 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.1 - XML Constructor"); var actual = 'Test not implemented'; var expect = 'PASS'; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.10.js0000644000175000017500000000627611545150464020113 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var nTest = 0; START("13.4.4.10 - XML contains()"); TEST(++nTest, true, XML.prototype.hasOwnProperty("contains")); emps = Jim25 Joe20 ; TEST(++nTest, true, emps.contains(emps)); // Martin - bug 289706 expect = 'gods.contains(\'Kibo\')==false && (gods==\'Kibo\')==false'; var gods = Kibo Xibo ; printStatus('XML markup is:\r\n' + gods.toXMLString()); var string = 'Kibo'; actual = 'gods.contains(\'' + string + '\')==' + gods.contains(string); actual += ' && '; actual += '(gods==\'' + string + '\')==' + (gods == string); TEST(++nTest, expect, actual); // Martin - bug 289790 function containsTest(xmlObject, value) { var comparison = (xmlObject == value); var containsCheck = xmlObject.contains(value); var result = (comparison == containsCheck); printStatus('Comparing ' + xmlObject.nodeKind() + ' against ' + (typeof value) + ':'); printStatus('==: ' + comparison + '; contains: ' + containsCheck + '; check ' + (result ? 'passed' : 'failed')); return result; } actual = containsTest(new XML('Kibo'), 'Kibo'); TEST(++nTest, true, actual); actual = containsTest(Kibo, 'Kibo'); TEST(++nTest, true, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.11.js0000644000175000017500000000551611545150464020110 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.11 - XML copy()"); TEST(1, true, XML.prototype.hasOwnProperty("copy")); emps = Jim25 Joe20 ; correct = Jim25; x = emps.employee[0].copy(); TEST(2, null, x.parent()); TEST(3, correct, x); // Make sure we're getting a copy, not a ref to orig. emps = Jim25 Joe20 ; correct = Jim25 empCopy = emps.employee[0].copy(); emps.employee[0].name[0] = "Sally"; TEST(4, correct, empCopy); // Try copying whole XML twice emps = Jim25 Joe20 ; empCopy = emps.copy(); x = empCopy.copy(); TEST(5, x, emps); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.12-1.js0000644000175000017500000000564011545150464020245 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin.Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "13.4.4.12 - XML Descendants"; var BUGNUMBER = 289117; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var xhtmlMarkup = XHTML example

      Kibology for all

      ; expect = 'element:http://www.w3.org/1999/xhtml::head;' + 'element:http://www.w3.org/1999/xhtml::title;' + 'text:XHTML example;' + 'element:http://www.w3.org/1999/xhtml::body;' + 'element:http://www.w3.org/1999/xhtml::p;' + 'text:Kibology for all;'; actual = ''; for each (var descendant in xhtmlMarkup..*) { actual += descendant.nodeKind() + ':'; var name = descendant.name(); if (name) { actual += name; } else { actual += descendant.toString(); } actual += ';' } TEST(1, expect, actual); actual = ''; for each (var descendant in xhtmlMarkup.descendants()) { actual += descendant.nodeKind() + ':'; var name = descendant.name(); if (name) { actual += name; } else { actual += descendant.toString(); } actual += ';' } TEST(2, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.12.js0000644000175000017500000000464711545150464020115 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.12 - XML descendants"); TEST(1, true, XML.prototype.hasOwnProperty("descendants")); x = one two three ; TEST(2, three, x.charlie.descendants("bravo")); TEST(3, <>onethree, x.descendants("bravo")); // Test * correct = <>oneonetwothreetwothreethree; XML.prettyPrinting = false; TEST(4, correct, x.descendants("*")); TEST(5, correct, x.descendants()); XML.prettyPrinting = true; END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.13.js0000644000175000017500000000365411545150464020113 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.14 - XML elements()"); TEST(1, true, XML.prototype.hasOwnProperty("elements")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.14.js0000644000175000017500000000466111545150464020113 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.14 - XML hasOwnProperty()"); TEST(1, true, XML.prototype.hasOwnProperty("hasOwnProperty")); x = one two three four ; // Returns true for elements/attributes TEST(2, true, x.hasOwnProperty("bravo")); TEST(3, true, x.hasOwnProperty("@attr1")); TEST(4, false, x.hasOwnProperty("foobar")); // Test for XML Prototype Object - returns true for XML methods. TEST(5, true, XML.prototype.hasOwnProperty("toString")); TEST(6, false, XML.prototype.hasOwnProperty("foobar")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.15.js0000644000175000017500000000527011545150464020111 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.15 - hasComplexContent()"); TEST(1, true, XML.prototype.hasOwnProperty("hasComplexContent")); x = one two three four five six seven ; TEST(2, true, x.hasComplexContent()); TEST(3, false, x.bravo.hasComplexContent()); TEST(4, true, x.charlie.hasComplexContent()); TEST(5, false, x.delta.hasComplexContent()); TEST(6, false, x.foxtrot.hasComplexContent()); TEST(7, false, x.golf.hasComplexContent()); TEST(8, false, x.hotel.hasComplexContent()); TEST(9, false, x.@attr1.hasComplexContent()); TEST(10, false, x.bravo.child(0).hasComplexContent()); TEST(11, true, x.india.hasComplexContent()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.16.js0000644000175000017500000000525311545150464020113 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.16 - XML hasSimpleContent()"); TEST(1, true, XML.prototype.hasOwnProperty("hasSimpleContent")); x = one two three four five six seven ; TEST(2, false, x.hasSimpleContent()); TEST(3, true, x.bravo.hasSimpleContent()); TEST(4, false, x.charlie.hasSimpleContent()); TEST(5, true, x.delta.hasSimpleContent()); TEST(6, true, x.foxtrot.hasSimpleContent()); TEST(7, true, x.golf.hasSimpleContent()); TEST(8, true, x.hotel.hasSimpleContent()); TEST(9, true, x.@attr1.hasSimpleContent()); TEST(10, true, x.bravo.child(0).hasSimpleContent()); TEST(11, false, x.india.hasSimpleContent()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.17.js0000644000175000017500000000451111545150464020110 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.17 - XML inScopeNamespaces()"); TEST(1, true, XML.prototype.hasOwnProperty("inScopeNamespaces")); x = one ; namespaces = x.bravo.inScopeNamespaces(); TEST(2, "foo", namespaces[0].prefix); TEST(3, "http://foo/", namespaces[0].uri); TEST(4, "bar", namespaces[1].prefix); TEST(5, "http://bar/", namespaces[1].uri); TEST(6, "", namespaces[2].prefix); TEST(7, "", namespaces[2].uri); TEST(8, 3, namespaces.length); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.18.js0000644000175000017500000000466011545150464020116 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.18 - XML insertChildAfter()"); TEST(1, true, XML.prototype.hasOwnProperty("insertChildAfter")); x = one two ; correct = one three two ; x.insertChildAfter(x.bravo[0], three); TEST(2, correct, x); x = one two ; correct = three one two ; x.insertChildAfter(null, three); TEST(3, correct, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.19.js0000644000175000017500000000466311545150464020122 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.19 - insertChildBefore()"); TEST(1, true, XML.prototype.hasOwnProperty("insertChildBefore")); x = one two ; correct = three one two ; x.insertChildBefore(x.bravo[0], three); TEST(2, correct, x); x = one two ; correct = one two three ; x.insertChildBefore(null, three); TEST(3, correct, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.2.js0000644000175000017500000000451011545150464020021 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.2 - XML addNamespace()"); TEST(1, true, XML.prototype.hasOwnProperty("addNamespace")); e = Jim25 Joe20 ; n = "http://foobar/"; e.addNamespace(n); n = new Namespace(); e.addNamespace(n); n = new Namespace("http://foobar/"); e.addNamespace(n); x =
      ; n = new Namespace("ns", "uri"); x.addNamespace(n); TEST(2, "", x.toXMLString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.20.js0000644000175000017500000000426611545150464020111 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.20 - XML length()"); TEST(1, true, XML.prototype.hasOwnProperty("length")); x = one two three four ; TEST(2, 1, x.length()); TEST(3, 1, x.bravo.length()); TEST(4, 1, x.charlie.length()); TEST(5, 1, x.delta.length()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.21.js0000644000175000017500000000502011545150464020077 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.21 - XML localName()"); TEST(1, true, XML.prototype.hasOwnProperty("localName")); x = one two ; y = x.bravo.localName(); TEST(2, "string", typeof(y)); TEST(3, "bravo", y); y = x.bravo.localName(); x.bravo.setNamespace("http://someuri"); TEST(4, "bravo", y); x = one ; ns = new Namespace("http://foo/"); y = x.ns::bravo.localName(); TEST(5, "string", typeof(y)); TEST(6, "bravo", y); y = x.ns::bravo.@name.localName(); TEST(7, "name", y); y = x.ns::bravo.@ns::value.localName(); TEST(8, "value", y); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.22.js0000644000175000017500000000502511545150464020105 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.22 - XML name()"); TEST(1, true, XML.prototype.hasOwnProperty("name")); x = one two ; y = x.bravo.name(); TEST(2, "object", typeof(y)); TEST(3, QName("bravo"), y); x = one ; ns = new Namespace("http://foo/"); y = x.ns::bravo.name(); TEST(4, "object", typeof(y)); TEST(5, QName("http://foo/", "bravo"), y); y = x.ns::bravo.@name.name(); TEST(6, QName("name"), y); y = x.ns::bravo.@ns::value.name(); TEST(7, "http://foo/", y.uri); TEST(8, "value", y.localName); TEST(9, QName("http://foo/", "value"), y); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.23.js0000644000175000017500000000550411545150464020110 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.23 - XML namespace()"); TEST(1, true, XML.prototype.hasOwnProperty("namespace")); // Prefix case x = one ; y = x.namespace(); TEST(2, "object", typeof(y)); TEST(3, Namespace("http://foo/"), y); y = x.namespace("bar"); TEST(4, "object", typeof(y)); TEST(5, Namespace("http://bar/"), y); // No Prefix Case x = one ; y = x.namespace(); TEST(6, "object", typeof(y)); TEST(7, Namespace("http://foobar/"), y); // No Namespace case x = one ; TEST(8, Namespace(""), x.namespace()); // Namespaces of attributes x = one ; var ns = new Namespace("http://bar"); y = x.ns::bravo.@name.namespace(); TEST(9, Namespace(""), y); y = x.ns::bravo.@ns::value.namespace(); TEST(10, ns.toString(), y.toString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.24.js0000644000175000017500000000447111545150464020113 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.24 - XML namespaceDeclarations()"); TEST(1, true, XML.prototype.hasOwnProperty("namespaceDeclarations")); x = one ; y = x.namespaceDeclarations(); TEST(2, 2, y.length); TEST(3, "object", typeof(y[0])); TEST(4, "object", typeof(y[1])); TEST(5, "foo", y[0].prefix); TEST(6, Namespace("http://foo/"), y[0]); TEST(7, "bar", y[1].prefix); TEST(8, Namespace("http://bar/"), y[1]); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.25.js0000644000175000017500000000426511545150464020115 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.25 - XML nodeKind()"); TEST(1, true, XML.prototype.hasOwnProperty("nodeKind")); x = one ; TEST(2, "element", x.bravo.nodeKind()); TEST(3, "attribute", x.@attr1.nodeKind()); // Nonexistent node type is text x = new XML(); TEST(4, "text", x.nodeKind()); TEST(5, "text", XML.prototype.nodeKind()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.26.js0000644000175000017500000000720611545150464020114 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * Jeff Walden * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.26 - XML normalize()"); TEST(1, true, XML.prototype.hasOwnProperty("normalize")); XML.ignoreWhitespace = false; XML.prettyPrinting = false; var x = one ; TEST_XML(2, " one ", x); x.normalize(); TEST_XML(3, " one ", x); // First, test text node coalescing delete x.bravo[0]; TEST_XML(4, " ", x); TEST(5, 2, x.children().length()); x.normalize(); TEST_XML(6, " ", x); TEST(7, 1, x.children().length()); // check that nodes are inserted in the right place after a normalization x.appendChild( fun ); TEST_XML(8, " fun ", x); TEST(9, 2, x.children().length()); // recursive nature var y = ; TEST(10, 3, y.children().length()); x.appendChild(y); delete y.delta[0]; TEST(11, 2, y.children().length()); x.normalize(); TEST(12, 1, y.children().length()); TEST(13, 1, x.charlie.children().length()); // Second, test empty text node removal x = ; TEST_XML(14, "", x); TEST(15, 1, x.children().length()); x.appendChild(XML()); TEST_XML(16, "", x); TEST(17, 2, x.children().length()); x.normalize(); TEST_XML(18, "", x); TEST(19, 1, x.children().length()); x.appendChild(XML(" ")); TEST_XML(20, " ", x); TEST(21, 2, x.children().length()); x.normalize(); // normalize does not remove whitespace-only text nodes TEST_XML(22, " ", x); TEST(23, 2, x.children().length()); y = ; y.appendChild(XML()); TEST(24, 1, y.children().length()); x.appendChild(y); // check recursive nature x.normalize(); TEST(25, 0, y.children().length()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.27.js0000644000175000017500000000412111545150464020106 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.27 - XML parent()"); TEST(1, true, XML.prototype.hasOwnProperty("parent")); x = one two ; y = x.bravo; TEST(2, x, y.parent()); TEST(3, null, x.parent()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.28.js0000644000175000017500000000536511545150464020122 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.28 - processingInsructions()"); TEST(1, true, XML.prototype.hasOwnProperty("processingInstructions")); XML.ignoreProcessingInstructions = false; // test generic PI x = one; correct = <>; TEST(2, correct, x.processingInstructions()); TEST(3, correct, x.processingInstructions("*")); correct = ""; TEST_XML(4, correct, x.processingInstructions("xyz")); // test XML-decl // Un-comment these tests when we can read in doc starting with PI. //x = new XML("one"); //correct = new XMLList(); //test(5, correct, x.processingInstructions()); //test(6, correct, x.processingInstructions("*")); //test(7, correct, x.processingInstructions("xml")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.29.js0000644000175000017500000000512011545150464020110 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.29 - XML prependChild()"); TEST(1, true, XML.prototype.hasOwnProperty("prependChild")); x = one ; correct = bar one ; x.bravo.prependChild(bar); TEST(2, correct, x); emps = John Sue correct = Mr. John Sue emps.employee.(name == "John").prependChild(Mr.); TEST(3, correct, emps); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.3-01.js0000644000175000017500000000445211545150464020245 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Seno.Aiko@gmail.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "13.4.4.3 - XML.appendChild should copy child"; var BUGNUMBER = 312692; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); var ul =
        ; var li =
      • ; li.setChildren("First"); ul.appendChild(li); li.setChildren("Second"); ul.appendChild(li); XML.ignoreWhitespace = true; XML.prettyPrinting = true; expect = (
        • Second
        • Second
        ).toXMLString().replace(/; node.appendChild(node); var result = String(node); actual = 'no error'; } catch(e) { actual = 'error'; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.3.js0000644000175000017500000000567111545150464020033 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.3 - XML appendChild()"); TEST(1, true, XML.prototype.hasOwnProperty("appendChild")); // Add new employee to list emps = Jim25 Joe20 ; correct = Jim25 Joe20 Sue30 ; newEmp = Sue30; emps.appendChild(newEmp); TEST(2, correct, emps); // Add a new child element to the end of Jim's employee element emps = Jim25 Joe20 ; correct = Jim25snorkeling Joe20 ; emps.employee.(name == "Jim").appendChild(snorkeling); TEST(3, correct, emps); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.30.js0000644000175000017500000000446111545150464020107 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.30 - propertyIsEnumerable()"); TEST(1, true, XML.prototype.hasOwnProperty("propertyIsEnumerable")); // All properties accessible by Get are enumerable x = one ; TEST(2, true, x.propertyIsEnumerable("0")); TEST(3, true, x.propertyIsEnumerable(0)); TEST(5, false, x.propertyIsEnumerable("bravo")); TEST(6, false, x.propertyIsEnumerable()); TEST(7, false, x.propertyIsEnumerable(undefined)); TEST(8, false, x.propertyIsEnumerable(null)); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.31.js0000644000175000017500000000456111545150464020111 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.31 - XML removeNamespace()"); TEST(1, true, XML.prototype.hasOwnProperty("removeNamespace")); x = one ; correct = one ; x.removeNamespace("http://foo/"); TEST(2, correct, x); // Shouldn't remove namespace if referenced x = one ; correct = one ; x.removeNamespace("http://foo/"); TEST(3, correct, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.32-01.js0000644000175000017500000000410611545150464020323 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Michael Lipp * David P. Caldwell * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.32-1 - XML replace() by index, text to string"); printBugNumber(291927); var root = text; TEST_XML(1, "text", root.child(0)); root.replace(0, "new text"); TEST_XML(2, "new text", root.child(0)); TEST(3, new text, root); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.32.js0000644000175000017500000000606411545150464020112 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.32 - XML replace()"); TEST(1, true, XML.prototype.hasOwnProperty("replace")); // Replace the first employee record with an open staff requisition emps = Jim25 Joe20 ; correct = Joe20 ; emps.replace(0, ); TEST(2, correct, emps); // Replace all children with open staff requisition emps = Jim25 Joe20 ; correct = ; emps.replace("*", ); TEST(3, correct, emps); // Replace all employee elements with open staff requisition emps = Jim25 Joe20 ; correct = ; emps.replace("employee", ); TEST(4, correct, emps); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.33.js0000644000175000017500000000506411545150464020112 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.33 - XML setChildren()"); TEST(1, true, XML.prototype.hasOwnProperty("setChildren")); x = one ; correct = two ; x.setChildren(two); TEST(2, correct, x); // Replace the entire contents of Jim's employee element emps = Jim25 Joe20 ; correct = John35 Joe20 ; emps.employee.(name == "Jim").setChildren(John + 35); TEST(3, correct, emps); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.34.js0000644000175000017500000000445511545150464020116 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.34 - XML setLocalName()"); TEST(1, true, XML.prototype.hasOwnProperty("setLocalName")); x = one ; correct = one ; x.setLocalName("charlie"); TEST(2, correct, x); x = one ; correct = one ; x.setLocalName("charlie"); TEST(3, correct, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.35.js0000644000175000017500000000501111545150464020104 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.35 - setName"); TEST(1, true, XML.prototype.hasOwnProperty("setName")); x = one ; correct = one ; x.setName("charlie"); TEST(2, correct, x); x = one ; correct = one ; x.setName("charlie"); TEST(3, correct, x); x = one ; correct = one ; x.setName(new QName("http://foobar/", "charlie")); TEST(4, correct, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.36.js0000644000175000017500000000464411545150464020120 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * Werner Sharp * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.36 - setNamespace"); TEST(1, true, XML.prototype.hasOwnProperty("setNamespace")); x = one ; correct = one ; x.setNamespace("http://bar/"); TEST(2, correct, x); var xhtml1NS = new Namespace('http://www.w3.org/1999/xhtml'); var xhtml = ; xhtml.setNamespace(xhtml1NS); TEST(3, 1, xhtml.namespaceDeclarations().length); TEST(4, xhtml1NS, xhtml.namespace()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.37.js0000644000175000017500000000440711545150464020116 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.37 - XML text()"); TEST(1, true, XML.prototype.hasOwnProperty("text")); x = one two ; TEST_XML(2, "one", x.bravo.text()); correct = new XMLList(); correct += new XML("one"); correct += new XML("two"); TEST(3, correct, x..bravo.text()); TEST_XML(4, "", x.charlie.text()); TEST_XML(5, "", x.foobar.text()); TEST_XML(6, "one", x.*.text()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.38.js0000644000175000017500000000555611545150464020125 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.38 - XML toString()"); TEST(1, true, XML.prototype.hasOwnProperty("toString")); XML.prettyPrinting = false; x = one two ; TEST(2, "one", x.bravo.toString()); TEST(3, "onetwo", x..bravo.toString()); x = one ; TEST(4, "", x.charlie.toString()); x = one two ; TEST(5, "two", x.charlie.toString()); x = one two ; TEST(5, "two", x.charlie.toString()); x = ; TEST(6, "", x.bravo.toString()); x = one two ; TEST(7, "onetwo", x.bravo.toString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.39.js0000644000175000017500000000644011545150464020117 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.39 - XML toXMLString"); TEST(1, true, XML.prototype.hasOwnProperty("toXMLString")); XML.prettyPrinting = false; x = one two ; TEST(2, "one", x.bravo.toXMLString()); TEST(3, "onetwo", x..bravo.toXMLString()); x = one ; TEST(4, "", x.charlie.toXMLString()); x = one two ; TEST(5, "two", x.charlie.toXMLString()); x = one two ; TEST(6, "two", x.charlie.toXMLString()); x = ; TEST(7, "", x.bravo.toXMLString()); x = one two ; TEST(8, "onetwo", x.bravo.toXMLString()); XML.prettyPrinting = true; x = one two ; copy = x.bravo.copy(); TEST(9, "one", copy.toXMLString()); x = one two ; TEST(10, "String contains value one from bravo", "String contains value " + x.bravo + " from bravo"); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.4.js0000644000175000017500000000523511545150464020030 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.4 - XML attribute()"); TEST(1, true, XML.prototype.hasOwnProperty("attribute")); // Get count of employees emps = Jim25 Joe20 ; TEST_XML(2, 2, emps.attribute("count")); // Get the id of the employee age 25 emps = Jim25 Joe20 ; TEST_XML(3, 0, emps.employee.(age == "25").attribute("id")); // Get the id of the employee named Jim emps = Jim25 Joe20 ; TEST_XML(4, 0, emps.employee.(name == "Jim").attribute("id")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.40.js0000644000175000017500000000417111545150464020106 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.40 - valueOf"); TEST(1, true, XML.prototype.hasOwnProperty("valueOf")); x = one ; TEST(2, x, x.valueOf()); // Make sure they're the same and not copies x = one ; y = x.valueOf(); x.bravo = "two"; TEST(3, x, y); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.5.js0000644000175000017500000000451511545150464020031 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.5 - XML attributes()"); TEST(1, true, XML.prototype.hasOwnProperty("attributes")); x = one ; TEST(2, "xml", typeof(x.attributes())); // Iterate through the attributes of an XML value x = one ; correct = new Array("value1", "value2", "value3"); i = 0; for each (var a in x.attributes()) { TEST_XML(i + 3, correct[i], a); i++; } END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.6.js0000644000175000017500000000462211545150464020031 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.6 - XML child()"); TEST(1, true, XML.prototype.hasOwnProperty("child")); emps = Jim25 Joe20 ; correct = Jim25 + Joe20; TEST(2, correct, emps.child("employee")); TEST(3, Joe, emps.employee[1].child("name")); correct = Joe20; TEST(4, correct, emps.child(1)); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.7.js0000644000175000017500000000443411545150464020033 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.7 - XML childIndex()"); TEST(1, true, XML.prototype.hasOwnProperty("childIndex")); emps = Jim25 Joe20 ; TEST(2, 0, emps.employee[0].childIndex()); // Get the ordinal index of the employee named Joe TEST(3, 1, emps.employee.(age == "20").childIndex()); TEST(4, 1, emps.employee.(name == "Joe").childIndex()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.8.js0000644000175000017500000000475211545150464020037 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.8 - XML children()"); TEST(1, true, XML.prototype.hasOwnProperty("children")); emps = Jim25 Joe20 ; correct = new XMLList(); correct += Jim25; correct += Joe20; TEST(2, "xml", typeof(emps.children())); TEST(3, correct, emps.children()); // Get the child elements of the first employee correct = new XMLList(); correct += Jim, correct += 25; TEST(4, correct, emps.employee[0].children()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/13.4.4.9.js0000644000175000017500000000424211545150464020032 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.4.4.9 - XML comments()"); TEST(1, true, XML.prototype.hasOwnProperty("comments")); XML.ignoreComments = false; x = some text ; TEST_XML(2, "", x.comments()); TEST_XML(3, "", x..*.comments()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/browser.js0000644000175000017500000000000011545150464020603 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/jstests.list0000644000175000017500000000235411545150464021174 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/XML/ script 13.4.1.js script 13.4.2.js script 13.4.3.10.js script 13.4.3.js skip script 13.4.4.1.js # obsolete test script 13.4.4.10.js script 13.4.4.11.js script 13.4.4.12-1.js script 13.4.4.12.js script 13.4.4.13.js script 13.4.4.14.js script 13.4.4.15.js script 13.4.4.16.js script 13.4.4.17.js script 13.4.4.18.js script 13.4.4.19.js script 13.4.4.2.js script 13.4.4.20.js script 13.4.4.21.js script 13.4.4.22.js script 13.4.4.23.js script 13.4.4.24.js script 13.4.4.25.js script 13.4.4.26.js script 13.4.4.27.js script 13.4.4.28.js script 13.4.4.29.js script 13.4.4.3-01.js script 13.4.4.3-02.js script 13.4.4.3.js script 13.4.4.30.js script 13.4.4.31.js script 13.4.4.32-01.js script 13.4.4.32.js script 13.4.4.33.js script 13.4.4.34.js script 13.4.4.35.js script 13.4.4.36.js script 13.4.4.37.js script 13.4.4.38.js script 13.4.4.39.js script 13.4.4.4.js script 13.4.4.40.js script 13.4.4.5.js script 13.4.4.6.js script 13.4.4.7.js script 13.4.4.8.js script 13.4.4.9.js script regress-291930.js script regress-324422-1.js skip script regress-324422-2.js # slow skip script regress-324688.js # bug 528404 - disable due to random timeouts script regress-336921.js script regress-376773.js script regress-621464.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/regress-291930.js0000644000175000017500000000406511545150464021356 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * David P. Caldwell. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Michael Lipp * David P. Caldwell * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("If document starts with comment, document is discarded"); printBugNumber(291930); XML.ignoreComments = false; try { var root = new XML(" "); SHOULD_THROW(1, "SyntaxError"); } catch (e) { TEST(1, "error", "error"); } END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/regress-324422-1.js0000644000175000017500000000465311545150464021510 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Doug Wright * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Do not crash creating XML object with long initialiser"; var BUGNUMBER = 324422; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); if (typeof document == 'undefined') { printStatus ("Expect possible out of memory error"); expectExitCode(0); expectExitCode(5); } var str = 'x'; for (var icount = 0; icount < 20; icount++) { str = str + str; } printStatus(str.length); try { var x = new XML('' + str + ''); } catch(ex) { expect = 'InternalError: script stack space quota is exhausted'; actual = ex + ''; print('Caught ' + ex); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/regress-324422-2.js0000644000175000017500000000451411545150464021505 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Doug Wright * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = "Do not crash creating XML object with long initialiser"; var BUGNUMBER = 324422; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); START(summary); printStatus ("Expect out of memory or script stack space quota is exhausted error"); expectExitCode(0); expectExitCode(3); try { var str = '0123456789'; for (var icount = 0; icount < 24; icount++) { str = str + str; } printStatus(str.length); var x = new XML('' + str + ''); } catch(ex) { print(ex + ''); } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/regress-324688.js0000644000175000017500000000676411545150464021375 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Nickolay Ponomarev * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = 'No Syntax Error when trailing space and XML.ignoreWhitespace ' + 'true'; var BUGNUMBER = 324688; var actual = 'No Error'; var expect = 'No Error'; START(summary); function init() { if (typeof Components != 'undefined') { try { netscape.security.PrivilegeManager. enablePrivilege('UniversalXPConnect'); var TestObject = { observe: function () { try { printBugNumber(BUGNUMBER); printStatus (summary); printStatus('Browser only: requires UniversalXPConnect'); printStatus("XML.ignoreWhitespace=" + XML.ignoreWhitespace); var x = new XML("
        "); } catch(ex2) { actual = ex2 + ''; } print('expect = ' + expect); print('actual = ' + actual); TEST(1, expect, actual); END(); gDelayTestDriverEnd = false; jsTestDriverEnd(); } }; var t = Components.classes["@mozilla.org/timer;1"]. createInstance(Components.interfaces.nsITimer); t.init(TestObject, 100, t.TYPE_ONE_SHOT); } catch(ex) { printStatus('Requires UniversalXPConnect'); } } } if (typeof window != 'undefined') { // delay test driver end gDelayTestDriverEnd = true; window.addEventListener("load", init, false); } else { TEST(1, expect, actual); END(); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/regress-336921.js0000644000175000017500000000431411545150464021353 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Joey Minta * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var summary = '13.4.4.3 - XML.prototype.appendChild creates undesired
        '; var BUGNUMBER = 336921; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); // test here var array = ["a","b","c"]; var myDiv =
        ; for each (a in array) { myDiv.appendChild(a); myDiv.appendChild(
        ); } actual = myDiv.toXMLString(); expect = '
        \n a\n
        \n b\n
        \n c\n
        \n
        '; TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/regress-376773.js0000644000175000017500000005045711545150464021375 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 376773; var summary = 'xmlsimple.stringmethod === xmlsimple.function::stringmethod'; var actual = ''; var expect = ''; var actualcall = ''; var expectcall = ''; printBugNumber(BUGNUMBER); START(summary); var nTest = 0; var xml = TEXT; // -------------------------------------------------------------- String.prototype.orig_toString = String.prototype.toString; String.prototype.toString = function() { actualcall = 'String.prototype.toString called'; return this.orig_toString(); }; expect = 'TEXT'; expectcall = 'String.prototype.toString not called'; actualcall = expectcall; actual = xml.toString(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::toString(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::toString.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toString = String.prototype.orig_toString; delete String.prototype.orig_toString; // -------------------------------------------------------------- String.prototype.orig_toSource = String.prototype.toSource; String.prototype.toSource = function() { actualcall = 'String.prototype.toSource called'; return this.orig_toSource(); }; expect = 'TEXT'; expectcall = 'String.prototype.toSource not called'; actualcall = expectcall; actual = xml.toSource(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::toSource(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::toSource.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toSource = String.prototype.orig_toSource; delete String.prototype.orig_toSource; // -------------------------------------------------------------- String.prototype.orig_valueOf = String.prototype.valueOf; String.prototype.valueOf = function() { actualcall = 'String.prototype.valueOf called'; return this.orig_valueOf(); }; expect = 'TEXT'; expectcall = 'String.prototype.valueOf not called'; actualcall = expectcall; actual = xml.valueOf(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::valueOf(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::valueOf.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.valueOf = String.prototype.orig_valueOf; delete String.prototype.orig_valueOf; // -------------------------------------------------------------- String.prototype.orig_charAt = String.prototype.charAt; String.prototype.charAt = function(pos) { actualcall = 'String.prototype.charAt called'; return this.orig_charAt(pos); }; expect = 'T'; expectcall = 'String.prototype.charAt called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.charAt(0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::charAt(0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::charAt.call(xml, 0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.charAt = String.prototype.orig_charAt; delete String.prototype.orig_charAt; // -------------------------------------------------------------- String.prototype.orig_charCodeAt = String.prototype.charCodeAt; String.prototype.charCodeAt = function(pos) { actualcall = 'String.prototype.charCodeAt called'; return this.orig_charCodeAt(pos); }; expect = 84; expectcall = 'String.prototype.charCodeAt called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.charCodeAt(0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::charCodeAt(0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::charCodeAt.call(xml, 0); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.charCodeAt = String.prototype.orig_charCodeAt; delete String.prototype.orig_charCodeAt; // -------------------------------------------------------------- String.prototype.orig_concat = String.prototype.concat; String.prototype.concat = function(string1) { actualcall = 'String.prototype.concat called'; return this.orig_concat(string1); }; expect = 'TEXTtext'; expectcall = 'String.prototype.concat called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.concat(text); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::concat(text); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::concat.call(xml, text); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.concat = String.prototype.orig_concat; delete String.prototype.orig_concat; // -------------------------------------------------------------- String.prototype.orig_indexOf = String.prototype.indexOf; String.prototype.indexOf = function(searchString, position) { actualcall = 'String.prototype.indexOf called'; return this.orig_indexOf(searchString, position); }; expect = 0; expectcall = 'String.prototype.indexOf called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.indexOf('T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::indexOf('T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::indexOf.call(xml, 'T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.indexOf = String.prototype.orig_indexOf; delete String.prototype.orig_indexOf; // -------------------------------------------------------------- String.prototype.orig_lastIndexOf = String.prototype.lastIndexOf; String.prototype.lastIndexOf = function(searchString, position) { actualcall = 'String.prototype.lastIndexOf called'; return this.orig_lastIndexOf(searchString, position); }; expect = 3; expectcall = 'String.prototype.lastIndexOf called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.lastIndexOf('T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::lastIndexOf('T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::lastIndexOf.call(xml, 'T'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.lastIndexOf = String.prototype.orig_lastIndexOf; delete String.prototype.orig_lastIndexOf; // -------------------------------------------------------------- String.prototype.orig_localeCompare = String.prototype.localeCompare; String.prototype.localeCompare = function(that) { actualcall = 'String.prototype.localeCompare called'; return this.orig_localeCompare(that); }; expect = 0; expectcall = 'String.prototype.localeCompare called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.localeCompare(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::localeCompare(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::localeCompare.call(xml, xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.localeCompare = String.prototype.orig_localeCompare; delete String.prototype.orig_localeCompare; // -------------------------------------------------------------- String.prototype.orig_match = String.prototype.match; String.prototype.match = function(regexp) { actualcall = 'String.prototype.match called'; return this.orig_match(regexp); }; expect = ['TEXT']; expectcall = 'String.prototype.match called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.match(/TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::match(/TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.replace(/called/, 'not called'); actual = xml.function::match.call(xml, /TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.match = String.prototype.orig_match; delete String.prototype.orig_match; // -------------------------------------------------------------- String.prototype.orig_replace = String.prototype.replace; String.prototype.replace = function(searchValue, replaceValue) { actualcall = 'String.prototype.replace called'; return this.orig_replace(searchValue, replaceValue); }; expect = 'TEXT'; expectcall = 'String.prototype.replace not called'; actualcall = expectcall; actual = xml.replace(/EXT/, 'ext'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::replace(/EXT/, 'ext'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall; actual = xml.function::replace.call(xml, /EXT/, 'ext'); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.replace = String.prototype.orig_replace; delete String.prototype.orig_replace; // -------------------------------------------------------------- String.prototype.orig_search = String.prototype.search; String.prototype.search = function(regexp) { actualcall = 'String.prototype.search called'; return this.orig_search(regexp); }; expect = 0; expectcall = 'String.prototype.search called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.search(/TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.search(/called/, 'not called'); actual = xml.function::search(/TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.search(/called/, 'not called'); actual = xml.function::search.call(xml, /TEXT/); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.search = String.prototype.orig_search; delete String.prototype.orig_search; // -------------------------------------------------------------- String.prototype.orig_slice = String.prototype.slice; String.prototype.slice = function(start, end) { actualcall = 'String.prototype.slice called'; return this.orig_slice(start, end); }; expect = ''; expectcall = 'String.prototype.slice called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.slice(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.slice(/called/, 'not called'); actual = xml.function::slice(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.slice(/called/, 'not called'); actual = xml.function::slice.call(xml, 1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.slice = String.prototype.orig_slice; delete String.prototype.orig_slice; // -------------------------------------------------------------- String.prototype.orig_split = String.prototype.split; String.prototype.split = function(separator, limit) { actualcall = 'String.prototype.split called'; return this.orig_split(separator, limit); }; expect = ['T', 'E', 'X', 'T']; expectcall = 'String.prototype.split called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.split(''); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.split(/called/, 'not called'); actual = xml.function::split(''); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.split(/called/, 'not called'); actual = xml.function::split.call(xml, ''); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.split = String.prototype.orig_split; delete String.prototype.orig_split; // -------------------------------------------------------------- String.prototype.orig_substr = String.prototype.substr; String.prototype.substr = function(start, length) { actualcall = 'String.prototype.substr called'; return this.orig_substr(start, length); }; expect = 'E'; expectcall = 'String.prototype.substr called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.substr(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.substr(/called/, 'not called'); actual = xml.function::substr(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.substr(/called/, 'not called'); actual = xml.function::substr.call(xml, 1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.substr = String.prototype.orig_substr; delete String.prototype.orig_substr; // -------------------------------------------------------------- String.prototype.orig_substring = String.prototype.substring; String.prototype.substring = function(start, end) { actualcall = 'String.prototype.substring called'; return this.orig_substring(start, end); }; expect = ''; expectcall = 'String.prototype.substring called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.substring(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.substring(/called/, 'not called'); actual = xml.function::substring(1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.substring(/called/, 'not called'); actual = xml.function::substring.call(xml, 1,1); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.substring = String.prototype.orig_substring; delete String.prototype.orig_substring; // -------------------------------------------------------------- String.prototype.orig_toLowerCase = String.prototype.toLowerCase; String.prototype.toLowerCase = function() { actualcall = 'String.prototype.toLowerCase called'; return this.orig_toLowerCase(); }; expect = 'text'; expectcall = 'String.prototype.toLowerCase called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.toLowerCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLowerCase(/called/, 'not called'); actual = xml.function::toLowerCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLowerCase(/called/, 'not called'); actual = xml.function::toLowerCase.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toLowerCase = String.prototype.orig_toLowerCase; delete String.prototype.orig_toLowerCase; // -------------------------------------------------------------- String.prototype.orig_toLocaleLowerCase = String.prototype.toLocaleLowerCase; String.prototype.toLocaleLowerCase = function() { actualcall = 'String.prototype.toLocaleLowerCase called'; return this.orig_toLocaleLowerCase(); }; expect = 'text'; expectcall = 'String.prototype.toLocaleLowerCase called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.toLocaleLowerCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLocaleLowerCase(/called/, 'not called'); actual = xml.function::toLocaleLowerCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLocaleLowerCase(/called/, 'not called'); actual = xml.function::toLocaleLowerCase.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toLocaleLowerCase = String.prototype.orig_toLocaleLowerCase; delete String.prototype.orig_toLocaleLowerCase; // -------------------------------------------------------------- String.prototype.orig_toUpperCase = String.prototype.toUpperCase; String.prototype.toUpperCase = function() { actualcall = 'String.prototype.toUpperCase called'; return this.orig_toUpperCase(); }; expect = 'TEXT'; expectcall = 'String.prototype.toUpperCase called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.toUpperCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toUpperCase(/called/, 'not called'); actual = xml.function::toUpperCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toUpperCase(/called/, 'not called'); actual = xml.function::toUpperCase.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toUpperCase = String.prototype.orig_toUpperCase; delete String.prototype.orig_toUpperCase; // -------------------------------------------------------------- String.prototype.orig_toLocaleUpperCase = String.prototype.toLocaleUpperCase; String.prototype.toLocaleUpperCase = function() { actualcall = 'String.prototype.toLocaleUpperCase called'; return this.orig_toLocaleUpperCase(); }; expect = 'TEXT'; expectcall = 'String.prototype.toLocaleUpperCase called'; actualcall = expectcall.replace(/called/, 'not called'); actual = xml.toLocaleUpperCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLocaleUpperCase(/called/, 'not called'); actual = xml.function::toLocaleUpperCase(); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); actualcall = expectcall.toLocaleUpperCase(/called/, 'not called'); actual = xml.function::toLocaleUpperCase.call(xml); TEST(++nTest, expectcall + ':' + expect, actualcall + ':' + actual); String.prototype.toLocaleUpperCase = String.prototype.orig_toLocaleUpperCase; delete String.prototype.orig_toLocaleUpperCase; var l = <>text; expect = 't'; actual = l.function::charAt.call(l, 0); TEST(++nTest, expect, actual); expect = 't'; with (l) actual = function::charAt(0); TEST(++nTest, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/regress-621464.js0000644000175000017500000000373011545150464021353 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Andrew Drake * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 621464; var summary = 'a.replace() == a'; printBugNumber(BUGNUMBER); START(summary); var expected = a; var actual = a.replace(); TEST(0, expected, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XML/shell.js0000644000175000017500000000000011545150464020227 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.1.js0000644000175000017500000000562711545150464020525 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.1 - XMLList Constructor as Function"); x = XMLList(); TEST(1, "xml", typeof(x)); TEST(2, true, x instanceof XMLList); // Make sure it's not copied if it's an XMLList x = <> one two ; y = XMLList(x); TEST(3, x === y, true); x += three; TEST(4, x === y, false); // Load from one XML type x = XMLList(one); TEST_XML(5, "one", x); // Load from Anonymous x = XMLList(<>onetwo); correct = new XMLList(); correct += one; correct += two; TEST_XML(6, correct.toString(), x); // Load from Anonymous as string x = XMLList(<>onetwo); correct = new XMLList(); correct += one; correct += two; TEST_XML(7, correct.toString(), x); // Load from single textnode x = XMLList("foobar"); TEST_XML(8, "foobar", x); x = XMLList(7); TEST_XML(9, "7", x); // Undefined and null should behave like "" x = XMLList(null); TEST_XML(10, "", x); x = XMLList(undefined); TEST_XML(11, "", x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.2.js0000644000175000017500000000554011545150464020520 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.2 - XMLList Constructor"); x = new XMLList(); TEST(1, "xml", typeof(x)); TEST(2, true, x instanceof XMLList); // Load from another XMLList // Make sure it is copied if it's an XMLList x = <> one two ; y = new XMLList(x); x += three; TEST(3, "one\ntwo", y.toString()); // Load from one XML type x = new XMLList(one); TEST_XML(4, "one", x); // Load from Anonymous x = new XMLList(<>onetwo); TEST(5, "one\ntwo", x.toString()); // Load from Anonymous as string x = new XMLList(<>onetwo); TEST(6, "one\ntwo", x.toString()); // Load from single textnode x = new XMLList("foobar"); TEST_XML(7, "foobar", x); x = XMLList(7); TEST_XML(8, 7, x); // Undefined and null should behave like "" x = new XMLList(null); TEST_XML(9, "", x); x = new XMLList(undefined); TEST_XML(10, "", x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.10.js0000644000175000017500000000362311545150464020741 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.10 - XMLList elements()"); TEST(1, true, XMLList.prototype.hasOwnProperty("elements")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.11.js0000644000175000017500000000503011545150464020734 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.11 - XMLList hasOwnProperty()"); TEST(1, true, XMLList.prototype.hasOwnProperty("hasOwnProperty")); x = <> one two three four five ; // Returns true for elements/attributes TEST(2, true, x.hasOwnProperty("bravo")); TEST(3, true, x.hasOwnProperty("@attr1")); TEST(4, false, x.hasOwnProperty("foobar")); TEST(5, true, x.hasOwnProperty("echo")); // Test for XML Prototype Object - returns true for XML methods. TEST(5, true, XMLList.prototype.hasOwnProperty("toString")); TEST(6, false, XMLList.prototype.hasOwnProperty("foobar")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.12.js0000644000175000017500000000615011545150464020741 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.12 - XMLList hasComplexContent()"); TEST(1, true, XMLList.prototype.hasOwnProperty("hasComplexContent")); // One element should be same as XML case x = <> one two three four five six seven ; ; TEST(2, true, x.hasComplexContent()); TEST(3, false, x.bravo.hasComplexContent()); TEST(4, true, x.charlie.hasComplexContent()); TEST(5, false, x.delta.hasComplexContent()); TEST(6, false, x.foxtrot.hasComplexContent()); TEST(7, false, x.golf.hasComplexContent()); TEST(8, false, x.hotel.hasComplexContent()); TEST(9, false, x.@attr1.hasComplexContent()); TEST(10, false, x.bravo.child(0).hasComplexContent()); TEST(11, true, x.india.hasComplexContent()); // More than one element is complex if one or more things in the list are elements. x = <> one two ; TEST(12, true, x.hasComplexContent()); x = one one ; TEST(13, true, x.*.hasComplexContent()); x = one ; TEST(14, false, x.@*.hasComplexContent()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.13.js0000644000175000017500000000612411545150464020743 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.13 - XMLList hasSimpleContent()"); TEST(1, true, XMLList.prototype.hasOwnProperty("hasSimpleContent")); // One element should be same as XML case x = <> one two three four five six seven ; ; TEST(2, false, x.hasSimpleContent()); TEST(3, true, x.bravo.hasSimpleContent()); TEST(4, false, x.charlie.hasSimpleContent()); TEST(5, true, x.delta.hasSimpleContent()); TEST(6, true, x.foxtrot.hasSimpleContent()); TEST(7, true, x.golf.hasSimpleContent()); TEST(8, true, x.hotel.hasSimpleContent()); TEST(9, true, x.@attr1.hasSimpleContent()); TEST(10, true, x.bravo.child(0).hasSimpleContent()); TEST(11, false, x.india.hasSimpleContent()); // More than one element is complex if one or more things in the list are elements. x = <> one two ; TEST(12, false, x.hasSimpleContent()); x = one one ; TEST(13, false, x.*.hasSimpleContent()); x = one ; TEST(14, true, x.@*.hasSimpleContent()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.14.js0000644000175000017500000000462711545150464020752 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.14 - XMLList length()"); TEST(1, true, XMLList.prototype.hasOwnProperty("length")); x = <>one; TEST(2, 1, x.length()); x = <>onetwo; TEST(2, 2, x.length()); emps = John Sue correct = Mr. John Sue TEST(3,2,emps..name.length()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.15.js0000644000175000017500000000366311545150464020752 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.15 - XMLList normalize()"); TEST(1, true, XMLList.prototype.hasOwnProperty("normalize")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.16.js0000644000175000017500000000472011545150464020746 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.16 - XMLList parent()"); TEST(1, true, XMLList.prototype.hasOwnProperty("parent")); // Empty should return undefined x = new XMLList(); TEST(2, undefined, x.parent()); // If all XMLList items have same parent, then return that parent. x = one two threefour ; y = new XMLList(); y += x.bravo; y += x.charlie; TEST(3, x, y.parent()); // If items have different parents then return undefined y = new XMLList(); y += x.bravo; y += x.bravo.charlie; TEST(4, undefined, y.parent()); y = x..charlie; TEST(5, undefined, y.parent()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.17.js0000644000175000017500000000371511545150464020752 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.17 - XMLList processingInstructions()"); TEST(1, true, XMLList.prototype.hasOwnProperty("processingInstructions")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.18.js0000644000175000017500000000371111545150464020747 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.18 - XMLList propertyIsEnumerable()"); TEST(1, true, XMLList.prototype.hasOwnProperty("propertyIsEnumerable")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.19.js0000644000175000017500000000365111545150464020753 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.19 - XMLList text()"); TEST(1, true, XMLList.prototype.hasOwnProperty("text")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.2.js0000644000175000017500000000552511545150464020665 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.2 - XMLList attribute()"); TEST(1, true, XMLList.prototype.hasOwnProperty("attribute")); // Test with list of size 0 emps = new XMLList(); TEST(2, "xml", typeof(emps.attribute("id"))); TEST_XML(3, "", emps.attribute("id")); // Test with list of size 1 emps += Jim25; TEST(4, "xml", typeof(emps.attribute("id"))); TEST_XML(5, 0, emps.attribute("id")); // Test with list of size > 1 emps += Joe20; TEST(6, "xml", typeof(emps.attribute("id"))); correct = new XMLList(); correct += new XML("0"); correct += new XML("1"); TEST(7, correct, emps.attribute("id")); // Test one that doesn't exist - should return empty XMLList TEST(8, "xml", typeof(emps.attribute("foobar"))); // Test args of null and undefined try { emps.attribute(null); SHOULD_THROW(9); } catch (ex) { TEST(9, "TypeError", ex.name); } try { emps.attribute(undefined); SHOULD_THROW(10); } catch (ex) { TEST(10, "TypeError", ex.name); } END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.20.js0000644000175000017500000000414311545150464020740 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.20 - XMLList toString()"); TEST(1, true, XMLList.prototype.hasOwnProperty("toString")); x = <>one; TEST(2, "one", x.toString()); x = <>onetwo; TEST(3, "one\ntwo", x.toString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.21.js0000644000175000017500000000417611545150464020747 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.21 - XMLList toXMLString()"); TEST(1, true, XMLList.prototype.hasOwnProperty("toXMLString")); x = <>one; TEST(2, "one", x.toXMLString()); x = <>onetwo; TEST(3, "one\ntwo", x.toXMLString()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.22.js0000644000175000017500000000366311545150464020750 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.22 - XMLList valueOf()"); TEST(1, true, XMLList.prototype.hasOwnProperty("valueOf")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.3.js0000644000175000017500000000513311545150464020661 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.3 - XMLList attributes()"); TEST(1, true, XMLList.prototype.hasOwnProperty("attributes")); // Test with XMLList of size 0 x = new XMLList() TEST(2, "xml", typeof(x.attributes())); TEST_XML(3, "", x.attributes()); // Test with XMLList of size 1 x += one; TEST(4, "xml", typeof(x.attributes())); correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); TEST(5, correct, x.attributes()); // Test with XMLList of size > 1 x += two; TEST(6, "xml", typeof(x.attributes())); correct = new XMLList(); correct += new XML("value1"); correct += new XML("value2"); correct += new XML("value3"); correct += new XML("value4"); TEST(7, correct, x.attributes()); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.4.js0000644000175000017500000000543011545150464020662 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.4 - XMLList child()"); TEST(1, true, XMLList.prototype.hasOwnProperty("child")); // Test with XMLList of size 0 x = new XMLList() TEST(2, "xml", typeof(x.child("bravo"))); TEST_XML(3, "", x.child("bravo")); // Test with XMLList of size 1 x += onetwo; TEST(4, "xml", typeof(x.child("bravo"))); TEST_XML(5, "two", x.child("bravo")); x += three; TEST(6, "xml", typeof(x.child("bravo"))); correct = <>twothree; TEST(7, correct, x.child("bravo")); // Test no match, null and undefined TEST(8, "xml", typeof(x.child("foobar"))); TEST_XML(9, "", x.child("foobar")); try { x.child(null); SHOULD_THROW(10); } catch (ex) { TEST(10, "TypeError", ex.name); } // Test numeric inputs x = one two ; TEST(12, one, x.child(0)); TEST(13, two, x.child(1)); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.5.js0000644000175000017500000000605311545150464020665 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.5 - XMLList children()"); TEST(1, true, XMLList.prototype.hasOwnProperty("children")); // Test with XMLList of size 0 x = new XMLList() TEST(2, "xml", typeof(x.children())); TEST_XML(3, "", x.children()); // Test with XMLList of size 1 x += onetwo; TEST(4, "xml", typeof(x.children())); correct = <>onetwo; TEST(5, correct, x.children()); // Test with XMLList of size > 1 x += three; TEST(6, "xml", typeof(x.children())); correct = <>onetwothree; TEST(7, correct, x.children()); // Test no children x = new XMLList(); x += ; x += ; TEST(8, "xml", typeof(x.children())); TEST_XML(9, "", x.children()); //get all grandchildren of the order that have the name price order = John Smith Big Screen Television 1299.99 DVD Player 399.99 ; correct= 1299.99 + 399.99; TEST(10, correct, order.children().price); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.6.js0000644000175000017500000000366011545150464020667 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.6 - XMLList comments()"); TEST(1, true, XMLList.prototype.hasOwnProperty("comments")); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.7.js0000644000175000017500000000455711545150464020676 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.7 - XMLList contains()"); TEST(1, true, XMLList.prototype.hasOwnProperty("contains")); emps = Jim25 Joe20 ; TEST(2, true, emps.employee.contains(Jim25)); TEST(3, true, emps.employee.contains(Joe20)); TEST(4, false, emps.employee.contains(Joe20)); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.8.js0000644000175000017500000000541611545150464020672 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.8 - XMLList copy()"); TEST(1, true, XMLList.prototype.hasOwnProperty("copy")); emps = new XMLList(); emps += Jim25; emps += Joe20; correct = new XMLList(); correct += Jim25; correct += Joe20; TEST(2, emps, emps.copy()); TEST(3, correct, emps.copy()); // Make sure we're getting a copy, not a ref to orig. emps = new XMLList(); emps += Jim25; emps += Joe20; correct = new XMLList(); correct += Jim25; correct += Joe20; x = emps.copy(); emps += Sue32; TEST(4, correct, x); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/13.5.4.9.js0000644000175000017500000000512711545150464020672 0ustar chr1schr1s/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Rhino code, released * May 6, 1999. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1997-2000 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Igor Bukanov * Ethan Hugg * Milen Nankov * Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ START("13.5.4.9 - XMLList descendants()"); TEST(1, true, XMLList.prototype.hasOwnProperty("descendants")); // From Martin Honnen var gods = Kibo Xibo ; var godList = gods.god; var expect; var actual; var node; var descendants = godList.descendants(); expect = 4; actual = descendants.length(); TEST(2, expect, actual) expect = 'nodeKind(): element, name(): name;\n' + 'nodeKind(): text, name(): null;\n' + 'nodeKind(): element, name(): name;\n' + 'nodeKind(): text, name(): null;\n'; actual = ''; for each (var xml in descendants) { actual += 'nodeKind(): ' + xml.nodeKind() + ', name(): ' + xml.name() + ';\n'; } TEST(4, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/browser.js0000644000175000017500000000000011545150464021437 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/jstests.list0000644000175000017500000000101111545150464022015 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=e4x/XMLList/ script 13.5.1.js script 13.5.2.js script 13.5.4.10.js script 13.5.4.11.js script 13.5.4.12.js script 13.5.4.13.js script 13.5.4.14.js script 13.5.4.15.js script 13.5.4.16.js script 13.5.4.17.js script 13.5.4.18.js script 13.5.4.19.js script 13.5.4.2.js script 13.5.4.20.js script 13.5.4.21.js script 13.5.4.22.js script 13.5.4.3.js script 13.5.4.4.js script 13.5.4.5.js script 13.5.4.6.js script 13.5.4.7.js script 13.5.4.8.js script 13.5.4.9.js script regress-373072.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/regress-373072.js0000644000175000017500000000422111545150464022202 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 373072; var summary = 'XML.prototype.namespace() does not check for xml list'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); START(summary); try { expect = "TypeError: can't call namespace method on an XML list with 0 elements"; XML.prototype.function::namespace.call(new XMLList()); } catch(ex) { actual = ex + ''; } TEST(1, expect, actual); END(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/e4x/XMLList/shell.js0000644000175000017500000000000011545150464021063 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4-1.js0000644000175000017500000001201511545150464020501 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4-1.js ECMA Section: 15.4 Array Objects Description: Every Array object has a length property whose value is always an integer with positive sign and less than Math.pow(2,32). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array Objects"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length", (Math.pow(2,32)-1), eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length", (Math.pow(2,32)-2), eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length", (Math.pow(2,31)-1), eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length", (Math.pow(2,31)), eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length", (Math.pow(2,31)+1), eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]", "hi", eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]") ); new TestCase(SECTION, "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length", (Math.pow(2,30)-1), eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4-2.js0000644000175000017500000001115411545150464020505 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4-2.js ECMA Section: 15.4 Array Objects Description: Whenever a property is added whose name is an array index, the length property is changed, if necessary, to be one more than the numeric value of that array index; and whenever the length property is changed, every property whose name is an array index whose value is not smaller than the new length is automatically deleted. This constraint applies only to the Array object itself, and is unaffected by length or array index properties that may be inherited from its prototype. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.4-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array Objects"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length", Math.pow(2,16)+1, eval("var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length", Math.pow(2,30)-1, eval("var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length", Math.pow(2,30), eval("var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length", Math.pow(2,30)+1, eval("var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length", Math.pow(2,31)-1, eval("var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length", Math.pow(2,31), eval("var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length", Math.pow(2,31)+1, eval("var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length") ); new TestCase( SECTION, "var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)", "0,1", eval("var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)") ); new TestCase( SECTION, "var arr = new Array(0,1); arr.length = 3; String(arr)", "0,1,", eval("var arr = new Array(0,1); arr.length = 3; String(arr)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.1.1.js0000644000175000017500000000734311545150464020651 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.1.1.js ECMA Section: 15.4.1 Array( item0, item1,... ) Description: When Array is called as a function rather than as a constructor, it creates and initializes a new array object. Thus, the function call Array(...) is equivalent to the object creation new Array(...) with the same arguments. An array is created and returned as if by the expression new Array( item0, item1, ... ). Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.1.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof Array(1,2)", "object", typeof Array(1,2) ); new TestCase( SECTION, "(Array(1,2)).toString", Array.prototype.toString, (Array(1,2)).toString ); new TestCase( SECTION, "var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()", "[object Array]", eval("var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()") ); new TestCase( SECTION, "(Array(1,2)).length", 2, (Array(1,2)).length ); new TestCase( SECTION, "var arr = (Array(1,2)); arr[0]", 1, eval("var arr = (Array(1,2)); arr[0]") ); new TestCase( SECTION, "var arr = (Array(1,2)); arr[1]", 2, eval("var arr = (Array(1,2)); arr[1]") ); new TestCase( SECTION, "var arr = (Array(1,2)); String(arr)", "1,2", eval("var arr = (Array(1,2)); String(arr)") ); test(); function ToUint32( n ) { n = Number( n ); if( isNaN(n) || n == 0 || n == Number.POSITIVE_INFINITY || n == Number.NEGATIVE_INFINITY ) { return 0; } var sign = n < 0 ? -1 : 1; return ( sign * ( n * Math.floor( Math.abs(n) ) ) ) % Math.pow(2, 32); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.1.2.js0000644000175000017500000001165611545150464020654 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.1.2.js ECMA Section: 15.4.1.2 Array(len) Description: When Array is called as a function rather than as a constructor, it creates and initializes a new array object. Thus, the function call Array(...) is equivalent to the object creationi new Array(...) with the same arguments. An array is created and returned as if by the expression new Array(len). Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.1.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array Constructor Called as a Function: Array(len)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(Array()).length", 0, (Array()).length ); new TestCase( SECTION, "(Array(0)).length", 0, (Array(0)).length ); new TestCase( SECTION, "(Array(1)).length", 1, (Array(1)).length ); new TestCase( SECTION, "(Array(10)).length", 10, (Array(10)).length ); new TestCase( SECTION, "(Array('1')).length", 1, (Array('1')).length ); new TestCase( SECTION, "(Array(1000)).length", 1000, (Array(1000)).length ); new TestCase( SECTION, "(Array('1000')).length", 1, (Array('1000')).length ); new TestCase( SECTION, "(Array(4294967295)).length", ToUint32(4294967295), (Array(4294967295)).length ); new TestCase( SECTION, "(Array(Math.pow(2,31)-1)).length", ToUint32(Math.pow(2,31)-1), (Array(Math.pow(2,31)-1)).length ); new TestCase( SECTION, "(Array(Math.pow(2,31))).length", ToUint32(Math.pow(2,31)), (Array(Math.pow(2,31))).length ); new TestCase( SECTION, "(Array(Math.pow(2,31)+1)).length", ToUint32(Math.pow(2,31)+1), (Array(Math.pow(2,31)+1)).length ); new TestCase( SECTION, "(Array('8589934592')).length", 1, (Array("8589934592")).length ); new TestCase( SECTION, "(Array('4294967296')).length", 1, (Array("4294967296")).length ); new TestCase( SECTION, "(Array(1073741823)).length", ToUint32(1073741823), (Array(1073741823)).length ); new TestCase( SECTION, "(Array(1073741824)).length", ToUint32(1073741824), (Array(1073741824)).length ); new TestCase( SECTION, "(Array('a string')).length", 1, (Array("a string")).length ); test(); function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.1.3.js0000644000175000017500000000564011545150464020651 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.1.3.js ECMA Section: 15.4.1.3 Array() Description: When Array is called as a function rather than as a constructor, it creates and initializes a new array object. Thus, the function call Array(...) is equivalent to the object creationi new Array(...) with the same arguments. An array is created and returned as if by the expression new Array(len). Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.1.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array Constructor Called as a Function: Array()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof Array()", "object", typeof Array() ); new TestCase( SECTION, "MYARR = new Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()", "[object Array]", eval("MYARR = Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()") ); new TestCase( SECTION, "(Array()).length", 0, (Array()).length ); new TestCase( SECTION, "Array().toString()", "", Array().toString() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.1.js0000644000175000017500000001032411545150464020503 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.1.js ECMA Section: 15.4.1 The Array Constructor Called as a Function Description: When Array is called as a function rather than as a constructor, it creates and initializes a new array object. Thus, the function call Array(...) is equivalent to the object creationi new Array(...) with the same arguments. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array() +''", "", Array() +"" ); new TestCase( SECTION, "typeof Array()", "object", typeof Array() ); new TestCase( SECTION, "var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()", "[object Array]", eval("var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()") ); new TestCase( SECTION, "var arr = Array(); arr.toString == Array.prototype.toString", true, eval("var arr = Array(); arr.toString == Array.prototype.toString") ); new TestCase( SECTION, "Array().length", 0, Array().length ); new TestCase( SECTION, "Array(1,2,3) +''", "1,2,3", Array(1,2,3) +"" ); new TestCase( SECTION, "typeof Array(1,2,3)", "object", typeof Array(1,2,3) ); new TestCase( SECTION, "var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()", "[object Array]", eval("var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") ); new TestCase( SECTION, "var arr = Array(1,2,3); arr.toString == Array.prototype.toString", true, eval("var arr = Array(1,2,3); arr.toString == Array.prototype.toString") ); new TestCase( SECTION, "Array(1,2,3).length", 3, Array(1,2,3).length ); new TestCase( SECTION, "typeof Array(12345)", "object", typeof Array(12345) ); new TestCase( SECTION, "var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()", "[object Array]", eval("var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()") ); new TestCase( SECTION, "var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString", true, eval("var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString") ); new TestCase( SECTION, "Array(12345).length", 12345, Array(12345).length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.2.1-1.js0000644000175000017500000000773111545150464021011 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.2.1-1.js ECMA Section: 15.4.2.1 new Array( item0, item1, ... ) Description: This description only applies of the constructor is given two or more arguments. The [[Prototype]] property of the newly constructed object is set to the original Array prototype object, the one that is the initial value of Array.prototype (15.4.3.1). The [[Class]] property of the newly constructed object is set to "Array". The length property of the newly constructed object is set to the number of arguments. The 0 property of the newly constructed object is set to item0... in general, for as many arguments as there are, the k property of the newly constructed object is set to argument k, where the first argument is considered to be argument number 0. This file tests the typeof the newly constructed object. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array( item0, item1, ...)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof new Array(1,2)", "object", typeof new Array(1,2) ); new TestCase( SECTION, "(new Array(1,2)).toString", Array.prototype.toString, (new Array(1,2)).toString ); new TestCase( SECTION, "var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()", "[object Array]", eval("var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") ); new TestCase( SECTION, "(new Array(1,2)).length", 2, (new Array(1,2)).length ); new TestCase( SECTION, "var arr = (new Array(1,2)); arr[0]", 1, eval("var arr = (new Array(1,2)); arr[0]") ); new TestCase( SECTION, "var arr = (new Array(1,2)); arr[1]", 2, eval("var arr = (new Array(1,2)); arr[1]") ); new TestCase( SECTION, "var arr = (new Array(1,2)); String(arr)", "1,2", eval("var arr = (new Array(1,2)); String(arr)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.2.1-2.js0000644000175000017500000000665411545150464021015 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.2.1-2.js ECMA Section: 15.4.2.1 new Array( item0, item1, ... ) Description: This description only applies of the constructor is given two or more arguments. The [[Prototype]] property of the newly constructed object is set to the original Array prototype object, the one that is the initial value of Array.prototype (15.4.3.1). The [[Class]] property of the newly constructed object is set to "Array". The length property of the newly constructed object is set to the number of arguments. The 0 property of the newly constructed object is set to item0... in general, for as many arguments as there are, the k property of the newly constructed object is set to argument k, where the first argument is considered to be argument number 0. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array( item0, item1, ...)"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = "new Array("; var ARGUMENTS = "" var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32); for ( var index = 0; index < TEST_LENGTH; index++ ) { ARGUMENTS += index; ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ","; } TEST_STRING += ARGUMENTS + ")"; TEST_ARRAY = eval( TEST_STRING ); for ( var item = 0; item < TEST_LENGTH; item++ ) { new TestCase( SECTION, "["+item+"]", item, TEST_ARRAY[item] ); } new TestCase( SECTION, "new Array( ["+TEST_LENGTH+" arguments] ) +''", ARGUMENTS, TEST_ARRAY +"" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.2.1-3.js0000644000175000017500000001116611545150464021010 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.2.1-3.js ECMA Section: 15.4.2.1 new Array( item0, item1, ... ) Description: This description only applies of the constructor is given two or more arguments. The [[Prototype]] property of the newly constructed object is set to the original Array prototype object, the one that is the initial value of Array.prototype (15.4.3.1). The [[Class]] property of the newly constructed object is set to "Array". The length property of the newly constructed object is set to the number of arguments. The 0 property of the newly constructed object is set to item0... in general, for as many arguments as there are, the k property of the newly constructed object is set to argument k, where the first argument is considered to be argument number 0. This test stresses the number of arguments presented to the Array constructor. Should support up to Math.pow (2,32) arguments, since that is the maximum length of an ECMAScript array. ***Change TEST_LENGTH to Math.pow(2,32) when larger array lengths are supported. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array( item0, item1, ...)"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = "new Array("; var ARGUMENTS = "" var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32); for ( var index = 0; index < TEST_LENGTH; index++ ) { ARGUMENTS += index; ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ","; } TEST_STRING += ARGUMENTS + ")"; TEST_ARRAY = eval( TEST_STRING ); for ( var item = 0; item < TEST_LENGTH; item++ ) { new TestCase( SECTION, "TEST_ARRAY["+item+"]", item, TEST_ARRAY[item] ); } new TestCase( SECTION, "new Array( ["+TEST_LENGTH+" arguments] ) +''", ARGUMENTS, TEST_ARRAY +"" ); new TestCase( SECTION, "TEST_ARRAY.toString", Array.prototype.toString, TEST_ARRAY.toString ); new TestCase( SECTION, "TEST_ARRAY.join", Array.prototype.join, TEST_ARRAY.join ); new TestCase( SECTION, "TEST_ARRAY.sort", Array.prototype.sort, TEST_ARRAY.sort ); new TestCase( SECTION, "TEST_ARRAY.reverse", Array.prototype.reverse, TEST_ARRAY.reverse ); new TestCase( SECTION, "TEST_ARRAY.length", TEST_LENGTH, TEST_ARRAY.length ); new TestCase( SECTION, "TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()", "[object Array]", eval("TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.2.2-1.js0000644000175000017500000001251311545150464021004 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.2.2-1.js ECMA Section: 15.4.2.2 new Array(len) Description: This description only applies of the constructor is given two or more arguments. The [[Prototype]] property of the newly constructed object is set to the original Array prototype object, the one that is the initial value of Array.prototype(0) (15.4.3.1). The [[Class]] property of the newly constructed object is set to "Array". If the argument len is a number, then the length property of the newly constructed object is set to ToUint32(len). If the argument len is not a number, then the length property of the newly constructed object is set to 1 and the 0 property of the newly constructed object is set to len. This file tests cases where len is a number. The cases in this test need to be updated since the ToUint32 description has changed. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array( len )"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "new Array(0)", "", (new Array(0)).toString() ); new TestCase( SECTION, "typeof new Array(0)", "object", (typeof new Array(0)) ); new TestCase( SECTION, "(new Array(0)).length", 0, (new Array(0)).length ); new TestCase( SECTION, "(new Array(0)).toString", Array.prototype.toString, (new Array(0)).toString ); new TestCase( SECTION, "new Array(1)", "", (new Array(1)).toString() ); new TestCase( SECTION, "new Array(1).length", 1, (new Array(1)).length ); new TestCase( SECTION, "(new Array(1)).toString", Array.prototype.toString, (new Array(1)).toString ); new TestCase( SECTION, "(new Array(-0)).length", 0, (new Array(-0)).length ); new TestCase( SECTION, "(new Array(0)).length", 0, (new Array(0)).length ); new TestCase( SECTION, "(new Array(10)).length", 10, (new Array(10)).length ); new TestCase( SECTION, "(new Array('1')).length", 1, (new Array('1')).length ); new TestCase( SECTION, "(new Array(1000)).length", 1000, (new Array(1000)).length ); new TestCase( SECTION, "(new Array('1000')).length", 1, (new Array('1000')).length ); new TestCase( SECTION, "(new Array(4294967295)).length", ToUint32(4294967295), (new Array(4294967295)).length ); new TestCase( SECTION, "(new Array('8589934592')).length", 1, (new Array("8589934592")).length ); new TestCase( SECTION, "(new Array('4294967296')).length", 1, (new Array("4294967296")).length ); new TestCase( SECTION, "(new Array(1073741824)).length", ToUint32(1073741824), (new Array(1073741824)).length ); test(); function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.2.2-2.js0000644000175000017500000000776111545150464021016 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.2.2-2.js ECMA Section: 15.4.2.2 new Array(len) Description: This description only applies of the constructor is given two or more arguments. The [[Prototype]] property of the newly constructed object is set to the original Array prototype object, the one that is the initial value of Array.prototype(0) (15.4.3.1). The [[Class]] property of the newly constructed object is set to "Array". If the argument len is a number, then the length property of the newly constructed object is set to ToUint32(len). If the argument len is not a number, then the length property of the newly constructed object is set to 1 and the 0 property of the newly constructed object is set to len. This file tests length of the newly constructed array when len is not a number. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array( len )"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Array(new Number(1073741823))).length", 1, (new Array(new Number(1073741823))).length ); new TestCase( SECTION, "(new Array(new Number(0))).length", 1, (new Array(new Number(0))).length ); new TestCase( SECTION, "(new Array(new Number(1000))).length", 1, (new Array(new Number(1000))).length ); new TestCase( SECTION, "(new Array('mozilla, larryzilla, curlyzilla')).length", 1, (new Array('mozilla, larryzilla, curlyzilla')).length ); new TestCase( SECTION, "(new Array(true)).length", 1, (new Array(true)).length ); new TestCase( SECTION, "(new Array(false)).length", 1, (new Array(false)).length); new TestCase( SECTION, "(new Array(new Boolean(true)).length", 1, (new Array(new Boolean(true))).length ); new TestCase( SECTION, "(new Array(new Boolean(false)).length", 1, (new Array(new Boolean(false))).length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.2.3.js0000644000175000017500000000715711545150464020657 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.2.3.js ECMA Section: 15.4.2.3 new Array() Description: The [[Prototype]] property of the newly constructed object is set to the origianl Array prototype object, the one that is the initial value of Array.prototype. The [[Class]] property of the new object is set to "Array". The length of the object is set to 0. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.2.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Array Constructor: new Array()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "new Array() +''", "", (new Array()) +"" ); new TestCase( SECTION, "typeof new Array()", "object", (typeof new Array()) ); new TestCase( SECTION, "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()", "[object Array]", eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") ); new TestCase( SECTION, "(new Array()).length", 0, (new Array()).length ); new TestCase( SECTION, "(new Array()).toString == Array.prototype.toString", true, (new Array()).toString == Array.prototype.toString ); new TestCase( SECTION, "(new Array()).join == Array.prototype.join", true, (new Array()).join == Array.prototype.join ); new TestCase( SECTION, "(new Array()).reverse == Array.prototype.reverse", true, (new Array()).reverse == Array.prototype.reverse ); new TestCase( SECTION, "(new Array()).sort == Array.prototype.sort", true, (new Array()).sort == Array.prototype.sort ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.3.1-2.js0000644000175000017500000000554511545150464021014 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.3.1-1.js ECMA Section: 15.4.3.1 Array.prototype Description: The initial value of Array.prototype is the built-in Array prototype object (15.4.4). Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.3.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); var ARRAY_PROTO = Array.prototype; new TestCase( SECTION, "var props = ''; for ( p in Array ) { props += p } props", "", eval("var props = ''; for ( p in Array ) { props += p } props") ); new TestCase( SECTION, "Array.prototype = null; Array.prototype", ARRAY_PROTO, eval("Array.prototype = null; Array.prototype") ); new TestCase( SECTION, "delete Array.prototype", false, delete Array.prototype ); new TestCase( SECTION, "delete Array.prototype; Array.prototype", ARRAY_PROTO, eval("delete Array.prototype; Array.prototype") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.3.2.js0000644000175000017500000000435311545150464020652 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.3.2.js ECMA Section: 15.4.3.2 Array.length Description: The length property is 1. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.3.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.length"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array.length", 1, Array.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.4.1.js0000644000175000017500000000455611545150464020657 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.4.1.js ECMA Section: 15.4.4.1 Array.prototype.constructor Description: The initial value of Array.prototype.constructor is the built-in Array constructor. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype.constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array.prototype.constructor == Array", true, Array.prototype.constructor == Array); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.4.2.js0000644000175000017500000000727611545150464020662 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.4.2.js ECMA Section: 15.4.4.2 Array.prototype.toString() Description: The elements of this object are converted to strings and these strings are then concatenated, separated by comma characters. The result is the same as if the built-in join method were invoiked for this object with no argument. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.4.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array.prototype.toString.length", 0, Array.prototype.toString.length ); new TestCase( SECTION, "(new Array()).toString()", "", (new Array()).toString() ); new TestCase( SECTION, "(new Array(2)).toString()", ",", (new Array(2)).toString() ); new TestCase( SECTION, "(new Array(0,1)).toString()", "0,1", (new Array(0,1)).toString() ); new TestCase( SECTION, "(new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString()", "NaN,Infinity,-Infinity", (new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString() ); new TestCase( SECTION, "(new Array( Boolean(1), Boolean(0))).toString()", "true,false", (new Array(Boolean(1),Boolean(0))).toString() ); new TestCase( SECTION, "(new Array(void 0,null)).toString()", ",", (new Array(void 0,null)).toString() ); var EXPECT_STRING = ""; var MYARR = new Array(); for ( var i = -50; i < 50; i+= 0.25 ) { MYARR[MYARR.length] = i; EXPECT_STRING += i +","; } EXPECT_STRING = EXPECT_STRING.substring( 0, EXPECT_STRING.length -1 ); new TestCase( SECTION, "MYARR.toString()", EXPECT_STRING, MYARR.toString() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.4.3-1.js0000644000175000017500000001524711545150464021016 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.4.3-1.js ECMA Section: 15.4.4.3-1 Array.prototype.join() Description: The elements of this object are converted to strings and these strings are then concatenated, separated by comma characters. The result is the same as if the built-in join method were invoiked for this object with no argument. Author: christine@netscape.com, pschwartau@netscape.com Date: 07 October 1997 Modified: 14 July 2002 Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155285 ECMA-262 Ed.3 Section 15.4.4.5 Array.prototype.join() Step 3: If |separator| is |undefined|, let |separator| be the single-character string "," * */ var SECTION = "15.4.4.3-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Array.prototype.join()"); var ARR_PROTOTYPE = Array.prototype; new TestCase( SECTION, "Array.prototype.join.length", 1, Array.prototype.join.length ); new TestCase( SECTION, "delete Array.prototype.join.length", false, delete Array.prototype.join.length ); new TestCase( SECTION, "delete Array.prototype.join.length; Array.prototype.join.length", 1, eval("delete Array.prototype.join.length; Array.prototype.join.length") ); // case where array length is 0 new TestCase( SECTION, "var TEST_ARRAY = new Array(); TEST_ARRAY.join()", "", eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join()") ); // array length is 0, but spearator is specified new TestCase( SECTION, "var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')", "", eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')") ); // length is greater than 0, separator is supplied new TestCase( SECTION, "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')", "&&true&false&123&[object Object]&true", eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')") ); // length is greater than 0, separator is empty string new TestCase( SECTION, "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')", "truefalse123[object Object]true", eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')") ); // length is greater than 0, separator is undefined new TestCase( SECTION, "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)", ",,true,false,123,[object Object],true", eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)") ); // length is greater than 0, separator is not supplied new TestCase( SECTION, "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()", ",,true,false,123,[object Object],true", eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()") ); // separator is a control character new TestCase( SECTION, "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')", decodeURIComponent("%0B%0Btrue%0Bfalse%0B123%0B[object Object]%0Btrue"), eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')") ); // length of array is 1 new TestCase( SECTION, "var TEST_ARRAY = new Array(true) ); TEST_ARRAY.join('\v')", "true", eval("var TEST_ARRAY = new Array(true); TEST_ARRAY.join('\v')") ); SEPARATOR = "\t" TEST_LENGTH = 100; TEST_STRING = ""; ARGUMENTS = ""; TEST_RESULT = ""; for ( var index = 0; index < TEST_LENGTH; index++ ) { ARGUMENTS += index; ARGUMENTS += ( index == TEST_LENGTH -1 ) ? "" : ","; TEST_RESULT += index; TEST_RESULT += ( index == TEST_LENGTH -1 ) ? "" : SEPARATOR; } TEST_ARRAY = eval( "new Array( "+ARGUMENTS +")" ); new TestCase( SECTION, "TEST_ARRAY.join("+SEPARATOR+")", TEST_RESULT, TEST_ARRAY.join( SEPARATOR ) ); new TestCase( SECTION, "(new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join()", "true,false,,,1e+21,1e-7", (new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join() ); // this is not an Array object new TestCase( SECTION, "var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')", "true:false:111:0.5:1230000:NaN::", eval("var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')") ); test(); function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = eval(this.array[i]); } this.join = Array.prototype.join; this.getClass = Object.prototype.toString; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.4.4-1.js0000644000175000017500000002103511545150464021007 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.4.3-1.js ECMA Section: 15.4.4.3-1 Array.prototype.reverse() Description: The elements of the array are rearranged so as to reverse their order. This object is returned as the result of the call. 1. Call the [[Get]] method of this object with argument "length". 2. Call ToUint32(Result(1)). 3. Compute floor(Result(2)/2). 4. Let k be 0. 5. If k equals Result(3), return this object. 6. Compute Result(2)k1. 7. Call ToString(k). 8. ToString(Result(6)). 9. Call the [[Get]] method of this object with argument Result(7). 10. Call the [[Get]] method of this object with argument Result(8). 11. If this object has a property named by Result(8), go to step 12; but if this object has no property named by Result(8), then go to either step 12 or step 14, depending on the implementation. 12. Call the [[Put]] method of this object with arguments Result(7) and Result(10). 13. Go to step 15. 14. Call the [[Delete]] method on this object, providing Result(7) as the name of the property to delete. 15. If this object has a property named by Result(7), go to step 16; but if this object has no property named by Result(7), then go to either step 16 or step 18, depending on the implementation. 16. Call the [[Put]] method of this object with arguments Result(8) and Result(9). 17. Go to step 19. 18. Call the [[Delete]] method on this object, providing Result(8) as the name of the property to delete. 19. Increase k by 1. 20. Go to step 5. Note that the reverse function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the reverse function can be applied successfully to a host object is implementation dependent. Note: Array.prototype.reverse allows some flexibility in implementation regarding array indices that have not been populated. This test covers the cases in which unpopulated indices are not deleted, since the JavaScript implementation does not delete uninitialzed indices. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.4.4-1"; var VERSION = "ECMA_1"; var BUGNUMBER="123724"; startTest(); writeHeaderToLog( SECTION + " Array.prototype.reverse()"); var ARR_PROTOTYPE = Array.prototype; new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length ); new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length ); new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") ); // length of array is 0 new TestCase( SECTION, "var A = new Array(); A.reverse(); A.length", 0, eval("var A = new Array(); A.reverse(); A.length") ); // length of array is 1 var A = new Array(true); var R = Reverse(A); new TestCase( SECTION, "var A = new Array(true); A.reverse(); A.length", R.length, eval("var A = new Array(true); A.reverse(); A.length") ); CheckItems( R, A ); // length of array is 2 var S = "var A = new Array( true,false )"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); // length of array is 3 var S = "var A = new Array( true,false,null )"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); // length of array is 4 var S = "var A = new Array( true,false,null,void 0 )"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); // some array indexes have not been set var S = "var A = new Array(); A[8] = 'hi', A[3] = 'yo'"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); var OBJECT_OBJECT = new Object(); var FUNCTION_OBJECT = new Function( 'return this' ); var BOOLEAN_OBJECT = new Boolean; var DATE_OBJECT = new Date(0); var STRING_OBJECT = new String('howdy'); var NUMBER_OBJECT = new Number(Math.PI); var ARRAY_OBJECT= new Array(1000); var args = "null, void 0, Math.pow(2,32), 1.234e-32, OBJECT_OBJECT, BOOLEAN_OBJECT, FUNCTION_OBJECT, DATE_OBJECT, STRING_OBJECT,"+ "ARRAY_OBJECT, NUMBER_OBJECT, Math, true, false, 123, '90210'"; var S = "var A = new Array("+args+")"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); var limit = 1000; var args = ""; for (var i = 0; i < limit; i++ ) { args += i +""; if ( i + 1 < limit ) { args += ","; } } var S = "var A = new Array("+args+")"; eval(S); var R = Reverse(A); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); var S = "var MYOBJECT = new Object_1( \"void 0, 1, null, 2, \'\'\" )"; eval(S); var R = Reverse( A ); new TestCase( SECTION, S +"; A.reverse(); A.length", R.length, eval( S + "; A.reverse(); A.length") ); CheckItems( R, A ); test(); function CheckItems( R, A ) { for ( var i = 0; i < R.length; i++ ) { new TestCase( SECTION, "A["+i+ "]", R[i], A[i] ); } } function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = eval(this.array[i]); } this.join = Array.prototype.reverse; this.getClass = Object.prototype.toString; } function Reverse( array ) { var r2 = array.length; var k = 0; var r3 = Math.floor( r2/2 ); if ( r3 == k ) { return array; } for ( k = 0; k < r3; k++ ) { var r6 = r2 - k - 1; // var r7 = String( k ); var r7 = k; var r8 = String( r6 ); var r9 = array[r7]; var r10 = array[r8]; array[r7] = r10; array[r8] = r9; } return array; } function Iterate( array ) { for ( var i = 0; i < array.length; i++ ) { // print( i+": "+ array[String(i)] ); } } function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = this.array[i]; } this.reverse = Array.prototype.reverse; this.getClass = Object.prototype.toString; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.4.4-2.js0000644000175000017500000001366711545150464021024 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.4.3-1.js ECMA Section: 15.4.4.3-1 Array.prototype.reverse() Description: The elements of the array are rearranged so as to reverse their order. This object is returned as the result of the call. 1. Call the [[Get]] method of this object with argument "length". 2. Call ToUint32(Result(1)). 3. Compute floor(Result(2)/2). 4. Let k be 0. 5. If k equals Result(3), return this object. 6. Compute Result(2)k1. 7. Call ToString(k). 8. ToString(Result(6)). 9. Call the [[Get]] method of this object with argument Result(7). 10. Call the [[Get]] method of this object with argument Result(8). 11. If this object has a property named by Result(8), go to step 12; but if this object has no property named by Result(8), then go to either step 12 or step 14, depending on the implementation. 12. Call the [[Put]] method of this object with arguments Result(7) and Result(10). 13. Go to step 15. 14. Call the [[Delete]] method on this object, providing Result(7) as the name of the property to delete. 15. If this object has a property named by Result(7), go to step 16; but if this object has no property named by Result(7), then go to either step 16 or step 18, depending on the implementation. 16. Call the [[Put]] method of this object with arguments Result(8) and Result(9). 17. Go to step 19. 18. Call the [[Delete]] method on this object, providing Result(8) as the name of the property to delete. 19. Increase k by 1. 20. Go to step 5. Note that the reverse function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the reverse function can be applied successfully to a host object is implementation dependent. Note: Array.prototype.reverse allows some flexibility in implementation regarding array indices that have not been populated. This test covers the cases in which unpopulated indices are not deleted, since the JavaScript implementation does not delete uninitialzed indices. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.4.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Array.prototype.reverse()"); var ARR_PROTOTYPE = Array.prototype; new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length ); new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length ); new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") ); // length of array is 0 new TestCase( SECTION, "var A = new Array(); A.reverse(); A.length", 0, eval("var A = new Array(); A.reverse(); A.length") ); test(); function CheckItems( R, A ) { for ( var i = 0; i < R.length; i++ ) { new TestCase( SECTION, "A["+i+ "]", R[i], A[i] ); } } test(); function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = eval(this.array[i]); } this.join = Array.prototype.reverse; this.getClass = Object.prototype.toString; } function Reverse( array ) { var r2 = array.length; var k = 0; var r3 = Math.floor( r2/2 ); if ( r3 == k ) { return array; } for ( k = 0; k < r3; k++ ) { var r6 = r2 - k - 1; // var r7 = String( k ); var r7 = k; var r8 = String( r6 ); var r9 = array[r7]; var r10 = array[r8]; array[r7] = r10; array[r8] = r9; } return array; } function Iterate( array ) { for ( var i = 0; i < array.length; i++ ) { // print( i+": "+ array[String(i)] ); } } function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = this.array[i]; } this.reverse = Array.prototype.reverse; this.getClass = Object.prototype.toString; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.4.5-1.js0000644000175000017500000002015511545150464021012 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.4.5.js ECMA Section: Array.prototype.sort(comparefn) Description: This test file tests cases in which the compare function is not supplied. The elements of this array are sorted. The sort is not necessarily stable. If comparefn is provided, it should be a function that accepts two arguments x and y and returns a negative value if x < y, zero if x = y, or a positive value if x > y. 1. Call the [[Get]] method of this object with argument "length". 2. Call ToUint32(Result(1)). 1. Perform an implementation-dependent sequence of calls to the [[Get]] , [[Put]], and [[Delete]] methods of this object and toSortCompare (described below), where the first argument for each call to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less than Result(2) and where the arguments for calls to SortCompare are results of previous calls to the [[Get]] method. After this sequence is complete, this object must have the following two properties. (1) There must be some mathematical permutation of the nonnegative integers less than Result(2), such that for every nonnegative integer j less than Result(2), if property old[j] existed, then new[(j)] is exactly the same value as old[j],. but if property old[j] did not exist, then new[(j)] either does not exist or exists with value undefined. (2) If comparefn is not supplied or is a consistent comparison function for the elements of this array, then for all nonnegative integers j and k, each less than Result(2), if old[j] compares less than old[k] (see SortCompare below), then (j) < (k). Here we use the notation old[j] to refer to the hypothetical result of calling the [ [Get]] method of this object with argument j before this step is executed, and the notation new[j] to refer to the hypothetical result of calling the [[Get]] method of this object with argument j after this step has been completely executed. A function is a consistent comparison function for a set of values if (a) for any two of those values (possibly the same value) considered as an ordered pair, it always returns the same value when given that pair of values as its two arguments, and the result of applying ToNumber to this value is not NaN; (b) when considered as a relation, where the pair (x, y) is considered to be in the relation if and only if applying the function to x and y and then applying ToNumber to the result produces a negative value, this relation is a partial order; and (c) when considered as a different relation, where the pair (x, y) is considered to be in the relation if and only if applying the function to x and y and then applying ToNumber to the result produces a zero value (of either sign), this relation is an equivalence relation. In this context, the phrase "x compares less than y" means applying Result(2) to x and y and then applying ToNumber to the result produces a negative value. 3.Return this object. When the SortCompare operator is called with two arguments x and y, the following steps are taken: 1.If x and y are both undefined, return +0. 2.If x is undefined, return 1. 3.If y is undefined, return 1. 4.If the argument comparefn was not provided in the call to sort, go to step 7. 5.Call comparefn with arguments x and y. 6.Return Result(5). 7.Call ToString(x). 8.Call ToString(y). 9.If Result(7) < Result(8), return 1. 10.If Result(7) > Result(8), return 1. 11.Return +0. Note that, because undefined always compared greater than any other value, undefined and nonexistent property values always sort to the end of the result. It is implementation-dependent whether or not such properties will exist or not at the end of the array when the sort is concluded. Note that the sort function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be applied successfully to a host object is implementation dependent . Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.4.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype.sort(comparefn)"; writeHeaderToLog( SECTION + " "+ TITLE); var S = new Array(); var item = 0; // array is empty. S[item++] = "var A = new Array()"; // array contains one item S[item++] = "var A = new Array( true )"; // length of array is 2 S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )"; S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0"; S[item] = "var A = new Array( "; var limit = 0x0061; for ( var i = 0x007A; i >= limit; i-- ) { S[item] += "\'"+ String.fromCharCode(i) +"\'" ; if ( i > limit ) { S[item] += ","; } } S[item] += ")"; item++; for ( var i = 0; i < S.length; i++ ) { CheckItems( S[i] ); } test(); function CheckItems( S ) { eval( S ); var E = Sort( A ); new TestCase( SECTION, S +"; A.sort(); A.length", E.length, eval( S + "; A.sort(); A.length") ); for ( var i = 0; i < E.length; i++ ) { new TestCase( SECTION, "A["+i+ "].toString()", E[i] +"", A[i] +""); if ( A[i] == void 0 && typeof A[i] == "undefined" ) { new TestCase( SECTION, "typeof A["+i+ "]", typeof E[i], typeof A[i] ); } } } function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = eval(this.array[i]); } this.sort = Array.prototype.sort; this.getClass = Object.prototype.toString; } function Sort( a ) { for ( i = 0; i < a.length; i++ ) { for ( j = i+1; j < a.length; j++ ) { var lo = a[i]; var hi = a[j]; var c = Compare( lo, hi ); if ( c == 1 ) { a[i] = hi; a[j] = lo; } } } return a; } function Compare( x, y ) { if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) { return +0; } if ( x == void 0 && typeof x == "undefined" ) { return 1; } if ( y == void 0 && typeof y == "undefined" ) { return -1; } x = String(x); y = String(y); if ( x < y ) { return -1; } if ( x > y ) { return 1; } return 0; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.4.5-2.js0000644000175000017500000002027211545150464021013 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.4.5-2.js ECMA Section: Array.prototype.sort(comparefn) Description: This test file tests cases in which the compare function is supplied. In this cases, the sort creates a reverse sort. The elements of this array are sorted. The sort is not necessarily stable. If comparefn is provided, it should be a function that accepts two arguments x and y and returns a negative value if x < y, zero if x = y, or a positive value if x > y. 1. Call the [[Get]] method of this object with argument "length". 2. Call ToUint32(Result(1)). 1. Perform an implementation-dependent sequence of calls to the [[Get]] , [[Put]], and [[Delete]] methods of this object and toSortCompare (described below), where the first argument for each call to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less than Result(2) and where the arguments for calls to SortCompare are results of previous calls to the [[Get]] method. After this sequence is complete, this object must have the following two properties. (1) There must be some mathematical permutation of the nonnegative integers less than Result(2), such that for every nonnegative integer j less than Result(2), if property old[j] existed, then new[(j)] is exactly the same value as old[j],. but if property old[j] did not exist, then new[(j)] either does not exist or exists with value undefined. (2) If comparefn is not supplied or is a consistent comparison function for the elements of this array, then for all nonnegative integers j and k, each less than Result(2), if old[j] compares less than old[k] (see SortCompare below), then (j) < (k). Here we use the notation old[j] to refer to the hypothetical result of calling the [ [Get]] method of this object with argument j before this step is executed, and the notation new[j] to refer to the hypothetical result of calling the [[Get]] method of this object with argument j after this step has been completely executed. A function is a consistent comparison function for a set of values if (a) for any two of those values (possibly the same value) considered as an ordered pair, it always returns the same value when given that pair of values as its two arguments, and the result of applying ToNumber to this value is not NaN; (b) when considered as a relation, where the pair (x, y) is considered to be in the relation if and only if applying the function to x and y and then applying ToNumber to the result produces a negative value, this relation is a partial order; and (c) when considered as a different relation, where the pair (x, y) is considered to be in the relation if and only if applying the function to x and y and then applying ToNumber to the result produces a zero value (of either sign), this relation is an equivalence relation. In this context, the phrase "x compares less than y" means applying Result(2) to x and y and then applying ToNumber to the result produces a negative value. 3.Return this object. When the SortCompare operator is called with two arguments x and y, the following steps are taken: 1.If x and y are both undefined, return +0. 2.If x is undefined, return 1. 3.If y is undefined, return 1. 4.If the argument comparefn was not provided in the call to sort, go to step 7. 5.Call comparefn with arguments x and y. 6.Return Result(5). 7.Call ToString(x). 8.Call ToString(y). 9.If Result(7) < Result(8), return 1. 10.If Result(7) > Result(8), return 1. 11.Return +0. Note that, because undefined always compared greater than any other value, undefined and nonexistent property values always sort to the end of the result. It is implementation-dependent whether or not such properties will exist or not at the end of the array when the sort is concluded. Note that the sort function is intentionally generic; it does not require that its this value be an Array object. Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be applied successfully to a host object is implementation dependent . Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.4.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype.sort(comparefn)"; writeHeaderToLog( SECTION + " "+ TITLE); var S = new Array(); var item = 0; // array is empty. S[item++] = "var A = new Array()"; // array contains one item S[item++] = "var A = new Array( true )"; // length of array is 2 S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )"; S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0"; S[item] = "var A = new Array( "; var limit = 0x0061; for ( var i = 0x007A; i >= limit; i-- ) { S[item] += "\'"+ String.fromCharCode(i) +"\'" ; if ( i > limit ) { S[item] += ","; } } S[item] += ")"; for ( var i = 0; i < S.length; i++ ) { CheckItems( S[i] ); } test(); function CheckItems( S ) { eval( S ); var E = Sort( A ); new TestCase( SECTION, S +"; A.sort(Compare); A.length", E.length, eval( S + "; A.sort(Compare); A.length") ); for ( var i = 0; i < E.length; i++ ) { new TestCase( SECTION, "A["+i+ "].toString()", E[i] +"", A[i] +""); if ( A[i] == void 0 && typeof A[i] == "undefined" ) { new TestCase( SECTION, "typeof A["+i+ "]", typeof E[i], typeof A[i] ); } } } function Object_1( value ) { this.array = value.split(","); this.length = this.array.length; for ( var i = 0; i < this.length; i++ ) { this[i] = eval(this.array[i]); } this.sort = Array.prototype.sort; this.getClass = Object.prototype.toString; } function Sort( a ) { var r1 = a.length; for ( i = 0; i < a.length; i++ ) { for ( j = i+1; j < a.length; j++ ) { var lo = a[i]; var hi = a[j]; var c = Compare( lo, hi ); if ( c == 1 ) { a[i] = hi; a[j] = lo; } } } return a; } function Compare( x, y ) { if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) { return +0; } if ( x == void 0 && typeof x == "undefined" ) { return 1; } if ( y == void 0 && typeof y == "undefined" ) { return -1; } x = String(x); y = String(y); if ( x < y ) { return 1; } if ( x > y ) { return -1; } return 0; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.4.5-3.js0000644000175000017500000001173511545150464021020 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.4.5-3.js ECMA Section: Array.prototype.sort(comparefn) Description: This is a regression test for http://scopus/bugsplat/show_bug.cgi?id=117144 Verify that sort is successfull, even if the sort compare function returns a very large negative or positive value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.4.5-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.prototype.sort(comparefn)"; writeHeaderToLog( SECTION + " "+ TITLE); var array = new Array(); array[array.length] = new Date( TIME_2000 * Math.PI ); array[array.length] = new Date( TIME_2000 * 10 ); array[array.length] = new Date( TIME_1900 + TIME_1900 ); array[array.length] = new Date(0); array[array.length] = new Date( TIME_2000 ); array[array.length] = new Date( TIME_1900 + TIME_1900 +TIME_1900 ); array[array.length] = new Date( TIME_1900 * Math.PI ); array[array.length] = new Date( TIME_1900 * 10 ); array[array.length] = new Date( TIME_1900 ); array[array.length] = new Date( TIME_2000 + TIME_2000 ); array[array.length] = new Date( 1899, 0, 1 ); array[array.length] = new Date( 2000, 1, 29 ); array[array.length] = new Date( 2000, 0, 1 ); array[array.length] = new Date( 1999, 11, 31 ); var testarr1 = new Array(); clone( array, testarr1 ); testarr1.sort( comparefn1 ); var testarr2 = new Array(); clone( array, testarr2 ); testarr2.sort( comparefn2 ); testarr3 = new Array(); clone( array, testarr3 ); testarr3.sort( comparefn3 ); // when there's no sort function, sort sorts by the toString value of Date. var testarr4 = new Array(); clone( array, testarr4 ); testarr4.sort(); var realarr = new Array(); clone( array, realarr ); realarr.sort( realsort ); var stringarr = new Array(); clone( array, stringarr ); stringarr.sort( stringsort ); for ( var i = 0; i < array.length; i++) { new TestCase( SECTION, "testarr1["+i+"]", realarr[i], testarr1[i] ); } for ( var i=0; i < array.length; i++) { new TestCase( SECTION, "testarr2["+i+"]", realarr[i], testarr2[i] ); } for ( var i=0; i < array.length; i++) { new TestCase( SECTION, "testarr3["+i+"]", realarr[i], testarr3[i] ); } for ( var i=0; i < array.length; i++) { new TestCase( SECTION, "testarr4["+i+"]", stringarr[i].toString(), testarr4[i].toString() ); } test(); function comparefn1( x, y ) { return x - y; } function comparefn2( x, y ) { return x.valueOf() - y.valueOf(); } function realsort( x, y ) { return ( x.valueOf() == y.valueOf() ? 0 : ( x.valueOf() > y.valueOf() ? 1 : -1 ) ); } function comparefn3( x, y ) { return ( x == y ? 0 : ( x > y ? 1: -1 ) ); } function clone( source, target ) { for (i = 0; i < source.length; i++ ) { target[i] = source[i]; } } function stringsort( x, y ) { for ( var i = 0; i < x.toString().length; i++ ) { var d = (x.toString()).charCodeAt(i) - (y.toString()).charCodeAt(i); if ( d > 0 ) { return 1; } else { if ( d < 0 ) { return -1; } else { continue; } } var d = x.length - y.length; if ( d > 0 ) { return 1; } else { if ( d < 0 ) { return -1; } } } return 0; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.4.js0000644000175000017500000000561611545150464020516 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.4.js ECMA Section: 15.4.4 Properties of the Array Prototype Object Description: The value of the internal [[Prototype]] property of the Array prototype object is the Object prototype object. Note that the Array prototype object is itself an array; it has a length property (whose initial value is (0) and the special [[Put]] method. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Array Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array.prototype.length", 0, Array.prototype.length ); // verify that prototype object is an Array object. new TestCase( SECTION, "typeof Array.prototype", "object", typeof Array.prototype ); new TestCase( SECTION, "Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()", "[object Array]", eval("Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.5.1-1.js0000644000175000017500000001350411545150464021007 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.5.1-1.js ECMA Section: [[ Put]] (P, V) Description: Array objects use a variation of the [[Put]] method used for other native ECMAScript objects (section 8.6.2.2). Assume A is an Array object and P is a string. When the [[Put]] method of A is called with property P and value V, the following steps are taken: 1. Call the [[CanPut]] method of A with name P. 2. If Result(1) is false, return. 3. If A doesn't have a property with name P, go to step 7. 4. If P is "length", go to step 12. 5. Set the value of property P of A to V. 6. Go to step 8. 7. Create a property with name P, set its value to V and give it empty attributes. 8. If P is not an array index, return. 9. If A itself has a property (not an inherited property) named "length", andToUint32(P) is less than the value of the length property of A, then return. 10. Change (or set) the value of the length property of A to ToUint32(P)+1. 11. Return. 12. Compute ToUint32(V). 13. For every integer k that is less than the value of the length property of A but not less than Result(12), if A itself has a property (not an inherited property) named ToString(k), then delete that property. 14. Set the value of property P of A to Result(12). 15. Return. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.5.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array [[Put]] (P, V)"; writeHeaderToLog( SECTION + " "+ TITLE); // P is "length" new TestCase( SECTION, "var A = new Array(); A.length = 1000; A.length", 1000, eval("var A = new Array(); A.length = 1000; A.length") ); // A has Property P, and P is not length or an array index new TestCase( SECTION, "var A = new Array(1000); A.name = 'name of this array'; A.name", 'name of this array', eval("var A = new Array(1000); A.name = 'name of this array'; A.name") ); new TestCase( SECTION, "var A = new Array(1000); A.name = 'name of this array'; A.length", 1000, eval("var A = new Array(1000); A.name = 'name of this array'; A.length") ); // A has Property P, P is not length, P is an array index, and ToUint32(p) is less than the // value of length new TestCase( SECTION, "var A = new Array(1000); A[123] = 'hola'; A[123]", 'hola', eval("var A = new Array(1000); A[123] = 'hola'; A[123]") ); new TestCase( SECTION, "var A = new Array(1000); A[123] = 'hola'; A.length", 1000, eval("var A = new Array(1000); A[123] = 'hola'; A.length") ); for ( var i = 0X0020, TEST_STRING = "var A = new Array( " ; i < 0x00ff; i++ ) { TEST_STRING += "\'\\"+ String.fromCharCode( i ) +"\'"; if ( i < 0x00FF - 1 ) { TEST_STRING += ","; } else { TEST_STRING += ");" } } var LENGTH = 0x00ff - 0x0020; new TestCase( SECTION, TEST_STRING +" A[150] = 'hello'; A[150]", 'hello', eval( TEST_STRING + " A[150] = 'hello'; A[150]" ) ); new TestCase( SECTION, TEST_STRING +" A[150] = 'hello'; A[150]", LENGTH, eval( TEST_STRING + " A[150] = 'hello'; A.length" ) ); // A has Property P, P is not length, P is an array index, and ToUint32(p) is not less than the // value of length new TestCase( SECTION, "var A = new Array(); A[123] = true; A.length", 124, eval("var A = new Array(); A[123] = true; A.length") ); new TestCase( SECTION, "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length", 16, eval("var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length") ); for ( var i = 0; i < A.length; i++ ) { new TestCase( SECTION, "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A[" +i +"]", (i <= 10) ? i : ( i == 15 ? '15' : void 0 ), A[i] ); } // P is not an array index, and P is not "length" new TestCase( SECTION, "var A = new Array(); A.join.length = 4; A.join.length", 1, eval("var A = new Array(); A.join.length = 4; A.join.length") ); new TestCase( SECTION, "var A = new Array(); A.join.length = 4; A.length", 0, eval("var A = new Array(); A.join.length = 4; A.length") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.5.1-2.js0000644000175000017500000001063211545150464021007 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.5.1-2.js ECMA Section: [[ Put]] (P, V) Description: Array objects use a variation of the [[Put]] method used for other native ECMAScript objects (section 8.6.2.2). Assume A is an Array object and P is a string. When the [[Put]] method of A is called with property P and value V, the following steps are taken: 1. Call the [[CanPut]] method of A with name P. 2. If Result(1) is false, return. 3. If A doesn't have a property with name P, go to step 7. 4. If P is "length", go to step 12. 5. Set the value of property P of A to V. 6. Go to step 8. 7. Create a property with name P, set its value to V and give it empty attributes. 8. If P is not an array index, return. 9. If A itself has a property (not an inherited property) named "length", andToUint32(P) is less than the value of the length property of A, then return. 10. Change (or set) the value of the length property of A to ToUint32(P)+1. 11. Return. 12. Compute ToUint32(V). 13. For every integer k that is less than the value of the length property of A but not less than Result(12), if A itself has a property (not an inherited property) named ToString(k), then delete that property. 14. Set the value of property P of A to Result(12). 15. Return. These are gTestcases from Waldemar, detailed in http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123552 Author: christine@netscape.com Date: 15 June 1998 */ var SECTION = "15.4.5.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array [[Put]] (P,V)"; writeHeaderToLog( SECTION + " "+ TITLE); var a = new Array(); AddCase( "3.00", "three" ); AddCase( "00010", "eight" ); AddCase( "37xyz", "thirty-five" ); AddCase("5000000000", 5) AddCase( "-2", -3 ); new TestCase( SECTION, "a[10]", void 0, a[10] ); new TestCase( SECTION, "a[3]", void 0, a[3] ); a[4] = "four"; new TestCase( SECTION, "a[4] = \"four\"; a[4]", "four", a[4] ); new TestCase( SECTION, "a[\"4\"]", "four", a["4"] ); new TestCase( SECTION, "a[\"4.00\"]", void 0, a["4.00"] ); new TestCase( SECTION, "a.length", 5, a.length ); a["5000000000"] = 5; new TestCase( SECTION, "a[\"5000000000\"] = 5; a.length", 5, a.length ); new TestCase( SECTION, "a[\"-2\"] = -3; a.length", 5, a.length ); test(); function AddCase ( arg, value ) { a[arg] = value; new TestCase( SECTION, "a[\"" + arg + "\"] = "+ value +"; a.length", 0, a.length ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.5.2-1.js0000644000175000017500000000654711545150464021021 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.5.2-1.js ECMA Section: Array.length Description: 15.4.5.2 length The length property of this Array object is always numerically greater than the name of every property whose name is an array index. The length property has the attributes { DontEnum, DontDelete }. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.5.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.length"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var A = new Array(); A.length", 0, eval("var A = new Array(); A.length") ); new TestCase( SECTION, "var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length", Math.pow(2,32)-1, eval("var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length") ); new TestCase( SECTION, "var A = new Array(); A.length = 123; A.length", 123, eval("var A = new Array(); A.length = 123; A.length") ); new TestCase( SECTION, "var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS", "", eval("var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS") ); new TestCase( SECTION, "var A = new Array(); A.length = 123; delete A.length", false , eval("var A = new Array(); A.length = 123; delete A.length") ); new TestCase( SECTION, "var A = new Array(); A.length = 123; delete A.length; A.length", 123, eval("var A = new Array(); A.length = 123; delete A.length; A.length") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/15.4.5.2-2.js0000644000175000017500000001006611545150464021011 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.5.2-2.js ECMA Section: Array.length Description: 15.4.5.2 length The length property of this Array object is always numerically greater than the name of every property whose name is an array index. The length property has the attributes { DontEnum, DontDelete }. This test verifies that the Array.length property is not Read Only. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.4.5.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Array.length"; writeHeaderToLog( SECTION + " "+ TITLE); addCase( new Array(), 0, Math.pow(2,14), Math.pow(2,14) ); addCase( new Array(), 0, 1, 1 ); addCase( new Array(Math.pow(2,12)), Math.pow(2,12), 0, 0 ); addCase( new Array(Math.pow(2,13)), Math.pow(2,13), Math.pow(2,12), Math.pow(2,12) ); addCase( new Array(Math.pow(2,12)), Math.pow(2,12), Math.pow(2,12), Math.pow(2,12) ); addCase( new Array(Math.pow(2,14)), Math.pow(2,14), Math.pow(2,12), Math.pow(2,12) ) // some tests where array is not empty // array is populated with strings for ( var arg = "", i = 0; i < Math.pow(2,12); i++ ) { arg += String(i) + ( i != Math.pow(2,12)-1 ? "," : "" ); } // print(i +":"+arg); var a = eval( "new Array("+arg+")" ); addCase( a, i, i, i ); addCase( a, i, Math.pow(2,12)+i+1, Math.pow(2,12)+i+1, true ); addCase( a, Math.pow(2,12)+5, 0, 0, true ); test(); function addCase( object, old_len, set_len, new_len, checkitems ) { object.length = set_len; new TestCase( SECTION, "array = new Array("+ old_len+"); array.length = " + set_len + "; array.length", new_len, object.length ); if ( checkitems ) { // verify that items between old and newlen are all undefined if ( new_len < old_len ) { var passed = true; for ( var i = new_len; i < old_len; i++ ) { if ( object[i] != void 0 ) { passed = false; } } new TestCase( SECTION, "verify that array items have been deleted", true, passed ); } if ( new_len > old_len ) { var passed = true; for ( var i = old_len; i < new_len; i++ ) { if ( object[i] != void 0 ) { passed = false; } } new TestCase( SECTION, "verify that new items are undefined", true, passed ); } } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/array-length-set-on-nonarray.js0000644000175000017500000000116611545150464025410 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 548671; var summary = "Don't use a shared-permanent inherited property to implement " + "[].length or (function(){}).length"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var a = []; a.p = 1; var x = Object.create(a); assertEq(x.length, 0); assertEq(x.p, 1); assertEq(a.length, 0); if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/browser.js0000644000175000017500000000000011545150464021426 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/jstests.list0000644000175000017500000000116111545150464022012 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/Array/ script 15.4-1.js script 15.4-2.js script 15.4.1.1.js script 15.4.1.2.js script 15.4.1.3.js script 15.4.1.js script 15.4.2.1-1.js script 15.4.2.1-2.js script 15.4.2.1-3.js script 15.4.2.2-1.js script 15.4.2.2-2.js script 15.4.2.3.js script 15.4.3.1-2.js script 15.4.3.2.js script 15.4.4.1.js script 15.4.4.2.js script 15.4.4.3-1.js script 15.4.4.4-1.js script 15.4.4.4-2.js script 15.4.4.5-1.js script 15.4.4.5-2.js script 15.4.4.5-3.js script 15.4.4.js script 15.4.5.1-1.js script 15.4.5.1-2.js script 15.4.5.2-1.js script 15.4.5.2-2.js script array-length-set-on-nonarray.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Array/shell.js0000644000175000017500000000000011545150464021052 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.1.js0000644000175000017500000001024511545150464021010 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.1.js ECMA Section: 15.6.1 The Boolean Function 15.6.1.1 Boolean( value ) 15.6.1.2 Boolean () Description: Boolean( value ) should return a Boolean value not a Boolean object) computed by Boolean.toBooleanValue( value) 15.6.1.2 Boolean() returns false Author: christine@netscape.com Date: 27 jun 1997 Data File Fields: VALUE Argument passed to the Boolean function TYPE typeof VALUE (not used, but helpful in understanding the data file) E_RETURN Expected return value of Boolean( VALUE ) */ var SECTION = "15.6.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Boolean constructor called as a function: Boolean( value ) and Boolean()"; writeHeaderToLog( SECTION + " "+ TITLE); var array = new Array(); var item = 0; new TestCase( SECTION, "Boolean(1)", true, Boolean(1) ); new TestCase( SECTION, "Boolean(0)", false, Boolean(0) ); new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) ); new TestCase( SECTION, "Boolean('1')", true, Boolean("1") ); new TestCase( SECTION, "Boolean('0')", true, Boolean("0") ); new TestCase( SECTION, "Boolean('-1')", true, Boolean("-1") ); new TestCase( SECTION, "Boolean(true)", true, Boolean(true) ); new TestCase( SECTION, "Boolean(false)", false, Boolean(false) ); new TestCase( SECTION, "Boolean('true')", true, Boolean("true") ); new TestCase( SECTION, "Boolean('false')", true, Boolean("false") ); new TestCase( SECTION, "Boolean(null)", false, Boolean(null) ); new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) ); new TestCase( SECTION, "Boolean(void(0))", false, Boolean( void(0) ) ); new TestCase( SECTION, "Boolean(x=0)", false, Boolean( x=0 ) ); new TestCase( SECTION, "Boolean(x=1)", true, Boolean( x=1 ) ); new TestCase( SECTION, "Boolean(x=false)", false, Boolean( x=false ) ); new TestCase( SECTION, "Boolean(x=true)", true, Boolean( x=true ) ); new TestCase( SECTION, "Boolean(x=null)", false, Boolean( x=null ) ); new TestCase( SECTION, "Boolean()", false, Boolean() ); // array[item++] = new TestCase( SECTION, "Boolean(var someVar)", false, Boolean( someVar ) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.2.js0000644000175000017500000002522311545150464021013 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.2.js ECMA Section: 15.6.2 The Boolean Constructor 15.6.2.1 new Boolean( value ) 15.6.2.2 new Boolean() This test verifies that the Boolean constructor initializes a new object (typeof should return "object"). The prototype of the new object should be Boolean.prototype. The value of the object should be ToBoolean( value ) (a boolean value). Description: Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "15.6.2 The Boolean Constructor; 15.6.2.1 new Boolean( value ); 15.6.2.2 new Boolean()"; writeHeaderToLog( SECTION + " "+ TITLE); var array = new Array(); var item = 0; new TestCase( SECTION, "typeof (new Boolean(1))", "object", typeof (new Boolean(1)) ); new TestCase( SECTION, "(new Boolean(1)).constructor", Boolean.prototype.constructor, (new Boolean(1)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(1)).valueOf()", true, (new Boolean(1)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(1)", "object", typeof new Boolean(1) ); new TestCase( SECTION, "(new Boolean(0)).constructor", Boolean.prototype.constructor, (new Boolean(0)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(0)).valueOf()", false, (new Boolean(0)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(0)", "object", typeof new Boolean(0) ); new TestCase( SECTION, "(new Boolean(-1)).constructor", Boolean.prototype.constructor, (new Boolean(-1)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(-1)).valueOf()", true, (new Boolean(-1)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(-1)", "object", typeof new Boolean(-1) ); new TestCase( SECTION, "(new Boolean('1')).constructor", Boolean.prototype.constructor, (new Boolean('1')).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean('1')).valueOf()", true, (new Boolean('1')).valueOf() ); new TestCase( SECTION, "typeof new Boolean('1')", "object", typeof new Boolean('1') ); new TestCase( SECTION, "(new Boolean('0')).constructor", Boolean.prototype.constructor, (new Boolean('0')).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean('0')).valueOf()", true, (new Boolean('0')).valueOf() ); new TestCase( SECTION, "typeof new Boolean('0')", "object", typeof new Boolean('0') ); new TestCase( SECTION, "(new Boolean('-1')).constructor", Boolean.prototype.constructor, (new Boolean('-1')).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean('-1')).valueOf()", true, (new Boolean('-1')).valueOf() ); new TestCase( SECTION, "typeof new Boolean('-1')", "object", typeof new Boolean('-1') ); new TestCase( SECTION, "(new Boolean(new Boolean(true))).constructor", Boolean.prototype.constructor, (new Boolean(new Boolean(true))).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(new Boolean(true))).valueOf()", true, (new Boolean(new Boolean(true))).valueOf() ); new TestCase( SECTION, "typeof new Boolean(new Boolean(true))", "object", typeof new Boolean(new Boolean(true)) ); new TestCase( SECTION, "(new Boolean(Number.NaN)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NaN)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(Number.NaN)).valueOf()", false, (new Boolean(Number.NaN)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(Number.NaN)", "object", typeof new Boolean(Number.NaN) ); new TestCase( SECTION, "(new Boolean(null)).constructor", Boolean.prototype.constructor, (new Boolean(null)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(null)).valueOf()", false, (new Boolean(null)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(null)", "object", typeof new Boolean(null) ); new TestCase( SECTION, "(new Boolean(void 0)).constructor", Boolean.prototype.constructor, (new Boolean(void 0)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(void 0)).valueOf()", false, (new Boolean(void 0)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(void 0)", "object", typeof new Boolean(void 0) ); new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.POSITIVE_INFINITY)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).valueOf()", true, (new Boolean(Number.POSITIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(Number.POSITIVE_INFINITY)", "object", typeof new Boolean(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor ); new TestCase( SECTION, "TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).valueOf()", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof new Boolean(Number.NEGATIVE_INFINITY)", "object", typeof new Boolean(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor ); new TestCase( "15.6.2.2", "TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()", "[object Boolean]", eval("TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") ); new TestCase( "15.6.2.2", "(new Boolean()).valueOf()", false, (new Boolean()).valueOf() ); new TestCase( "15.6.2.2", "typeof new Boolean()", "object", typeof new Boolean() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.3.1-1.js0000644000175000017500000000506411545150464021312 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.3.1-1.js ECMA Section: 15.6.3 Boolean.prototype Description: The initial value of Boolean.prototype is the built-in Boolean prototype object (15.6.4). The property shall have the attributes [DontEnum, DontDelete, ReadOnly ]. This tests the DontEnum property of Boolean.prototype Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.3.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); var array = new Array(); var item = 0; new TestCase( SECTION, "var str='';for ( p in Boolean ) { str += p } str;", "", eval("var str='';for ( p in Boolean ) { str += p } str;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.3.1-2.js0000644000175000017500000000500111545150464021302 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.3.1-2.js ECMA Section: 15.6.3.1 Boolean.prototype Description: The initial valu eof Boolean.prototype is the built-in Boolean prototype object (15.6.4). The property shall have the attributes [DontEnum, DontDelete, ReadOnly ]. This tests the DontDelete property of Boolean.prototype Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype" writeHeaderToLog( SECTION + TITLE ); var array = new Array(); var item = 0; new TestCase( SECTION, "delete( Boolean.prototype)", false, delete( Boolean.prototype) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.3.1-3.js0000644000175000017500000000507311545150464021314 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.3.1-3.js ECMA Section: 15.6.3.1 Boolean.prototype Description: The initial valu eof Boolean.prototype is the built-in Boolean prototype object (15.6.4). The property shall have the attributes [DontEnum, DontDelete, ReadOnly ]. This tests the DontDelete property of Boolean.prototype Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.3.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype" writeHeaderToLog( SECTION + TITLE ); var array = new Array(); var item = 0; new TestCase( SECTION, "delete( Boolean.prototype); Boolean.prototype", Boolean.prototype, eval("delete( Boolean.prototype); Boolean.prototype") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.3.1-4.js0000644000175000017500000000562011545150464021313 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.3.1-4.js ECMA Section: 15.6.3.1 Properties of the Boolean Prototype Object Description: The initial value of Boolean.prototype is the built-in Boolean prototype object (15.6.4). The property shall have the attributes [DontEnum, DontDelete, ReadOnly ]. This tests the ReadOnly property of Boolean.prototype Author: christine@netscape.com Date: 30 september 1997 */ var SECTION = "15.6.3.1-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype" writeHeaderToLog( SECTION + TITLE ); var BOOL_PROTO = Boolean.prototype; new TestCase( SECTION, "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO", true, eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO") ); new TestCase( SECTION, "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null", false, eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.3.1.js0000644000175000017500000000511211545150464021146 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.3.1.js ECMA Section: 15.6.3.1 Boolean.prototype Description: The initial valu eof Boolean.prototype is the built-in Boolean prototype object (15.6.4). The property shall have the attributes [DontEnum, DontDelete, ReadOnly ]. It has the internal [[Call]] and [[Construct]] properties (not tested), and the length property. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() ); new TestCase( SECTION, "Boolean.length", 1, Boolean.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4-1.js0000644000175000017500000000600611545150464021151 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4-1.js ECMA Section: 15.6.4 Properties of the Boolean Prototype Object Description: The Boolean prototype object is itself a Boolean object (its [[Class]] is "Boolean") whose value is false. The value of the internal [[Prototype]] property of the Boolean prototype object is the Object prototype object (15.2.3.1). Author: christine@netscape.com Date: 30 september 1997 */ var VERSION = "ECMA_1" startTest(); var SECTION = "15.6.4-1"; writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object"); new TestCase( SECTION, "typeof Boolean.prototype == typeof( new Boolean )", true, typeof Boolean.prototype == typeof( new Boolean ) ); new TestCase( SECTION, "typeof( Boolean.prototype )", "object", typeof(Boolean.prototype) ); new TestCase( SECTION, "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()", "[object Boolean]", eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") ); new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4.1.js0000644000175000017500000000460311545150464021153 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4.1.js ECMA Section: 15.6.4.1 Boolean.prototype.constructor Description: The initial value of Boolean.prototype.constructor is the built-in Boolean constructor. Author: christine@netscape.com Date: 30 september 1997 */ var SECTION = "15.6.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.constructor" writeHeaderToLog( SECTION + TITLE ); new TestCase( SECTION, "( Boolean.prototype.constructor == Boolean )", true , (Boolean.prototype.constructor == Boolean) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4.2-1.js0000644000175000017500000001160611545150464021313 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4.2.js ECMA Section: 15.6.4.2-1 Boolean.prototype.toString() Description: If this boolean value is true, then the string "true" is returned; otherwise this boolean value must be false, and the string "false" is returned. The toString function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.toString()" writeHeaderToLog( SECTION + TITLE ); new TestCase( SECTION, "new Boolean(1)", "true", (new Boolean(1)).toString() ); new TestCase( SECTION, "new Boolean(0)", "false", (new Boolean(0)).toString() ); new TestCase( SECTION, "new Boolean(-1)", "true", (new Boolean(-1)).toString() ); new TestCase( SECTION, "new Boolean('1')", "true", (new Boolean("1")).toString() ); new TestCase( SECTION, "new Boolean('0')", "true", (new Boolean("0")).toString() ); new TestCase( SECTION, "new Boolean(true)", "true", (new Boolean(true)).toString() ); new TestCase( SECTION, "new Boolean(false)", "false", (new Boolean(false)).toString() ); new TestCase( SECTION, "new Boolean('true')", "true", (new Boolean('true')).toString() ); new TestCase( SECTION, "new Boolean('false')", "true", (new Boolean('false')).toString() ); new TestCase( SECTION, "new Boolean('')", "false", (new Boolean('')).toString() ); new TestCase( SECTION, "new Boolean(null)", "false", (new Boolean(null)).toString() ); new TestCase( SECTION, "new Boolean(void(0))", "false", (new Boolean(void(0))).toString() ); new TestCase( SECTION, "new Boolean(-Infinity)", "true", (new Boolean(Number.NEGATIVE_INFINITY)).toString() ); new TestCase( SECTION, "new Boolean(NaN)", "false", (new Boolean(Number.NaN)).toString() ); new TestCase( SECTION, "new Boolean()", "false", (new Boolean()).toString() ); new TestCase( SECTION, "new Boolean(x=1)", "true", (new Boolean(x=1)).toString() ); new TestCase( SECTION, "new Boolean(x=0)", "false", (new Boolean(x=0)).toString() ); new TestCase( SECTION, "new Boolean(x=false)", "false", (new Boolean(x=false)).toString() ); new TestCase( SECTION, "new Boolean(x=true)", "true", (new Boolean(x=true)).toString() ); new TestCase( SECTION, "new Boolean(x=null)", "false", (new Boolean(x=null)).toString() ); new TestCase( SECTION, "new Boolean(x='')", "false", (new Boolean(x="")).toString() ); new TestCase( SECTION, "new Boolean(x=' ')", "true", (new Boolean(x=" ")).toString() ); new TestCase( SECTION, "new Boolean(new MyObject(true))", "true", (new Boolean(new MyObject(true))).toString() ); new TestCase( SECTION, "new Boolean(new MyObject(false))", "true", (new Boolean(new MyObject(false))).toString() ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4.2-2.js0000644000175000017500000000604111545150464021311 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4.2-2.js ECMA Section: 15.6.4.2 Boolean.prototype.toString() Description: Returns this boolean value. The toString function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.toString()" writeHeaderToLog( SECTION + TITLE ); new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()") ); new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()", "true", eval("tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()") ); new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=new Boolean(false); x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4.2-3.js0000644000175000017500000000537511545150464021323 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4.2-3.js ECMA Section: 15.6.4.2 Boolean.prototype.toString() Description: Returns this boolean value. The toString function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.toString()" writeHeaderToLog( SECTION + TITLE ); new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()", "true", eval("tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()") ); new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4.2-4-n.js0000644000175000017500000000535611545150464021556 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4.2-4.js ECMA Section: 15.6.4.2 Boolean.prototype.toString() Description: Returns this boolean value. The toString function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.2-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.toString()"; writeHeaderToLog( SECTION +" "+ TITLE ); DESCRIPTION = "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()"; EXPECTED = "error"; new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()", "error", eval("tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4.3-1.js0000644000175000017500000001052611545150464021314 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4.3.js ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() Description: Returns this boolean value. The valueOf function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.valueOf()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "new Boolean(1)", true, (new Boolean(1)).valueOf() ); new TestCase( SECTION, "new Boolean(0)", false, (new Boolean(0)).valueOf() ); new TestCase( SECTION, "new Boolean(-1)", true, (new Boolean(-1)).valueOf() ); new TestCase( SECTION, "new Boolean('1')", true, (new Boolean("1")).valueOf() ); new TestCase( SECTION, "new Boolean('0')", true, (new Boolean("0")).valueOf() ); new TestCase( SECTION, "new Boolean(true)", true, (new Boolean(true)).valueOf() ); new TestCase( SECTION, "new Boolean(false)", false, (new Boolean(false)).valueOf() ); new TestCase( SECTION, "new Boolean('true')", true, (new Boolean("true")).valueOf() ); new TestCase( SECTION, "new Boolean('false')", true, (new Boolean('false')).valueOf() ); new TestCase( SECTION, "new Boolean('')", false, (new Boolean('')).valueOf() ); new TestCase( SECTION, "new Boolean(null)", false, (new Boolean(null)).valueOf() ); new TestCase( SECTION, "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() ); new TestCase( SECTION, "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() ); new TestCase( SECTION, "new Boolean()", false, (new Boolean()).valueOf() ); new TestCase( SECTION, "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() ); new TestCase( SECTION, "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() ); new TestCase( SECTION, "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() ); new TestCase( SECTION, "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() ); new TestCase( SECTION, "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() ); new TestCase( SECTION, "new Boolean(x='')", false, (new Boolean(x="")).valueOf() ); new TestCase( SECTION, "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4.3-2.js0000644000175000017500000000543411545150464021317 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4.3-2.js ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() Description: Returns this boolean value. The valueOf function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.valueOf()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()", false, eval("valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()") ); new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()", true, eval("valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4.3-3.js0000644000175000017500000000505711545150464021321 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4.3-3.js ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() Description: Returns this boolean value. The valueOf function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.3-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.valueOf()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()", true, eval("x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4.3-4-n.js0000644000175000017500000000534011545150464021550 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4.3-4.js ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() Description: Returns this boolean value. The valueOf function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.4.3-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean.prototype.valueOf()"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()" EXPECTED = "error"; new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()", "error", eval("valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4.3.js0000644000175000017500000001040111545150464021146 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4.3.js ECMA Section: 15.6.4.3 Boolean.prototype.valueOf() Description: Returns this boolean value. The valueOf function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ new TestCase( "15.8.6.4", "new Boolean(1)", true, (new Boolean(1)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(0)", false, (new Boolean(0)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(-1)", true, (new Boolean(-1)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean('1')", true, (new Boolean("1")).valueOf() ); new TestCase( "15.8.6.4", "new Boolean('0')", true, (new Boolean("0")).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(true)", true, (new Boolean(true)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(false)", false, (new Boolean(false)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean('true')", true, (new Boolean("true")).valueOf() ); new TestCase( "15.8.6.4", "new Boolean('false')", true, (new Boolean('false')).valueOf() ); new TestCase( "15.8.6.4", "new Boolean('')", false, (new Boolean('')).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(null)", false, (new Boolean(null)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean()", false, (new Boolean()).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x='')", false, (new Boolean(x="")).valueOf() ); new TestCase( "15.8.6.4", "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/15.6.4.js0000644000175000017500000000641311545150464021015 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4.js ECMA Section: Properties of the Boolean Prototype Object Description: The Boolean prototype object is itself a Boolean object (its [[Class]] is " Boolean") whose value is false. The value of the internal [[Prototype]] property of the Boolean prototype object is the Object prototype object (15.2.3.1). In following descriptions of functions that are properties of the Boolean prototype object, the phrase "this Boolean object" refers to the object that is the this value for the invocation of the function; it is an error if this does not refer to an object for which the value of the internal [[Class]] property is "Boolean". Also, the phrase "this boolean value" refers to the boolean value represented by this Boolean object, that is, the value of the internal [[Value]] property of this Boolean object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.6.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Boolean Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Boolean.prototype == false", true, Boolean.prototype == false ); new TestCase( SECTION, "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()", "[object Boolean]", eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/browser.js0000644000175000017500000000000011545150464021727 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/jstests.list0000644000175000017500000000066211545150464022320 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/Boolean/ script 15.6.1.js script 15.6.2.js script 15.6.3.1-1.js script 15.6.3.1-2.js script 15.6.3.1-3.js script 15.6.3.1-4.js script 15.6.3.1.js script 15.6.4-1.js script 15.6.4.1.js script 15.6.4.2-1.js script 15.6.4.2-2.js script 15.6.4.2-3.js script 15.6.4.2-4-n.js script 15.6.4.3-1.js script 15.6.4.3-2.js script 15.6.4.3-3.js script 15.6.4.3-4-n.js script 15.6.4.3.js script 15.6.4.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Boolean/shell.js0000644000175000017500000000000011545150464021353 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-13.js0000644000175000017500000001332411545150464020762 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, -2208988800000 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-14.js0000644000175000017500000001332211545150464020761 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-14"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, 946684800000 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-15.js0000644000175000017500000001330611545150464020764 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, 0 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-16.js0000644000175000017500000001333011545150464020762 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, String( TIME_1900 ) ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-17.js0000644000175000017500000001334111545150464020765 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, String( TZ_DIFF* msPerHour ) ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-18.js0000644000175000017500000001333011545150464020764 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, String( TIME_2000 ) ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-2.js0000644000175000017500000000661611545150464020706 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_1970, TIME_1900, TIME_2000 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(TIME_NOW), test_times[j] ); } new TestCase( SECTION, "(new Date(NaN)).setTime()", NaN, (new Date(NaN)).setTime() ); new TestCase( SECTION, "Date.prototype.setTime.length", 1, Date.prototype.setTime.length ); test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-3-n.js0000644000175000017500000000535511545150464021141 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-3-n.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); var MYDATE = new MyDate(TIME_1970); DESCRIPTION = "MYDATE.setTime(TIME_2000)"; EXPECTED = "error"; new TestCase( SECTION, "MYDATE.setTime(TIME_2000)", "error", eval("MYDATE.setTime(TIME_2000)") ); test(); function MyDate(value) { this.value = value; this.setTime = Date.prototype.setTime; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-4.js0000644000175000017500000000670011545150464020702 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(TIME_0000), test_times[j] ); } new TestCase( SECTION, "(new Date(NaN)).setTime()", NaN, (new Date(NaN)).setTime() ); new TestCase( SECTION, "Date.prototype.setTime.length", 1, Date.prototype.setTime.length ); test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-5.js0000644000175000017500000000670111545150464020704 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(TIME_1970), test_times[j] ); } new TestCase( SECTION, "(new Date(NaN)).setTime()", NaN, (new Date(NaN)).setTime() ); new TestCase( SECTION, "Date.prototype.setTime.length", 1, Date.prototype.setTime.length ); test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-6.js0000644000175000017500000000670011545150464020704 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(TIME_1900), test_times[j] ); } new TestCase( SECTION, "(new Date(NaN)).setTime()", NaN, (new Date(NaN)).setTime() ); new TestCase( SECTION, "Date.prototype.setTime.length", 1, Date.prototype.setTime.length ); test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-7.js0000644000175000017500000000670111545150464020706 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(TIME_2000), test_times[j] ); } new TestCase( SECTION, "(new Date(NaN)).setTime()", NaN, (new Date(NaN)).setTime() ); new TestCase( SECTION, "Date.prototype.setTime.length", 1, Date.prototype.setTime.length ); test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-8.js0000644000175000017500000000635111545150464020710 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(UTC_FEB_29_2000), test_times[j] ); } test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-9.js0000644000175000017500000000635011545150464020710 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-2.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " "+ TITLE); test_times = new Array( TIME_NOW, TIME_0000, TIME_1970, TIME_1900, TIME_2000, UTC_FEB_29_2000, UTC_JAN_1_2005 ); for ( var j = 0; j < test_times.length; j++ ) { addTestCase( new Date(UTC_JAN_1_2005), test_times[j] ); } test(); function addTestCase( d, t ) { new TestCase( SECTION, "( "+d+" ).setTime("+t+")", t, d.setTime(t) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1.1)+")", TimeClip(t+1.1), d.setTime(t+1.1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+1)+")", t+1, d.setTime(t+1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-1)+")", t-1, d.setTime(t-1) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t-TZ_ADJUST)+")", t-TZ_ADJUST, d.setTime(t-TZ_ADJUST) ); new TestCase( SECTION, "( "+d+" ).setTime("+(t+TZ_ADJUST)+")", t+TZ_ADJUST, d.setTime(t+TZ_ADJUST) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.24-1.js0000644000175000017500000001260511545150464020701 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, 0 ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.24-2.js0000644000175000017500000001261511545150464020703 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, -86400000 ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.24-3.js0000644000175000017500000001262211545150464020702 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, -2208988800000 ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.24-4.js0000644000175000017500000001262011545150464020701 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, 946684800000 ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.24-5.js0000644000175000017500000001260711545150464020707 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, "0" ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.24-6.js0000644000175000017500000001262411545150464020707 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, "-2208988800000" ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.24-7.js0000644000175000017500000001261711545150464020712 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, "-86400000" ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.24-8.js0000644000175000017500000001262111545150464020706 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.24-1.js ECMA Section: 15.9.5.24 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var TITLE = "Date.prototype.setTime" var SECTION = "15.9.5.24-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)"); addTestCase( 0, "946684800000" ); test(); function addTestCase( startms, newms ) { var DateCase = new Date( startms ); DateCase.setMilliseconds( newms ); var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date"; var UTCDate = UTCDateFromTime( Number(newms) ); var LocalDate = LocalDateFromTime( Number(newms) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.25-1.js0000644000175000017500000001663711545150464020713 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.25-1.js ECMA Section: 15.9.5.25 Date.prototype.setUTCMilliseconds(ms) Description: 1. Let t be this time value. 2. Call ToNumber(ms). 3. Compute MakeTime(HourFromTime(t), MinFromTime(t), SecFromTime(t), Result(2)). 4. Compute MakeDate(Day(t), Result(3)). 5. Set the [[Value]] property of the this value to TimeClip(Result(4)). 6. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.25-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCMilliseconds(ms)"); addNewTestCase( 0, 0, "TDATE = new Date(0);(TDATE).setUTCMilliseconds(0);TDATE", UTCDateFromTime(SetUTCMilliseconds(0,0)), LocalDateFromTime(SetUTCMilliseconds(0,0)) ); addNewTestCase( 28800000,999, "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(999);TDATE", UTCDateFromTime(SetUTCMilliseconds(28800000,999)), LocalDateFromTime(SetUTCMilliseconds(28800000,999)) ); addNewTestCase( 28800000,-28800000, "TDATE = new Date(28800000);(TDATE).setUTCMilliseconds(-28800000);TDATE", UTCDateFromTime(SetUTCMilliseconds(28800000,-28800000)), LocalDateFromTime(SetUTCMilliseconds(28800000,-28800000)) ); addNewTestCase( 946684800000,1234567, "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(1234567);TDATE", UTCDateFromTime(SetUTCMilliseconds(946684800000,1234567)), LocalDateFromTime(SetUTCMilliseconds(946684800000,1234567)) ); addNewTestCase( 946684800000, 123456789, "TDATE = new Date(946684800000);(TDATE).setUTCMilliseconds(123456789);TDATE", UTCDateFromTime(SetUTCMilliseconds(946684800000,123456789)), LocalDateFromTime(SetUTCMilliseconds(946684800000,123456789)) ); addNewTestCase( -2208988800000,123456789, "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE", UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)), LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) ); addNewTestCase( -2208988800000,123456, "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE", UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)), LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) ); addNewTestCase( -2208988800000,-123456, "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE", UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)), LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) ); addNewTestCase( 0,-999, "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE", UTCDateFromTime(SetUTCMilliseconds(0,-999)), LocalDateFromTime(SetUTCMilliseconds(0,-999)) ); test(); function addNewTestCase( initialTime, ms, DateString, UTCDate, LocalDate) { DateCase = new Date(initialTime); DateCase.setUTCMilliseconds(ms); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCMilliseconds( T, MS ) { T = Number( T ); TIME = MakeTime( HourFromTime(T), MinFromTime(T), SecFromTime(T), MS ); return( MakeDate( Day(T), TIME )); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.26-1.js0000644000175000017500000001640611545150464020706 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.26-1.js ECMA Section: 15.9.5.26 Date.prototype.setSeconds(sec [,ms]) Description: If ms is not specified, this behaves as if ms were specified with the value getMilliseconds( ). 1. Let t be the result of LocalTime(this time value). 2. Call ToNumber(sec). 3. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2), Result(3)). 5. Compute UTC(MakeDate(Day(t), Result(4))). 6. Set the [[Value]] property of the this value to TimeClip(Result(5)). 7. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.26-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setSeconds(sec [,ms] )"); addNewTestCase( 0, 0, 0, "TDATE = new Date(0);(TDATE).setSeconds(0,0);TDATE", UTCDateFromTime(SetSeconds(0,0,0)), LocalDateFromTime(SetSeconds(0,0,0)) ); addNewTestCase( 28800000,59,999, "TDATE = new Date(28800000);(TDATE).setSeconds(59,999);TDATE", UTCDateFromTime(SetSeconds(28800000,59,999)), LocalDateFromTime(SetSeconds(28800000,59,999)) ); addNewTestCase( 28800000,999,999, "TDATE = new Date(28800000);(TDATE).setSeconds(999,999);TDATE", UTCDateFromTime(SetSeconds(28800000,999,999)), LocalDateFromTime(SetSeconds(28800000,999,999)) ); addNewTestCase( 28800000,999, void 0, "TDATE = new Date(28800000);(TDATE).setSeconds(999);TDATE", UTCDateFromTime(SetSeconds(28800000,999,0)), LocalDateFromTime(SetSeconds(28800000,999,0)) ); addNewTestCase( 28800000,-28800, void 0, "TDATE = new Date(28800000);(TDATE).setSeconds(-28800);TDATE", UTCDateFromTime(SetSeconds(28800000,-28800)), LocalDateFromTime(SetSeconds(28800000,-28800)) ); addNewTestCase( 946684800000,1234567,void 0, "TDATE = new Date(946684800000);(TDATE).setSeconds(1234567);TDATE", UTCDateFromTime(SetSeconds(946684800000,1234567)), LocalDateFromTime(SetSeconds(946684800000,1234567)) ); addNewTestCase( -2208988800000,59,999, "TDATE = new Date(-2208988800000);(TDATE).setSeconds(59,999);TDATE", UTCDateFromTime(SetSeconds(-2208988800000,59,999)), LocalDateFromTime(SetSeconds(-2208988800000,59,999)) ); test(); function addNewTestCase( startTime, sec, ms, DateString,UTCDate, LocalDate) { DateCase = new Date( startTime ); if ( ms != void 0 ) { DateCase.setSeconds( sec, ms ); } else { DateCase.setSeconds( sec ); } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetSeconds( t, s, m ) { var MS = ( m == void 0 ) ? msFromTime(t) : Number( m ); var TIME = LocalTime( t ); var SEC = Number(s); var RESULT4 = MakeTime( HourFromTime( TIME ), MinFromTime( TIME ), SEC, MS ); var UTC_TIME = UTC(MakeDate(Day(TIME), RESULT4)); return ( TimeClip(UTC_TIME) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.27-1.js0000644000175000017500000001631411545150464020705 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.27-1.js ECMA Section: 15.9.5.27 Date.prototype.setUTCSeconds(sec [,ms]) Description: If ms is not specified, this behaves as if ms were specified with the value getUTCMilliseconds( ). 1. Let t be this time value. 2. Call ToNumber(sec). 3. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms) 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2), Result(3)) 5. Compute MakeDate(Day(t), Result(4)). 6. Set the [[Value]] property of the this value to TimeClip(Result(5)). 7. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.27-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCSeconds(sec [,ms] )"); addNewTestCase( 0, 0, 0, "TDATE = new Date(0);(TDATE).setUTCSeconds(0,0);TDATE", UTCDateFromTime(SetUTCSeconds(0,0,0)), LocalDateFromTime(SetUTCSeconds(0,0,0)) ); addNewTestCase( 28800000,59,999, "TDATE = new Date(28800000);(TDATE).setUTCSeconds(59,999);TDATE", UTCDateFromTime(SetUTCSeconds(28800000,59,999)), LocalDateFromTime(SetUTCSeconds(28800000,59,999)) ); addNewTestCase( 28800000,999,999, "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999,999);TDATE", UTCDateFromTime(SetUTCSeconds(28800000,999,999)), LocalDateFromTime(SetUTCSeconds(28800000,999,999)) ); addNewTestCase( 28800000, 999, void 0, "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999);TDATE", UTCDateFromTime(SetUTCSeconds(28800000,999,0)), LocalDateFromTime(SetUTCSeconds(28800000,999,0)) ); addNewTestCase( 28800000, -28800, void 0, "TDATE = new Date(28800000);(TDATE).setUTCSeconds(-28800);TDATE", UTCDateFromTime(SetUTCSeconds(28800000,-28800)), LocalDateFromTime(SetUTCSeconds(28800000,-28800)) ); addNewTestCase( 946684800000, 1234567, void 0, "TDATE = new Date(946684800000);(TDATE).setUTCSeconds(1234567);TDATE", UTCDateFromTime(SetUTCSeconds(946684800000,1234567)), LocalDateFromTime(SetUTCSeconds(946684800000,1234567)) ); addNewTestCase( -2208988800000,59,999, "TDATE = new Date(-2208988800000);(TDATE).setUTCSeconds(59,999);TDATE", UTCDateFromTime(SetUTCSeconds(-2208988800000,59,999)), LocalDateFromTime(SetUTCSeconds(-2208988800000,59,999)) ); test(); function addNewTestCase( startTime, sec, ms, DateString, UTCDate, LocalDate) { DateCase = new Date( startTime ); if ( ms == void 0) { DateCase.setSeconds( sec ); } else { DateCase.setSeconds( sec, ms ); } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCSeconds( t, s, m ) { var TIME = t; var SEC = Number(s); var MS = ( m == void 0 ) ? msFromTime(TIME) : Number( m ); var RESULT4 = MakeTime( HourFromTime( TIME ), MinFromTime( TIME ), SEC, MS ); return ( TimeClip(MakeDate(Day(TIME), RESULT4)) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.28-1.js0000644000175000017500000001744411545150464020713 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.28-1.js ECMA Section: 15.9.5.28 Date.prototype.setMinutes(min [, sec [, ms ]] ) Description: If sec is not specified, this behaves as if sec were specified with the value getSeconds ( ). If ms is not specified, this behaves as if ms were specified with the value getMilliseconds( ). 1. Let t be the result of LocalTime(this time value). 2. Call ToNumber(min). 3. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec). 4. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Day(t), Result(5))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.28-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMinutes(sec [,ms] )"); addNewTestCase( 0, 0, void 0, void 0, "TDATE = new Date(0);(TDATE).setMinutes(0);TDATE", UTCDateFromTime(SetMinutes(0,0,0,0)), LocalDateFromTime(SetMinutes(0,0,0,0)) ); addNewTestCase( 28800000, 59, 59, void 0, "TDATE = new Date(28800000);(TDATE).setMinutes(59,59);TDATE", UTCDateFromTime(SetMinutes(28800000,59,59)), LocalDateFromTime(SetMinutes(28800000,59,59)) ); addNewTestCase( 28800000, 59, 59, 999, "TDATE = new Date(28800000);(TDATE).setMinutes(59,59,999);TDATE", UTCDateFromTime(SetMinutes(28800000,59,59,999)), LocalDateFromTime(SetMinutes(28800000,59,59,999)) ); addNewTestCase( 28800000, 59, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setMinutes(59);TDATE", UTCDateFromTime(SetMinutes(28800000,59,0)), LocalDateFromTime(SetMinutes(28800000,59,0)) ); addNewTestCase( 28800000, -480, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setMinutes(-480);TDATE", UTCDateFromTime(SetMinutes(28800000,-480)), LocalDateFromTime(SetMinutes(28800000,-480)) ); addNewTestCase( 946684800000, 1234567, void 0, void 0, "TDATE = new Date(946684800000);(TDATE).setMinutes(1234567);TDATE", UTCDateFromTime(SetMinutes(946684800000,1234567)), LocalDateFromTime(SetMinutes(946684800000,1234567)) ); addNewTestCase( -2208988800000,59, 59, void 0, "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59);TDATE", UTCDateFromTime(SetMinutes(-2208988800000,59,59)), LocalDateFromTime(SetMinutes(-2208988800000,59,59)) ); addNewTestCase( -2208988800000, 59, 59, 999, "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59,999);TDATE", UTCDateFromTime(SetMinutes(-2208988800000,59,59,999)), LocalDateFromTime(SetMinutes(-2208988800000,59,59,999)) ); test(); function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) { DateCase = new Date( time ); if ( sec == void 0 ) { DateCase.setMinutes( min ); } else { if ( ms == void 0 ) { DateCase.setMinutes( min, sec ); } else { DateCase.setMinutes( min, sec, ms ); } } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetMinutes( t, min, sec, ms ) { var TIME = LocalTime(t); var MIN = Number(min); var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); var RESULT5 = MakeTime( HourFromTime( TIME ), MIN, SEC, MS ); return ( TimeClip(UTC( MakeDate(Day(TIME),RESULT5))) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.29-1.js0000644000175000017500000001714411545150464020711 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.29-1.js ECMA Section: 15.9.5.29 Date.prototype.setUTCMinutes(min [, sec [, ms ]] ) Description: If sec is not specified, this behaves as if sec were specified with the value getUTCSeconds ( ). If ms is not specified, this behaves as if ms were specified with the value getUTCMilliseconds( ). 1. Let t be this time value. 2. Call ToNumber(min). 3. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec). 4. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)). 6. Compute MakeDate(Day(t), Result(5)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.29-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCMinutes( min [, sec, ms] )"); addNewTestCase( 0, 0, void 0, void 0, "TDATE = new Date(0);(TDATE).setUTCMinutes(0);TDATE", UTCDateFromTime(SetUTCMinutes(0,0,0,0)), LocalDateFromTime(SetUTCMinutes(0,0,0,0)) ); addNewTestCase( 28800000, 59, 59, void 0, "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59);TDATE", UTCDateFromTime(SetUTCMinutes(28800000,59,59)), LocalDateFromTime(SetUTCMinutes(28800000,59,59)) ); addNewTestCase( 28800000, 59, 59, 999, "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59,999);TDATE", UTCDateFromTime(SetUTCMinutes(28800000,59,59,999)), LocalDateFromTime(SetUTCMinutes(28800000,59,59,999)) ); addNewTestCase( 28800000, 59, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59);TDATE", UTCDateFromTime(SetUTCMinutes(28800000,59)), LocalDateFromTime(SetUTCMinutes(28800000,59)) ); addNewTestCase( 28800000, -480, 0, 0, "TDATE = new Date(28800000);(TDATE).setUTCMinutes(-480);TDATE", UTCDateFromTime(SetUTCMinutes(28800000,-480)), LocalDateFromTime(SetUTCMinutes(28800000,-480)) ); addNewTestCase( 946684800000, 1234567, void 0, void 0, "TDATE = new Date(946684800000);(TDATE).setUTCMinutes(1234567);TDATE", UTCDateFromTime(SetUTCMinutes(946684800000,1234567)), LocalDateFromTime(SetUTCMinutes(946684800000,1234567)) ); addNewTestCase( -2208988800000, 59, 999, void 0, "TDATE = new Date(-2208988800000);(TDATE).setUTCMinutes(59,999);TDATE", UTCDateFromTime(SetUTCMinutes(-2208988800000,59,999)), LocalDateFromTime(SetUTCMinutes(-2208988800000,59,999)) ); test(); function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) { var DateCase = new Date( time ); if ( sec == void 0 ) { DateCase.setUTCMinutes( min ); } else { if ( ms == void 0 ) { DateCase.setUTCMinutes( min, sec ); } else { DateCase.setUTCMinutes( min, sec, ms ); } } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCMinutes( t, min, sec, ms ) { var TIME = t; var MIN = Number(min); var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); var RESULT5 = MakeTime( HourFromTime( TIME ), MIN, SEC, MS ); return ( TimeClip(MakeDate(Day(TIME),RESULT5)) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.3-1-n.js0000644000175000017500000000556711545150464021062 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.3-1.js ECMA Section: 15.9.5.3-1 Date.prototype.valueOf Description: The valueOf function returns a number, which is this time value. The valueOf function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.3-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.valueOf"; writeHeaderToLog( SECTION + " "+ TITLE); var OBJ = new MyObject( new Date(0) ); DESCRIPTION = "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()"; EXPECTED = "error"; new TestCase( SECTION, "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()", "error", eval("OBJ.valueOf()") ); test(); function MyObject( value ) { this.value = value; this.valueOf = Date.prototype.valueOf; // The following line causes an infinte loop // this.toString = new Function( "return this+\"\";"); return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.3-2.js0000644000175000017500000000643311545150464020621 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.3-2.js ECMA Section: 15.9.5.3-2 Date.prototype.valueOf Description: The valueOf function returns a number, which is this time value. The valueOf function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.valueOf"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+").valueOf()", t, (new Date(t)).valueOf() ); new TestCase( SECTION, "(new Date("+(t+1)+").valueOf()", t+1, (new Date(t+1)).valueOf() ); new TestCase( SECTION, "(new Date("+(t-1)+").valueOf()", t-1, (new Date(t-1)).valueOf() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+").valueOf()", t-TZ_ADJUST, (new Date(t-TZ_ADJUST)).valueOf() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+").valueOf()", t+TZ_ADJUST, (new Date(t+TZ_ADJUST)).valueOf() ); } function MyObject( value ) { this.value = value; this.valueOf = Date.prototype.valueOf; this.toString = new Function( "return this+\"\";"); return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.30-1.js0000644000175000017500000001737711545150464020711 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.30-1.js ECMA Section: 15.9.5.30 Date.prototype.setHours(hour [, min [, sec [, ms ]]] ) Description: If min is not specified, this behaves as if min were specified with the value getMinutes( ). If sec is not specified, this behaves as if sec were specified with the value getSeconds ( ). If ms is not specified, this behaves as if ms were specified with the value getMilliseconds( ). 1. Let t be the result of LocalTime(this time value). 2. Call ToNumber(hour). 3. If min is not specified, compute MinFromTime(t); otherwise, call ToNumber(min). 4. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec). 5. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). 6. Compute MakeTime(Result(2), Result(3), Result(4), Result(5)). 7. Compute UTC(MakeDate(Day(t), Result(6))). 8. Set the [[Value]] property of the this value to TimeClip(Result(7)). 9. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.30-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setHours( hour [, min, sec, ms] )"); addNewTestCase( 0,0,0,0,void 0, "TDATE = new Date(0);(TDATE).setHours(0);TDATE" ); addNewTestCase( 28800000, 23, 59, 999,void 0, "TDATE = new Date(28800000);(TDATE).setHours(23,59,999);TDATE" ); addNewTestCase( 28800000, 999, 999, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setHours(999,999);TDATE" ); addNewTestCase( 28800000,999,0, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setHours(999);TDATE" ); addNewTestCase( 28800000,-8, void 0, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setHours(-8);TDATE" ); addNewTestCase( 946684800000,8760, void 0, void 0, void 0, "TDATE = new Date(946684800000);(TDATE).setHours(8760);TDATE" ); addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 999, "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,999)" ); addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 1000, "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,1000)" ); test(); function addNewTestCase( time, hours, min, sec, ms, DateString) { var UTCDate = UTCDateFromTime( SetHours( time, hours, min, sec, ms )); var LocalDate = LocalDateFromTime( SetHours( time, hours, min, sec, ms )); var DateCase = new Date( time ); if ( min == void 0 ) { DateCase.setHours( hours ); } else { if ( sec == void 0 ) { DateCase.setHours( hours, min ); } else { if ( ms == void 0 ) { DateCase.setHours( hours, min, sec ); } else { DateCase.setHours( hours, min, sec, ms ); } } } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.day = WeekDay( t ); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); return (d); } function SetHours( t, hour, min, sec, ms ) { var TIME = LocalTime(t); var HOUR = Number(hour); var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min); var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); var RESULT6 = MakeTime( HOUR, MIN, SEC, MS ); var UTC_TIME = UTC( MakeDate(Day(TIME), RESULT6) ); return ( TimeClip(UTC_TIME) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.31-1.js0000644000175000017500000002154011545150464020675 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.31-1.js ECMA Section: 15.9.5.31 Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] ) Description: If min is not specified, this behaves as if min were specified with the value getUTCMinutes( ). If sec is not specified, this behaves as if sec were specified with the value getUTCSeconds ( ). If ms is not specified, this behaves as if ms were specified with the value getUTCMilliseconds( ). 1.Let t be this time value. 2.Call ToNumber(hour). 3.If min is not specified, compute MinFromTime(t); otherwise, call ToNumber(min). 4.If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec). 5.If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms). 6.Compute MakeTime(Result(2), Result(3), Result(4), Result(5)). 7.Compute MakeDate(Day(t), Result(6)). 8.Set the [[Value]] property of the this value to TimeClip(Result(7)). 1.Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.31-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog(SECTION + " Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )"); addNewTestCase( 0, 0, void 0, void 0, void 0, "TDATE = new Date(0);(TDATE).setUTCHours(0);TDATE", UTCDateFromTime(SetUTCHours(0,0,0,0)), LocalDateFromTime(SetUTCHours(0,0,0,0)) ); addNewTestCase( 28800000, 23, 59, 999, void 0, "TDATE = new Date(28800000);(TDATE).setUTCHours(23,59,999);TDATE", UTCDateFromTime(SetUTCHours(28800000,23,59,999)), LocalDateFromTime(SetUTCHours(28800000,23,59,999)) ); addNewTestCase( 28800000,999,999, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setUTCHours(999,999);TDATE", UTCDateFromTime(SetUTCHours(28800000,999,999)), LocalDateFromTime(SetUTCHours(28800000,999,999)) ); addNewTestCase( 28800000, 999, void 0, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setUTCHours(999);TDATE", UTCDateFromTime(SetUTCHours(28800000,999,0)), LocalDateFromTime(SetUTCHours(28800000,999,0)) ); addNewTestCase( 28800000, -8670, void 0, void 0, void 0, "TDATE = new Date(28800000);(TDATE).setUTCHours(-8670);TDATE", UTCDateFromTime(SetUTCHours(28800000,-8670)), LocalDateFromTime(SetUTCHours(28800000,-8670)) ); // modify hours to remove dst ambiguity addNewTestCase( 946684800000, 1235567, void 0, void 0, void 0, "TDATE = new Date(946684800000);(TDATE).setUTCHours(1235567);TDATE", UTCDateFromTime(SetUTCHours(946684800000,1235567)), LocalDateFromTime(SetUTCHours(946684800000,1235567)) ); addNewTestCase( -2208988800000, 59, 999, void 0, void 0, "TDATE = new Date(-2208988800000);(TDATE).setUTCHours(59,999);TDATE", UTCDateFromTime(SetUTCHours(-2208988800000,59,999)), LocalDateFromTime(SetUTCHours(-2208988800000,59,999)) ); test(); function addNewTestCase( time, hours, min, sec, ms, DateString, UTCDate, LocalDate) { DateCase = new Date(time); if ( min == void 0 ) { DateCase.setUTCHours( hours ); } else { if ( sec == void 0 ) { DateCase.setUTCHours( hours, min ); } else { if ( ms == void 0 ) { DateCase.setUTCHours( hours, min, sec ); } else { DateCase.setUTCHours( hours, min, sec, ms ); } } } new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;" + DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCHours( t, hour, min, sec, ms ) { var TIME = t; var HOUR = Number(hour); var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min); var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec); var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms); var RESULT6 = MakeTime( HOUR, MIN, SEC, MS ); return ( TimeClip(MakeDate(Day(TIME), RESULT6)) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.32-1.js0000644000175000017500000001345511545150464020704 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.32-1.js ECMA Section: 15.9.5.32 Date.prototype.setDate(date) Description: 1. Let t be the result of LocalTime(this time value). 2. Call ToNumber(date). 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)). 4. Compute UTC(MakeDate(Result(3), TimeWithinDay(t))). 5. Set the [[Value]] property of the this value to TimeClip(Result(4)). 6. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.32-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setDate(date) "); addNewTestCase( 0, 1, "TDATE = new Date(0);(TDATE).setDate(1);TDATE" ); test(); function addNewTestCase( t, d, DateString ) { var DateCase = new Date( t ); DateCase.setDate( d ); var UTCDate = UTCDateFromTime(SetDate(t, d)); var LocalDate=LocalDateFromTime(SetDate(t,d)); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetDate( t, date ) { var T = LocalTime( t ); var DATE = Number( date ); var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE ); var UTC_DATE = UTC( MakeDate(RESULT3, TimeWithinDay(T)) ); return ( TimeClip(UTC_DATE) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.33-1.js0000644000175000017500000001377111545150464020706 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.33-1.js ECMA Section: 15.9.5.33 Date.prototype.setUTCDate(date) Description: 1. Let t be this time value. 2. Call ToNumber(date). 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)). 4. Compute MakeDate(Result(3), TimeWithinDay(t)). 5. Set the [[Value]] property of the this value to TimeClip(Result(4)). 6. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.33-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCDate(date) "); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(31);TDATE", UTCDateFromTime(SetUTCDate(0,31)), LocalDateFromTime(SetUTCDate(0,31)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(1);TDATE", UTCDateFromTime(SetUTCDate(0,1)), LocalDateFromTime(SetUTCDate(0,1)) ); addNewTestCase( "TDATE = new Date(86400000);(TDATE).setUTCDate(1);TDATE", UTCDateFromTime(SetUTCDate(86400000,1)), LocalDateFromTime(SetUTCDate(86400000,1)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCDate( t, date ) { var T = t; var DATE = Number( date ); var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE ); return ( TimeClip(MakeDate(RESULT3, TimeWithinDay(t))) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.34-1.js0000644000175000017500000001571711545150464020711 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.34-1.js ECMA Section: 15.9.5.34 Date.prototype.setMonth(mon [, date ] ) Description: If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value). 2. Call ToNumber(date). 3. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 4. Compute MakeDay(YearFromTime(t), Result(2), Result(3)). 5. Compute UTC(MakeDate(Result(4), TimeWithinDay(t))). 6. Set the [[Value]] property of the this value to TimeClip(Result(5)). 7. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.34-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setMonth(mon [, date ] )"); getFunctionCases(); // regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112404 d = new Date(0); d.setMonth(1,1,1,1,1,1); addNewTestCase( "TDATE = new Date(0); TDATE.setMonth(1,1,1,1,1,1); TDATE", UTCDateFromTime(SetMonth(0,1,1)), LocalDateFromTime(SetMonth(0,1,1)) ); // whatever today is addNewTestCase( "TDATE = new Date(TIME_NOW); (TDATE).setMonth(11,31); TDATE", UTCDateFromTime(SetMonth(TIME_NOW,11,31)), LocalDateFromTime(SetMonth(TIME_NOW,11,31)) ); // 1970 addNewTestCase( "TDATE = new Date(0);(TDATE).setMonth(0,1);TDATE", UTCDateFromTime(SetMonth(0,0,1)), LocalDateFromTime(SetMonth(0,0,1)) ); addNewTestCase( "TDATE = new Date("+TIME_1900+"); "+ "(TDATE).setMonth(11,31); TDATE", UTCDateFromTime( SetMonth(TIME_1900,11,31) ), LocalDateFromTime( SetMonth(TIME_1900,11,31) ) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function getFunctionCases() { // some tests for all functions new TestCase( SECTION, "Date.prototype.setMonth.length", 2, Date.prototype.setMonth.length ); new TestCase( SECTION, "typeof Date.prototype.setMonth", "function", typeof Date.prototype.setMonth ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetMonth( t, mon, date ) { var TIME = LocalTime(t); var MONTH = Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(TIME) : Number( date ); var DAY = MakeDay( YearFromTime(TIME), MONTH, DATE ); return ( TimeClip (UTC(MakeDate( DAY, TimeWithinDay(TIME) ))) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.35-1.js0000644000175000017500000001367611545150464020714 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.35-1.js ECMA Section: 15.9.5.35 Date.prototype.setUTCMonth(mon [,date]) Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.35-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCMonth(mon [,date] ) "); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(0);TDATE", UTCDateFromTime(SetUTCMonth(0,0)), LocalDateFromTime(SetUTCMonth(0,0)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(11);TDATE", UTCDateFromTime(SetUTCMonth(0,11)), LocalDateFromTime(SetUTCMonth(0,11)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(5,4);TDATE", UTCDateFromTime(SetUTCMonth(0,5,4)), LocalDateFromTime(SetUTCMonth(0,5,4)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCMonth( t, month, date ) { var T = t; var MONTH = Number( month ); var DATE = ( date == void 0) ? DateFromTime(T) : Number( date ); var RESULT4 = MakeDay(YearFromTime(T), MONTH, DATE ); var RESULT5 = MakeDate( RESULT4, TimeWithinDay(T)); return ( TimeClip(RESULT5) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.36-1.js0000644000175000017500000001537711545150464020715 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // 1969 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969);TDATE", UTCDateFromTime(SetFullYear(0,1969)), LocalDateFromTime(SetFullYear(0,1969)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11);TDATE", UTCDateFromTime(SetFullYear(0,1969,11)), LocalDateFromTime(SetFullYear(0,1969,11)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11,31);TDATE", UTCDateFromTime(SetFullYear(0,1969,11,31)), LocalDateFromTime(SetFullYear(0,1969,11,31)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.36-2.js0000644000175000017500000001536511545150464020713 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // 1970 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE", UTCDateFromTime(SetFullYear(0,1970)), LocalDateFromTime(SetFullYear(0,1970)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE", UTCDateFromTime(SetFullYear(0,1970,0)), LocalDateFromTime(SetFullYear(0,1970,0)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE", UTCDateFromTime(SetFullYear(0,1970,0,1)), LocalDateFromTime(SetFullYear(0,1970,0,1)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.36-3.js0000644000175000017500000001536411545150464020713 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // 1971 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE", UTCDateFromTime(SetFullYear(0,1971)), LocalDateFromTime(SetFullYear(0,1971)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE", UTCDateFromTime(SetFullYear(0,1971,0)), LocalDateFromTime(SetFullYear(0,1971,0)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE", UTCDateFromTime(SetFullYear(0,1971,0,1)), LocalDateFromTime(SetFullYear(0,1971,0,1)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.36-4.js0000644000175000017500000001537511545150464020716 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // 1999 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE", UTCDateFromTime(SetFullYear(0,1999)), LocalDateFromTime(SetFullYear(0,1999)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE", UTCDateFromTime(SetFullYear(0,1999,11)), LocalDateFromTime(SetFullYear(0,1999,11)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE", UTCDateFromTime(SetFullYear(0,1999,11,31)), LocalDateFromTime(SetFullYear(0,1999,11,31)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.36-5.js0000644000175000017500000001536411545150464020715 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // 2000 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", UTCDateFromTime(SetFullYear(0,2000)), LocalDateFromTime(SetFullYear(0,2000)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE", UTCDateFromTime(SetFullYear(0,2000,0)), LocalDateFromTime(SetFullYear(0,2000,0)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE", UTCDateFromTime(SetFullYear(0,2000,0,1)), LocalDateFromTime(SetFullYear(0,2000,0,1)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.36-6.js0000644000175000017500000001537711545150464020722 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // feb 29, 2000 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE", UTCDateFromTime(SetFullYear(0,2000)), LocalDateFromTime(SetFullYear(0,2000)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE", UTCDateFromTime(SetFullYear(0,2000,1)), LocalDateFromTime(SetFullYear(0,2000,1)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE", UTCDateFromTime(SetFullYear(0,2000,1,29)), LocalDateFromTime(SetFullYear(0,2000,1,29)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.36-7.js0000644000175000017500000001537311545150464020717 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.36-1.js ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getMonth( ). If date is not specified, this behaves as if date were specified with the value getDate( ). 1. Let t be the result of LocalTime(this time value); but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added test cases for Year 2000 Compatilibity Testing. */ var SECTION = "15.9.5.36-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )"); // Jan 1, 2005 addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE", UTCDateFromTime(SetFullYear(0,2005)), LocalDateFromTime(SetFullYear(0,2005)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE", UTCDateFromTime(SetFullYear(0,2005,0)), LocalDateFromTime(SetFullYear(0,2005,0)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE", UTCDateFromTime(SetFullYear(0,2005,0,1)), LocalDateFromTime(SetFullYear(0,2005,0,1)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetFullYear( t, year, mon, date ) { var T = ( isNaN(t) ) ? 0 : LocalTime(t) ; var YEAR = Number( year ); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T))); return ( TimeClip(UTC_DATE) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.37-1.js0000644000175000017500000001625211545150464020707 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.37-1.js ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getUTCMonth( ). If date is not specified, this behaves as if date were specified with the value getUTCDate( ). 1. Let t be this time value; but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute MakeDate(Result(5), TimeWithinDay(t)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added some Year 2000 test cases. */ var SECTION = "15.9.5.37-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); // Dates around 1970 addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1970);TDATE", UTCDateFromTime(SetUTCFullYear(0,1970)), LocalDateFromTime(SetUTCFullYear(0,1970)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1971);TDATE", UTCDateFromTime(SetUTCFullYear(0,1971)), LocalDateFromTime(SetUTCFullYear(0,1971)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE", UTCDateFromTime(SetUTCFullYear(0,1972)), LocalDateFromTime(SetUTCFullYear(0,1972)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE", UTCDateFromTime(SetUTCFullYear(0,1968)), LocalDateFromTime(SetUTCFullYear(0,1968)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE", UTCDateFromTime(SetUTCFullYear(0,1969)), LocalDateFromTime(SetUTCFullYear(0,1969)) ); addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE", UTCDateFromTime(SetUTCFullYear(0,1969)), LocalDateFromTime(SetUTCFullYear(0,1969)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCFullYear( t, year, mon, date ) { var T = ( t != t ) ? 0 : t; var YEAR = Number(year); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.37-2.js0000644000175000017500000001527011545150464020707 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.37-1.js ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getUTCMonth( ). If date is not specified, this behaves as if date were specified with the value getUTCDate( ). 1. Let t be this time value; but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute MakeDate(Result(5), TimeWithinDay(t)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added some Year 2000 test cases. */ var SECTION = "15.9.5.37-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); // Dates around 2000 addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE", UTCDateFromTime(SetUTCFullYear(0,2000)), LocalDateFromTime(SetUTCFullYear(0,2000)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE", UTCDateFromTime(SetUTCFullYear(0,2001)), LocalDateFromTime(SetUTCFullYear(0,2001)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE", UTCDateFromTime(SetUTCFullYear(0,1999)), LocalDateFromTime(SetUTCFullYear(0,1999)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCFullYear( t, year, mon, date ) { var T = ( t != t ) ? 0 : t; var YEAR = Number(year); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.37-3.js0000644000175000017500000001545411545150464020714 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.37-1.js ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getUTCMonth( ). If date is not specified, this behaves as if date were specified with the value getUTCDate( ). 1. Let t be this time value; but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute MakeDate(Result(5), TimeWithinDay(t)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added some Year 2000 test cases. */ var SECTION = "15.9.5.37-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); // Dates around 29 February 2000 var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) + 31*msPerDay + 28*msPerDay; var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour; addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+ "TDATE.setUTCFullYear(2000);TDATE", UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)), LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) ); addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+ "TDATE.setUTCFullYear(2000);TDATE", UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)), LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCFullYear( t, year, mon, date ) { var T = ( t != t ) ? 0 : t; var YEAR = Number(year); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.37-4.js0000644000175000017500000001545511545150464020716 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.37-1.js ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getUTCMonth( ). If date is not specified, this behaves as if date were specified with the value getUTCDate( ). 1. Let t be this time value; but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute MakeDate(Result(5), TimeWithinDay(t)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added some Year 2000 test cases. */ var SECTION = "15.9.5.37-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); // Dates around 2005 addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE", UTCDateFromTime(SetUTCFullYear(0,2005)), LocalDateFromTime(SetUTCFullYear(0,2005)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE", UTCDateFromTime(SetUTCFullYear(0,2004)), LocalDateFromTime(SetUTCFullYear(0,2004)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE", UTCDateFromTime(SetUTCFullYear(0,2006)), LocalDateFromTime(SetUTCFullYear(0,2006)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); // fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year; new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCFullYear( t, year, mon, date ) { var T = ( t != t ) ? 0 : t; var YEAR = Number(year); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.37-5.js0000644000175000017500000001526611545150464020717 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.37-1.js ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] ) Description: If mon is not specified, this behaves as if mon were specified with the value getUTCMonth( ). If date is not specified, this behaves as if date were specified with the value getUTCDate( ). 1. Let t be this time value; but if this time value is NaN, let t be +0. 2. Call ToNumber(year). 3. If mon is not specified, compute MonthFromTime(t); otherwise, call ToNumber(mon). 4. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date). 5. Compute MakeDay(Result(2), Result(3), Result(4)). 6. Compute MakeDate(Result(5), TimeWithinDay(t)). 7. Set the [[Value]] property of the this value to TimeClip(Result(6)). 8. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 Added some Year 2000 test cases. */ var SECTION = "15.9.5.37-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )"); // Dates around 1900 addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE", UTCDateFromTime(SetUTCFullYear(0,1900)), LocalDateFromTime(SetUTCFullYear(0,1900)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE", UTCDateFromTime(SetUTCFullYear(0,1899)), LocalDateFromTime(SetUTCFullYear(0,1899)) ); addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE", UTCDateFromTime(SetUTCFullYear(0,1901)), LocalDateFromTime(SetUTCFullYear(0,1901)) ); test(); function addNewTestCase( DateString, UTCDate, LocalDate) { DateCase = eval( DateString ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } function SetUTCFullYear( t, year, mon, date ) { var T = ( t != t ) ? 0 : t; var YEAR = Number(year); var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon ); var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date ); var DAY = MakeDay( YEAR, MONTH, DATE ); return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.4-1.js0000644000175000017500000000576411545150464020627 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.4-1.js ECMA Section: 15.9.5.4-1 Date.prototype.getTime Description: 1. If the this value is not an object whose [[Class]] property is "Date", generate a runtime error. 2. Return this time value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTime"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+").getTime()", t, (new Date(t)).getTime() ); new TestCase( SECTION, "(new Date("+(t+1)+").getTime()", t+1, (new Date(t+1)).getTime() ); new TestCase( SECTION, "(new Date("+(t-1)+").getTime()", t-1, (new Date(t-1)).getTime() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+").getTime()", t-TZ_ADJUST, (new Date(t-TZ_ADJUST)).getTime() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+").getTime()", t+TZ_ADJUST, (new Date(t+TZ_ADJUST)).getTime() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.4-2-n.js0000644000175000017500000000507211545150464021053 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.4-2-n.js ECMA Section: 15.9.5.4-1 Date.prototype.getTime Description: 1. If the this value is not an object whose [[Class]] property is "Date", generate a runtime error. 2. Return this time value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.4-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTime"; writeHeaderToLog( SECTION + " "+ TITLE); var MYDATE = new MyDate( TIME_2000 ); DESCRIPTION = "MYDATE.getTime()"; EXPECTED = "error"; new TestCase( SECTION, "MYDATE.getTime()", "error", eval("MYDATE.getTime()") ); test(); function MyDate( value ) { this.value = value; this.getTime = Date.prototype.getTime; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.5.js0000644000175000017500000000713311545150464020462 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.5.js ECMA Section: 15.9.5.5 Description: Date.prototype.getYear This function is specified here for backwards compatibility only. The function getFullYear is much to be preferred for nearly all purposes, because it avoids the "year 2000 problem." 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return YearFromTime(LocalTime(t)) 1900. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getYear()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); new TestCase( SECTION, "(new Date(NaN)).getYear()", NaN, (new Date(NaN)).getYear() ); new TestCase( SECTION, "Date.prototype.getYear.length", 0, Date.prototype.getYear.length ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getYear()", GetYear(YearFromTime(LocalTime(t))), (new Date(t)).getYear() ); new TestCase( SECTION, "(new Date("+(t+1)+")).getYear()", GetYear(YearFromTime(LocalTime(t+1))), (new Date(t+1)).getYear() ); new TestCase( SECTION, "(new Date("+(t-1)+")).getYear()", GetYear(YearFromTime(LocalTime(t-1))), (new Date(t-1)).getYear() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+")).getYear()", GetYear(YearFromTime(LocalTime(t-TZ_ADJUST))), (new Date(t-TZ_ADJUST)).getYear() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+")).getYear()", GetYear(YearFromTime(LocalTime(t+TZ_ADJUST))), (new Date(t+TZ_ADJUST)).getYear() ); } function GetYear( year ) { return year - 1900; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.6.js0000644000175000017500000000662511545150464020470 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.6.js ECMA Section: 15.9.5.6 Description: Date.prototype.getFullYear 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return YearFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getFullYear()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getFullYear()", NaN, (new Date(NaN)).getFullYear() ); new TestCase( SECTION, "Date.prototype.getFullYear.length", 0, Date.prototype.getFullYear.length ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getFullYear()", YearFromTime(LocalTime(t)), (new Date(t)).getFullYear() ); new TestCase( SECTION, "(new Date("+(t+1)+")).getFullYear()", YearFromTime(LocalTime(t+1)), (new Date(t+1)).getFullYear() ); new TestCase( SECTION, "(new Date("+(t-1)+")).getFullYear()", YearFromTime(LocalTime(t-1)), (new Date(t-1)).getFullYear() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+")).getFullYear()", YearFromTime(LocalTime(t-TZ_ADJUST)), (new Date(t-TZ_ADJUST)).getFullYear() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+")).getFullYear()", YearFromTime(LocalTime(t+TZ_ADJUST)), (new Date(t+TZ_ADJUST)).getFullYear() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.7.js0000644000175000017500000000657311545150464020473 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.7.js ECMA Section: 15.9.5.7 Description: Date.prototype.getUTCFullYear 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return YearFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.7"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCFullYear()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getUTCFullYear()", NaN, (new Date(NaN)).getUTCFullYear() ); new TestCase( SECTION, "Date.prototype.getUTCFullYear.length", 0, Date.prototype.getUTCFullYear.length ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCFullYear()", YearFromTime(t), (new Date(t)).getUTCFullYear() ); new TestCase( SECTION, "(new Date("+(t+1)+")).getUTCFullYear()", YearFromTime(t+1), (new Date(t+1)).getUTCFullYear() ); new TestCase( SECTION, "(new Date("+(t-1)+")).getUTCFullYear()", YearFromTime(t-1), (new Date(t-1)).getUTCFullYear() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+")).getUTCFullYear()", YearFromTime(t-TZ_ADJUST), (new Date(t-TZ_ADJUST)).getUTCFullYear() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+")).getUTCFullYear()", YearFromTime(t+TZ_ADJUST), (new Date(t+TZ_ADJUST)).getUTCFullYear() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.8.js0000644000175000017500000000736311545150464020472 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.8.js ECMA Section: 15.9.5.8 Description: Date.prototype.getMonth 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return MonthFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.8"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getMonth()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getMonth()", NaN, (new Date(NaN)).getMonth() ); new TestCase( SECTION, "Date.prototype.getMonth.length", 0, Date.prototype.getMonth.length ); test(); function addTestCase( t ) { var leap = InLeapYear(t); for ( var m = 0; m < 12; m++ ) { t += TimeInMonth(m, leap); new TestCase( SECTION, "(new Date("+t+")).getMonth()", MonthFromTime(LocalTime(t)), (new Date(t)).getMonth() ); new TestCase( SECTION, "(new Date("+(t+1)+")).getMonth()", MonthFromTime(LocalTime(t+1)), (new Date(t+1)).getMonth() ); new TestCase( SECTION, "(new Date("+(t-1)+")).getMonth()", MonthFromTime(LocalTime(t-1)), (new Date(t-1)).getMonth() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+")).getMonth()", MonthFromTime(LocalTime(t-TZ_ADJUST)), (new Date(t-TZ_ADJUST)).getMonth() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+")).getMonth()", MonthFromTime(LocalTime(t+TZ_ADJUST)), (new Date(t+TZ_ADJUST)).getMonth() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.9.js0000644000175000017500000000674511545150464020476 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.9.js ECMA Section: 15.9.5.9 Description: Date.prototype.getUTCMonth 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return MonthFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.9"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMonth()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getUTCMonth()", NaN, (new Date(NaN)).getUTCMonth() ); new TestCase( SECTION, "Date.prototype.getUTCMonth.length", 0, Date.prototype.getUTCMonth.length ); test(); function addTestCase( t ) { var leap = InLeapYear(t); for ( var m = 0; m < 12; m++ ) { t += TimeInMonth(m, leap); new TestCase( SECTION, "(new Date("+t+")).getUTCMonth()", MonthFromTime(t), (new Date(t)).getUTCMonth() ); new TestCase( SECTION, "(new Date("+(t+1)+")).getUTCMonth()", MonthFromTime(t+1), (new Date(t+1)).getUTCMonth() ); new TestCase( SECTION, "(new Date("+(t-1)+")).getUTCMonth()", MonthFromTime(t-1), (new Date(t-1)).getUTCMonth() ); new TestCase( SECTION, "(new Date("+(t-TZ_ADJUST)+")).getUTCMonth()", MonthFromTime(t-TZ_ADJUST), (new Date(t-TZ_ADJUST)).getUTCMonth() ); new TestCase( SECTION, "(new Date("+(t+TZ_ADJUST)+")).getUTCMonth()", MonthFromTime(t+TZ_ADJUST), (new Date(t+TZ_ADJUST)).getUTCMonth() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.js0000644000175000017500000000624611545150464020323 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.js ECMA Section: 15.9.5 Properties of the Date prototype object Description: The Date prototype object is itself a Date object (its [[Class]] is "Date") whose value is NaN. The value of the internal [[Prototype]] property of the Date prototype object is the Object prototype object (15.2.3.1). In following descriptions of functions that are properties of the Date prototype object, the phrase "this Date object" refers to the object that is the this value for the invocation of the function; it is an error if this does not refer to an object for which the value of the internal [[Class]] property is "Date". Also, the phrase "this time value" refers to the number value for the time represented by this Date object, that is, the value of the internal [[Value]] property of this Date object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Date Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); Date.prototype.getClass = Object.prototype.toString; new TestCase( SECTION, "Date.prototype.getClass", "[object Date]", Date.prototype.getClass() ); new TestCase( SECTION, "Date.prototype.valueOf()", NaN, Date.prototype.valueOf() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/browser.js0000644000175000017500000000000011545150464021225 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/dst-offset-caching-1-of-8.js0000644000175000017500000000023011545150464024124 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(1, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/dst-offset-caching-2-of-8.js0000644000175000017500000000023011545150464024125 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(2, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/dst-offset-caching-3-of-8.js0000644000175000017500000000023011545150464024126 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(3, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/dst-offset-caching-4-of-8.js0000644000175000017500000000023011545150464024127 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(4, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/dst-offset-caching-5-of-8.js0000644000175000017500000000023011545150464024130 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(5, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/dst-offset-caching-6-of-8.js0000644000175000017500000000023011545150464024131 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(6, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/dst-offset-caching-7-of-8.js0000644000175000017500000000023011545150464024132 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(7, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/dst-offset-caching-8-of-8.js0000644000175000017500000000023011545150464024133 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ runDSTOffsetCachingTestsFraction(8, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/jstests.list0000644000175000017500000000743311545150464021621 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/Date/ script 15.9.1.1-1.js script 15.9.1.1-2.js script 15.9.1.13-1.js script 15.9.2.1.js script 15.9.2.2-1.js script 15.9.2.2-2.js script 15.9.2.2-3.js script 15.9.2.2-4.js script 15.9.2.2-5.js script 15.9.2.2-6.js script 15.9.3.1-1.js script 15.9.3.1-2.js script 15.9.3.1-3.js script 15.9.3.1-4.js script 15.9.3.1-5.js script 15.9.3.2-1.js script 15.9.3.2-2.js script 15.9.3.2-3.js script 15.9.3.2-4.js script 15.9.3.2-5.js script 15.9.3.8-1.js script 15.9.3.8-2.js script 15.9.3.8-3.js script 15.9.3.8-4.js script 15.9.3.8-5.js script 15.9.4.2-1.js script 15.9.4.2.js script 15.9.4.3.js script 15.9.5.1.js script 15.9.5.10-1.js script 15.9.5.10-10.js script 15.9.5.10-11.js script 15.9.5.10-12.js script 15.9.5.10-13.js script 15.9.5.10-2.js script 15.9.5.10-3.js script 15.9.5.10-4.js script 15.9.5.10-5.js script 15.9.5.10-6.js script 15.9.5.10-7.js script 15.9.5.10-8.js script 15.9.5.10-9.js script 15.9.5.11-1.js script 15.9.5.11-2.js script 15.9.5.11-3.js script 15.9.5.11-4.js script 15.9.5.11-5.js script 15.9.5.11-6.js script 15.9.5.11-7.js script 15.9.5.12-1.js skip-if(!xulRuntime.shell&&xulRuntime.OS=="Linux"&&xulRuntime.XPCOMABI.match(/x86_64/)) script 15.9.5.12-2.js # bug xxx crash script 15.9.5.12-3.js script 15.9.5.12-4.js script 15.9.5.12-5.js script 15.9.5.12-6.js script 15.9.5.12-7.js script 15.9.5.12-8.js script 15.9.5.13-1.js script 15.9.5.13-2.js script 15.9.5.13-3.js script 15.9.5.13-4.js script 15.9.5.13-5.js script 15.9.5.13-6.js script 15.9.5.13-7.js script 15.9.5.13-8.js random script 15.9.5.14.js script 15.9.5.15.js skip-if(!xulRuntime.shell&&xulRuntime.OS=="Linux"&&xulRuntime.XPCOMABI.match(/x86_64/)) script 15.9.5.16.js # bug xxx crash script 15.9.5.17.js script 15.9.5.18.js script 15.9.5.19.js script 15.9.5.2-1.js script 15.9.5.2-2-n.js script 15.9.5.2.js script 15.9.5.20.js script 15.9.5.21-1.js script 15.9.5.21-2.js script 15.9.5.21-3.js script 15.9.5.21-4.js script 15.9.5.21-5.js script 15.9.5.21-6.js script 15.9.5.21-7.js script 15.9.5.21-8.js script 15.9.5.22-1.js script 15.9.5.22-2.js script 15.9.5.22-3.js script 15.9.5.22-4.js script 15.9.5.22-5.js script 15.9.5.22-6.js script 15.9.5.22-7.js script 15.9.5.22-8.js script 15.9.5.23-1.js script 15.9.5.23-10.js script 15.9.5.23-11.js script 15.9.5.23-12.js script 15.9.5.23-13.js script 15.9.5.23-14.js script 15.9.5.23-15.js script 15.9.5.23-16.js script 15.9.5.23-17.js script 15.9.5.23-18.js script 15.9.5.23-2.js script 15.9.5.23-3-n.js script 15.9.5.23-4.js script 15.9.5.23-5.js script 15.9.5.23-6.js script 15.9.5.23-7.js script 15.9.5.23-8.js script 15.9.5.23-9.js script 15.9.5.24-1.js script 15.9.5.24-2.js script 15.9.5.24-3.js script 15.9.5.24-4.js script 15.9.5.24-5.js script 15.9.5.24-6.js script 15.9.5.24-7.js script 15.9.5.24-8.js script 15.9.5.25-1.js script 15.9.5.26-1.js script 15.9.5.27-1.js script 15.9.5.28-1.js script 15.9.5.29-1.js script 15.9.5.3-1-n.js script 15.9.5.3-2.js script 15.9.5.30-1.js script 15.9.5.31-1.js script 15.9.5.32-1.js script 15.9.5.33-1.js random-if(xulRuntime.OS=="Linux") script 15.9.5.34-1.js script 15.9.5.35-1.js script 15.9.5.36-1.js script 15.9.5.36-2.js script 15.9.5.36-3.js script 15.9.5.36-4.js script 15.9.5.36-5.js script 15.9.5.36-6.js script 15.9.5.36-7.js script 15.9.5.37-1.js script 15.9.5.37-2.js script 15.9.5.37-3.js script 15.9.5.37-4.js script 15.9.5.37-5.js script 15.9.5.4-1.js script 15.9.5.4-2-n.js script 15.9.5.5.js script 15.9.5.6.js script 15.9.5.7.js script 15.9.5.8.js script 15.9.5.9.js script 15.9.5.js slow script dst-offset-caching-1-of-8.js slow script dst-offset-caching-2-of-8.js slow script dst-offset-caching-3-of-8.js slow script dst-offset-caching-4-of-8.js slow script dst-offset-caching-5-of-8.js slow script dst-offset-caching-6-of-8.js slow script dst-offset-caching-7-of-8.js slow script dst-offset-caching-8-of-8.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/shell.js0000644000175000017500000001111711545150464020664 0ustar chr1schr1s var BUGNUMBER; var summary; function runDSTOffsetCachingTestsFraction(part, parts) { BUGNUMBER = 563938; summary = 'Cache DST offsets to improve SunSpider score'; print(BUGNUMBER + ": " + summary); var MAX_UNIX_TIMET = 2145859200; var RANGE_EXPANSION_AMOUNT = 30 * 24 * 60 * 60; /** * Computes the time zone offset in minutes at the given timestamp. */ function tzOffsetFromUnixTimestamp(timestamp) { var d = new Date(NaN); d.setTime(timestamp); // local slot = NaN, UTC slot = timestamp return d.getTimezoneOffset(); // get UTC, calculate local => diff in minutes } /** * Clear the DST offset cache, leaving it initialized to include a timestamp * completely unlike the provided one (i.e. one very, very far away in time * from it). Thus an immediately following lookup for the provided timestamp * will cache-miss and compute a clean value. */ function clearDSTOffsetCache(undesiredTimestamp) { var opposite = (undesiredTimestamp + MAX_UNIX_TIMET / 2) % MAX_UNIX_TIMET; // Generic purge to known, but not necessarily desired, state tzOffsetFromUnixTimestamp(0); tzOffsetFromUnixTimestamp(MAX_UNIX_TIMET); // Purge to desired state. Cycle 2x in case opposite or undesiredTimestamp // is close to 0 or MAX_UNIX_TIMET. tzOffsetFromUnixTimestamp(opposite); tzOffsetFromUnixTimestamp(undesiredTimestamp); tzOffsetFromUnixTimestamp(opposite); tzOffsetFromUnixTimestamp(undesiredTimestamp); } function computeCanonicalTZOffset(timestamp) { clearDSTOffsetCache(timestamp); return tzOffsetFromUnixTimestamp(timestamp); } var TEST_TIMESTAMPS_SECONDS = [ // Special-ish timestamps 0, RANGE_EXPANSION_AMOUNT, MAX_UNIX_TIMET, ]; var ONE_DAY = 24 * 60 * 60; var EIGHTY_THREE_HOURS = 83 * 60 * 60; var NINETY_EIGHT_HOURS = 98 * 60 * 60; function nextIncrement(i) { return i === EIGHTY_THREE_HOURS ? NINETY_EIGHT_HOURS : EIGHTY_THREE_HOURS; } // Now add a long sequence of non-special timestamps, from a fixed range, that // overlaps a DST change by "a bit" on each side. 67 days should be enough // displacement that we can occasionally exercise the implementation's // thirty-day expansion and the DST-offset-change logic. Use two different // increments just to be safe and catch something a single increment might not. var DST_CHANGE_DATE = 1268553600; // March 14, 2010 for (var t = DST_CHANGE_DATE - 67 * ONE_DAY, i = nextIncrement(NINETY_EIGHT_HOURS), end = DST_CHANGE_DATE + 67 * ONE_DAY; t < end; i = nextIncrement(i), t += i) { TEST_TIMESTAMPS_SECONDS.push(t); } var TEST_TIMESTAMPS = TEST_TIMESTAMPS_SECONDS.map(function(v) { return v * 1000; }); /************** * BEGIN TEST * **************/ // Compute the correct time zone offsets for all timestamps to be tested. var CORRECT_TZOFFSETS = TEST_TIMESTAMPS.map(computeCanonicalTZOffset); // Intentionally and knowingly invoking every single logic path in the cache // isn't easy for a human to get right (and know he's gotten it right), so // let's do it the easy way: exhaustively try all possible four-date sequences // selecting from our array of possible timestamps. var sz = TEST_TIMESTAMPS.length; var start = Math.floor((part - 1) / parts * sz); var end = Math.floor(part / parts * sz); print("Exhaustively testing timestamps " + "[" + start + ", " + end + ") of " + sz + "..."); try { for (var i = start; i < end; i++) { print("Testing timestamp " + i + "..."); var t1 = TEST_TIMESTAMPS[i]; for (var j = 0; j < sz; j++) { var t2 = TEST_TIMESTAMPS[j]; for (var k = 0; k < sz; k++) { var t3 = TEST_TIMESTAMPS[k]; for (var w = 0; w < sz; w++) { var t4 = TEST_TIMESTAMPS[w]; clearDSTOffsetCache(t1); var tzo1 = tzOffsetFromUnixTimestamp(t1); var tzo2 = tzOffsetFromUnixTimestamp(t2); var tzo3 = tzOffsetFromUnixTimestamp(t3); var tzo4 = tzOffsetFromUnixTimestamp(t4); assertEq(tzo1, CORRECT_TZOFFSETS[i]); assertEq(tzo2, CORRECT_TZOFFSETS[j]); assertEq(tzo3, CORRECT_TZOFFSETS[k]); assertEq(tzo4, CORRECT_TZOFFSETS[w]); } } } } } catch (e) { assertEq(true, false, "Error when testing with timestamps " + i + ", " + j + ", " + k + ", " + w + " (" + t1 + ", " + t2 + ", " + t3 + ", " + t4 + ")!"); } reportCompare(true, true); print("All tests passed!"); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.1.1-1.js0000644000175000017500000000627111545150464020612 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.1.1-1.js ECMA Section: 15.9.1.1 Time Range Description: - leap seconds are ignored - assume 86400000 ms / day - numbers range fom +/- 9,007,199,254,740,991 - ms precision for any instant that is within approximately +/-285,616 years from 1 jan 1970 UTC - range of times supported is -100,000,000 days to 100,000,000 days from 1 jan 1970 12:00 am - time supported is 8.64e5*10e8 milliseconds from 1 jan 1970 UTC (+/-273972.6027397 years) - this test generates its own data -- it does not read data from a file. Author: christine@netscape.com Date: 7 july 1997 Static variables: FOUR_HUNDRED_YEARS */ // every one hundred years contains: // 24 years with 366 days // // every four hundred years contains: // 97 years with 366 days // 303 years with 365 days // // 86400000*365*97 = 3067372800000 // +86400000*366*303 = + 9555408000000 // = 1.26227808e+13 var FOUR_HUNDRED_YEARS = 1.26227808e+13; var SECTION = "15.9.1.1-1"; writeHeaderToLog("15.9.1.1 Time Range"); var M_SECS; var CURRENT_YEAR; for ( M_SECS = 0, CURRENT_YEAR = 1970; M_SECS < 8640000000000000; M_SECS += FOUR_HUNDRED_YEARS, CURRENT_YEAR += 400 ) { new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS)).getUTCFullYear() ); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.1.1-2.js0000644000175000017500000000606611545150464020615 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.1.1-2.js ECMA Section: 15.9.1.1 Time Range Description: - leap seconds are ignored - assume 86400000 ms / day - numbers range fom +/- 9,007,199,254,740,991 - ms precision for any instant that is within approximately +/-285,616 years from 1 jan 1970 UTC - range of times supported is -100,000,000 days to 100,000,000 days from 1 jan 1970 12:00 am - time supported is 8.64e5*10e8 milliseconds from 1 jan 1970 UTC (+/-273972.6027397 years) Author: christine@netscape.com Date: 9 july 1997 */ // every one hundred years contains: // 24 years with 366 days // // every four hundred years contains: // 97 years with 366 days // 303 years with 365 days // // 86400000*366*97 = 3067372800000 // +86400000*365*303 = + 9555408000000 // = 1.26227808e+13 var FOUR_HUNDRED_YEARS = 1.26227808e+13; var SECTION = "15.9.1.1-2"; writeHeaderToLog("15.9.1.1 Time Range"); var M_SECS; var CURRENT_YEAR; for ( M_SECS = 0, CURRENT_YEAR = 1970; M_SECS > -8640000000000000; M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) { new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS )).getUTCFullYear() ); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.1.13-1.js0000644000175000017500000000547611545150464020703 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.1.13-1.js ECMA Section: 15.9.1.1 MakeDate(day, time) Description: The operator MakeDate calculates a number of milliseconds from its two arguments, which must be ECMAScript number values. This operator functions as follows: 1. If day is not finite or time is not finite, return NaN. 2. Compute day * msPerDay + time. 3. Return Result(2). */ new TestCase( SECTION, "MakeDate(Number.POSITIVE_INFINITY, 0)", Number.NaN, MakeDate(Number.POSITIVE_INFINITY, 0)); new TestCase( SECTION, "MakeDate(Number.NEGATIVE_INFINITY, 0)", Number.NaN, MakeDate(Number.NEGATIVE_INFINITY, 0)); new TestCase( SECTION, "MakeDate(0, Number.POSITIVE_INFINITY)", Number.NaN, MakeDate(0, Number.POSITIVE_INFINITY)); new TestCase( SECTION, "MakeDate(0, Number.NEGATIVE_INFINITY)", Number.NaN, MakeDate(0, Number.NEGATIVE_INFINITY)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.2.1.js0000644000175000017500000001377611545150464020465 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.2.1.js ECMA Section: 15.9.2.1 Date constructor used as a function Date( year, month, date, hours, minutes, seconds, ms ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.2.1"; var TITLE = "Date Constructor used as a function"; var TYPEOF = "string"; var TOLERANCE = 1000; writeHeaderToLog("15.9.2.1 The Date Constructor Called as a Function: " + "Date( year, month, date, hours, minutes, seconds, ms )" ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around 1970 d1 = new Date(); d2 = Date.parse(Date(1970,0,1,0,0,0,0)); new TestCase(SECTION, "Date(1970,0,1,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,15,59,59,999)); new TestCase(SECTION, "Date(1969,11,31,15,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,16,0,0,0)); new TestCase(SECTION, "Date(1969,11,31,16,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,16,0,0,1)); new TestCase(SECTION, "Date(1969,11,31,16,0,0,1)", true, d2 - d1 <= 1000); // Dates around 2000 d1 = new Date(); d2 = Date.parse(Date(1999,11,15,59,59,999)); new TestCase(SECTION, "Date(1999,11,15,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1999,11,16,0,0,0,0)); new TestCase(SECTION, "Date(1999,11,16,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1999,11,31,23,59,59,999)); new TestCase(SECTION, "Date(1999,11,31,23,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,0,0,0,0,0,0)); new TestCase(SECTION, "Date(2000,0,1,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,0,0,0,0,0,1)); new TestCase(SECTION, "Date(2000,0,1,0,0,0,1)", true, d2 - d1 <= 1000); // Dates around 1900 d1 = new Date(); d2 = Date.parse(Date(1899,11,31,23,59,59,999)); new TestCase(SECTION, "Date(1899,11,31,23,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1900,0,1,0,0,0,0)); new TestCase(SECTION, "Date(1900,0,1,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1900,0,1,0,0,0,1)); new TestCase(SECTION, "Date(1900,0,1,0,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1899,11,31,16,0,0,0,0)); new TestCase(SECTION, "Date(1899,11,31,16,0,0,0,0)", true, d2 - d1 <= 1000); // Dates around feb 29, 2000 d1 = new Date(); d2 = Date.parse(Date(2000,1,29,0,0,0,0)); new TestCase(SECTION, "Date(2000,1,29,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,1,28,23,59,59,999)); new TestCase(SECTION, "Date(2000,1,28,23,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,1,27,16,0,0,0)); new TestCase(SECTION, "Date(2000,1,27,16,0,0,0)", true, d2 - d1 <= 1000); // Dates around jan 1, 2005 d1 = new Date(); d2 = Date.parse(Date(2004,11,31,23,59,59,999)); new TestCase(SECTION, "Date(2004,11,31,23,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2005,0,1,0,0,0,0)); new TestCase(SECTION, "Date(2005,0,1,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2005,0,1,0,0,0,1)); new TestCase(SECTION, "Date(2005,0,1,0,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2004,11,31,16,0,0,0,0)); new TestCase(SECTION, "Date(2004,11,31,16,0,0,0,0)", true, d2 - d1 <= 1000); // Dates around jan 1, 2032 d1 = new Date(); d2 = Date.parse(Date(2031,11,31,23,59,59,999)); new TestCase(SECTION, "Date(2031,11,31,23,59,59,999)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2032,0,1,0,0,0,0)); new TestCase(SECTION, "Date(2032,0,1,0,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2032,0,1,0,0,0,1)); new TestCase(SECTION, "Date(2032,0,1,0,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2031,11,31,16,0,0,0,0)); new TestCase(SECTION, "Date(2031,11,31,16,0,0,0,0)", true, d2 - d1 <= 1000); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.2.2-1.js0000644000175000017500000000610411545150464020607 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around 1970 d1 = new Date(); d2 = Date.parse(Date(1970,0,1,0,0,0)); new TestCase(SECTION, "Date(1970,0,1,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,15,59,59)); new TestCase(SECTION, "Date(1969,11,31,15,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,16,0,0)); new TestCase(SECTION, "Date(1969,11,31,16,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1969,11,31,16,0,1)); new TestCase(SECTION, "Date(1969,11,31,16,0,1)", true, d2 - d1 <= 1000); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.2.2-2.js0000644000175000017500000000630211545150464020610 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around 2000 d1 = new Date(); d2 = Date.parse(Date(1999,11,15,59,59)); new TestCase( SECTION, "Date(1999,11,15,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1999,11,16,0,0,0)); new TestCase( SECTION, "Date(1999,11,16,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1999,11,31,23,59,59)); new TestCase( SECTION, "Date(1999,11,31,23,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,0,0,0,0,0)); new TestCase( SECTION, "Date(2000,0,1,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,0,0,0,0,1)); new TestCase( SECTION, "Date(2000,0,1,0,0,1)", true, d2 - d1 <= 1000) test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.2.2-3.js0000644000175000017500000000610711545150464020614 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around 1900 d1 = new Date(); d2 = Date.parse(Date(1899,11,31,23,59,59)); new TestCase( SECTION, "Date(1899,11,31,23,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1900,0,1,0,0,0)); new TestCase( SECTION, "Date(1900,0,1,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1900,0,1,0,0,1) ); new TestCase( SECTION, "Date(1900,0,1,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(1899,11,31,16,0,0,0)); new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", true, d2 - d1 <= 1000); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.2.2-4.js0000644000175000017500000000570511545150464020620 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around feb 29, 2000 d1 = new Date(); d2 = Date.parse(Date(2000,1,29,0,0,0)); new TestCase(SECTION, "Date(2000,1,29,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,1,28,23,59,59)); new TestCase(SECTION, "Date(2000,1,28,23,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2000,1,27,16,0,0)); new TestCase(SECTION, "Date(2000,1,27,16,0,0)", true, d2 - d1 <= 1000); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.2.2-5.js0000644000175000017500000000611711545150464020617 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around jan 1, 2005 d1 = new Date(); d2 = Date.parse(Date(2004,11,31,23,59,59)); new TestCase( SECTION, "Date(2004,11,31,23,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2005,0,1,0,0,0) ); new TestCase( SECTION, "Date(2005,0,1,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2005,0,1,0,0,1) ); new TestCase( SECTION, "Date(2005,0,1,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2004,11,31,16,0,0,0)); new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", true, d2 - d1 <= 1000); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.2.2-6.js0000644000175000017500000000611011545150464020611 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.2.2.js ECMA Section: 15.9.2.2 Date constructor used as a function Date( year, month, date, hours, minutes, seconds ) Description: The arguments are accepted, but are completely ignored. A string is created and returned as if by the expression (new Date()).toString(). Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = 9706; startTest(); var SECTION = "15.9.2.2"; var TOLERANCE = 100; var TITLE = "The Date Constructor Called as a Function"; writeHeaderToLog(SECTION+" "+TITLE ); // allow up to 1 second difference due to possibility // the date may change by 1 second in between calls to Date var d1; var d2; // Dates around jan 1, 2032 d1 = new Date(); d2 = Date.parse(Date(2031,11,31,23,59,59)); new TestCase(SECTION, "Date(2031,11,31,23,59,59)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2032,0,1,0,0,0)); new TestCase(SECTION, "Date(2032,0,1,0,0,0)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2032,0,1,0,0,1)); new TestCase(SECTION, "Date(2032,0,1,0,0,1)", true, d2 - d1 <= 1000); d1 = new Date(); d2 = Date.parse(Date(2031,11,31,16,0,0,0)); new TestCase(SECTION, "Date(2031,11,31,16,0,0,0)", true, d2 - d1 <= 1000); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.1-1.js0000644000175000017500000002265111545150464020614 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.9.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; writeHeaderToLog( SECTION + " "+ TITLE); // Dates around 1970 addNewTestCase( new Date( 1969,11,31,15,59,59,999), "new Date( 1969,11,31,15,59,59,999)", [TIME_1970-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] ); addNewTestCase( new Date( 1969,11,31,23,59,59,999), "new Date( 1969,11,31,23,59,59,999)", [TIME_1970-PST_ADJUST-1,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] ); addNewTestCase( new Date( 1970,0,1,0,0,0,0), "new Date( 1970,0,1,0,0,0,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date( 1969,11,31,16,0,0,0), "new Date( 1969,11,31,16,0,0,0)", [TIME_1970,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date(1969,12,1,0,0,0,0), "new Date(1969,12,1,0,0,0,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date(1969,11,32,0,0,0,0), "new Date(1969,11,32,0,0,0,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date(1969,11,31,24,0,0,0), "new Date(1969,11,31,24,0,0,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date(1969,11,31,23,60,0,0), "new Date(1969,11,31,23,60,0,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date(1969,11,31,23,59,60,0), "new Date(1969,11,31,23,59,60,0)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date(1969,11,31,23,59,59,1000), "new Date(1969,11,31,23,59,59,1000)", [TIME_1970-PST_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); // Dates around 2000 addNewTestCase( new Date( 1999,11,31,15,59,59,999), "new Date( 1999,11,31,15,59,59,999)", [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] ); addNewTestCase( new Date( 1999,11,31,16,0,0,0), "new Date( 1999,11,31,16,0,0,0)", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); addNewTestCase( new Date( 1999,11,31,23,59,59,999), "new Date( 1999,11,31,23,59,59,999)", [TIME_2000-PST_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] ); addNewTestCase( new Date( 2000,0,1,0,0,0,0), "new Date( 2000,0,1,0,0,0,0)", [TIME_2000-PST_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); addNewTestCase( new Date( 2000,0,1,0,0,0,1), "new Date( 2000,0,1,0,0,0,1)", [TIME_2000-PST_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] ); // Dates around 29 Feb 2000 addNewTestCase( new Date(2000,1,28,16,0,0,0), "new Date(2000,1,28,16,0,0,0)", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); addNewTestCase( new Date(2000,1,29,0,0,0,0), "new Date(2000,1,29,0,0,0,0)", [UTC_FEB_29_2000-PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); addNewTestCase( new Date(2000,1,28,24,0,0,0), "new Date(2000,1,28,24,0,0,0)", [UTC_FEB_29_2000-PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); // Dates around 1900 addNewTestCase( new Date(1899,11,31,16,0,0,0), "new Date(1899,11,31,16,0,0,0)", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date(1899,11,31,15,59,59,999), "new Date(1899,11,31,15,59,59,999)", [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] ); addNewTestCase( new Date(1899,11,31,23,59,59,999), "new Date(1899,11,31,23,59,59,999)", [TIME_1900-PST_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] ); addNewTestCase( new Date(1900,0,1,0,0,0,0), "new Date(1900,0,1,0,0,0,0)", [TIME_1900-PST_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date(1900,0,1,0,0,0,1), "new Date(1900,0,1,0,0,0,1)", [TIME_1900-PST_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] ); // Dates around 2005 addNewTestCase( new Date(2005,0,1,0,0,0,0), "new Date(2005,0,1,0,0,0,0)", [UTC_JAN_1_2005-PST_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); addNewTestCase( new Date(2004,11,31,16,0,0,0), "new Date(2004,11,31,16,0,0,0)", [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.1-2.js0000644000175000017500000001467711545150464020626 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.9.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; writeHeaderToLog( SECTION + " "+ TITLE); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - // Dates around 2000 addNewTestCase( new Date( 1999,11,31,15,59,59,999), "new Date( 1999,11,31,15,59,59,999)", [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] ); addNewTestCase( new Date( 1999,11,31,16,0,0,0), "new Date( 1999,11,31,16,0,0,0)", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); addNewTestCase( new Date( 1999,11,31,23,59,59,999), "new Date( 1999,11,31,23,59,59,999)", [TIME_2000-PST_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] ); addNewTestCase( new Date( 2000,0,1,0,0,0,0), "new Date( 2000,0,1,0,0,0,0)", [TIME_2000-PST_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); addNewTestCase( new Date( 2000,0,1,0,0,0,1), "new Date( 2000,0,1,0,0,0,1)", [TIME_2000-PST_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.1-3.js0000644000175000017500000001415511545150464020616 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.9.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; writeHeaderToLog( SECTION + " "+ TITLE); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - addNewTestCase( new Date(2000,1,28,16,0,0,0), "new Date(2000,1,28,16,0,0,0)", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); addNewTestCase( new Date(2000,1,29,0,0,0,0), "new Date(2000,1,29,0,0,0,0)", [UTC_FEB_29_2000 - PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); addNewTestCase( new Date(2000,1,28,24,0,0,0), "new Date(2000,1,28,24,0,0,0)", [UTC_FEB_29_2000 - PST_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.1-4.js0000644000175000017500000001466311545150464020623 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.9.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; writeHeaderToLog( SECTION + " "+ TITLE); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - // Dates around 1900 addNewTestCase( new Date(1899,11,31,16,0,0,0), "new Date(1899,11,31,16,0,0,0)", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date(1899,11,31,15,59,59,999), "new Date(1899,11,31,15,59,59,999)", [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] ); addNewTestCase( new Date(1899,11,31,23,59,59,999), "new Date(1899,11,31,23,59,59,999)", [TIME_1900-PST_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] ); addNewTestCase( new Date(1900,0,1,0,0,0,0), "new Date(1900,0,1,0,0,0,0)", [TIME_1900-PST_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date(1900,0,1,0,0,0,1), "new Date(1900,0,1,0,0,0,1)", [TIME_1900-PST_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.1-5.js0000644000175000017500000001374111545150464020620 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.9.3.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; writeHeaderToLog( SECTION + " "+ TITLE); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - // Dates around 2005 addNewTestCase( new Date(2005,0,1,0,0,0,0), "new Date(2005,0,1,0,0,0,0)", [UTC_JAN_1_2005-PST_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); addNewTestCase( new Date(2004,11,31,16,0,0,0), "new Date(2004,11,31,16,0,0,0)", [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.2-1.js0000644000175000017500000001444411545150464020616 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var SECTION = "15.9.3.1"; var TITLE = "Date( year, month, date, hours, minutes, seconds )"; writeHeaderToLog( SECTION+" " +TITLE ); // Dates around 1970 addNewTestCase( new Date( 1969,11,31,15,59,59), "new Date( 1969,11,31,15,59,59)", [-1000,1969,11,31,3,23,59,59,0,1969,11,31,3,15,59,59,0] ); addNewTestCase( new Date( 1969,11,31,16,0,0), "new Date( 1969,11,31,16,0,0)", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date( 1969,11,31,23,59,59), "new Date( 1969,11,31,23,59,59)", [28799000,1970,0,1,4,7,59,59,0,1969,11,31,3,23,59,59,0] ); addNewTestCase( new Date( 1970, 0, 1, 0, 0, 0), "new Date( 1970, 0, 1, 0, 0, 0)", [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date( 1969,11,31,16,0,0), "new Date( 1969,11,31,16,0,0)", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.2-2.js0000644000175000017500000001403311545150464020611 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var SECTION = "15.9.3.1"; var TITLE = "Date( year, month, date, hours, minutes, seconds )"; writeHeaderToLog( SECTION+" " +TITLE ); // Dates around 2000 addNewTestCase( new Date( 1999,11,31,15,59,59), "new Date( 1999,11,31,15,59,59)", [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] ); addNewTestCase( new Date( 1999,11,31,16,0,0), "new Date( 1999,11,31,16,0,0)", [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); addNewTestCase( new Date( 2000,0,1,0,0,0), "new Date( 2000,0,1,0,0,0)", [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.2-3.js0000644000175000017500000001423711545150464020620 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var SECTION = "15.9.3.1"; var TITLE = "Date( year, month, date, hours, minutes, seconds )"; writeHeaderToLog( SECTION+" " +TITLE ); // Dates around 1900 addNewTestCase( new Date(1899,11,31,16,0,0), "new Date(1899,11,31,16,0,0)", [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date(1899,11,31,15,59,59), "new Date(1899,11,31,15,59,59)", [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] ); addNewTestCase( new Date(1900,0,1,0,0,0), "new Date(1900,0,1,0,0,0)", [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date(1900,0,1,0,0,1), "new Date(1900,0,1,0,0,1)", [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.2-4.js0000644000175000017500000001414311545150464020615 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var SECTION = "15.9.3.1"; var TITLE = "Date( year, month, date, hours, minutes, seconds )"; writeHeaderToLog( SECTION+" " +TITLE ); var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour; // Dates around Feb 29, 2000 addNewTestCase( new Date(2000,1,28,16,0,0,0), "new Date(2000,1,28,16,0,0,0)", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] ); addNewTestCase( new Date(2000,1,29,0,0,0,0), "new Date(2000,1,29,0,0,0,0)", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); addNewTestCase( new Date(2000,1,29,24,0,0,0), "new Date(2000,1,29,24,0,0,0)", [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.2-5.js0000644000175000017500000001370211545150464020616 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.1.js ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial value of Date.prototype. The [[Class]] property of the newly constructed object is set as follows: 1. Call ToNumber(year) 2. Call ToNumber(month) 3. Call ToNumber(date) 4. Call ToNumber(hours) 5. Call ToNumber(minutes) 6. Call ToNumber(seconds) 7. Call ToNumber(ms) 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <= 99, Result(8) is 1900+ToInteger(Result(1)); otherwise, Result(8) is Result(1) 9. Compute MakeDay(Result(8), Result(2), Result(3) 10. Compute MakeTime(Result(4), Result(5), Result(6), Result(7) 11. Compute MakeDate(Result(9), Result(10)) 12. Set the [[Value]] property of the newly constructed object to TimeClip(UTC(Result(11))). This tests the returned value of a newly constructed Date object. Author: christine@netscape.com Date: 7 july 1997 */ var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var SECTION = "15.9.3.1"; var TITLE = "Date( year, month, date, hours, minutes, seconds )"; writeHeaderToLog( SECTION+" " +TITLE ); // Dates around Jan 1, 2005 var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour; addNewTestCase( new Date(2005,0,1,0,0,0,0), "new Date(2005,0,1,0,0,0,0)", [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); addNewTestCase( new Date(2004,11,31,16,0,0,0), "new Date(2004,11,31,16,0,0,0)", [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.8-1.js0000644000175000017500000001430711545150464020622 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.8.js ECMA Section: 15.9.3.8 The Date Constructor new Date( value ) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial valiue of Date.prototype. The [[Class]] property of the newly constructed object is set to "Date". The [[Value]] property of the newly constructed object is set as follows: 1. Call ToPrimitive(value) 2. If Type( Result(1) ) is String, then go to step 5. 3. Let V be ToNumber( Result(1) ). 4. Set the [[Value]] property of the newly constructed object to TimeClip(V) and return. 5. Parse Result(1) as a date, in exactly the same manner as for the parse method. Let V be the time value for this date. 6. Go to step 4. Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.3.8"; var TYPEOF = "object"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var gTc= 0; var TITLE = "Date constructor: new Date( value )"; var SECTION = "15.9.3.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION +" " + TITLE ); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - var TZ_ADJUST = -TZ_PST * msPerHour; // Dates around 1970 addNewTestCase( new Date(0), "new Date(0)", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date(1), "new Date(1)", [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] ); addNewTestCase( new Date(true), "new Date(true)", [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] ); addNewTestCase( new Date(false), "new Date(false)", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date( (new Date(0)).toString() ), "new Date(\""+ (new Date(0)).toString()+"\" )", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray, 'msMode'); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.8-2.js0000644000175000017500000001463511545150464020627 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.8.js ECMA Section: 15.9.3.8 The Date Constructor new Date( value ) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial valiue of Date.prototype. The [[Class]] property of the newly constructed object is set to "Date". The [[Value]] property of the newly constructed object is set as follows: 1. Call ToPrimitive(value) 2. If Type( Result(1) ) is String, then go to step 5. 3. Let V be ToNumber( Result(1) ). 4. Set the [[Value]] property of the newly constructed object to TimeClip(V) and return. 5. Parse Result(1) as a date, in exactly the same manner as for the parse method. Let V be the time value for this date. 6. Go to step 4. Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.3.8"; var TYPEOF = "object"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var gTc= 0; var TITLE = "Date constructor: new Date( value )"; var SECTION = "15.9.3.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION +" " + TITLE ); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - var TZ_ADJUST = -TZ_PST * msPerHour; addNewTestCase( new Date((new Date(0)).toUTCString()), "new Date(\""+ (new Date(0)).toUTCString()+"\" )", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date((new Date(1)).toString()), "new Date(\""+ (new Date(1)).toString()+"\" )", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date( TZ_ADJUST ), "new Date(" + TZ_ADJUST+")", [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()), "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")", [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ), "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")", [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray, 'msMode'); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.8-3.js0000644000175000017500000001527511545150464020631 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.8.js ECMA Section: 15.9.3.8 The Date Constructor new Date( value ) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial valiue of Date.prototype. The [[Class]] property of the newly constructed object is set to "Date". The [[Value]] property of the newly constructed object is set as follows: 1. Call ToPrimitive(value) 2. If Type( Result(1) ) is String, then go to step 5. 3. Let V be ToNumber( Result(1) ). 4. Set the [[Value]] property of the newly constructed object to TimeClip(V) and return. 5. Parse Result(1) as a date, in exactly the same manner as for the parse method. Let V be the time value for this date. 6. Go to step 4. Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.3.8"; var TYPEOF = "object"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var gTc= 0; var TITLE = "Date constructor: new Date( value )"; var SECTION = "15.9.3.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION +" " + TITLE ); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - var TZ_ADJUST = -TZ_PST * msPerHour; // Dates around 2000 addNewTestCase( new Date(TIME_2000+TZ_ADJUST), "new Date(" +(TIME_2000+TZ_ADJUST)+")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); addNewTestCase( new Date(TIME_2000), "new Date(" +TIME_2000+")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()), "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); addNewTestCase( new Date((new Date(TIME_2000)).toString()), "new Date(\"" +(new Date(TIME_2000)).toString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()), "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()), "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray, 'msMode'); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.8-4.js0000644000175000017500000001541211545150464020623 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.8.js ECMA Section: 15.9.3.8 The Date Constructor new Date( value ) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial valiue of Date.prototype. The [[Class]] property of the newly constructed object is set to "Date". The [[Value]] property of the newly constructed object is set as follows: 1. Call ToPrimitive(value) 2. If Type( Result(1) ) is String, then go to step 5. 3. Let V be ToNumber( Result(1) ). 4. Set the [[Value]] property of the newly constructed object to TimeClip(V) and return. 5. Parse Result(1) as a date, in exactly the same manner as for the parse method. Let V be the time value for this date. 6. Go to step 4. Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.3.8"; var TYPEOF = "object"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var gTc= 0; var TITLE = "Date constructor: new Date( value )"; var SECTION = "15.9.3.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION +" " + TITLE ); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - var TZ_ADJUST = -TZ_PST * msPerHour; // Dates around Feb 29, 2000 var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST; addNewTestCase( new Date(UTC_FEB_29_2000), "new Date("+UTC_FEB_29_2000+")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); addNewTestCase( new Date(PST_FEB_29_2000), "new Date("+PST_FEB_29_2000+")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ), "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ), "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ), "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] ); addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ), "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray, 'msMode'); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.3.8-5.js0000644000175000017500000001520311545150464020622 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.3.8.js ECMA Section: 15.9.3.8 The Date Constructor new Date( value ) Description: The [[Prototype]] property of the newly constructed object is set to the original Date prototype object, the one that is the initial valiue of Date.prototype. The [[Class]] property of the newly constructed object is set to "Date". The [[Value]] property of the newly constructed object is set as follows: 1. Call ToPrimitive(value) 2. If Type( Result(1) ) is String, then go to step 5. 3. Let V be ToNumber( Result(1) ). 4. Set the [[Value]] property of the newly constructed object to TimeClip(V) and return. 5. Parse Result(1) as a date, in exactly the same manner as for the parse method. Let V be the time value for this date. 6. Go to step 4. Author: christine@netscape.com Date: 28 october 1997 Version: 9706 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.3.8"; var TYPEOF = "object"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; // for TCMS, the gTestcases array must be global. var gTc= 0; var TITLE = "Date constructor: new Date( value )"; var SECTION = "15.9.3.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION +" " + TITLE ); // all the "ResultArrays" below are hard-coded to Pacific Standard Time values - var TZ_ADJUST = -TZ_PST * msPerHour; // Dates around 1900 var PST_1900 = TIME_1900 + 8*msPerHour; addNewTestCase( new Date( TIME_1900 ), "new Date("+TIME_1900+")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date(PST_1900), "new Date("+PST_1900+")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date( (new Date(TIME_1900)).toString() ), "new Date(\""+(new Date(TIME_1900)).toString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date( (new Date(PST_1900)).toString() ), "new Date(\""+(new Date(PST_1900 )).toString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ), "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ), "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { //adjust hard-coded ResultArray for tester's timezone instead of PST adjustResultArray(ResultArray, 'msMode'); new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.4.2-1.js0000644000175000017500000000637411545150464020622 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=4088 * Description: Date parsing gets 12:30 AM wrong. * New behavior: * js> d = new Date('1/1/1999 13:30 AM') * Invalid Date * js> d = new Date('1/1/1999 13:30 PM') * Invalid Date * js> d = new Date('1/1/1999 12:30 AM') * Fri Jan 01 00:30:00 GMT-0800 (PST) 1999 * js> d = new Date('1/1/1999 12:30 PM') * Fri Jan 01 12:30:00 GMT-0800 (PST) 1999 * Author: christine@netscape.com */ var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section) var VERSION = "ECMA"; // Version of JavaScript or ECMA var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report startTest(); // leave this alone AddTestCase( "new Date('1/1/1999 12:30 AM').toString()", new Date(1999,0,1,0,30).toString(), new Date('1/1/1999 12:30 AM').toString() ); AddTestCase( "new Date('1/1/1999 12:30 PM').toString()", new Date( 1999,0,1,12,30 ).toString(), new Date('1/1/1999 12:30 PM').toString() ); AddTestCase( "new Date('1/1/1999 13:30 AM')", "Invalid Date", new Date('1/1/1999 13:30 AM').toString() ); AddTestCase( "new Date('1/1/1999 13:30 PM')", "Invalid Date", new Date('1/1/1999 13:30 PM').toString() ); test(); // leave this alone. this executes the test cases and // displays results. mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.4.2.js0000644000175000017500000001524411545150464020460 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.4.2.js ECMA Section: 15.9.4.2 Date.parse() Description: The parse() function applies the to ToString() operator to its argument and interprets the resulting string as a date. It returns a number, the UTC time value corresponding to the date. The string may be interpreted as a local time, a UTC time, or a time in some other time zone, depending on the contents of the string. (need to test strings containing stuff with the time zone specified, and verify that parse() returns the correct GMT time) so for any Date object x, all of these things should be equal: value tested in function: x.valueOf() test_value() Date.parse(x.toString()) test_tostring() Date.parse(x.toGMTString()) test_togmt() Date.parse(x.toLocaleString()) is not required to produce the same number value as the preceding three expressions. in general the value produced by Date.parse is implementation dependent when given any string value that could not be produced in that implementation by the toString or toGMTString method. value tested in function: Date.parse( x.toLocaleString()) test_tolocale() Author: christine@netscape.com Date: 10 july 1997 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.9.4.2"; var TITLE = "Date.parse()"; var TIME = 0; var UTC_YEAR = 1; var UTC_MONTH = 2; var UTC_DATE = 3; var UTC_DAY = 4; var UTC_HOURS = 5; var UTC_MINUTES = 6; var UTC_SECONDS = 7; var UTC_MS = 8; var YEAR = 9; var MONTH = 10; var DATE = 11; var DAY = 12; var HOURS = 13; var MINUTES = 14; var SECONDS = 15; var MS = 16; var TYPEOF = "object"; // for TCMS, the gTestcases array must be global. writeHeaderToLog("15.9.4.2 Date.parse()" ); // Dates around 1970 addNewTestCase( new Date(0), "new Date(0)", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] ); addNewTestCase( new Date(-1), "new Date(-1)", [-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] ); addNewTestCase( new Date(28799999), "new Date(28799999)", [28799999,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] ); addNewTestCase( new Date(28800000), "new Date(28800000)", [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] ); // Dates around 2000 addNewTestCase( new Date(946684799999), "new Date(946684799999)", [946684799999,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] ); addNewTestCase( new Date(946713599999), "new Date(946713599999)", [946713599999,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] ); addNewTestCase( new Date(946684800000), "new Date(946684800000)", [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] ); addNewTestCase( new Date(946713600000), "new Date(946713600000)", [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] ); // Dates around 1900 addNewTestCase( new Date(-2208988800000), "new Date(-2208988800000)", [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] ); addNewTestCase( new Date(-2208988800001), "new Date(-2208988800001)", [-2208988800001,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] ); addNewTestCase( new Date(-2208960000001), "new Date(-2208960000001)", [-2208960000001,1900,0,1,1,7,59,59,0,1899,11,31,0,23,59,59,999] ); addNewTestCase( new Date(-2208960000000), "new Date(-2208960000000)", [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] ); addNewTestCase( new Date(-2208959999999), "new Date(-2208959999999)", [-2208959999999,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] ); // Dates around Feb 29, 2000 var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour; addNewTestCase( new Date(UTC_FEB_29_2000), "new Date(" + UTC_FEB_29_2000 +")", [UTC_FEB_29_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] ); addNewTestCase( new Date(PST_FEB_29_2000), "new Date(" + PST_FEB_29_2000 +")", [PST_FEB_29_2000,2000,0,1,6,8.0,0,0,2000,0,1,6,0,0,0,0]); // Dates around Jan 1 2005 var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour; addNewTestCase( new Date(UTC_JAN_1_2005), "new Date("+ UTC_JAN_1_2005 +")", [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] ); addNewTestCase( new Date(PST_JAN_1_2005), "new Date("+ PST_JAN_1_2005 +")", [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] ); test(); function addNewTestCase( DateCase, DateString, ResultArray ) { DateCase = DateCase; new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() ); new TestCase( SECTION, "Date.parse(" + DateCase.toString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toString()) ); new TestCase( SECTION, "Date.parse(" + DateCase.toGMTString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toGMTString()) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.4.3.js0000644000175000017500000001352411545150464020460 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var SECTION = "15.9.4.3"; var TITLE = "Date.UTC( year, month, date, hours, minutes, seconds, ms )"; // Dates around 1970 addNewTestCase( Date.UTC( 1970,0,1,0,0,0,0), "Date.UTC( 1970,0,1,0,0,0,0)", utc(1970,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 1969,11,31,23,59,59,999), "Date.UTC( 1969,11,31,23,59,59,999)", utc(1969,11,31,23,59,59,999) ); addNewTestCase( Date.UTC( 1972,1,29,23,59,59,999), "Date.UTC( 1972,1,29,23,59,59,999)", utc(1972,1,29,23,59,59,999) ); addNewTestCase( Date.UTC( 1972,2,1,23,59,59,999), "Date.UTC( 1972,2,1,23,59,59,999)", utc(1972,2,1,23,59,59,999) ); addNewTestCase( Date.UTC( 1968,1,29,23,59,59,999), "Date.UTC( 1968,1,29,23,59,59,999)", utc(1968,1,29,23,59,59,999) ); addNewTestCase( Date.UTC( 1968,2,1,23,59,59,999), "Date.UTC( 1968,2,1,23,59,59,999)", utc(1968,2,1,23,59,59,999) ); addNewTestCase( Date.UTC( 1969,0,1,0,0,0,0), "Date.UTC( 1969,0,1,0,0,0,0)", utc(1969,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 1969,11,31,23,59,59,1000), "Date.UTC( 1969,11,31,23,59,59,1000)", utc(1970,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 1969,Number.NaN,31,23,59,59,999), "Date.UTC( 1969,Number.NaN,31,23,59,59,999)", utc(1969,Number.NaN,31,23,59,59,999) ); // Dates around 2000 addNewTestCase( Date.UTC( 1999,11,31,23,59,59,999), "Date.UTC( 1999,11,31,23,59,59,999)", utc(1999,11,31,23,59,59,999) ); addNewTestCase( Date.UTC( 2000,0,1,0,0,0,0), "Date.UTC( 2000,0,1,0,0,0,0)", utc(2000,0,1,0,0,0,0) ); // Dates around 1900 addNewTestCase( Date.UTC( 1899,11,31,23,59,59,999), "Date.UTC( 1899,11,31,23,59,59,999)", utc(1899,11,31,23,59,59,999) ); addNewTestCase( Date.UTC( 1900,0,1,0,0,0,0), "Date.UTC( 1900,0,1,0,0,0,0)", utc(1900,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 1973,0,1,0,0,0,0), "Date.UTC( 1973,0,1,0,0,0,0)", utc(1973,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 1776,6,4,12,36,13,111), "Date.UTC( 1776,6,4,12,36,13,111)", utc(1776,6,4,12,36,13,111) ); addNewTestCase( Date.UTC( 2525,9,18,15,30,1,123), "Date.UTC( 2525,9,18,15,30,1,123)", utc(2525,9,18,15,30,1,123) ); // Dates around 29 Feb 2000 addNewTestCase( Date.UTC( 2000,1,29,0,0,0,0 ), "Date.UTC( 2000,1,29,0,0,0,0 )", utc(2000,1,29,0,0,0,0) ); addNewTestCase( Date.UTC( 2000,1,29,8,0,0,0 ), "Date.UTC( 2000,1,29,8,0,0,0 )", utc(2000,1,29,8,0,0,0) ); // Dates around 1 Jan 2005 addNewTestCase( Date.UTC( 2005,0,1,0,0,0,0 ), "Date.UTC( 2005,0,1,0,0,0,0 )", utc(2005,0,1,0,0,0,0) ); addNewTestCase( Date.UTC( 2004,11,31,16,0,0,0 ), "Date.UTC( 2004,11,31,16,0,0,0 )", utc(2004,11,31,16,0,0,0) ); test(); function addNewTestCase( DateCase, DateString, ExpectDate) { DateCase = DateCase; new TestCase( SECTION, DateString, ExpectDate.value, DateCase ); new TestCase( SECTION, DateString, ExpectDate.value, DateCase ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function utc( year, month, date, hours, minutes, seconds, ms ) { d = new MyDate(); d.year = Number(year); if (month) d.month = Number(month); if (date) d.date = Number(date); if (hours) d.hours = Number(hours); if (minutes) d.minutes = Number(minutes); if (seconds) d.seconds = Number(seconds); if (ms) d.ms = Number(ms); if ( isNaN(d.year) && 0 <= ToInteger(d.year) && d.year <= 99 ) { d.year = 1900 + ToInteger(d.year); } if (isNaN(month) || isNaN(year) || isNaN(date) || isNaN(hours) || isNaN(minutes) || isNaN(seconds) || isNaN(ms) ) { d.year = Number.NaN; d.month = Number.NaN; d.date = Number.NaN; d.hours = Number.NaN; d.minutes = Number.NaN; d.seconds = Number.NaN; d.ms = Number.NaN; d.value = Number.NaN; d.time = Number.NaN; d.day =Number.NaN; return d; } d.day = MakeDay( d.year, d.month, d.date ); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = (TimeClip( MakeDate(d.day,d.time))); return d; } function UTCTime( t ) { sign = ( t < 0 ) ? -1 : 1; return ( (t +(TZ_DIFF*msPerHour)) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.1.js0000644000175000017500000000454211545150464020457 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.1.js ECMA Section: 15.9.5.1 Date.prototype.constructor Description: The initial value of Date.prototype.constructor is the built-in Date constructor. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Date.prototype.constructor == Date", true, Date.prototype.constructor == Date ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-1.js0000644000175000017500000000551111545150464020672 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-10.js0000644000175000017500000000565511545150464020763 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_START_1998 = GetDSTStart(TimeFromYear(1998)); addTestCase( DST_START_1998+1 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-11.js0000644000175000017500000000564511545150464020763 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_END_1998 = GetDSTEnd(TimeFromYear(1998)); addTestCase( DST_END_1998 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-12.js0000644000175000017500000000564711545150464020766 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_END_1998 = GetDSTEnd(TimeFromYear(1998)); addTestCase( DST_END_1998-1 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-13.js0000644000175000017500000000564711545150464020767 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_END_1998 = GetDSTEnd(TimeFromYear(1998)); addTestCase( DST_END_1998+1 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-2.js0000644000175000017500000000556411545150464020703 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-3.js0000644000175000017500000000551211545150464020675 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-4.js0000644000175000017500000000556411545150464020705 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-5.js0000644000175000017500000000556411545150464020706 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-6.js0000644000175000017500000000557211545150464020706 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-7.js0000644000175000017500000000557111545150464020706 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-8.js0000644000175000017500000000572511545150464020710 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_START_1998 = GetDSTStart(TimeFromYear(1998)); addTestCase( DST_START_1998 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.10-9.js0000644000175000017500000000565511545150464020713 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.10.js ECMA Section: 15.9.5.10 Description: Date.prototype.getDate 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return DateFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDate()"; writeHeaderToLog( SECTION + " "+ TITLE); // some daylight savings time cases var DST_START_1998 = GetDSTStart(TimeFromYear(1998)); addTestCase( DST_START_1998-1 ); new TestCase( SECTION, "(new Date(NaN)).getDate()", NaN, (new Date(NaN)).getDate() ); new TestCase( SECTION, "Date.prototype.getDate.length", 0, Date.prototype.getDate.length ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDate()", DateFromTime(LocalTime(d)), (new Date(d)).getDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.11-1.js0000644000175000017500000000514211545150464020673 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.11-2.js0000644000175000017500000000514011545150464020672 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.11 ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.11-3.js0000644000175000017500000000514311545150464020676 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.11-4.js0000644000175000017500000000514311545150464020677 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.11-5.js0000644000175000017500000000514311545150464020700 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.11-6.js0000644000175000017500000000515111545150464020700 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.11-7.js0000644000175000017500000000515011545150464020700 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.11.js ECMA Section: 15.9.5.11 Description: Date.prototype.getUTCDate 1.Let t be this time value. 2.If t is NaN, return NaN. 1.Return DateFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDate()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDate()", DateFromTime(d), (new Date(d)).getUTCDate() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.12-1.js0000644000175000017500000000515211545150464020675 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.12-2.js0000644000175000017500000000515311545150464020677 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.12-3.js0000644000175000017500000000515311545150464020700 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.12-4.js0000644000175000017500000000515311545150464020701 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.12-5.js0000644000175000017500000000515311545150464020702 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.12-6.js0000644000175000017500000000516111545150464020702 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.12-7.js0000644000175000017500000000516011545150464020702 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.12.js ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getDay()", WeekDay((LocalTime(d))), (new Date(d)).getDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.12-8.js0000644000175000017500000000471711545150464020712 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.12 ECMA Section: 15.9.5.12 Description: Date.prototype.getDay 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return WeekDay(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getDay()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Date(NaN)).getDay()", NaN, (new Date(NaN)).getDay() ); new TestCase( SECTION, "Date.prototype.getDay.length", 0, Date.prototype.getDay.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.13-1.js0000644000175000017500000000521411545150464020675 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); // get the current time var now = (new Date()).valueOf(); addTestCase( now ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.13-2.js0000644000175000017500000000512411545150464020676 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.13 ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.13-3.js0000644000175000017500000000513011545150464020674 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.13-4.js0000644000175000017500000000513011545150464020675 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.13-5.js0000644000175000017500000000513011545150464020676 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.13-6.js0000644000175000017500000000513611545150464020705 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.13-7.js0000644000175000017500000000513411545150464020704 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { var start = TimeFromYear(YearFromTime(t)); var stop = TimeFromYear(YearFromTime(t) + 1); for (var d = start; d < stop; d += msPerDay) { new TestCase( SECTION, "(new Date("+d+")).getUTCDay()", WeekDay((d)), (new Date(d)).getUTCDay() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.13-8.js0000644000175000017500000000477211545150464020714 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.13.js ECMA Section: 15.9.5.13 Description: Date.prototype.getUTCDay 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return WeekDay(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.13"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCDay()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Date(NaN)).getUTCDay()", NaN, (new Date(NaN)).getUTCDay() ); new TestCase( SECTION, "Date.prototype.getUTCDay.length", 0, Date.prototype.getUTCDay.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.14.js0000644000175000017500000000556711545150464020553 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.14.js ECMA Section: 15.9.5.14 Description: Date.prototype.getHours 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return HourFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.14"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getHours()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getHours()", NaN, (new Date(NaN)).getHours() ); new TestCase( SECTION, "Date.prototype.getHours.length", 0, Date.prototype.getHours.length ); test(); function addTestCase( t ) { for ( h = 0; h < 24; h+=4 ) { t += msPerHour; new TestCase( SECTION, "(new Date("+t+")).getHours()", HourFromTime((LocalTime(t))), (new Date(t)).getHours() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.15.js0000644000175000017500000000557211545150464020550 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.15.js ECMA Section: 15.9.5.15 Description: Date.prototype.getUTCHours 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return HourFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.15"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCHours()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getUTCHours()", NaN, (new Date(NaN)).getUTCHours() ); new TestCase( SECTION, "Date.prototype.getUTCHours.length", 0, Date.prototype.getUTCHours.length ); test(); function addTestCase( t ) { for ( h = 0; h < 24; h+=3 ) { t += msPerHour; new TestCase( SECTION, "(new Date("+t+")).getUTCHours()", HourFromTime((t)), (new Date(t)).getUTCHours() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.16.js0000644000175000017500000000560311545150464020544 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.16.js ECMA Section: 15.9.5.16 Description: Date.prototype.getMinutes 1.Let t be this time value. 2.If t is NaN, return NaN. 3.Return MinFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.16"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getMinutes()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getMinutes()", NaN, (new Date(NaN)).getMinutes() ); new TestCase( SECTION, "Date.prototype.getMinutes.length", 0, Date.prototype.getMinutes.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 60; m+=10 ) { t += msPerMinute; new TestCase( SECTION, "(new Date("+t+")).getMinutes()", MinFromTime((LocalTime(t))), (new Date(t)).getMinutes() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.17.js0000644000175000017500000000561211545150464020545 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.17.js ECMA Section: 15.9.5.17 Description: Date.prototype.getUTCMinutes 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return MinFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.17"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMinutes()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getUTCMinutes()", NaN, (new Date(NaN)).getUTCMinutes() ); new TestCase( SECTION, "Date.prototype.getUTCMinutes.length", 0, Date.prototype.getUTCMinutes.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 60; m+=10 ) { t += msPerMinute; new TestCase( SECTION, "(new Date("+t+")).getUTCMinutes()", MinFromTime(t), (new Date(t)).getUTCMinutes() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.18.js0000644000175000017500000000560111545150464020544 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.18.js ECMA Section: 15.9.5.18 Description: Date.prototype.getSeconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return SecFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.18"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getSeconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getSeconds()", NaN, (new Date(NaN)).getSeconds() ); new TestCase( SECTION, "Date.prototype.getSeconds.length", 0, Date.prototype.getSeconds.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 60; m+=10 ) { t += 1000; new TestCase( SECTION, "(new Date("+t+")).getSeconds()", SecFromTime(LocalTime(t)), (new Date(t)).getSeconds() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.19.js0000644000175000017500000000560311545150464020547 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.19.js ECMA Section: 15.9.5.19 Description: Date.prototype.getUTCSeconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return SecFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.19"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCSeconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getUTCSeconds()", NaN, (new Date(NaN)).getUTCSeconds() ); new TestCase( SECTION, "Date.prototype.getUTCSeconds.length", 0, Date.prototype.getUTCSeconds.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 60; m+=10 ) { t += 1000; new TestCase( SECTION, "(new Date("+t+")).getUTCSeconds()", SecFromTime(t), (new Date(t)).getUTCSeconds() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.2-1.js0000644000175000017500000001230211545150464020607 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.2.js ECMA Section: 15.9.5.2 Date.prototype.toString Description: This function returns a string value. The contents of the string are implementation dependent, but are intended to represent the Date in a convenient, human-readable form in the current time zone. The toString function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Date.prototype.toString.length", 0, Date.prototype.toString.length ); var now = new Date(); // can't test the content of the string, but can verify that the string is // parsable by Date.parse new TestCase( SECTION, "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000", true, Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 ); new TestCase( SECTION, "typeof now.toString()", "string", typeof now.toString() ); // 1970 new TestCase( SECTION, "Date.parse( (new Date(0)).toString() )", 0, Date.parse( (new Date(0)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TZ_ADJUST+")).toString() )", TZ_ADJUST, Date.parse( (new Date(TZ_ADJUST)).toString() ) ); // 1900 new TestCase( SECTION, "Date.parse( (new Date("+TIME_1900+")).toString() )", TIME_1900, Date.parse( (new Date(TIME_1900)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )", TIME_1900 -TZ_ADJUST, Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) ); // 2000 new TestCase( SECTION, "Date.parse( (new Date("+TIME_2000+")).toString() )", TIME_2000, Date.parse( (new Date(TIME_2000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )", TIME_2000 -TZ_ADJUST, Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) ); // 29 Feb 2000 new TestCase( SECTION, "Date.parse( (new Date("+UTC_FEB_29_2000+")).toString() )", UTC_FEB_29_2000, Date.parse( (new Date(UTC_FEB_29_2000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_FEB_29_2000-1000)+")).toString() )", UTC_FEB_29_2000-1000, Date.parse( (new Date(UTC_FEB_29_2000-1000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_FEB_29_2000-TZ_ADJUST)+")).toString() )", UTC_FEB_29_2000-TZ_ADJUST, Date.parse( (new Date(UTC_FEB_29_2000-TZ_ADJUST)).toString() ) ); // 2O05 new TestCase( SECTION, "Date.parse( (new Date("+UTC_JAN_1_2005+")).toString() )", UTC_JAN_1_2005, Date.parse( (new Date(UTC_JAN_1_2005)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_JAN_1_2005-1000)+")).toString() )", UTC_JAN_1_2005-1000, Date.parse( (new Date(UTC_JAN_1_2005-1000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_JAN_1_2005-TZ_ADJUST)+")).toString() )", UTC_JAN_1_2005-TZ_ADJUST, Date.parse( (new Date(UTC_JAN_1_2005-TZ_ADJUST)).toString() ) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.2-2-n.js0000644000175000017500000000607211545150464021052 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.2-2.js ECMA Section: 15.9.5.2 Date.prototype.toString Description: This function returns a string value. The contents of the string are implementation dependent, but are intended to represent the Date in a convenient, human-readable form in the current time zone. The toString function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. This verifies that calling toString on an object that is not a string generates a runtime error. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); var OBJ = new MyObject( new Date(0) ); DESCRIPTION = "var OBJ = new MyObject( new Date(0) ); OBJ.toString()"; EXPECTED = "error"; new TestCase( SECTION, "var OBJ = new MyObject( new Date(0) ); OBJ.toString()", "error", eval("OBJ.toString()") ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); this.toString = Date.prototype.toString; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.2.js0000644000175000017500000001230211545150464020451 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.2.js ECMA Section: 15.9.5.2 Date.prototype.toString Description: This function returns a string value. The contents of the string are implementation dependent, but are intended to represent the Date in a convenient, human-readable form in the current time zone. The toString function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Date.prototype.toString.length", 0, Date.prototype.toString.length ); var now = new Date(); // can't test the content of the string, but can verify that the string is // parsable by Date.parse new TestCase( SECTION, "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000", true, Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 ); new TestCase( SECTION, "typeof now.toString()", "string", typeof now.toString() ); // 1970 new TestCase( SECTION, "Date.parse( (new Date(0)).toString() )", 0, Date.parse( (new Date(0)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TZ_ADJUST+")).toString() )", TZ_ADJUST, Date.parse( (new Date(TZ_ADJUST)).toString() ) ); // 1900 new TestCase( SECTION, "Date.parse( (new Date("+TIME_1900+")).toString() )", TIME_1900, Date.parse( (new Date(TIME_1900)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )", TIME_1900 -TZ_ADJUST, Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) ); // 2000 new TestCase( SECTION, "Date.parse( (new Date("+TIME_2000+")).toString() )", TIME_2000, Date.parse( (new Date(TIME_2000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )", TIME_2000 -TZ_ADJUST, Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) ); // 29 Feb 2000 new TestCase( SECTION, "Date.parse( (new Date("+UTC_FEB_29_2000+")).toString() )", UTC_FEB_29_2000, Date.parse( (new Date(UTC_FEB_29_2000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_FEB_29_2000-1000)+")).toString() )", UTC_FEB_29_2000-1000, Date.parse( (new Date(UTC_FEB_29_2000-1000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_FEB_29_2000-TZ_ADJUST)+")).toString() )", UTC_FEB_29_2000-TZ_ADJUST, Date.parse( (new Date(UTC_FEB_29_2000-TZ_ADJUST)).toString() ) ); // 2O05 new TestCase( SECTION, "Date.parse( (new Date("+UTC_JAN_1_2005+")).toString() )", UTC_JAN_1_2005, Date.parse( (new Date(UTC_JAN_1_2005)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_JAN_1_2005-1000)+")).toString() )", UTC_JAN_1_2005-1000, Date.parse( (new Date(UTC_JAN_1_2005-1000)).toString() ) ); new TestCase( SECTION, "Date.parse( (new Date("+(UTC_JAN_1_2005-TZ_ADJUST)+")).toString() )", UTC_JAN_1_2005-TZ_ADJUST, Date.parse( (new Date(UTC_JAN_1_2005-TZ_ADJUST)).toString() ) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.20.js0000644000175000017500000000564411545150464020544 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.20.js ECMA Section: 15.9.5.20 Description: Date.prototype.getMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(LocalTime(t)). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.20"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getMilliseconds()", NaN, (new Date(NaN)).getMilliseconds() ); new TestCase( SECTION, "Date.prototype.getMilliseconds.length", 0, Date.prototype.getMilliseconds.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getMilliseconds()", msFromTime(LocalTime(t)), (new Date(t)).getMilliseconds() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.21-1.js0000644000175000017500000000467411545150464020705 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_NOW ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.21-2.js0000644000175000017500000000467511545150464020707 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.21-3.js0000644000175000017500000000467511545150464020710 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.21-4.js0000644000175000017500000000467511545150464020711 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.21-5.js0000644000175000017500000000467511545150464020712 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.21-6.js0000644000175000017500000000470311545150464020703 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.21-7.js0000644000175000017500000000470211545150464020703 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { new TestCase( SECTION, "(new Date("+t+")).getUTCMilliseconds()", msFromTime(t), (new Date(t)).getUTCMilliseconds() ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.21-8.js0000644000175000017500000000501711545150464020704 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.21.js ECMA Section: 15.9.5.21 Description: Date.prototype.getUTCMilliseconds 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return msFromTime(t). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.21"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getUTCMilliseconds()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Date(NaN)).getUTCMilliseconds()", NaN, (new Date(NaN)).getUTCMilliseconds() ); new TestCase( SECTION, "Date.prototype.getUTCMilliseconds.length", 0, Date.prototype.getUTCMilliseconds.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.22-1.js0000644000175000017500000000576211545150464020705 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); addTestCase( TIME_1970 ); addTestCase( TIME_1900 ); addTestCase( TIME_2000 ); addTestCase( UTC_FEB_29_2000 ); addTestCase( UTC_JAN_1_2005 ); new TestCase( SECTION, "(new Date(NaN)).getTimezoneOffset()", NaN, (new Date(NaN)).getTimezoneOffset() ); new TestCase( SECTION, "Date.prototype.getTimezoneOffset.length", 0, Date.prototype.getTimezoneOffset.length ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.22-2.js0000644000175000017500000000513711545150464020702 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_0000 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.22-3.js0000644000175000017500000000513711545150464020703 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1970 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.22-4.js0000644000175000017500000000513711545150464020704 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_1900 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.22-5.js0000644000175000017500000000513711545150464020705 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( TIME_2000 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.22-6.js0000644000175000017500000000514511545150464020705 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_FEB_29_2000 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.22-7.js0000644000175000017500000000514411545150464020705 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); addTestCase( UTC_JAN_1_2005 ); test(); function addTestCase( t ) { for ( m = 0; m <= 1000; m+=100 ) { t++; new TestCase( SECTION, "(new Date("+t+")).getTimezoneOffset()", (t - LocalTime(t)) / msPerMinute, (new Date(t)).getTimezoneOffset() ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.22-8.js0000644000175000017500000000514211545150464020704 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.22.js ECMA Section: 15.9.5.22 Description: Date.prototype.getTimezoneOffset Returns the difference between local time and UTC time in minutes. 1. Let t be this time value. 2. If t is NaN, return NaN. 3. Return (t - LocalTime(t)) / msPerMinute. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.22"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.getTimezoneOffset()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Date(NaN)).getTimezoneOffset()", NaN, (new Date(NaN)).getTimezoneOffset() ); new TestCase( SECTION, "Date.prototype.getTimezoneOffset.length", 0, Date.prototype.getTimezoneOffset.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-1.js0000644000175000017500000001330611545150464020677 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( 0, 0 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-10.js0000644000175000017500000001332511545150464020760 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, -2208988800000 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-11.js0000644000175000017500000001332111545150464020755 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, -86400000 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Date/15.9.5.23-12.js0000644000175000017500000001332111545150464020756 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.23-1.js ECMA Section: 15.9.5.23 Date.prototype.setTime(time) Description: 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5.23-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Date.prototype.setTime()"; writeHeaderToLog( SECTION + " Date.prototype.setTime(time)"); var now = "now"; addTestCase( now, 946684800000 ); test(); function addTestCase( startTime, setTime ) { if ( startTime == "now" ) { DateCase = new Date(); } else { DateCase = new Date( startTime ); } DateCase.setTime( setTime ); var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ; var UTCDate = UTCDateFromTime ( Number(setTime) ); var LocalDate = LocalDateFromTime( Number(setTime) ); new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() ); new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() ); new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() ); new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() ); new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() ); new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() ); new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() ); new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() ); new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() ); new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() ); new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() ); new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() ); new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() ); new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() ); new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() ); new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() ); new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() ); new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() ); DateCase.toString = Object.prototype.toString; new TestCase( SECTION, DateString+".toString=Object.prototype.toString;"+DateString+".toString()", "[object Date]", DateCase.toString() ); } function MyDate() { this.year = 0; this.month = 0; this.date = 0; this.hours = 0; this.minutes = 0; this.seconds = 0; this.ms = 0; } function LocalDateFromTime(t) { t = LocalTime(t); return ( MyDateFromTime(t) ); } function UTCDateFromTime(t) { return ( MyDateFromTime(t) ); } function MyDateFromTime( t ) { var d = new MyDate(); d.year = YearFromTime(t); d.month = MonthFromTime(t); d.date = DateFromTime(t); d.hours = HourFromTime(t); d.minutes = MinFromTime(t); d.seconds = SecFromTime(t); d.ms = msFromTime(t); d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms ); d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) ); d.day = WeekDay( d.value ); return (d); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.3-1.js0000644000175000017500000000662311545150464023257 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.3-1.js ECMA Section: 10.1.3 Description: For each formal parameter, as defined in the FormalParameterList, create a property of the variable object whose name is the Identifier and whose attributes are determined by the type of code. The values of the parameters are supplied by the caller. If the caller supplies fewer parameter values than there are formal parameters, the extra formal parameters have value undefined. If two or more formal parameters share the same name, hence the same property, the corresponding property is given the value that was supplied for the last parameter with this name. If the value of this last parameter was not supplied by the caller, the value of the corresponding property is undefined. http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104191 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.3-1"; var VERSION = "ECMA_1"; var TITLE = "Variable Instantiation: Formal Parameters"; var BUGNUMBER="104191"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var myfun1 = new Function( "a", "a", "return a" ); var myfun2 = new Function( "a", "b", "a", "return a" ); function myfun3(a, b, a) { return a; } // myfun1, myfun2, myfun3 tostring new TestCase( SECTION, String(myfun2) +"; myfun2(2,4,8)", 8, myfun2(2,4,8) ); new TestCase( SECTION, "myfun2(2,4)", void 0, myfun2(2,4)); new TestCase( SECTION, String(myfun3) +"; myfun3(2,4,8)", 8, myfun3(2,4,8) ); new TestCase( SECTION, "myfun3(2,4)", void 0, myfun3(2,4) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.3-2.js0000644000175000017500000000453611545150464023261 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): mozilla@florian.loitsch.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.3-1.js ECMA Section: 10.1.3 Description: Author: mozilla@florian.loitsch.com Date: 27 July 2005 */ var SECTION = "10.1.3-2"; var VERSION = "ECMA_1"; var TITLE = "Variable Instantiation: Function Declarations"; var BUGNUMBER="299639"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function f(g) { function g() { return "g"; }; return g; } new TestCase( SECTION, "typeof f(\"parameter\")", "function", typeof f("parameter") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.3.js0000644000175000017500000001246111545150464023116 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.3.js ECMA Section: 10.1.3.js Variable Instantiation Description: Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "10.1.3"; var VERSION = "ECMA_1"; var TITLE = "Variable instantiation"; var BUGNUMBER = "20256"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // overriding a variable or function name with a function should succeed new TestCase(SECTION, "function t() { return \"first\" };" + "function t() { return \"second\" };t() ", "second", eval("function t() { return \"first\" };" + "function t() { return \"second\" };t()")); new TestCase(SECTION, "var t; function t(){}; typeof(t)", "function", eval("var t; function t(){}; typeof(t)")); // formal parameter tests new TestCase(SECTION, "function t1(a,b) { return b; }; t1( 4 );", void 0, eval("function t1(a,b) { return b; }; t1( 4 );") ); new TestCase(SECTION, "function t1(a,b) { return a; }; t1(4);", 4, eval("function t1(a,b) { return a; }; t1(4)")); new TestCase(SECTION, "function t1(a,b) { return a; }; t1();", void 0, eval("function t1(a,b) { return a; }; t1()")); new TestCase(SECTION, "function t1(a,b) { return a; }; t1(1,2,4);", 1, eval("function t1(a,b) { return a; }; t1(1,2,4)")); /* new TestCase(SECTION, "function t1(a,a) { return a; }; t1( 4 );", void 0, eval("function t1(a,a) { return a; }; t1( 4 )")); new TestCase(SECTION, "function t1(a,a) { return a; }; t1( 1,2 );", 2, eval("function t1(a,a) { return a; }; t1( 1,2 )")); */ // variable declarations new TestCase(SECTION, "function t1(a,b) { return a; }; t1( false, true );", false, eval("function t1(a,b) { return a; }; t1( false, true );")); new TestCase(SECTION, "function t1(a,b) { return b; }; t1( false, true );", true, eval("function t1(a,b) { return b; }; t1( false, true );")); new TestCase(SECTION, "function t1(a,b) { return a+b; }; t1( 4, 2 );", 6, eval("function t1(a,b) { return a+b; }; t1( 4, 2 );")); new TestCase(SECTION, "function t1(a,b) { return a+b; }; t1( 4 );", Number.NaN, eval("function t1(a,b) { return a+b; }; t1( 4 );")); // overriding a function name with a variable should fail new TestCase(SECTION, "function t() { return 'function' };" + "var t = 'variable'; typeof(t)", "string", eval("function t() { return 'function' };" + "var t = 'variable'; typeof(t)")); // function as a constructor new TestCase(SECTION, "function t1(a,b) { var a = b; return a; } t1(1,3);", 3, eval("function t1(a, b){ var a = b; return a;}; t1(1,3)")); new TestCase(SECTION, "function t2(a,b) { this.a = b; } x = new t2(1,3); x.a", 3, eval("function t2(a,b) { this.a = b; };" + "x = new t2(1,3); x.a")); new TestCase(SECTION, "function t2(a,b) { this.a = a; } x = new t2(1,3); x.a", 1, eval("function t2(a,b) { this.a = a; };" + "x = new t2(1,3); x.a")); new TestCase(SECTION, "function t2(a,b) { this.a = b; this.b = a; } " + "x = new t2(1,3);x.a;", 3, eval("function t2(a,b) { this.a = b; this.b = a; };" + "x = new t2(1,3);x.a;")); new TestCase(SECTION, "function t2(a,b) { this.a = b; this.b = a; }" + "x = new t2(1,3);x.b;", 1, eval("function t2(a,b) { this.a = b; this.b = a; };" + "x = new t2(1,3);x.b;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.4-1.js0000644000175000017500000001064211545150464023254 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should return square of " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += "( " + INPUT +" )" ; with ( MYOBJECT ) { gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = Math.pow(INPUT,2); } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.4-10.js0000644000175000017500000001036711545150464023340 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.4-10.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-10"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "MYOBJECT.toString()" ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var VALUE = 12345; var MYOBJECT = new Number( VALUE ); with ( MYOBJECT ) { gTestcases[gTc].actual = toString(); gTestcases[gTc].expect = String(VALUE); } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.4-2.js0000644000175000017500000001066411545150464023261 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should return square of " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += "( "+INPUT +" )" ; with ( this ) { with ( MYOBJECT ) { gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = Math.pow(INPUT,2); } } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.4-3.js0000644000175000017500000001053711545150464023261 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += ( INPUT +"" ); with ( MYOBJECT ) { eval( INPUT ); } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.4-4.js0000644000175000017500000001065711545150464023265 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += ( INPUT +"" ); with ( MYOBJECT ) { eval( INPUT ); } gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = INPUT; gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.4-5.js0000644000175000017500000001065411545150464023263 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += ( INPUT +"" ); with ( MYOBJECT ) { eval = null; } gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = INPUT; gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.4-6.js0000644000175000017500000001000311545150464023250 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-6"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); var testcase = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); var MYOBJECT = new MyObject(); var INPUT = 2; testcase.description += ( INPUT +"" ); with ( MYOBJECT ) { ; } testcase.actual = eval( INPUT ); testcase.expect = INPUT; test(); function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.4-7.js0000644000175000017500000001066311545150464023265 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.4-7.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-7"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += ( INPUT +"" ); with ( MYOBJECT ) { delete( eval ); gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = INPUT; } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.4-8.js0000644000175000017500000001074311545150464023265 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.4-1.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( "SECTION", "with MyObject, eval should cube INPUT: " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var INPUT = 2; gTestcases[gTc].description += ( INPUT +"" ); with ( MYOBJECT ) { eval = new Function ( "x", "return(Math.pow(Number(x),3))" ); gTestcases[gTc].actual = eval( INPUT ); gTestcases[gTc].expect = Math.pow(INPUT,3); } gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject() { this.eval = new Function( "x", "return(Math.pow(Number(x),2))" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.5-1.js0000644000175000017500000000730611545150464023260 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.5-1.js ECMA Section: 10.1.5 Global Object Description: There is a unique global object which is created before control enters any execution context. Initially the global object has the following properties: Built-in objects such as Math, String, Date, parseInt, etc. These have attributes { DontEnum }. Additional host defined properties. This may include a property whose value is the global object itself, for example window in HTML. As control enters execution contexts, and as ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be changed. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.5.1-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Global Object"); new TestCase( "SECTION", "Global Code check" ); if ( Object == null ) { gTestcases[0].reason += " Object == null" ; } if ( Function == null ) { gTestcases[0].reason += " Function == null"; } if ( String == null ) { gTestcases[0].reason += " String == null"; } if ( Array == null ) { gTestcases[0].reason += " Array == null"; } if ( Number == null ) { gTestcases[0].reason += " Function == null"; } if ( Math == null ) { gTestcases[0].reason += " Math == null"; } if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; } if ( Date == null ) { gTestcases[0].reason += " Date == null"; } /* if ( NaN == null ) { gTestcases[0].reason += " NaN == null"; } if ( Infinity == null ) { gTestcases[0].reason += " Infinity == null"; } */ if ( eval == null ) { gTestcases[0].reason += " eval == null"; } if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; } if ( gTestcases[0].reason != "" ) { gTestcases[0].actual = "fail"; } else { gTestcases[0].actual = "pass"; } gTestcases[0].expect = "pass"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.5-2.js0000644000175000017500000000745111545150464023262 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.5-2.js ECMA Section: 10.1.5 Global Object Description: There is a unique global object which is created before control enters any execution context. Initially the global object has the following properties: Built-in objects such as Math, String, Date, parseInt, etc. These have attributes { DontEnum }. Additional host defined properties. This may include a property whose value is the global object itself, for example window in HTML. As control enters execution contexts, and as ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be changed. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.5.1-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Global Object"); new TestCase( "SECTION", "Eval Code check" ); var EVAL_STRING = 'if ( Object == null ) { gTestcases[0].reason += " Object == null" ; }' + 'if ( Function == null ) { gTestcases[0].reason += " Function == null"; }' + 'if ( String == null ) { gTestcases[0].reason += " String == null"; }' + 'if ( Array == null ) { gTestcases[0].reason += " Array == null"; }' + 'if ( Number == null ) { gTestcases[0].reason += " Function == null";}' + 'if ( Math == null ) { gTestcases[0].reason += " Math == null"; }' + 'if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; }' + 'if ( Date == null ) { gTestcases[0].reason += " Date == null"; }' + 'if ( eval == null ) { gTestcases[0].reason += " eval == null"; }' + 'if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; }' ; eval( EVAL_STRING ); /* if ( NaN == null ) { gTestcases[0].reason += " NaN == null"; } if ( Infinity == null ) { gTestcases[0].reason += " Infinity == null"; } */ if ( gTestcases[0].reason != "" ) { gTestcases[0].actual = "fail"; } else { gTestcases[0].actual = "pass"; } gTestcases[0].expect = "pass"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.5-3.js0000644000175000017500000001021111545150464023247 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.5-3.js ECMA Section: 10.1.5 Global Object Description: There is a unique global object which is created before control enters any execution context. Initially the global object has the following properties: Built-in objects such as Math, String, Date, parseInt, etc. These have attributes { DontEnum }. Additional host defined properties. This may include a property whose value is the global object itself, for example window in HTML. As control enters execution contexts, and as ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be changed. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.5.1-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Global Object"); new TestCase( "SECTION", "Function Code check" ); test(); function test() { if ( Object == null ) { gTestcases[0].reason += " Object == null" ; } if ( Function == null ) { gTestcases[0].reason += " Function == null"; } if ( String == null ) { gTestcases[0].reason += " String == null"; } if ( Array == null ) { gTestcases[0].reason += " Array == null"; } if ( Number == null ) { gTestcases[0].reason += " Function == null"; } if ( Math == null ) { gTestcases[0].reason += " Math == null"; } if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; } if ( Date == null ) { gTestcases[0].reason += " Date == null"; } /* if ( NaN == null ) { gTestcases[0].reason += " NaN == null"; } if ( Infinity == null ) { gTestcases[0].reason += " Infinity == null"; } */ if ( eval == null ) { gTestcases[0].reason += " eval == null"; } if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; } if ( gTestcases[0].reason != "" ) { gTestcases[0].actual = "fail"; } else { gTestcases[0].actual = "pass"; } gTestcases[0].expect = "pass"; for ( gTc=0; gTc < gTestcases.length; gTc++ ) { gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.5-4.js0000644000175000017500000000725611545150464023267 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.5-4.js ECMA Section: 10.1.5 Global Object Description: There is a unique global object which is created before control enters any execution context. Initially the global object has the following properties: Built-in objects such as Math, String, Date, parseInt, etc. These have attributes { DontEnum }. Additional host defined properties. This may include a property whose value is the global object itself, for example window in HTML. As control enters execution contexts, and as ECMAScript code is executed, additional properties may be added to the global object and the initial properties may be changed. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.5.1-4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Global Object"); new TestCase( "SECTION", "Anonymous Code check" ); var EVAL_STRING = 'if ( Object == null ) { gTestcases[0].reason += " Object == null" ; }' + 'if ( Function == null ) { gTestcases[0].reason += " Function == null"; }' + 'if ( String == null ) { gTestcases[0].reason += " String == null"; }' + 'if ( Array == null ) { gTestcases[0].reason += " Array == null"; }' + 'if ( Number == null ) { gTestcases[0].reason += " Function == null";}' + 'if ( Math == null ) { gTestcases[0].reason += " Math == null"; }' + 'if ( Boolean == null ) { gTestcases[0].reason += " Boolean == null"; }' + 'if ( Date == null ) { gTestcases[0].reason += " Date == null"; }' + 'if ( eval == null ) { gTestcases[0].reason += " eval == null"; }' + 'if ( parseInt == null ) { gTestcases[0].reason += " parseInt == null"; }' ; var NEW_FUNCTION = new Function( EVAL_STRING ); if ( gTestcases[0].reason != "" ) { gTestcases[0].actual = "fail"; } else { gTestcases[0].actual = "pass"; } gTestcases[0].expect = "pass"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.8-2.js0000644000175000017500000001057611545150464023267 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.8-2 ECMA Section: Arguments Object Description: When control enters an execution context for declared function code, anonymous code, or implementation-supplied code, an arguments object is created and initialized as follows: The [[Prototype]] of the arguments object is to the original Object prototype object, the one that is the initial value of Object.prototype (section 15.2.3.1). A property is created with name callee and property attributes {DontEnum}. The initial value of this property is the function object being executed. This allows anonymous functions to be recursive. A property is created with name length and property attributes {DontEnum}. The initial value of this property is the number of actual parameter values supplied by the caller. For each non-negative integer, iarg, less than the value of the length property, a property is created with name ToString(iarg) and property attributes { DontEnum }. The initial value of this property is the value of the corresponding actual parameter supplied by the caller. The first actual parameter value corresponds to iarg = 0, the second to iarg = 1 and so on. In the case when iarg is less than the number of formal parameters for the function object, this property shares its value with the corresponding property of the activation object. This means that changing this property changes the corresponding property of the activation object and vice versa. The value sharing mechanism depends on the implementation. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.8-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Arguments Object"; writeHeaderToLog( SECTION + " "+ TITLE); // Tests for anonymous functions var GetCallee = new Function( "var c = arguments.callee; return c" ); var GetArguments = new Function( "var a = arguments; return a" ); var GetLength = new Function( "var l = arguments.length; return l" ); var ARG_STRING = "value of the argument property"; new TestCase( SECTION, "GetCallee()", GetCallee, GetCallee() ); var LIMIT = 100; for ( var i = 0, args = "" ; i < LIMIT; i++ ) { args += String(i) + ( i+1 < LIMIT ? "," : "" ); } var LENGTH = eval( "GetLength("+ args +")" ); new TestCase( SECTION, "GetLength("+args+")", 100, LENGTH ); var ARGUMENTS = eval( "GetArguments( " +args+")" ); for ( var i = 0; i < 100; i++ ) { new TestCase( SECTION, "GetArguments("+args+")["+i+"]", i, ARGUMENTS[i] ); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.1.8-3.js0000644000175000017500000000462511545150464023266 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Norris Boyd * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.8-3 ECMA Section: Arguments Object Description: The [[Prototype]] of the arguments object is to the original Object prototype object, the one that is the initial value of Object.prototype (section 15.2.3.1). ... Test that "typeof arguments" is thus "object". */ var SECTION = "10.1.8-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Arguments Object"; writeHeaderToLog( SECTION + " "+ TITLE); var expected = "object"; var actual = (function () { return typeof arguments; })(); reportCompare(expected, actual, "typeof arguments == object"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.2.1.js0000644000175000017500000000534011545150464023113 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.2.1.js ECMA Section: 10.2.1 Global Code Description: The scope chain is created and initialized to contain the global object and no others. Variable instantiation is performed using the global object as the variable object and using empty property attributes. The this value is the global object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.2.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Global Code"; writeHeaderToLog( SECTION + " "+ TITLE); var THIS = this; new TestCase( SECTION, "this +''", GLOBAL, THIS + "" ); var GLOBAL_PROPERTIES = new Array(); var i = 0; for ( p in this ) { GLOBAL_PROPERTIES[i++] = p; } for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) { new TestCase( SECTION, GLOBAL_PROPERTIES[i] +" == void 0", false, eval("GLOBAL_PROPERTIES["+i+"] == void 0")); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.2.2-1.js0000644000175000017500000000746211545150464023261 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.2.2-1.js ECMA Section: 10.2.2 Eval Code Description: When control enters an execution context for eval code, the previous active execution context, referred to as the calling context, is used to determine the scope chain, the variable object, and the this value. If there is no calling context, then initializing the scope chain, variable instantiation, and determination of the this value are performed just as for global code. The scope chain is initialized to contain the same objects, in the same order, as the calling context's scope chain. This includes objects added to the calling context's scope chain by WithStatement. Variable instantiation is performed using the calling context's variable object and using empty property attributes. The this value is the same as the this value of the calling context. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.2.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Eval Code"; writeHeaderToLog( SECTION + " "+ TITLE); var THIS = eval("this"); new TestCase( SECTION, "this +''", GLOBAL, THIS + "" ); var GLOBAL_PROPERTIES = new Array(); var i = 0; for ( p in THIS ) { GLOBAL_PROPERTIES[i++] = p; } for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) { new TestCase( SECTION, GLOBAL_PROPERTIES[i] +" == THIS["+GLOBAL_PROPERTIES[i]+"]", true, eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") ); } // this in eval statements is the same as this value of the calling context var RESULT = THIS == this; new TestCase( SECTION, "eval( 'this == THIS' )", true, RESULT ); var RESULT = THIS +''; new TestCase( SECTION, "eval( 'this + \"\"' )", GLOBAL, RESULT ); new TestCase( SECTION, "eval( 'this == THIS' )", true, eval( "this == THIS" ) ); new TestCase( SECTION, "eval( 'this + \"\"' )", GLOBAL, eval( "this +''") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.2.2-2.js0000644000175000017500000001054011545150464023251 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.2.2-2.js ECMA Section: 10.2.2 Eval Code Description: When control enters an execution context for eval code, the previous active execution context, referred to as the calling context, is used to determine the scope chain, the variable object, and the this value. If there is no calling context, then initializing the scope chain, variable instantiation, and determination of the this value are performed just as for global code. The scope chain is initialized to contain the same objects, in the same order, as the calling context's scope chain. This includes objects added to the calling context's scope chain by WithStatement. Variable instantiation is performed using the calling context's variable object and using empty property attributes. The this value is the same as the this value of the calling context. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.2.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Eval Code"; writeHeaderToLog( SECTION + " "+ TITLE); // Test Objects var OBJECT = new MyObject( "hello" ); var GLOBAL_PROPERTIES = new Array(); var i = 0; for ( p in this ) { GLOBAL_PROPERTIES[i++] = p; } with ( OBJECT ) { var THIS = this; new TestCase( SECTION, "eval( 'this == THIS' )", true, eval("this == THIS") ); new TestCase( SECTION, "this in a with() block", GLOBAL, this+"" ); new TestCase( SECTION, "new MyObject('hello').value", "hello", value ); new TestCase( SECTION, "eval(new MyObject('hello').value)", "hello", eval("value") ); new TestCase( SECTION, "new MyObject('hello').getClass()", "[object Object]", getClass() ); new TestCase( SECTION, "eval(new MyObject('hello').getClass())", "[object Object]", eval("getClass()") ); new TestCase( SECTION, "eval(new MyObject('hello').toString())", "hello", eval("toString()") ); new TestCase( SECTION, "eval('getClass') == Object.prototype.toString", true, eval("getClass") == Object.prototype.toString ); for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) { new TestCase( SECTION, GLOBAL_PROPERTIES[i] + " == THIS["+GLOBAL_PROPERTIES[i]+"]", true, eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") ); } } test(); function MyObject( value ) { this.value = value; this.getClass = Object.prototype.toString; this.toString = new Function( "return this.value+''" ); return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.2.3-1.js0000644000175000017500000000572211545150464023257 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.2.3-1.js ECMA Section: 10.2.3 Function and Anonymous Code Description: The scope chain is initialized to contain the activation object followed by the global object. Variable instantiation is performed using the activation by the global object. Variable instantiation is performed using the activation object as the variable object and using property attributes { DontDelete }. The caller provides the this value. If the this value provided by the caller is not an object (including the case where it is null), then the this value is the global object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.2.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Eval Code"; writeHeaderToLog( SECTION + " "+ TITLE); var o = new MyObject("hello") new TestCase( SECTION, "var o = new MyObject('hello'); o.THIS == x", true, o.THIS == o ); var o = MyFunction(); new TestCase( SECTION, "var o = MyFunction(); o == this", true, o == this ); test(); function MyFunction( value ) { return this; } function MyObject( value ) { this.THIS = this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/10.2.3-2.js0000644000175000017500000000612411545150464023255 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.2.3-2.js ECMA Section: 10.2.3 Function and Anonymous Code Description: The scope chain is initialized to contain the activation object followed by the global object. Variable instantiation is performed using the activation by the global object. Variable instantiation is performed using the activation object as the variable object and using property attributes { DontDelete }. The caller provides the this value. If the this value provided by the caller is not an object (including the case where it is null), then the this value is the global object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.2.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function and Anonymous Code"; writeHeaderToLog( SECTION + " "+ TITLE); var o = new MyObject("hello"); new TestCase( SECTION, "MyFunction(\"PASSED!\")", "PASSED!", MyFunction("PASSED!") ); var o = MyFunction(); new TestCase( SECTION, "MyOtherFunction(true);", false, MyOtherFunction(true) ); test(); function MyFunction( value ) { var x = value; delete x; return x; } function MyOtherFunction(value) { var x = value; return delete x; } function MyObject( value ) { this.THIS = this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/browser.js0000644000175000017500000000000011545150464024043 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/jstests.list0000644000175000017500000000120411545150464024425 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/ExecutionContexts/ script 10.1.3-1.js script 10.1.3-2.js script 10.1.3.js script 10.1.4-1.js script 10.1.4-10.js script 10.1.4-2.js script 10.1.4-3.js script 10.1.4-4.js script 10.1.4-5.js script 10.1.4-6.js script 10.1.4-7.js script 10.1.4-8.js script 10.1.5-1.js script 10.1.5-2.js script 10.1.5-3.js script 10.1.5-4.js script 10.1.8-2.js script 10.1.8-3.js script 10.2.1.js skip-if(!xulRuntime.shell) script 10.2.2-1.js # bug - NS_ERROR_DOM_NOT_SUPPORTED_ERR Line 91 skip-if(!xulRuntime.shell) script 10.2.2-2.js # bug - NS_ERROR_DOM_NOT_SUPPORTED_ERR Line 177 script 10.2.3-1.js script 10.2.3-2.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ExecutionContexts/shell.js0000644000175000017500000000000011545150464023467 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.1.1.js0000644000175000017500000001226611545150464021747 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.1.1.js ECMA Section: 11.1.1 The this keyword Description: The this keyword evaluates to the this value of the execution context. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.1.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The this keyword"); var GLOBAL_OBJECT = this.toString(); // this in global code and eval(this) in global code should return the global object. new TestCase( SECTION, "Global Code: this.toString()", GLOBAL_OBJECT, this.toString() ); new TestCase( SECTION, "Global Code: eval('this.toString()')", GLOBAL_OBJECT, eval('this.toString()') ); // this in anonymous code called as a function should return the global object. new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('return this.toString()'); MYFUNC()", GLOBAL_OBJECT, eval("var MYFUNC = new Function('return this.toString()'); MYFUNC()") ); // eval( this ) in anonymous code called as a function should return that function's activation object new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('return (eval(\"this.toString()\")'); (MYFUNC()).toString()", GLOBAL_OBJECT, eval("var MYFUNC = new Function('return eval(\"this.toString()\")'); (MYFUNC()).toString()") ); // this and eval( this ) in anonymous code called as a constructor should return the object new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()", "[object Object]", eval("var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()") ); new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1", true, eval("var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") ); new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC().THIS).toString()", "[object Object]", eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC()).THIS).toString()") ); new TestCase( SECTION, "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1", true, eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") ); // this and eval(this) in function code called as a function should return the global object. new TestCase( SECTION, "Function Code: ReturnThis()", GLOBAL_OBJECT, ReturnThis() ); new TestCase( SECTION, "Function Code: ReturnEvalThis()", GLOBAL_OBJECT, ReturnEvalThis() ); // this and eval(this) in function code called as a contructor should return the object. new TestCase( SECTION, "var MYOBJECT = new ReturnThis(); MYOBJECT.toString()", "[object Object]", eval("var MYOBJECT = new ReturnThis(); MYOBJECT.toString()") ); new TestCase( SECTION, "var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()", "[object Object]", eval("var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()") ); test(); function ReturnThis() { return this.toString(); } function ReturnEvalThis() { return( eval("this.toString()") ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.10-1.js0000644000175000017500000001454011545150464022023 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.10-1.js ECMA Section: 11.10-1 Binary Bitwise Operators: & Description: Semantics The production A : A @ B, where @ is one of the bitwise operators in the productions &, ^, | , is evaluated as follows: 1. Evaluate A. 2. Call GetValue(Result(1)). 3. Evaluate B. 4. Call GetValue(Result(3)). 5. Call ToInt32(Result(2)). 6. Call ToInt32(Result(4)). 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is a signed 32 bit integer. 8. Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.10-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Binary Bitwise Operators: &"); var shiftexp = 0; var addexp = 0; // for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) { for ( shiftpow = 0; shiftpow < 1; shiftpow++ ) { shiftexp += Math.pow( 2, shiftpow ); for ( addpow = 0; addpow < 33; addpow++ ) { addexp += Math.pow(2, addpow); new TestCase( SECTION, shiftexp + " & " + addexp, And( shiftexp, addexp ), shiftexp & addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function And( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Xor( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") || (bs.charAt(bit) == "0" && ba.charAt(bit) == "1") ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Or( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.10-2.js0000644000175000017500000001445011545150464022024 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.10-2.js ECMA Section: 11.10-2 Binary Bitwise Operators: | Description: Semantics The production A : A @ B, where @ is one of the bitwise operators in the productions &, ^, | , is evaluated as follows: 1. Evaluate A. 2. Call GetValue(Result(1)). 3. Evaluate B. 4. Call GetValue(Result(3)). 5. Call ToInt32(Result(2)). 6. Call ToInt32(Result(4)). 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is a signed 32 bit integer. 8. Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.10-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Binary Bitwise Operators: |"); var shiftexp = 0; var addexp = 0; for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) { shiftexp += Math.pow( 2, shiftpow ); for ( addpow = 0; addpow < 33; addpow++ ) { addexp += Math.pow(2, addpow); new TestCase( SECTION, shiftexp + " | " + addexp, Or( shiftexp, addexp ), shiftexp | addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function And( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Xor( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") || (bs.charAt(bit) == "0" && ba.charAt(bit) == "1") ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Or( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.10-3.js0000644000175000017500000001445011545150464022025 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.10-3.js ECMA Section: 11.10-3 Binary Bitwise Operators: ^ Description: Semantics The production A : A @ B, where @ is one of the bitwise operators in the productions &, ^, | , is evaluated as follows: 1. Evaluate A. 2. Call GetValue(Result(1)). 3. Evaluate B. 4. Call GetValue(Result(3)). 5. Call ToInt32(Result(2)). 6. Call ToInt32(Result(4)). 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is a signed 32 bit integer. 8. Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.10-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Binary Bitwise Operators: ^"); var shiftexp = 0; var addexp = 0; for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) { shiftexp += Math.pow( 2, shiftpow ); for ( addpow = 0; addpow < 33; addpow++ ) { addexp += Math.pow(2, addpow); new TestCase( SECTION, shiftexp + " ^ " + addexp, Xor( shiftexp, addexp ), shiftexp ^ addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function And( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Xor( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") || (bs.charAt(bit) == "0" && ba.charAt(bit) == "1") ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } function Or( s, a ) { s = ToInt32( s ); a = ToInt32( a ); var bs = ToInt32BitString( s ); var ba = ToInt32BitString( a ); var result = ""; for ( var bit = 0; bit < bs.length; bit++ ) { if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) { result += "1"; } else { result += "0"; } } return ToInt32Decimal(result); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.12-1.js0000644000175000017500000000731211545150464022024 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.12.js ECMA Section: 11.12 Conditional Operator Description: Logi calORExpression ? AssignmentExpression : AssignmentExpression Semantics The production ConditionalExpression : LogicalORExpression ? AssignmentExpression : AssignmentExpression is evaluated as follows: 1. Evaluate LogicalORExpression. 2. Call GetValue(Result(1)). 3. Call ToBoolean(Result(2)). 4. If Result(3) is false, go to step 8. 5. Evaluate the first AssignmentExpression. 6. Call GetValue(Result(5)). 7. Return Result(6). 8. Evaluate the second AssignmentExpression. 9. Call GetValue(Result(8)). 10. Return Result(9). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.12"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Conditional operator( ? : )"); new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED")); new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.12-2-n.js0000644000175000017500000000563311545150464022264 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.12-2-n.js ECMA Section: 11.12 Description: The grammar for a ConditionalExpression in ECMAScript is a little bit different from that in C and Java, which each allow the second subexpression to be an Expression but restrict the third expression to be a ConditionalExpression. The motivation for this difference in ECMAScript is to allow an assignment expression to be governed by either arm of a conditional and to eliminate the confusing and fairly useless case of a comma expression as the center expression. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.12-2-n"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Conditional operator ( ? : )"); // the following expression should be an error in JS. DESCRIPTION = "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR"; EXPECTED = "error"; new TestCase( SECTION, "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR", "error", eval("var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.12-3.js0000644000175000017500000000546011545150464022030 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.12-3.js ECMA Section: 11.12 Description: The grammar for a ConditionalExpression in ECMAScript is a little bit different from that in C and Java, which each allow the second subexpression to be an Expression but restrict the third expression to be a ConditionalExpression. The motivation for this difference in ECMAScript is to allow an assignment expression to be governed by either arm of a conditional and to eliminate the confusing and fairly useless case of a comma expression as the center expression. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.12-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Conditional operator ( ? : )"); // the following expression should NOT be an error in JS. new TestCase( SECTION, "var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR", "PASSED", eval("var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.12-4.js0000644000175000017500000000545111545150464022031 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.12-4.js ECMA Section: 11.12 Description: The grammar for a ConditionalExpression in ECMAScript is a little bit different from that in C and Java, which each allow the second subexpression to be an Expression but restrict the third expression to be a ConditionalExpression. The motivation for this difference in ECMAScript is to allow an assignment expression to be governed by either arm of a conditional and to eliminate the confusing and fairly useless case of a comma expression as the center expression. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.12-4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Conditional operator ( ? : )"); // the following expression should NOT be an error in JS. new TestCase( SECTION, "true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1", "PASSED", eval("true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.13.1.js0000644000175000017500000000504611545150464022030 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.13.1.js ECMA Section: 11.13.1 Simple assignment Description: 11.13.1 Simple Assignment ( = ) The production AssignmentExpression : LeftHandSideExpression = AssignmentExpression is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Evaluate AssignmentExpression. 3. Call GetValue(Result(2)). 4. Call PutValue(Result(1), Result(3)). 5. Return Result(3). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Simple Assignment ( = )"); new TestCase( SECTION, "SOMEVAR = true", true, SOMEVAR = true ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.13.2-1.js0000644000175000017500000002075011545150464022166 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.13.2-1.js ECMA Section: 11.13.2 Compound Assignment: *= Description: *= /= %= += -= <<= >>= >>>= &= ^= |= 11.13.2 Compound assignment ( op= ) The production AssignmentExpression : LeftHandSideExpression @ = AssignmentExpression, where @ represents one of the operators indicated above, is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Apply operator @ to Result(2) and Result(4). 6. Call PutValue(Result(1), Result(5)). 7. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.2-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Compound Assignment: *="); // NaN cases new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 *= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 *= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2; VAR1") ); // number cases new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 *= VAR2", 0, eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1") ); new TestCase( SECTION, "VAR1 = 0xFF; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 *= VAR2") ); // special multiplication cases new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 *= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 *= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 *= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 *= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") ); // string cases new TestCase( SECTION, "VAR1 = 10; VAR2 = '255', VAR1 *= VAR2", 2550, eval("VAR1 = 10; VAR2 = '255', VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2", 2550, eval("VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") ); // boolean cases new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 *= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 *= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 *= VAR2") ); // object cases new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2") ); new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2", 225, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.13.2-2.js0000644000175000017500000002422511545150464022170 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.13.2-2js ECMA Section: 11.13.2 Compound Assignment: /= Description: *= /= %= += -= <<= >>= >>>= &= ^= |= 11.13.2 Compound assignment ( op= ) The production AssignmentExpression : LeftHandSideExpression @ = AssignmentExpression, where @ represents one of the operators indicated above, is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Apply operator @ to Result(2) and Result(4). 6. Call PutValue(Result(1), Result(5)). 7. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.2-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Compound Assignment: /="); // NaN cases new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2; VAR1") ); // number cases new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1") ); new TestCase( SECTION, "VAR1 = 0xFF; VAR2 = 0xA, VAR1 /= VAR2", 25.5, eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 /= VAR2") ); // special division cases new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = 1; VAR2 = 0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = 1; VAR2 = -0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = -1; VAR2 = 0; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = -1; VAR2 = -0; VAR1 /= VAR2; VAR1") ); // string cases new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1", 100, eval("VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1", 100, eval("VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1") ); /* new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") ); // boolean cases new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 /= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 /= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 /= VAR2") ); // object cases new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2") ); new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2") ); */ test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.13.2-3.js0000644000175000017500000003012511545150464022165 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.13.2-4.js ECMA Section: 11.13.2 Compound Assignment: %= Description: *= /= %= += -= <<= >>= >>>= &= ^= |= 11.13.2 Compound assignment ( op= ) The production AssignmentExpression : LeftHandSideExpression @ = AssignmentExpression, where @ represents one of the operators indicated above, is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Apply operator @ to Result(2) and Result(4). 6. Call PutValue(Result(1), Result(5)). 7. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.2-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Compound Assignment: +="); // If either operand is NaN, result is NaN new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2; VAR1") ); // if the dividend is infinity or the divisor is zero or both, the result is NaN new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = 0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = -0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = 0; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = -0; VAR1 %= VAR2; VAR1") ); // if the dividend is finite and the divisor is an infinity, the result equals the dividend. new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") ); // if the dividend is a zero and the divisor is finite, the result is the same as the dividend new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = 1; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = 1; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = -1; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = -1; VAR1 %= VAR2; VAR1") ); // string cases new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1", 0, eval("VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1") ); /* new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") ); // boolean cases new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 %= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 %= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 %= VAR2") ); // object cases new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2") ); new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2") ); */ test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.13.2-4.js0000644000175000017500000002137411545150464022174 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.13.2-4.js ECMA Section: 11.13.2 Compound Assignment:+= Description: *= /= %= += -= <<= >>= >>>= &= ^= |= 11.13.2 Compound assignment ( op= ) The production AssignmentExpression : LeftHandSideExpression @ = AssignmentExpression, where @ represents one of the operators indicated above, is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Apply operator @ to Result(2) and Result(4). 6. Call PutValue(Result(1), Result(5)). 7. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.2-4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Compound Assignment: +="); // If either operand is NaN, result is NaN new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2; VAR1") ); // the sum of two Infinities the same sign is the infinity of that sign // the sum of two Infinities of opposite sign is NaN new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 += VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); // the sum of an infinity and a finite value is equal to the infinite operand new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") ); // the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0 new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 += VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 += VAR2; VAR1") ); // the sum of a zero and a nonzero finite value is eqal to the nonzero operand new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = 0; VAR2 = 1; VAR2 += VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = -0; VAR2 = 1; VAR2 += VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = -0; VAR2 = -1; VAR2 += VAR1; VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = 0; VAR2 = -1; VAR2 += VAR1; VAR2") ); // the sum of a zero and a nozero finite value is equal to the nonzero operand. new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1") ); // the sum of two nonzero finite values of the same magnitude and opposite sign is +0 new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1") ); /* new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") ); // boolean cases new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 += VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 += VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 += VAR2") ); // object cases new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2") ); new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 += VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 += VAR2") ); */ test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.13.2-5.js0000644000175000017500000002136711545150464022177 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.13.2-5.js ECMA Section: 11.13.2 Compound Assignment: -= Description: *= /= %= -= -= <<= >>= >>>= &= ^= |= 11.13.2 Compound assignment ( op= ) The production AssignmentExpression : LeftHandSideExpression @ = AssignmentExpression, where @ represents one of the operators indicated above, is evaluated as follows: 1. Evaluate LeftHandSideExpression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Apply operator @ to Result(2) and Result(4). 6. Call PutValue(Result(1), Result(5)). 7. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.13.2-5"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Compound Assignment: -="); // If either operand is NaN, result is NaN new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2; VAR1") ); // the sum of two Infinities the same sign is the infinity of that sign // the sum of two Infinities of opposite sign is NaN new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 -= VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); // the sum of an infinity and a finite value is equal to the infinite operand new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") ); // the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0 new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 -= VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 -= VAR2; VAR1") ); // the sum of a zero and a nonzero finite value is eqal to the nonzero operand new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = 0; VAR2 = -1; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = -0; VAR2 = -1; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = -0; VAR2 = 1; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = 0; VAR2 = 1; VAR1 -= VAR2; VAR1") ); // the sum of a zero and a nozero finite value is equal to the nonzero operand. new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") ); new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") ); // the sum of two nonzero finite values of the same magnitude and opposite sign is +0 new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1") ); /* new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") ); // boolean cases new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 -= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 -= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 -= VAR2") ); // object cases new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1") ); new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2") ); new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2") ); */ test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.13.js0000644000175000017500000000664111545150464021673 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.12.js ECMA Section: 11.12 Conditional Operator Description: Logi calORExpression ? AssignmentExpression : AssignmentExpression Semantics The production ConditionalExpression : LogicalORExpression ? AssignmentExpression : AssignmentExpression is evaluated as follows: 1. Evaluate LogicalORExpression. 2. Call GetValue(Result(1)). 3. Call ToBoolean(Result(2)). 4. If Result(3) is false, go to step 8. 5. Evaluate the first AssignmentExpression. 6. Call GetValue(Result(5)). 7. Return Result(6). 8. Evaluate the second AssignmentExpression. 9. Call GetValue(Result(8)). 10. Return Result(9). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.12"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Conditional operator( ? : )"); new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED")); new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED")); new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED")); new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.14-1.js0000644000175000017500000000533611545150464022032 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.14-1.js ECMA Section: 11.14 Comma operator (,) Description: Expression : AssignmentExpression Expression , AssignmentExpression Semantics The production Expression : Expression , AssignmentExpression is evaluated as follows: 1. Evaluate Expression. 2. Call GetValue(Result(1)). 3. Evaluate AssignmentExpression. 4. Call GetValue(Result(3)). 5. Return Result(4). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.14-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Comma operator (,)"); new TestCase( SECTION, "true, false", false, eval("true, false") ); new TestCase( SECTION, "VAR1=true, VAR2=false", false, eval("VAR1=true, VAR2=false") ); new TestCase( SECTION, "VAR1=true, VAR2=false;VAR1", true, eval("VAR1=true, VAR2=false; VAR1") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.1-1.js0000644000175000017500000003404511545150464022105 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.1-1.js ECMA Section: 11.2.1 Property Accessors Description: Properties are accessed by name, using either the dot notation: MemberExpression . Identifier CallExpression . Identifier or the bracket notation: MemberExpression [ Expression ] CallExpression [ Expression ] The dot notation is explained by the following syntactic conversion: MemberExpression . Identifier is identical in its behavior to MemberExpression [ ] and similarly CallExpression . Identifier is identical in its behavior to CallExpression [ ] where is a string literal containing the same sequence of characters as the Identifier. The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Expression. 4. Call GetValue(Result(3)). 5. Call ToObject(Result(2)). 6. Call ToString(Result(4)). 7. Return a value of type Reference whose base object is Result(5) and whose property name is Result(6). The production CallExpression : CallExpression [ Expression ] is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); // go through all Native Function objects, methods, and properties and get their typeof. var PROPERTY = new Array(); var p = 0; // properties and functions of the global object PROPERTY[p++] = new Property( "this", "NaN", "number" ); PROPERTY[p++] = new Property( "this", "Infinity", "number" ); PROPERTY[p++] = new Property( "this", "eval", "function" ); PROPERTY[p++] = new Property( "this", "parseInt", "function" ); PROPERTY[p++] = new Property( "this", "parseFloat", "function" ); PROPERTY[p++] = new Property( "this", "escape", "function" ); PROPERTY[p++] = new Property( "this", "unescape", "function" ); PROPERTY[p++] = new Property( "this", "isNaN", "function" ); PROPERTY[p++] = new Property( "this", "isFinite", "function" ); PROPERTY[p++] = new Property( "this", "Object", "function" ); PROPERTY[p++] = new Property( "this", "Number", "function" ); PROPERTY[p++] = new Property( "this", "Function", "function" ); PROPERTY[p++] = new Property( "this", "Array", "function" ); PROPERTY[p++] = new Property( "this", "String", "function" ); PROPERTY[p++] = new Property( "this", "Boolean", "function" ); PROPERTY[p++] = new Property( "this", "Date", "function" ); PROPERTY[p++] = new Property( "this", "Math", "object" ); // properties and methods of Object objects PROPERTY[p++] = new Property( "Object", "prototype", "object" ); PROPERTY[p++] = new Property( "Object", "toString", "function" ); PROPERTY[p++] = new Property( "Object", "valueOf", "function" ); PROPERTY[p++] = new Property( "Object", "constructor", "function" ); // properties of the Function object PROPERTY[p++] = new Property( "Function", "prototype", "function" ); PROPERTY[p++] = new Property( "Function.prototype", "toString", "function" ); PROPERTY[p++] = new Property( "Function.prototype", "length", "number" ); PROPERTY[p++] = new Property( "Function.prototype", "valueOf", "function" ); Function.prototype.myProperty = "hi"; PROPERTY[p++] = new Property( "Function.prototype", "myProperty", "string" ); // properties of the Array object PROPERTY[p++] = new Property( "Array", "prototype", "object" ); PROPERTY[p++] = new Property( "Array", "length", "number" ); PROPERTY[p++] = new Property( "Array.prototype", "constructor", "function" ); PROPERTY[p++] = new Property( "Array.prototype", "toString", "function" ); PROPERTY[p++] = new Property( "Array.prototype", "join", "function" ); PROPERTY[p++] = new Property( "Array.prototype", "reverse", "function" ); PROPERTY[p++] = new Property( "Array.prototype", "sort", "function" ); // properties of the String object PROPERTY[p++] = new Property( "String", "prototype", "object" ); PROPERTY[p++] = new Property( "String", "fromCharCode", "function" ); PROPERTY[p++] = new Property( "String.prototype", "toString", "function" ); PROPERTY[p++] = new Property( "String.prototype", "constructor", "function" ); PROPERTY[p++] = new Property( "String.prototype", "valueOf", "function" ); PROPERTY[p++] = new Property( "String.prototype", "charAt", "function" ); PROPERTY[p++] = new Property( "String.prototype", "charCodeAt", "function" ); PROPERTY[p++] = new Property( "String.prototype", "indexOf", "function" ); PROPERTY[p++] = new Property( "String.prototype", "lastIndexOf", "function" ); PROPERTY[p++] = new Property( "String.prototype", "split", "function" ); PROPERTY[p++] = new Property( "String.prototype", "substring", "function" ); PROPERTY[p++] = new Property( "String.prototype", "toLowerCase", "function" ); PROPERTY[p++] = new Property( "String.prototype", "toUpperCase", "function" ); PROPERTY[p++] = new Property( "String.prototype", "length", "number" ); // properties of the Boolean object PROPERTY[p++] = new Property( "Boolean", "prototype", "object" ); PROPERTY[p++] = new Property( "Boolean", "constructor", "function" ); PROPERTY[p++] = new Property( "Boolean.prototype", "valueOf", "function" ); PROPERTY[p++] = new Property( "Boolean.prototype", "toString", "function" ); // properties of the Number object PROPERTY[p++] = new Property( "Number", "MAX_VALUE", "number" ); PROPERTY[p++] = new Property( "Number", "MIN_VALUE", "number" ); PROPERTY[p++] = new Property( "Number", "NaN", "number" ); PROPERTY[p++] = new Property( "Number", "NEGATIVE_INFINITY", "number" ); PROPERTY[p++] = new Property( "Number", "POSITIVE_INFINITY", "number" ); PROPERTY[p++] = new Property( "Number.prototype", "toString", "function" ); PROPERTY[p++] = new Property( "Number.prototype", "constructor", "function" ); PROPERTY[p++] = new Property( "Number.prototype", "valueOf", "function" ); // properties of the Math Object. PROPERTY[p++] = new Property( "Math", "E", "number" ); PROPERTY[p++] = new Property( "Math", "LN10", "number" ); PROPERTY[p++] = new Property( "Math", "LN2", "number" ); PROPERTY[p++] = new Property( "Math", "LOG2E", "number" ); PROPERTY[p++] = new Property( "Math", "LOG10E", "number" ); PROPERTY[p++] = new Property( "Math", "PI", "number" ); PROPERTY[p++] = new Property( "Math", "SQRT1_2", "number" ); PROPERTY[p++] = new Property( "Math", "SQRT2", "number" ); PROPERTY[p++] = new Property( "Math", "abs", "function" ); PROPERTY[p++] = new Property( "Math", "acos", "function" ); PROPERTY[p++] = new Property( "Math", "asin", "function" ); PROPERTY[p++] = new Property( "Math", "atan", "function" ); PROPERTY[p++] = new Property( "Math", "atan2", "function" ); PROPERTY[p++] = new Property( "Math", "ceil", "function" ); PROPERTY[p++] = new Property( "Math", "cos", "function" ); PROPERTY[p++] = new Property( "Math", "exp", "function" ); PROPERTY[p++] = new Property( "Math", "floor", "function" ); PROPERTY[p++] = new Property( "Math", "log", "function" ); PROPERTY[p++] = new Property( "Math", "max", "function" ); PROPERTY[p++] = new Property( "Math", "min", "function" ); PROPERTY[p++] = new Property( "Math", "pow", "function" ); PROPERTY[p++] = new Property( "Math", "random", "function" ); PROPERTY[p++] = new Property( "Math", "round", "function" ); PROPERTY[p++] = new Property( "Math", "sin", "function" ); PROPERTY[p++] = new Property( "Math", "sqrt", "function" ); PROPERTY[p++] = new Property( "Math", "tan", "function" ); // properties of the Date object PROPERTY[p++] = new Property( "Date", "parse", "function" ); PROPERTY[p++] = new Property( "Date", "prototype", "object" ); PROPERTY[p++] = new Property( "Date", "UTC", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "constructor", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "toString", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "valueOf", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getTime", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getFullYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCFullYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getMonth", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCMonth", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getDate", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCDate", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getDay", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCDay", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getHours", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCHours", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getMinutes", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCMinutes", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getSeconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCSeconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "getMilliseconds","function" ); PROPERTY[p++] = new Property( "Date.prototype", "getUTCMilliseconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setTime", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setMilliseconds","function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCMilliseconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setSeconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCSeconds", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setMinutes", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCMinutes", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setHours", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCHours", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setDate", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCDate", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setMonth", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCMonth", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setFullYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setUTCFullYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "setYear", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "toLocaleString", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "toUTCString", "function" ); PROPERTY[p++] = new Property( "Date.prototype", "toGMTString", "function" ); for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { RESULT = eval("typeof " + PROPERTY[i].object + "." + PROPERTY[i].name ); new TestCase( SECTION, "typeof " + PROPERTY[i].object + "." + PROPERTY[i].name, PROPERTY[i].type, RESULT ); RESULT = eval("typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']"); new TestCase( SECTION, "typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']", PROPERTY[i].type, RESULT ); } test(); function MyObject( arg0, arg1, arg2, arg3, arg4 ) { this.name = arg0; } function Property( object, name, type ) { this.object = object; this.name = name; this.type = type; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.1-2.js0000644000175000017500000001103711545150464022102 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.1-2.js ECMA Section: 11.2.1 Property Accessors Description: Properties are accessed by name, using either the dot notation: MemberExpression . Identifier CallExpression . Identifier or the bracket notation: MemberExpression [ Expression ] CallExpression [ Expression ] The dot notation is explained by the following syntactic conversion: MemberExpression . Identifier is identical in its behavior to MemberExpression [ ] and similarly CallExpression . Identifier is identical in its behavior to CallExpression [ ] where is a string literal containing the same sequence of characters as the Identifier. The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Expression. 4. Call GetValue(Result(3)). 5. Call ToObject(Result(2)). 6. Call ToString(Result(4)). 7. Return a value of type Reference whose base object is Result(5) and whose property name is Result(6). The production CallExpression : CallExpression [ Expression ] is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); // go through all Native Function objects, methods, and properties and get their typeof. var PROPERTY = new Array(); var p = 0; // try to access properties of primitive types PROPERTY[p++] = new Property( "\"hi\"", "hi", "hi", NaN ); PROPERTY[p++] = new Property( NaN, NaN, "NaN", NaN ); // PROPERTY[p++] = new Property( 3, 3, "3", 3 ); PROPERTY[p++] = new Property( true, true, "true", 1 ); PROPERTY[p++] = new Property( false, false, "false", 0 ); for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { new TestCase( SECTION, PROPERTY[i].object + ".valueOf()", PROPERTY[i].value, eval( PROPERTY[i].object+ ".valueOf()" ) ); new TestCase( SECTION, PROPERTY[i].object + ".toString()", PROPERTY[i].string, eval( PROPERTY[i].object+ ".toString()" ) ); } test(); function MyObject( value ) { this.value = value; this.stringValue = value +""; this.numberValue = Number(value); return this; } function Property( object, value, string, number ) { this.object = object; this.string = String(value); this.number = Number(value); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.1-3-n.js0000644000175000017500000001040311545150464022332 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.1-2.js ECMA Section: 11.2.1 Property Accessors Description: Properties are accessed by name, using either the dot notation: MemberExpression . Identifier CallExpression . Identifier or the bracket notation: MemberExpression [ Expression ] CallExpression [ Expression ] The dot notation is explained by the following syntactic conversion: MemberExpression . Identifier is identical in its behavior to MemberExpression [ ] and similarly CallExpression . Identifier is identical in its behavior to CallExpression [ ] where is a string literal containing the same sequence of characters as the Identifier. The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Expression. 4. Call GetValue(Result(3)). 5. Call ToObject(Result(2)). 6. Call ToString(Result(4)). 7. Return a value of type Reference whose base object is Result(5) and whose property name is Result(6). The production CallExpression : CallExpression [ Expression ] is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); // go through all Native Function objects, methods, and properties and get their typeof. var PROPERTY = new Array(); var p = 0; // try to access properties of primitive types PROPERTY[p++] = new Property( "undefined", void 0, "undefined", NaN ); for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { DESCRIPTION = PROPERTY[i].object + ".valueOf()"; EXPECTED = "error"; new TestCase( SECTION, PROPERTY[i].object + ".valueOf()", PROPERTY[i].value, eval( PROPERTY[i].object+ ".valueOf()" ) ); new TestCase( SECTION, PROPERTY[i].object + ".toString()", PROPERTY[i].string, eval(PROPERTY[i].object+ ".toString()") ); } test(); function MyObject( value ) { this.value = value; this.stringValue = value +""; this.numberValue = Number(value); return this; } function Property( object, value, string, number ) { this.object = object; this.string = String(value); this.number = Number(value); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.1-4-n.js0000644000175000017500000001051511545150464022337 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.1-4-n.js ECMA Section: 11.2.1 Property Accessors Description: Properties are accessed by name, using either the dot notation: MemberExpression . Identifier CallExpression . Identifier or the bracket notation: MemberExpression [ Expression ] CallExpression [ Expression ] The dot notation is explained by the following syntactic conversion: MemberExpression . Identifier is identical in its behavior to MemberExpression [ ] and similarly CallExpression . Identifier is identical in its behavior to CallExpression [ ] where is a string literal containing the same sequence of characters as the Identifier. The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Expression. 4. Call GetValue(Result(3)). 5. Call ToObject(Result(2)). 6. Call ToString(Result(4)). 7. Return a value of type Reference whose base object is Result(5) and whose property name is Result(6). The production CallExpression : CallExpression [ Expression ] is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.1-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); // go through all Native Function objects, methods, and properties and get their typeof. var PROPERTY = new Array(); var p = 0; // try to access properties of primitive types PROPERTY[p++] = new Property( "null", null, "null", 0 ); for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { DESCRIPTION = PROPERTY[i].object + ".valueOf()"; EXPECTED = "error"; new TestCase( SECTION, PROPERTY[i].object + ".valueOf()", PROPERTY[i].value, eval( PROPERTY[i].object+ ".valueOf()" ) ); new TestCase( SECTION, PROPERTY[i].object + ".toString()", PROPERTY[i].string, eval(PROPERTY[i].object+ ".toString()") ); } test(); function MyObject( value ) { this.value = value; this.stringValue = value +""; this.numberValue = Number(value); return this; } function Property( object, value, string, number ) { this.object = object; this.string = String(value); this.number = Number(value); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.1-5.js0000644000175000017500000001111711545150464022104 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.1-5.js ECMA Section: 11.2.1 Property Accessors Description: Properties are accessed by name, using either the dot notation: MemberExpression . Identifier CallExpression . Identifier or the bracket notation: MemberExpression [ Expression ] CallExpression [ Expression ] The dot notation is explained by the following syntactic conversion: MemberExpression . Identifier is identical in its behavior to MemberExpression [ ] and similarly CallExpression . Identifier is identical in its behavior to CallExpression [ ] where is a string literal containing the same sequence of characters as the Identifier. The production MemberExpression : MemberExpression [ Expression ] is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Expression. 4. Call GetValue(Result(3)). 5. Call ToObject(Result(2)). 6. Call ToString(Result(4)). 7. Return a value of type Reference whose base object is Result(5) and whose property name is Result(6). The production CallExpression : CallExpression [ Expression ] is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.1-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); // go through all Native Function objects, methods, and properties and get their typeof. var PROPERTY = new Array(); var p = 0; // try to access properties of primitive types PROPERTY[p++] = new Property( new String("hi"), "hi", "hi", NaN ); PROPERTY[p++] = new Property( new Number(NaN), NaN, "NaN", NaN ); PROPERTY[p++] = new Property( new Number(3), 3, "3", 3 ); PROPERTY[p++] = new Property( new Boolean(true), true, "true", 1 ); PROPERTY[p++] = new Property( new Boolean(false), false, "false", 0 ); for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) { new TestCase( SECTION, PROPERTY[i].object + ".valueOf()", PROPERTY[i].value, eval( "PROPERTY[i].object.valueOf()" ) ); new TestCase( SECTION, PROPERTY[i].object + ".toString()", PROPERTY[i].string, eval( "PROPERTY[i].object.toString()" ) ); } test(); function MyObject( value ) { this.value = value; this.stringValue = value +""; this.numberValue = Number(value); return this; } function Property( object, value, string, number ) { this.object = object; this.string = String(value); this.number = Number(value); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-1-n.js0000644000175000017500000000727611545150464022347 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-1.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-1-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var OBJECT = new Object(); DESCRIPTION = "OBJECT = new Object; var o = new OBJECT()"; EXPECTED = "error"; new TestCase( SECTION, "OBJECT = new Object; var o = new OBJECT()", "error", eval("o = new OBJECT()") ); test(); function TestFunction() { return arguments; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-1.js0000644000175000017500000000715011545150464022103 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-1.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new TestFunction(0,1,2,3,4,5)).length", 6, (new TestFunction(0,1,2,3,4,5)).length ); test(); function TestFunction() { return arguments; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-10-n.js0000644000175000017500000000721111545150464022414 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-9-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-9-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var m = new Math()"; EXPECTED = "error"; new TestCase( SECTION, "var m = new Math()", "error", eval("m = new Math()") ); test(); function TestFunction() { return arguments; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-11.js0000644000175000017500000000760311545150464022167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-9-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-9-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var FUNCTION = new Function(); new TestCase( SECTION, "var FUNCTION = new Function(); f = new FUNCTION(); typeof f", "object", eval("var FUNCTION = new Function(); f = new FUNCTION(); typeof f") ); new TestCase( SECTION, "var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f", "object", eval("var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-2-n.js0000644000175000017500000000730211545150464022336 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-2.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-2-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var UNDEFINED = void 0; DESCRIPTION = "UNDEFINED = void 0; var o = new UNDEFINED()"; EXPECTED = "error"; new TestCase( SECTION, "UNDEFINED = void 0; var o = new UNDEFINED()", "error", eval("o = new UNDEFINED()") ); test(); function TestFunction() { return arguments; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-3-n.js0000644000175000017500000000716711545150464022350 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-3-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-3-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var DESCRIPTION = "NULL = null; var o = new NULL()"; var EXPECTED = "error"; var NULL = null; new TestCase( SECTION, "NULL = null; var o = new NULL()", "error", eval("o = new NULL()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-4-n.js0000644000175000017500000000724611545150464022347 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-4-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-4-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var STRING = ""; DESCRIPTION = "STRING = '', var s = new STRING()"; EXPECTED = "error"; new TestCase( SECTION, "STRING = '', var s = new STRING()", "error", eval("s = new STRING()") ); test(); function TestFunction() { return arguments; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-5-n.js0000644000175000017500000000723711545150464022350 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-5-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-5-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var NUMBER = 0; DESCRIPTION = "NUMBER=0, var n = new NUMBER()"; EXPECTED = "error"; new TestCase( SECTION, "NUMBER=0, var n = new NUMBER()", "error", eval("n = new NUMBER()") ); test(); function TestFunction() { return arguments; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-6-n.js0000644000175000017500000000726211545150464022347 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-6-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-6-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var BOOLEAN = true; DESCRIPTION = "BOOLEAN = true; var b = new BOOLEAN()"; EXPECTED = "error"; new TestCase( SECTION, "BOOLEAN = true; var b = new BOOLEAN()", "error", eval("b = new BOOLEAN()") ); test(); function TestFunction() { return arguments; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-7-n.js0000644000175000017500000000733011545150464022344 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-6-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-6-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var STRING = new String("hi"); DESCRIPTION = "var STRING = new String('hi'); var s = new STRING()"; EXPECTED = "error"; new TestCase( SECTION, "var STRING = new String('hi'); var s = new STRING()", "error", eval("s = new STRING()") ); test(); function TestFunction() { return arguments; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-8-n.js0000644000175000017500000000731711545150464022352 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-8-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-8-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var NUMBER = new Number(1); DESCRIPTION = "var NUMBER = new Number(1); var n = new NUMBER()"; EXPECTED = "error"; new TestCase( SECTION, "var NUMBER = new Number(1); var n = new NUMBER()", "error", eval("n = new NUMBER()") ); test(); function TestFunction() { return arguments; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.2-9-n.js0000644000175000017500000000732511545150464022352 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.2-9-n.js ECMA Section: 11.2.2. The new operator Description: MemberExpression: PrimaryExpression MemberExpression[Expression] MemberExpression.Identifier new MemberExpression Arguments new NewExpression The production NewExpression : new NewExpression is evaluated as follows: 1. Evaluate NewExpression. 2. Call GetValue(Result(1)). 3. If Type(Result(2)) is not Object, generate a runtime error. 4. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 5. Call the [[Construct]] method on Result(2), providing no arguments (that is, an empty list of arguments). 6. If Type(Result(5)) is not Object, generate a runtime error. 7. Return Result(5). The production MemberExpression : new MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Evaluate Arguments, producing an internal list of argument values (section 0). 4. If Type(Result(2)) is not Object, generate a runtime error. 5. If Result(2) does not implement the internal [[Construct]] method, generate a runtime error. 6. Call the [[Construct]] method on Result(2), providing the list Result(3) as the argument values. 7. If Type(Result(6)) is not Object, generate a runtime error. 8 .Return Result(6). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.2-9-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The new operator"; writeHeaderToLog( SECTION + " "+ TITLE); var BOOLEAN = new Boolean(); DESCRIPTION = "var BOOLEAN = new Boolean(); var b = new BOOLEAN()"; EXPECTED = "error"; new TestCase( SECTION, "var BOOLEAN = new Boolean(); var b = new BOOLEAN()", "error", eval("b = new BOOLEAN()") ); test(); function TestFunction() { return arguments; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.3-1.js0000644000175000017500000001017611545150464022106 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.3-1.js ECMA Section: 11.2.3. Function Calls Description: The production CallExpression : MemberExpression Arguments is evaluated as follows: 1.Evaluate MemberExpression. 2.Evaluate Arguments, producing an internal list of argument values (section 0). 3.Call GetValue(Result(1)). 4.If Type(Result(3)) is not Object, generate a runtime error. 5.If Result(3) does not implement the internal [[Call]] method, generate a runtime error. 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, Result(6) is null. 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is the same as Result(6). 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value and providing the list Result(2) as the argument values. 9.Return Result(8). The production CallExpression : CallExpression Arguments is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Note: Result(8) will never be of type Reference if Result(3) is a native ECMAScript object. Whether calling a host object can return a value of type Reference is implementation-dependent. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function Calls"; writeHeaderToLog( SECTION + " "+ TITLE); /* this.eval() is no longer legal syntax. // MemberExpression : this new TestCase( SECTION, "this.eval()", void 0, this.eval() ); new TestCase( SECTION, "this.eval('NaN')", NaN, this.eval("NaN") ); */ // MemberExpression: Identifier var OBJECT = true; new TestCase( SECTION, "OBJECT.toString()", "true", OBJECT.toString() ); // MemberExpression[ Expression] new TestCase( SECTION, "(new Array())['length'].valueOf()", 0, (new Array())["length"].valueOf() ); // MemberExpression . Identifier new TestCase( SECTION, "(new Array()).length.valueOf()", 0, (new Array()).length.valueOf() ); // new MemberExpression Arguments new TestCase( SECTION, "(new Array(20))['length'].valueOf()", 20, (new Array(20))["length"].valueOf() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.3-2-n.js0000644000175000017500000000665611545150464022352 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.3-2-n.js ECMA Section: 11.2.3. Function Calls Description: The production CallExpression : MemberExpression Arguments is evaluated as follows: 1.Evaluate MemberExpression. 2.Evaluate Arguments, producing an internal list of argument values (section 0). 3.Call GetValue(Result(1)). 4.If Type(Result(3)) is not Object, generate a runtime error. 5.If Result(3) does not implement the internal [[Call]] method, generate a runtime error. 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, Result(6) is null. 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is the same as Result(6). 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value and providing the list Result(2) as the argument values. 9.Return Result(8). The production CallExpression : CallExpression Arguments is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Note: Result(8) will never be of type Reference if Result(3) is a native ECMAScript object. Whether calling a host object can return a value of type Reference is implementation-dependent. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.3-2-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function Calls"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "3.valueOf()", 3, eval("3.valueOf()") ); new TestCase( SECTION, "(3).valueOf()", 3, eval("(3).valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.3-3-n.js0000644000175000017500000000666511545150464022353 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.3-3-n.js ECMA Section: 11.2.3. Function Calls Description: The production CallExpression : MemberExpression Arguments is evaluated as follows: 1.Evaluate MemberExpression. 2.Evaluate Arguments, producing an internal list of argument values (section 0). 3.Call GetValue(Result(1)). 4.If Type(Result(3)) is not Object, generate a runtime error. 5.If Result(3) does not implement the internal [[Call]] method, generate a runtime error. 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, Result(6) is null. 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is the same as Result(6). 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value and providing the list Result(2) as the argument values. 9.Return Result(8). The production CallExpression : CallExpression Arguments is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Note: Result(8) will never be of type Reference if Result(3) is a native ECMAScript object. Whether calling a host object can return a value of type Reference is implementation-dependent. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.3-3-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function Calls"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "(void 0).valueOf()"; EXPECTED = "error"; new TestCase( SECTION, "(void 0).valueOf()", "error", eval("(void 0).valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.3-4-n.js0000644000175000017500000000665111545150464022347 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.3-4-n.js ECMA Section: 11.2.3. Function Calls Description: The production CallExpression : MemberExpression Arguments is evaluated as follows: 1.Evaluate MemberExpression. 2.Evaluate Arguments, producing an internal list of argument values (section 0). 3.Call GetValue(Result(1)). 4.If Type(Result(3)) is not Object, generate a runtime error. 5.If Result(3) does not implement the internal [[Call]] method, generate a runtime error. 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, Result(6) is null. 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is the same as Result(6). 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value and providing the list Result(2) as the argument values. 9.Return Result(8). The production CallExpression : CallExpression Arguments is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Note: Result(8) will never be of type Reference if Result(3) is a native ECMAScript object. Whether calling a host object can return a value of type Reference is implementation-dependent. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.3-4-n.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function Calls"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "null.valueOf()"; EXPECTED = "error"; new TestCase( SECTION, "null.valueOf()", "error", eval("null.valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.2.3-5.js0000644000175000017500000000651411545150464022113 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.2.3-5-n.js ECMA Section: 11.2.3. Function Calls Description: The production CallExpression : MemberExpression Arguments is evaluated as follows: 1. Evaluate MemberExpression. 2. Evaluate Arguments, producing an internal list of argument values (section 0). 3. Call GetValue(Result(1)). 4. If Type(Result(3)) is not Object, generate a runtime error. 5. If Result(3) does not implement the internal [[Call]] method, generate a runtime error. 6. If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise, Result(6) is null. 7. If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is the same as Result(6). 8. Call the [[Call]] method on Result(3), providing Result(7) as the this value and providing the list Result(2) as the argument values. 9. Return Result(8). The production CallExpression : CallExpression Arguments is evaluated in exactly the same manner, except that the contained CallExpression is evaluated in step 1. Note: Result(8) will never be of type Reference if Result(3) is a native ECMAScript object. Whether calling a host object can return a value of type Reference is implementation-dependent. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.2.3-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function Calls"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "true.valueOf()", true, true.valueOf() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.3.1.js0000644000175000017500000002243311545150464021746 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.3.1.js ECMA Section: 11.3.1 Postfix increment operator Description: The production MemberExpression : MemberExpression ++ is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Call ToNumber(Result(2)). 4. Add the value 1 to Result(3), using the same rules as for the + operator (section 0). 5. Call PutValue(Result(1), Result(4)). 6. Return Result(3). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.3.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Postfix increment operator"); // special numbers new TestCase( SECTION, "var MYVAR; MYVAR++", NaN, eval("var MYVAR; MYVAR++") ); new TestCase( SECTION, "var MYVAR= void 0; MYVAR++", NaN, eval("var MYVAR=void 0; MYVAR++") ); new TestCase( SECTION, "var MYVAR=null; MYVAR++", 0, eval("var MYVAR=null; MYVAR++") ); new TestCase( SECTION, "var MYVAR=true; MYVAR++", 1, eval("var MYVAR=true; MYVAR++") ); new TestCase( SECTION, "var MYVAR=false; MYVAR++", 0, eval("var MYVAR=false; MYVAR++") ); // verify return value new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++") ); new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++;MYVAR") ); // number primitives new TestCase( SECTION, "var MYVAR=0;MYVAR++", 0, eval("var MYVAR=0;MYVAR++") ); new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++", 0.2345, eval("var MYVAR=0.2345;MYVAR++") ); new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++", -0.2345, eval("var MYVAR=-0.2345;MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++;MYVAR", 1.2345, eval("var MYVAR=0.2345;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++;MYVAR", 0.7655, eval("var MYVAR=-0.2345;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") ); // boolean values // verify return value new TestCase( SECTION, "var MYVAR=true;MYVAR++", 1, eval("var MYVAR=true;MYVAR++") ); new TestCase( SECTION, "var MYVAR=false;MYVAR++", 0, eval("var MYVAR=false;MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR=true;MYVAR++;MYVAR", 2, eval("var MYVAR=true;MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=false;MYVAR++;MYVAR", 1, eval("var MYVAR=false;MYVAR++;MYVAR") ); // boolean objects // verify return value new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++", 1, eval("var MYVAR=true;MYVAR++") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++", 0, eval("var MYVAR=false;MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++;MYVAR", 2, eval("var MYVAR=new Boolean(true);MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++;MYVAR", 1, eval("var MYVAR=new Boolean(false);MYVAR++;MYVAR") ); // string primitives new TestCase( SECTION, "var MYVAR='string';MYVAR++", Number.NaN, eval("var MYVAR='string';MYVAR++") ); new TestCase( SECTION, "var MYVAR='12345';MYVAR++", 12345, eval("var MYVAR='12345';MYVAR++") ); new TestCase( SECTION, "var MYVAR='-12345';MYVAR++", -12345, eval("var MYVAR='-12345';MYVAR++") ); new TestCase( SECTION, "var MYVAR='0Xf';MYVAR++", 15, eval("var MYVAR='0Xf';MYVAR++") ); new TestCase( SECTION, "var MYVAR='077';MYVAR++", 77, eval("var MYVAR='077';MYVAR++") ); new TestCase( SECTION, "var MYVAR=''; MYVAR++", 0, eval("var MYVAR='';MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR='string';MYVAR++;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';MYVAR++;MYVAR", 12346, eval("var MYVAR='12345';MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';MYVAR++;MYVAR", -12344, eval("var MYVAR='-12345';MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR='0xf';MYVAR++;MYVAR", 16, eval("var MYVAR='0xf';MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR='077';MYVAR++;MYVAR", 78, eval("var MYVAR='077';MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR='';MYVAR++;MYVAR", 1, eval("var MYVAR='';MYVAR++;MYVAR") ); // string objects new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++", Number.NaN, eval("var MYVAR=new String('string');MYVAR++") ); new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++", 12345, eval("var MYVAR=new String('12345');MYVAR++") ); new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++", -12345, eval("var MYVAR=new String('-12345');MYVAR++") ); new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR++", 15, eval("var MYVAR=new String('0Xf');MYVAR++") ); new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++", 77, eval("var MYVAR=new String('077');MYVAR++") ); new TestCase( SECTION, "var MYVAR=new String(''); MYVAR++", 0, eval("var MYVAR=new String('');MYVAR++") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++;MYVAR", 12346, eval("var MYVAR=new String('12345');MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++;MYVAR", -12344, eval("var MYVAR=new String('-12345');MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR++;MYVAR", 16, eval("var MYVAR=new String('0xf');MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++;MYVAR", 78, eval("var MYVAR=new String('077');MYVAR++;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('');MYVAR++;MYVAR", 1, eval("var MYVAR=new String('');MYVAR++;MYVAR") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.3.2.js0000644000175000017500000002251311545150464021746 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.3.2.js ECMA Section: 11.3.2 Postfix decrement operator Description: 11.3.2 Postfix decrement operator The production MemberExpression : MemberExpression -- is evaluated as follows: 1. Evaluate MemberExpression. 2. Call GetValue(Result(1)). 3. Call ToNumber(Result(2)). 4. Subtract the value 1 from Result(3), using the same rules as for the - operator (section 0). 5. Call PutValue(Result(1), Result(4)). 6. Return Result(3). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.3.2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Postfix decrement operator"); // special numbers new TestCase( SECTION, "var MYVAR; MYVAR--", NaN, eval("var MYVAR; MYVAR--") ); new TestCase( SECTION, "var MYVAR= void 0; MYVAR--", NaN, eval("var MYVAR=void 0; MYVAR--") ); new TestCase( SECTION, "var MYVAR=null; MYVAR--", 0, eval("var MYVAR=null; MYVAR--") ); new TestCase( SECTION, "var MYVAR=true; MYVAR--", 1, eval("var MYVAR=true; MYVAR--") ); new TestCase( SECTION, "var MYVAR=false; MYVAR--", 0, eval("var MYVAR=false; MYVAR--") ); // verify return value new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--") ); new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--;MYVAR") ); // number primitives new TestCase( SECTION, "var MYVAR=0;MYVAR--", 0, eval("var MYVAR=0;MYVAR--") ); new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--", 0.2345, eval("var MYVAR=0.2345;MYVAR--") ); new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--", -0.2345, eval("var MYVAR=-0.2345;MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--;MYVAR", -0.7655, eval("var MYVAR=0.2345;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--;MYVAR", -1.2345, eval("var MYVAR=-0.2345;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") ); // boolean values // verify return value new TestCase( SECTION, "var MYVAR=true;MYVAR--", 1, eval("var MYVAR=true;MYVAR--") ); new TestCase( SECTION, "var MYVAR=false;MYVAR--", 0, eval("var MYVAR=false;MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR=true;MYVAR--;MYVAR", 0, eval("var MYVAR=true;MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=false;MYVAR--;MYVAR", -1, eval("var MYVAR=false;MYVAR--;MYVAR") ); // boolean objects // verify return value new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--", 1, eval("var MYVAR=true;MYVAR--") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--", 0, eval("var MYVAR=false;MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--;MYVAR", 0, eval("var MYVAR=new Boolean(true);MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--;MYVAR", -1, eval("var MYVAR=new Boolean(false);MYVAR--;MYVAR") ); // string primitives new TestCase( SECTION, "var MYVAR='string';MYVAR--", Number.NaN, eval("var MYVAR='string';MYVAR--") ); new TestCase( SECTION, "var MYVAR='12345';MYVAR--", 12345, eval("var MYVAR='12345';MYVAR--") ); new TestCase( SECTION, "var MYVAR='-12345';MYVAR--", -12345, eval("var MYVAR='-12345';MYVAR--") ); new TestCase( SECTION, "var MYVAR='0Xf';MYVAR--", 15, eval("var MYVAR='0Xf';MYVAR--") ); new TestCase( SECTION, "var MYVAR='077';MYVAR--", 77, eval("var MYVAR='077';MYVAR--") ); new TestCase( SECTION, "var MYVAR=''; MYVAR--", 0, eval("var MYVAR='';MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR='string';MYVAR--;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';MYVAR--;MYVAR", 12344, eval("var MYVAR='12345';MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';MYVAR--;MYVAR", -12346, eval("var MYVAR='-12345';MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR='0xf';MYVAR--;MYVAR", 14, eval("var MYVAR='0xf';MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR='077';MYVAR--;MYVAR", 76, eval("var MYVAR='077';MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR='';MYVAR--;MYVAR", -1, eval("var MYVAR='';MYVAR--;MYVAR") ); // string objects new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--", Number.NaN, eval("var MYVAR=new String('string');MYVAR--") ); new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--", 12345, eval("var MYVAR=new String('12345');MYVAR--") ); new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--", -12345, eval("var MYVAR=new String('-12345');MYVAR--") ); new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR--", 15, eval("var MYVAR=new String('0Xf');MYVAR--") ); new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--", 77, eval("var MYVAR=new String('077');MYVAR--") ); new TestCase( SECTION, "var MYVAR=new String(''); MYVAR--", 0, eval("var MYVAR=new String('');MYVAR--") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--;MYVAR", 12344, eval("var MYVAR=new String('12345');MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--;MYVAR", -12346, eval("var MYVAR=new String('-12345');MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR--;MYVAR", 14, eval("var MYVAR=new String('0xf');MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--;MYVAR", 76, eval("var MYVAR=new String('077');MYVAR--;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('');MYVAR--;MYVAR", -1, eval("var MYVAR=new String('');MYVAR--;MYVAR") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.4.1.js0000644000175000017500000000762211545150464021752 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.4.1.js ECMA Section: 11.4.1 the Delete Operator Description: returns true if the property could be deleted returns false if it could not be deleted Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "11.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The delete operator"; writeHeaderToLog( SECTION + " "+ TITLE); // new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.length", 2, eval("x=[9,8,7];delete(x[2]);x.length") ); // new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.toString()", "9,8", eval("x=[9,8,7];delete(x[2]);x.toString()") ); new TestCase( SECTION, "x=new Date();delete x;typeof(x)", "undefined", eval("x=new Date();delete x;typeof(x)") ); // array[item++] = new TestCase( SECTION, "delete(x=new Date())", true, delete(x=new Date()) ); // array[item++] = new TestCase( SECTION, "delete('string primitive')", true, delete("string primitive") ); // array[item++] = new TestCase( SECTION, "delete(new String( 'string object' ) )", true, delete(new String("string object")) ); // array[item++] = new TestCase( SECTION, "delete(new Number(12345) )", true, delete(new Number(12345)) ); new TestCase( SECTION, "delete(Math.PI)", false, delete(Math.PI) ); // array[item++] = new TestCase( SECTION, "delete(null)", true, delete(null) ); // array[item++] = new TestCase( SECTION, "delete(void(0))", true, delete(void(0)) ); // variables declared with the var statement are not deletable. var abc; new TestCase( SECTION, "var abc; delete(abc)", false, delete abc ); new TestCase( SECTION, "var OB = new MyObject(); for ( p in OB ) { delete p }", true, eval("var OB = new MyObject(); for ( p in OB ) { delete p }") ); test(); function MyObject() { this.prop1 = true; this.prop2 = false; this.prop3 = null; this.prop4 = void 0; this.prop5 = "hi"; this.prop6 = 42; this.prop7 = new Date(); this.prop8 = Math.PI; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.4.2.js0000644000175000017500000001077311545150464021754 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.4.2.js ECMA Section: 11.4.2 the Void Operator Description: always returns undefined (?) Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "11.4.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The void operator"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "void(new String('string object'))", void 0, void(new String( 'string object' )) ); new TestCase( SECTION, "void('string primitive')", void 0, void("string primitive") ); new TestCase( SECTION, "void(Number.NaN)", void 0, void(Number.NaN) ); new TestCase( SECTION, "void(Number.POSITIVE_INFINITY)", void 0, void(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "void(1)", void 0, void(1) ); new TestCase( SECTION, "void(0)", void 0, void(0) ); new TestCase( SECTION, "void(-1)", void 0, void(-1) ); new TestCase( SECTION, "void(Number.NEGATIVE_INFINITY)", void 0, void(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "void(Math.PI)", void 0, void(Math.PI) ); new TestCase( SECTION, "void(true)", void 0, void(true) ); new TestCase( SECTION, "void(false)", void 0, void(false) ); new TestCase( SECTION, "void(null)", void 0, void(null) ); new TestCase( SECTION, "void new String('string object')", void 0, void new String( 'string object' ) ); new TestCase( SECTION, "void 'string primitive'", void 0, void "string primitive" ); new TestCase( SECTION, "void Number.NaN", void 0, void Number.NaN ); new TestCase( SECTION, "void Number.POSITIVE_INFINITY", void 0, void Number.POSITIVE_INFINITY ); new TestCase( SECTION, "void 1", void 0, void 1 ); new TestCase( SECTION, "void 0", void 0, void 0 ); new TestCase( SECTION, "void -1", void 0, void -1 ); new TestCase( SECTION, "void Number.NEGATIVE_INFINITY", void 0, void Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "void Math.PI", void 0, void Math.PI ); new TestCase( SECTION, "void true", void 0, void true ); new TestCase( SECTION, "void false", void 0, void false ); new TestCase( SECTION, "void null", void 0, void null ); // array[item++] = new TestCase( SECTION, "void()", void 0, void() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.4.3.js0000644000175000017500000001441511545150464021752 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: typeof_1.js ECMA Section: 11.4.3 typeof operator Description: typeof evaluates unary expressions: undefined "undefined" null "object" Boolean "boolean" Number "number" String "string" Object "object" [native, doesn't implement Call] Object "function" [native, implements [Call]] Object implementation dependent [not sure how to test this] Author: christine@netscape.com Date: june 30, 1997 */ var SECTION = "11.4.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = " The typeof operator"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof(void(0))", "undefined", typeof(void(0)) ); new TestCase( SECTION, "typeof(null)", "object", typeof(null) ); new TestCase( SECTION, "typeof(true)", "boolean", typeof(true) ); new TestCase( SECTION, "typeof(false)", "boolean", typeof(false) ); new TestCase( SECTION, "typeof(new Boolean())", "object", typeof(new Boolean()) ); new TestCase( SECTION, "typeof(new Boolean(true))", "object", typeof(new Boolean(true)) ); new TestCase( SECTION, "typeof(Boolean())", "boolean", typeof(Boolean()) ); new TestCase( SECTION, "typeof(Boolean(false))", "boolean", typeof(Boolean(false)) ); new TestCase( SECTION, "typeof(Boolean(true))", "boolean", typeof(Boolean(true)) ); new TestCase( SECTION, "typeof(NaN)", "number", typeof(Number.NaN) ); new TestCase( SECTION, "typeof(Infinity)", "number", typeof(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "typeof(-Infinity)", "number", typeof(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "typeof(Math.PI)", "number", typeof(Math.PI) ); new TestCase( SECTION, "typeof(0)", "number", typeof(0) ); new TestCase( SECTION, "typeof(1)", "number", typeof(1) ); new TestCase( SECTION, "typeof(-1)", "number", typeof(-1) ); new TestCase( SECTION, "typeof('0')", "string", typeof("0") ); new TestCase( SECTION, "typeof(Number())", "number", typeof(Number()) ); new TestCase( SECTION, "typeof(Number(0))", "number", typeof(Number(0)) ); new TestCase( SECTION, "typeof(Number(1))", "number", typeof(Number(1)) ); new TestCase( SECTION, "typeof(Nubmer(-1))", "number", typeof(Number(-1)) ); new TestCase( SECTION, "typeof(new Number())", "object", typeof(new Number()) ); new TestCase( SECTION, "typeof(new Number(0))", "object", typeof(new Number(0)) ); new TestCase( SECTION, "typeof(new Number(1))", "object", typeof(new Number(1)) ); // Math does not implement [[Construct]] or [[Call]] so its type is object. new TestCase( SECTION, "typeof(Math)", "object", typeof(Math) ); new TestCase( SECTION, "typeof(Number.prototype.toString)", "function", typeof(Number.prototype.toString) ); new TestCase( SECTION, "typeof('a string')", "string", typeof("a string") ); new TestCase( SECTION, "typeof('')", "string", typeof("") ); new TestCase( SECTION, "typeof(new Date())", "object", typeof(new Date()) ); new TestCase( SECTION, "typeof(new Array(1,2,3))", "object", typeof(new Array(1,2,3)) ); new TestCase( SECTION, "typeof(new String('string object'))", "object", typeof(new String("string object")) ); new TestCase( SECTION, "typeof(String('string primitive'))", "string", typeof(String("string primitive")) ); new TestCase( SECTION, "typeof(['array', 'of', 'strings'])", "object", typeof(["array", "of", "strings"]) ); new TestCase( SECTION, "typeof(new Function())", "function", typeof( new Function() ) ); new TestCase( SECTION, "typeof(parseInt)", "function", typeof( parseInt ) ); new TestCase( SECTION, "typeof(test)", "function", typeof( test ) ); new TestCase( SECTION, "typeof(String.fromCharCode)", "function", typeof( String.fromCharCode ) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.4.4.js0000644000175000017500000002250011545150464021745 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.4.4.js ECMA Section: 11.4.4 Prefix increment operator Description: The production UnaryExpression : ++ UnaryExpression is evaluated as follows: 1. Evaluate UnaryExpression. 2. Call GetValue(Result(1)). 3. Call ToNumber(Result(2)). 4. Add the value 1 to Result(3), using the same rules as for the + operator (section 11.6.3). 5. Call PutValue(Result(1), Result(4)). 6. Return Result(4). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.4.4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Prefix increment operator"); // special case: var is not defined new TestCase( SECTION, "var MYVAR; ++MYVAR", NaN, eval("var MYVAR; ++MYVAR") ); new TestCase( SECTION, "var MYVAR= void 0; ++MYVAR", NaN, eval("var MYVAR=void 0; ++MYVAR") ); new TestCase( SECTION, "var MYVAR=null; ++MYVAR", 1, eval("var MYVAR=null; ++MYVAR") ); new TestCase( SECTION, "var MYVAR=true; ++MYVAR", 2, eval("var MYVAR=true; ++MYVAR") ); new TestCase( SECTION, "var MYVAR=false; ++MYVAR", 1, eval("var MYVAR=false; ++MYVAR") ); // special numbers // verify return value new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR;MYVAR") ); // number primitives new TestCase( SECTION, "var MYVAR=0;++MYVAR", 1, eval("var MYVAR=0;++MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR;MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR;MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") ); // boolean values // verify return value new TestCase( SECTION, "var MYVAR=true;++MYVAR", 2, eval("var MYVAR=true;++MYVAR") ); new TestCase( SECTION, "var MYVAR=false;++MYVAR", 1, eval("var MYVAR=false;++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=true;++MYVAR;MYVAR", 2, eval("var MYVAR=true;++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=false;++MYVAR;MYVAR", 1, eval("var MYVAR=false;++MYVAR;MYVAR") ); // boolean objects // verify return value new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR", 2, eval("var MYVAR=true;++MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR", 1, eval("var MYVAR=false;++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR;MYVAR", 2, eval("var MYVAR=new Boolean(true);++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR;MYVAR", 1, eval("var MYVAR=new Boolean(false);++MYVAR;MYVAR") ); // string primitives new TestCase( SECTION, "var MYVAR='string';++MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';++MYVAR", 12346, eval("var MYVAR='12345';++MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';++MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR") ); new TestCase( SECTION, "var MYVAR='0Xf';++MYVAR", 16, eval("var MYVAR='0Xf';++MYVAR") ); new TestCase( SECTION, "var MYVAR='077';++MYVAR", 78, eval("var MYVAR='077';++MYVAR") ); new TestCase( SECTION, "var MYVAR=''; ++MYVAR", 1, eval("var MYVAR='';++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR='string';++MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';++MYVAR;MYVAR", 12346, eval("var MYVAR='12345';++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';++MYVAR;MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='0xf';++MYVAR;MYVAR", 16, eval("var MYVAR='0xf';++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='077';++MYVAR;MYVAR", 78, eval("var MYVAR='077';++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='';++MYVAR;MYVAR", 1, eval("var MYVAR='';++MYVAR;MYVAR") ); // string objects new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0Xf');++MYVAR", 16, eval("var MYVAR=new String('0Xf');++MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR") ); new TestCase( SECTION, "var MYVAR=new String(''); ++MYVAR", 1, eval("var MYVAR=new String('');++MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR;MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR;MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0xf');++MYVAR;MYVAR", 16, eval("var MYVAR=new String('0xf');++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR;MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('');++MYVAR;MYVAR", 1, eval("var MYVAR=new String('');++MYVAR;MYVAR") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.4.5.js0000644000175000017500000002244311545150464021754 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.4.5.js ECMA Section: 11.4.5 Prefix decrement operator Description: The production UnaryExpression : -- UnaryExpression is evaluated as follows: 1.Evaluate UnaryExpression. 2.Call GetValue(Result(1)). 3.Call ToNumber(Result(2)). 4.Subtract the value 1 from Result(3), using the same rules as for the - operator (section 11.6.3). 5.Call PutValue(Result(1), Result(4)). 1.Return Result(4). Author: christine@netscape.com Date: \ 12 november 1997 */ var SECTION = "11.4.5"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Prefix decrement operator"); // new TestCase( SECTION, "var MYVAR; --MYVAR", NaN, eval("var MYVAR; --MYVAR") ); new TestCase( SECTION, "var MYVAR= void 0; --MYVAR", NaN, eval("var MYVAR=void 0; --MYVAR") ); new TestCase( SECTION, "var MYVAR=null; --MYVAR", -1, eval("var MYVAR=null; --MYVAR") ); new TestCase( SECTION, "var MYVAR=true; --MYVAR", 0, eval("var MYVAR=true; --MYVAR") ); new TestCase( SECTION, "var MYVAR=false; --MYVAR", -1, eval("var MYVAR=false; --MYVAR") ); // special numbers // verify return value new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR;MYVAR") ); // number primitives new TestCase( SECTION, "var MYVAR=0;--MYVAR", -1, eval("var MYVAR=0;--MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR;MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR;MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") ); // boolean values // verify return value new TestCase( SECTION, "var MYVAR=true;--MYVAR", 0, eval("var MYVAR=true;--MYVAR") ); new TestCase( SECTION, "var MYVAR=false;--MYVAR", -1, eval("var MYVAR=false;--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=true;--MYVAR;MYVAR", 0, eval("var MYVAR=true;--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=false;--MYVAR;MYVAR", -1, eval("var MYVAR=false;--MYVAR;MYVAR") ); // boolean objects // verify return value new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR", 0, eval("var MYVAR=true;--MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR", -1, eval("var MYVAR=false;--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR;MYVAR", 0, eval("var MYVAR=new Boolean(true);--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR;MYVAR", -1, eval("var MYVAR=new Boolean(false);--MYVAR;MYVAR") ); // string primitives new TestCase( SECTION, "var MYVAR='string';--MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';--MYVAR", 12344, eval("var MYVAR='12345';--MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';--MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR") ); new TestCase( SECTION, "var MYVAR='0Xf';--MYVAR", 14, eval("var MYVAR='0Xf';--MYVAR") ); new TestCase( SECTION, "var MYVAR='077';--MYVAR", 76, eval("var MYVAR='077';--MYVAR") ); new TestCase( SECTION, "var MYVAR=''; --MYVAR", -1, eval("var MYVAR='';--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR='string';--MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='12345';--MYVAR;MYVAR", 12344, eval("var MYVAR='12345';--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='-12345';--MYVAR;MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='0xf';--MYVAR;MYVAR", 14, eval("var MYVAR='0xf';--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='077';--MYVAR;MYVAR", 76, eval("var MYVAR='077';--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR='';--MYVAR;MYVAR", -1, eval("var MYVAR='';--MYVAR;MYVAR") ); // string objects new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0Xf');--MYVAR", 14, eval("var MYVAR=new String('0Xf');--MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR") ); new TestCase( SECTION, "var MYVAR=new String(''); --MYVAR", -1, eval("var MYVAR=new String('');--MYVAR") ); // verify value of variable new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR;MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR;MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('0xf');--MYVAR;MYVAR", 14, eval("var MYVAR=new String('0xf');--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR;MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR;MYVAR") ); new TestCase( SECTION, "var MYVAR=new String('');--MYVAR;MYVAR", -1, eval("var MYVAR=new String('');--MYVAR;MYVAR") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.4.6.js0000644000175000017500000004415611545150464021762 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.4.6.js ECMA Section: 11.4.6 Unary + Operator Description: convert operand to Number type Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "11.4.6"; var VERSION = "ECMA_1"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " Unary + operator"); new TestCase( SECTION, "+('')", 0, +("") ); new TestCase( SECTION, "+(' ')", 0, +(" ") ); new TestCase( SECTION, "+(\\t)", 0, +("\t") ); new TestCase( SECTION, "+(\\n)", 0, +("\n") ); new TestCase( SECTION, "+(\\r)", 0, +("\r") ); new TestCase( SECTION, "+(\\f)", 0, +("\f") ); new TestCase( SECTION, "+(String.fromCharCode(0x0009)", 0, +(String.fromCharCode(0x0009)) ); new TestCase( SECTION, "+(String.fromCharCode(0x0020)", 0, +(String.fromCharCode(0x0020)) ); new TestCase( SECTION, "+(String.fromCharCode(0x000C)", 0, +(String.fromCharCode(0x000C)) ); new TestCase( SECTION, "+(String.fromCharCode(0x000B)", 0, +(String.fromCharCode(0x000B)) ); new TestCase( SECTION, "+(String.fromCharCode(0x000D)", 0, +(String.fromCharCode(0x000D)) ); new TestCase( SECTION, "+(String.fromCharCode(0x000A)", 0, +(String.fromCharCode(0x000A)) ); // a StringNumericLiteral may be preceeded or followed by whitespace and/or // line terminators new TestCase( SECTION, "+( ' ' + 999 )", 999, +( ' '+999) ); new TestCase( SECTION, "+( '\\n' + 999 )", 999, +( '\n' +999) ); new TestCase( SECTION, "+( '\\r' + 999 )", 999, +( '\r' +999) ); new TestCase( SECTION, "+( '\\t' + 999 )", 999, +( '\t' +999) ); new TestCase( SECTION, "+( '\\f' + 999 )", 999, +( '\f' +999) ); new TestCase( SECTION, "+( 999 + ' ' )", 999, +( 999+' ') ); new TestCase( SECTION, "+( 999 + '\\n' )", 999, +( 999+'\n' ) ); new TestCase( SECTION, "+( 999 + '\\r' )", 999, +( 999+'\r' ) ); new TestCase( SECTION, "+( 999 + '\\t' )", 999, +( 999+'\t' ) ); new TestCase( SECTION, "+( 999 + '\\f' )", 999, +( 999+'\f' ) ); new TestCase( SECTION, "+( '\\n' + 999 + '\\n' )", 999, +( '\n' +999+'\n' ) ); new TestCase( SECTION, "+( '\\r' + 999 + '\\r' )", 999, +( '\r' +999+'\r' ) ); new TestCase( SECTION, "+( '\\t' + 999 + '\\t' )", 999, +( '\t' +999+'\t' ) ); new TestCase( SECTION, "+( '\\f' + 999 + '\\f' )", 999, +( '\f' +999+'\f' ) ); new TestCase( SECTION, "+( ' ' + '999' )", 999, +( ' '+'999') ); new TestCase( SECTION, "+( '\\n' + '999' )", 999, +( '\n' +'999') ); new TestCase( SECTION, "+( '\\r' + '999' )", 999, +( '\r' +'999') ); new TestCase( SECTION, "+( '\\t' + '999' )", 999, +( '\t' +'999') ); new TestCase( SECTION, "+( '\\f' + '999' )", 999, +( '\f' +'999') ); new TestCase( SECTION, "+( '999' + ' ' )", 999, +( '999'+' ') ); new TestCase( SECTION, "+( '999' + '\\n' )", 999, +( '999'+'\n' ) ); new TestCase( SECTION, "+( '999' + '\\r' )", 999, +( '999'+'\r' ) ); new TestCase( SECTION, "+( '999' + '\\t' )", 999, +( '999'+'\t' ) ); new TestCase( SECTION, "+( '999' + '\\f' )", 999, +( '999'+'\f' ) ); new TestCase( SECTION, "+( '\\n' + '999' + '\\n' )", 999, +( '\n' +'999'+'\n' ) ); new TestCase( SECTION, "+( '\\r' + '999' + '\\r' )", 999, +( '\r' +'999'+'\r' ) ); new TestCase( SECTION, "+( '\\t' + '999' + '\\t' )", 999, +( '\t' +'999'+'\t' ) ); new TestCase( SECTION, "+( '\\f' + '999' + '\\f' )", 999, +( '\f' +'999'+'\f' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' )", 99, +( String.fromCharCode(0x0009) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' )", 99, +( String.fromCharCode(0x0020) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' )", 99, +( String.fromCharCode(0x000C) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' )", 99, +( String.fromCharCode(0x000B) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' )", 99, +( String.fromCharCode(0x000D) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' )", 99, +( String.fromCharCode(0x000A) + '99' ) ); new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0009)", 99, +( '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0020)", 99, +( '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000C)", 99, +( '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000D)", 99, +( '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000B)", 99, +( '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000A)", 99, +( '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 )", 99, +( String.fromCharCode(0x0009) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 )", 99, +( String.fromCharCode(0x0020) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 )", 99, +( String.fromCharCode(0x000C) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 )", 99, +( String.fromCharCode(0x000B) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 )", 99, +( String.fromCharCode(0x000D) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 )", 99, +( String.fromCharCode(0x000A) + 99 ) ); new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0009)", 99, +( 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0020)", 99, +( 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000C)", 99, +( 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000D)", 99, +( 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000B)", 99, +( 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000A)", 99, +( 99 + String.fromCharCode(0x000A)) ); // StrNumericLiteral:::StrDecimalLiteral:::Infinity new TestCase( SECTION, "+('Infinity')", Math.pow(10,10000), +("Infinity") ); new TestCase( SECTION, "+('-Infinity')", -Math.pow(10,10000), +("-Infinity") ); new TestCase( SECTION, "+('+Infinity')", Math.pow(10,10000), +("+Infinity") ); // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt new TestCase( SECTION, "+('0')", 0, +("0") ); new TestCase( SECTION, "+('-0')", -0, +("-0") ); new TestCase( SECTION, "+('+0')", 0, +("+0") ); new TestCase( SECTION, "+('1')", 1, +("1") ); new TestCase( SECTION, "+('-1')", -1, +("-1") ); new TestCase( SECTION, "+('+1')", 1, +("+1") ); new TestCase( SECTION, "+('2')", 2, +("2") ); new TestCase( SECTION, "+('-2')", -2, +("-2") ); new TestCase( SECTION, "+('+2')", 2, +("+2") ); new TestCase( SECTION, "+('3')", 3, +("3") ); new TestCase( SECTION, "+('-3')", -3, +("-3") ); new TestCase( SECTION, "+('+3')", 3, +("+3") ); new TestCase( SECTION, "+('4')", 4, +("4") ); new TestCase( SECTION, "+('-4')", -4, +("-4") ); new TestCase( SECTION, "+('+4')", 4, +("+4") ); new TestCase( SECTION, "+('5')", 5, +("5") ); new TestCase( SECTION, "+('-5')", -5, +("-5") ); new TestCase( SECTION, "+('+5')", 5, +("+5") ); new TestCase( SECTION, "+('6')", 6, +("6") ); new TestCase( SECTION, "+('-6')", -6, +("-6") ); new TestCase( SECTION, "+('+6')", 6, +("+6") ); new TestCase( SECTION, "+('7')", 7, +("7") ); new TestCase( SECTION, "+('-7')", -7, +("-7") ); new TestCase( SECTION, "+('+7')", 7, +("+7") ); new TestCase( SECTION, "+('8')", 8, +("8") ); new TestCase( SECTION, "+('-8')", -8, +("-8") ); new TestCase( SECTION, "+('+8')", 8, +("+8") ); new TestCase( SECTION, "+('9')", 9, +("9") ); new TestCase( SECTION, "+('-9')", -9, +("-9") ); new TestCase( SECTION, "+('+9')", 9, +("+9") ); new TestCase( SECTION, "+('3.14159')", 3.14159, +("3.14159") ); new TestCase( SECTION, "+('-3.14159')", -3.14159, +("-3.14159") ); new TestCase( SECTION, "+('+3.14159')", 3.14159, +("+3.14159") ); new TestCase( SECTION, "+('3.')", 3, +("3.") ); new TestCase( SECTION, "+('-3.')", -3, +("-3.") ); new TestCase( SECTION, "+('+3.')", 3, +("+3.") ); new TestCase( SECTION, "+('3.e1')", 30, +("3.e1") ); new TestCase( SECTION, "+('-3.e1')", -30, +("-3.e1") ); new TestCase( SECTION, "+('+3.e1')", 30, +("+3.e1") ); new TestCase( SECTION, "+('3.e+1')", 30, +("3.e+1") ); new TestCase( SECTION, "+('-3.e+1')", -30, +("-3.e+1") ); new TestCase( SECTION, "+('+3.e+1')", 30, +("+3.e+1") ); new TestCase( SECTION, "+('3.e-1')", .30, +("3.e-1") ); new TestCase( SECTION, "+('-3.e-1')", -.30, +("-3.e-1") ); new TestCase( SECTION, "+('+3.e-1')", .30, +("+3.e-1") ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "+('.00001')", 0.00001, +(".00001") ); new TestCase( SECTION, "+('+.00001')", 0.00001, +("+.00001") ); new TestCase( SECTION, "+('-0.0001')", -0.00001, +("-.00001") ); new TestCase( SECTION, "+('.01e2')", 1, +(".01e2") ); new TestCase( SECTION, "+('+.01e2')", 1, +("+.01e2") ); new TestCase( SECTION, "+('-.01e2')", -1, +("-.01e2") ); new TestCase( SECTION, "+('.01e+2')", 1, +(".01e+2") ); new TestCase( SECTION, "+('+.01e+2')", 1, +("+.01e+2") ); new TestCase( SECTION, "+('-.01e+2')", -1, +("-.01e+2") ); new TestCase( SECTION, "+('.01e-2')", 0.0001, +(".01e-2") ); new TestCase( SECTION, "+('+.01e-2')", 0.0001, +("+.01e-2") ); new TestCase( SECTION, "+('-.01e-2')", -0.0001, +("-.01e-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "+('1234e5')", 123400000, +("1234e5") ); new TestCase( SECTION, "+('+1234e5')", 123400000, +("+1234e5") ); new TestCase( SECTION, "+('-1234e5')", -123400000, +("-1234e5") ); new TestCase( SECTION, "+('1234e+5')", 123400000, +("1234e+5") ); new TestCase( SECTION, "+('+1234e+5')", 123400000, +("+1234e+5") ); new TestCase( SECTION, "+('-1234e+5')", -123400000, +("-1234e+5") ); new TestCase( SECTION, "+('1234e-5')", 0.01234, +("1234e-5") ); new TestCase( SECTION, "+('+1234e-5')", 0.01234, +("+1234e-5") ); new TestCase( SECTION, "+('-1234e-5')", -0.01234, +("-1234e-5") ); // StrNumericLiteral::: HexIntegerLiteral new TestCase( SECTION, "+('0x0')", 0, +("0x0")); new TestCase( SECTION, "+('0x1')", 1, +("0x1")); new TestCase( SECTION, "+('0x2')", 2, +("0x2")); new TestCase( SECTION, "+('0x3')", 3, +("0x3")); new TestCase( SECTION, "+('0x4')", 4, +("0x4")); new TestCase( SECTION, "+('0x5')", 5, +("0x5")); new TestCase( SECTION, "+('0x6')", 6, +("0x6")); new TestCase( SECTION, "+('0x7')", 7, +("0x7")); new TestCase( SECTION, "+('0x8')", 8, +("0x8")); new TestCase( SECTION, "+('0x9')", 9, +("0x9")); new TestCase( SECTION, "+('0xa')", 10, +("0xa")); new TestCase( SECTION, "+('0xb')", 11, +("0xb")); new TestCase( SECTION, "+('0xc')", 12, +("0xc")); new TestCase( SECTION, "+('0xd')", 13, +("0xd")); new TestCase( SECTION, "+('0xe')", 14, +("0xe")); new TestCase( SECTION, "+('0xf')", 15, +("0xf")); new TestCase( SECTION, "+('0xA')", 10, +("0xA")); new TestCase( SECTION, "+('0xB')", 11, +("0xB")); new TestCase( SECTION, "+('0xC')", 12, +("0xC")); new TestCase( SECTION, "+('0xD')", 13, +("0xD")); new TestCase( SECTION, "+('0xE')", 14, +("0xE")); new TestCase( SECTION, "+('0xF')", 15, +("0xF")); new TestCase( SECTION, "+('0X0')", 0, +("0X0")); new TestCase( SECTION, "+('0X1')", 1, +("0X1")); new TestCase( SECTION, "+('0X2')", 2, +("0X2")); new TestCase( SECTION, "+('0X3')", 3, +("0X3")); new TestCase( SECTION, "+('0X4')", 4, +("0X4")); new TestCase( SECTION, "+('0X5')", 5, +("0X5")); new TestCase( SECTION, "+('0X6')", 6, +("0X6")); new TestCase( SECTION, "+('0X7')", 7, +("0X7")); new TestCase( SECTION, "+('0X8')", 8, +("0X8")); new TestCase( SECTION, "+('0X9')", 9, +("0X9")); new TestCase( SECTION, "+('0Xa')", 10, +("0Xa")); new TestCase( SECTION, "+('0Xb')", 11, +("0Xb")); new TestCase( SECTION, "+('0Xc')", 12, +("0Xc")); new TestCase( SECTION, "+('0Xd')", 13, +("0Xd")); new TestCase( SECTION, "+('0Xe')", 14, +("0Xe")); new TestCase( SECTION, "+('0Xf')", 15, +("0Xf")); new TestCase( SECTION, "+('0XA')", 10, +("0XA")); new TestCase( SECTION, "+('0XB')", 11, +("0XB")); new TestCase( SECTION, "+('0XC')", 12, +("0XC")); new TestCase( SECTION, "+('0XD')", 13, +("0XD")); new TestCase( SECTION, "+('0XE')", 14, +("0XE")); new TestCase( SECTION, "+('0XF')", 15, +("0XF")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.4.7-01.js0000644000175000017500000004444711545150464022204 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.4.7-01.js ECMA Section: 11.4.7 Unary - Operator Description: convert operand to Number type and change sign Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "11.4.7"; var VERSION = "ECMA_1"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " Unary + operator"); new TestCase( SECTION, "-('')", -0, -("") ); new TestCase( SECTION, "-(' ')", -0, -(" ") ); new TestCase( SECTION, "-(\\t)", -0, -("\t") ); new TestCase( SECTION, "-(\\n)", -0, -("\n") ); new TestCase( SECTION, "-(\\r)", -0, -("\r") ); new TestCase( SECTION, "-(\\f)", -0, -("\f") ); new TestCase( SECTION, "-(String.fromCharCode(0x0009)", -0, -(String.fromCharCode(0x0009)) ); new TestCase( SECTION, "-(String.fromCharCode(0x0020)", -0, -(String.fromCharCode(0x0020)) ); new TestCase( SECTION, "-(String.fromCharCode(0x000C)", -0, -(String.fromCharCode(0x000C)) ); new TestCase( SECTION, "-(String.fromCharCode(0x000B)", -0, -(String.fromCharCode(0x000B)) ); new TestCase( SECTION, "-(String.fromCharCode(0x000D)", -0, -(String.fromCharCode(0x000D)) ); new TestCase( SECTION, "-(String.fromCharCode(0x000A)", -0, -(String.fromCharCode(0x000A)) ); // a StringNumericLiteral may be preceeded or followed by whitespace and/or // line terminators new TestCase( SECTION, "-( ' ' + 999 )", -999, -( ' '+999) ); new TestCase( SECTION, "-( '\\n' + 999 )", -999, -( '\n' +999) ); new TestCase( SECTION, "-( '\\r' + 999 )", -999, -( '\r' +999) ); new TestCase( SECTION, "-( '\\t' + 999 )", -999, -( '\t' +999) ); new TestCase( SECTION, "-( '\\f' + 999 )", -999, -( '\f' +999) ); new TestCase( SECTION, "-( 999 + ' ' )", -999, -( 999+' ') ); new TestCase( SECTION, "-( 999 + '\\n' )", -999, -( 999+'\n' ) ); new TestCase( SECTION, "-( 999 + '\\r' )", -999, -( 999+'\r' ) ); new TestCase( SECTION, "-( 999 + '\\t' )", -999, -( 999+'\t' ) ); new TestCase( SECTION, "-( 999 + '\\f' )", -999, -( 999+'\f' ) ); new TestCase( SECTION, "-( '\\n' + 999 + '\\n' )", -999, -( '\n' +999+'\n' ) ); new TestCase( SECTION, "-( '\\r' + 999 + '\\r' )", -999, -( '\r' +999+'\r' ) ); new TestCase( SECTION, "-( '\\t' + 999 + '\\t' )", -999, -( '\t' +999+'\t' ) ); new TestCase( SECTION, "-( '\\f' + 999 + '\\f' )", -999, -( '\f' +999+'\f' ) ); new TestCase( SECTION, "-( ' ' + '999' )", -999, -( ' '+'999') ); new TestCase( SECTION, "-( '\\n' + '999' )", -999, -( '\n' +'999') ); new TestCase( SECTION, "-( '\\r' + '999' )", -999, -( '\r' +'999') ); new TestCase( SECTION, "-( '\\t' + '999' )", -999, -( '\t' +'999') ); new TestCase( SECTION, "-( '\\f' + '999' )", -999, -( '\f' +'999') ); new TestCase( SECTION, "-( '999' + ' ' )", -999, -( '999'+' ') ); new TestCase( SECTION, "-( '999' + '\\n' )", -999, -( '999'+'\n' ) ); new TestCase( SECTION, "-( '999' + '\\r' )", -999, -( '999'+'\r' ) ); new TestCase( SECTION, "-( '999' + '\\t' )", -999, -( '999'+'\t' ) ); new TestCase( SECTION, "-( '999' + '\\f' )", -999, -( '999'+'\f' ) ); new TestCase( SECTION, "-( '\\n' + '999' + '\\n' )", -999, -( '\n' +'999'+'\n' ) ); new TestCase( SECTION, "-( '\\r' + '999' + '\\r' )", -999, -( '\r' +'999'+'\r' ) ); new TestCase( SECTION, "-( '\\t' + '999' + '\\t' )", -999, -( '\t' +'999'+'\t' ) ); new TestCase( SECTION, "-( '\\f' + '999' + '\\f' )", -999, -( '\f' +'999'+'\f' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x0009) + '99' )", -99, -( String.fromCharCode(0x0009) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x0020) + '99' )", -99, -( String.fromCharCode(0x0020) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000C) + '99' )", -99, -( String.fromCharCode(0x000C) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000B) + '99' )", -99, -( String.fromCharCode(0x000B) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000D) + '99' )", -99, -( String.fromCharCode(0x000D) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000A) + '99' )", -99, -( String.fromCharCode(0x000A) + '99' ) ); new TestCase( SECTION, "-( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "-( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", -99, -( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x0009)", -99, -( '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x0020)", -99, -( '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000C)", -99, -( '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000D)", -99, -( '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000B)", -99, -( '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "-( '99' + String.fromCharCode(0x000A)", -99, -( '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "-( String.fromCharCode(0x0009) + 99 )", -99, -( String.fromCharCode(0x0009) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x0020) + 99 )", -99, -( String.fromCharCode(0x0020) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000C) + 99 )", -99, -( String.fromCharCode(0x000C) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000B) + 99 )", -99, -( String.fromCharCode(0x000B) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000D) + 99 )", -99, -( String.fromCharCode(0x000D) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x000A) + 99 )", -99, -( String.fromCharCode(0x000A) + 99 ) ); new TestCase( SECTION, "-( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "-( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "-( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", -99, -( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x0009)", -99, -( 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x0020)", -99, -( 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000C)", -99, -( 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000D)", -99, -( 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000B)", -99, -( 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "-( 99 + String.fromCharCode(0x000A)", -99, -( 99 + String.fromCharCode(0x000A)) ); // StrNumericLiteral:::StrDecimalLiteral:::Infinity new TestCase( SECTION, "-('Infinity')", -Math.pow(10,10000), -("Infinity") ); new TestCase( SECTION, "-('-Infinity')", +Math.pow(10,10000), -("-Infinity") ); new TestCase( SECTION, "-('+Infinity')", -Math.pow(10,10000), -("+Infinity") ); // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt new TestCase( SECTION, "-('0')", -0, -("0") ); new TestCase( SECTION, "-('-0')", +0, -("-0") ); new TestCase( SECTION, "-('+0')", -0, -("+0") ); new TestCase( SECTION, "-('1')", -1, -("1") ); new TestCase( SECTION, "-('-1')", +1, -("-1") ); new TestCase( SECTION, "-('+1')", -1, -("+1") ); new TestCase( SECTION, "-('2')", -2, -("2") ); new TestCase( SECTION, "-('-2')", +2, -("-2") ); new TestCase( SECTION, "-('+2')", -2, -("+2") ); new TestCase( SECTION, "-('3')", -3, -("3") ); new TestCase( SECTION, "-('-3')", +3, -("-3") ); new TestCase( SECTION, "-('+3')", -3, -("+3") ); new TestCase( SECTION, "-('4')", -4, -("4") ); new TestCase( SECTION, "-('-4')", +4, -("-4") ); new TestCase( SECTION, "-('+4')", -4, -("+4") ); new TestCase( SECTION, "-('5')", -5, -("5") ); new TestCase( SECTION, "-('-5')", +5, -("-5") ); new TestCase( SECTION, "-('+5')", -5, -("+5") ); new TestCase( SECTION, "-('6')", -6, -("6") ); new TestCase( SECTION, "-('-6')", +6, -("-6") ); new TestCase( SECTION, "-('+6')", -6, -("+6") ); new TestCase( SECTION, "-('7')", -7, -("7") ); new TestCase( SECTION, "-('-7')", +7, -("-7") ); new TestCase( SECTION, "-('+7')", -7, -("+7") ); new TestCase( SECTION, "-('8')", -8, -("8") ); new TestCase( SECTION, "-('-8')", +8, -("-8") ); new TestCase( SECTION, "-('+8')", -8, -("+8") ); new TestCase( SECTION, "-('9')", -9, -("9") ); new TestCase( SECTION, "-('-9')", +9, -("-9") ); new TestCase( SECTION, "-('+9')", -9, -("+9") ); new TestCase( SECTION, "-('3.14159')", -3.14159, -("3.14159") ); new TestCase( SECTION, "-('-3.14159')", +3.14159, -("-3.14159") ); new TestCase( SECTION, "-('+3.14159')", -3.14159, -("+3.14159") ); new TestCase( SECTION, "-('3.')", -3, -("3.") ); new TestCase( SECTION, "-('-3.')", +3, -("-3.") ); new TestCase( SECTION, "-('+3.')", -3, -("+3.") ); new TestCase( SECTION, "-('3.e1')", -30, -("3.e1") ); new TestCase( SECTION, "-('-3.e1')", +30, -("-3.e1") ); new TestCase( SECTION, "-('+3.e1')", -30, -("+3.e1") ); new TestCase( SECTION, "-('3.e+1')", -30, -("3.e+1") ); new TestCase( SECTION, "-('-3.e+1')", +30, -("-3.e+1") ); new TestCase( SECTION, "-('+3.e+1')", -30, -("+3.e+1") ); new TestCase( SECTION, "-('3.e-1')", -.30, -("3.e-1") ); new TestCase( SECTION, "-('-3.e-1')", +.30, -("-3.e-1") ); new TestCase( SECTION, "-('+3.e-1')", -.30, -("+3.e-1") ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "-('.00001')", -0.00001, -(".00001") ); new TestCase( SECTION, "-('+.00001')", -0.00001, -("+.00001") ); new TestCase( SECTION, "-('-0.0001')", +0.00001, -("-.00001") ); new TestCase( SECTION, "-('.01e2')", -1, -(".01e2") ); new TestCase( SECTION, "-('+.01e2')", -1, -("+.01e2") ); new TestCase( SECTION, "-('-.01e2')", +1, -("-.01e2") ); new TestCase( SECTION, "-('.01e+2')", -1, -(".01e+2") ); new TestCase( SECTION, "-('+.01e+2')", -1, -("+.01e+2") ); new TestCase( SECTION, "-('-.01e+2')", +1, -("-.01e+2") ); new TestCase( SECTION, "-('.01e-2')", -0.0001, -(".01e-2") ); new TestCase( SECTION, "-('+.01e-2')", -0.0001, -("+.01e-2") ); new TestCase( SECTION, "-('-.01e-2')", +0.0001, -("-.01e-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "-('1234e5')", -123400000, -("1234e5") ); new TestCase( SECTION, "-('+1234e5')", -123400000, -("+1234e5") ); new TestCase( SECTION, "-('-1234e5')", +123400000, -("-1234e5") ); new TestCase( SECTION, "-('1234e+5')", -123400000, -("1234e+5") ); new TestCase( SECTION, "-('+1234e+5')", -123400000, -("+1234e+5") ); new TestCase( SECTION, "-('-1234e+5')", +123400000, -("-1234e+5") ); new TestCase( SECTION, "-('1234e-5')", -0.01234, -("1234e-5") ); new TestCase( SECTION, "-('+1234e-5')", -0.01234, -("+1234e-5") ); new TestCase( SECTION, "-('-1234e-5')", +0.01234, -("-1234e-5") ); // StrNumericLiteral::: HexIntegerLiteral new TestCase( SECTION, "-('0x0')", -0, -("0x0")); new TestCase( SECTION, "-('0x1')", -1, -("0x1")); new TestCase( SECTION, "-('0x2')", -2, -("0x2")); new TestCase( SECTION, "-('0x3')", -3, -("0x3")); new TestCase( SECTION, "-('0x4')", -4, -("0x4")); new TestCase( SECTION, "-('0x5')", -5, -("0x5")); new TestCase( SECTION, "-('0x6')", -6, -("0x6")); new TestCase( SECTION, "-('0x7')", -7, -("0x7")); new TestCase( SECTION, "-('0x8')", -8, -("0x8")); new TestCase( SECTION, "-('0x9')", -9, -("0x9")); new TestCase( SECTION, "-('0xa')", -10, -("0xa")); new TestCase( SECTION, "-('0xb')", -11, -("0xb")); new TestCase( SECTION, "-('0xc')", -12, -("0xc")); new TestCase( SECTION, "-('0xd')", -13, -("0xd")); new TestCase( SECTION, "-('0xe')", -14, -("0xe")); new TestCase( SECTION, "-('0xf')", -15, -("0xf")); new TestCase( SECTION, "-('0xA')", -10, -("0xA")); new TestCase( SECTION, "-('0xB')", -11, -("0xB")); new TestCase( SECTION, "-('0xC')", -12, -("0xC")); new TestCase( SECTION, "-('0xD')", -13, -("0xD")); new TestCase( SECTION, "-('0xE')", -14, -("0xE")); new TestCase( SECTION, "-('0xF')", -15, -("0xF")); new TestCase( SECTION, "-('0X0')", -0, -("0X0")); new TestCase( SECTION, "-('0X1')", -1, -("0X1")); new TestCase( SECTION, "-('0X2')", -2, -("0X2")); new TestCase( SECTION, "-('0X3')", -3, -("0X3")); new TestCase( SECTION, "-('0X4')", -4, -("0X4")); new TestCase( SECTION, "-('0X5')", -5, -("0X5")); new TestCase( SECTION, "-('0X6')", -6, -("0X6")); new TestCase( SECTION, "-('0X7')", -7, -("0X7")); new TestCase( SECTION, "-('0X8')", -8, -("0X8")); new TestCase( SECTION, "-('0X9')", -9, -("0X9")); new TestCase( SECTION, "-('0Xa')", -10, -("0Xa")); new TestCase( SECTION, "-('0Xb')", -11, -("0Xb")); new TestCase( SECTION, "-('0Xc')", -12, -("0Xc")); new TestCase( SECTION, "-('0Xd')", -13, -("0Xd")); new TestCase( SECTION, "-('0Xe')", -14, -("0Xe")); new TestCase( SECTION, "-('0Xf')", -15, -("0Xf")); new TestCase( SECTION, "-('0XA')", -10, -("0XA")); new TestCase( SECTION, "-('0XB')", -11, -("0XB")); new TestCase( SECTION, "-('0XC')", -12, -("0XC")); new TestCase( SECTION, "-('0XD')", -13, -("0XD")); new TestCase( SECTION, "-('0XE')", -14, -("0XE")); new TestCase( SECTION, "-('0XF')", -15, -("0XF")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.4.7-02.js0000644000175000017500000000566511545150464022204 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: 11.4.7-02.js * Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=432881 * Description: ecma 11.4.7 */ var SECTION = "11.4.7"; var VERSION = "ECMA"; var TITLE = "Unary - Operator"; var BUGNUMBER = "432881"; startTest(); test_negation(0, -0.0); test_negation(-0.0, 0); test_negation(1, -1); test_negation(1.0/0.0, -1.0/0.0); test_negation(-1.0/0.0, 1.0/0.0); //1073741824 == (1 << 30) test_negation(1073741824, -1073741824); test_negation(-1073741824, 1073741824); //1073741824 == (1 << 30) - 1 test_negation(1073741823, -1073741823); test_negation(-1073741823, 1073741823); //1073741824 == (1 << 30) test_negation(1073741824, -1073741824); test_negation(-1073741824, 1073741824); //1073741824 == (1 << 30) - 1 test_negation(1073741823, -1073741823); test_negation(-1073741823, 1073741823); //2147483648 == (1 << 31) test_negation(2147483648, -2147483648); test_negation(-2147483648, 2147483648); //2147483648 == (1 << 31) - 1 test_negation(2147483647, -2147483647); test_negation(-2147483647, 2147483647); function test_negation(value, expected) { var actual = -value; reportCompare(expected, actual, '-(' + value + ') == ' + expected); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.4.8.js0000644000175000017500000001207311545150464021755 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.4.8.js ECMA Section: 11.4.8 Bitwise NOT Operator Description: flip bits up to 32 bits no special cases Author: christine@netscape.com Date: 7 july 1997 Data File Fields: VALUE value passed as an argument to the ~ operator E_RESULT expected return value of ~ VALUE; Static variables: none */ var SECTION = "11.4.8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Bitwise Not operator"); for ( var i = 0; i < 35; i++ ) { var p = Math.pow(2,i); new TestCase( SECTION, "~"+p, Not(p), ~p ); } for ( i = 0; i < 35; i++ ) { var p = -Math.pow(2,i); new TestCase( SECTION, "~"+p, Not(p), ~p ); } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( var p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( var p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( var l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function Not( n ) { n = ToInt32(n); n = ToInt32BitString(n); var r = ""; for( var l = 0; l < n.length; l++ ) { r += ( n.charAt(l) == "0" ) ? "1" : "0"; } n = ToInt32Decimal(r); return n; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.4.9.js0000644000175000017500000001065611545150464021763 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.4.9.js ECMA Section: 11.4.9 Logical NOT Operator (!) Description: if the ToBoolean( VALUE ) result is true, return true. else return false. Author: christine@netscape.com Date: 7 july 1997 Static variables: none */ var SECTION = "11.4.9"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Logical NOT operator (!)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "!(null)", true, !(null) ); new TestCase( SECTION, "!(var x)", true, !(eval("var x")) ); new TestCase( SECTION, "!(void 0)", true, !(void 0) ); new TestCase( SECTION, "!(false)", true, !(false) ); new TestCase( SECTION, "!(true)", false, !(true) ); new TestCase( SECTION, "!()", true, !(eval()) ); new TestCase( SECTION, "!(0)", true, !(0) ); new TestCase( SECTION, "!(-0)", true, !(-0) ); new TestCase( SECTION, "!(NaN)", true, !(Number.NaN) ); new TestCase( SECTION, "!(Infinity)", false, !(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "!(-Infinity)", false, !(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "!(Math.PI)", false, !(Math.PI) ); new TestCase( SECTION, "!(1)", false, !(1) ); new TestCase( SECTION, "!(-1)", false, !(-1) ); new TestCase( SECTION, "!('')", true, !("") ); new TestCase( SECTION, "!('\t')", false, !("\t") ); new TestCase( SECTION, "!('0')", false, !("0") ); new TestCase( SECTION, "!('string')", false, !("string") ); new TestCase( SECTION, "!(new String(''))", false, !(new String("")) ); new TestCase( SECTION, "!(new String('string'))", false, !(new String("string")) ); new TestCase( SECTION, "!(new String())", false, !(new String()) ); new TestCase( SECTION, "!(new Boolean(true))", false, !(new Boolean(true)) ); new TestCase( SECTION, "!(new Boolean(false))", false, !(new Boolean(false)) ); new TestCase( SECTION, "!(new Array())", false, !(new Array()) ); new TestCase( SECTION, "!(new Array(1,2,3)", false, !(new Array(1,2,3)) ); new TestCase( SECTION, "!(new Number())", false, !(new Number()) ); new TestCase( SECTION, "!(new Number(0))", false, !(new Number(0)) ); new TestCase( SECTION, "!(new Number(NaN))", false, !(new Number(Number.NaN)) ); new TestCase( SECTION, "!(new Number(Infinity))", false, !(new Number(Number.POSITIVE_INFINITY)) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.5.1.js0000644000175000017500000001517311545150464021753 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.5.1.js ECMA Section: 11.5.1 Applying the * operator Description: 11.5.1 Applying the * operator The * operator performs multiplication, producing the product of its operands. Multiplication is commutative. Multiplication is not always associative in ECMAScript, because of finite precision. The result of a floating-point multiplication is governed by the rules of IEEE 754 double-precision arithmetic: If either operand is NaN, the result is NaN. The sign of the result is positive if both operands have the same sign, negative if the operands have different signs. Multiplication of an infinity by a zero results in NaN. Multiplication of an infinity by an infinity results in an infinity. The sign is determined by the rule already stated above. Multiplication of an infinity by a finite non-zero value results in a signed infinity. The sign is determined by the rule already stated above. In the remaining cases, where neither an infinity or NaN is involved, the product is computed and rounded to the nearest representable value using IEEE 754 round-to-nearest mode. If the magnitude is too large to represent, the result is then an infinity of appropriate sign. If the magnitude is oo small to represent, the result is then a zero of appropriate sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.5.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Applying the * operator"); new TestCase( SECTION, "Number.NaN * Number.NaN", Number.NaN, Number.NaN * Number.NaN ); new TestCase( SECTION, "Number.NaN * 1", Number.NaN, Number.NaN * 1 ); new TestCase( SECTION, "1 * Number.NaN", Number.NaN, 1 * Number.NaN ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * 0", Number.NaN, Number.POSITIVE_INFINITY * 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 0", Number.NaN, Number.NEGATIVE_INFINITY * 0 ); new TestCase( SECTION, "0 * Number.POSITIVE_INFINITY", Number.NaN, 0 * Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 * Number.NEGATIVE_INFINITY", Number.NaN, 0 * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-0 * Number.POSITIVE_INFINITY", Number.NaN, -0 * Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-0 * Number.NEGATIVE_INFINITY", Number.NaN, -0 * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * -0", Number.NaN, Number.POSITIVE_INFINITY * -0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -0", Number.NaN, Number.NEGATIVE_INFINITY * -0 ); new TestCase( SECTION, "0 * -0", -0, 0 * -0 ); new TestCase( SECTION, "-0 * 0", -0, -0 * 0 ); new TestCase( SECTION, "-0 * -0", 0, -0 * -0 ); new TestCase( SECTION, "0 * 0", 0, 0 * 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * 1 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * -1 ); new TestCase( SECTION, "1 * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, 1 * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-1 * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, -1 * Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * 1 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY * -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * -1 ); new TestCase( SECTION, "1 * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, 1 * Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-1 * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, -1 * Number.POSITIVE_INFINITY ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.5.2.js0000644000175000017500000002307111545150464021750 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.5.2.js ECMA Section: 11.5.2 Applying the / operator Description: The / operator performs division, producing the quotient of its operands. The left operand is the dividend and the right operand is the divisor. ECMAScript does not perform integer division. The operands and result of all division operations are double-precision floating-point numbers. The result of division is determined by the specification of IEEE 754 arithmetic: If either operand is NaN, the result is NaN. The sign of the result is positive if both operands have the same sign, negative if the operands have different signs. Division of an infinity by an infinity results in NaN. Division of an infinity by a zero results in an infinity. The sign is determined by the rule already stated above. Division of an infinity by a non-zero finite value results in a signed infinity. The sign is determined by the rule already stated above. Division of a finite value by an infinity results in zero. The sign is determined by the rule already stated above. Division of a zero by a zero results in NaN; division of zero by any other finite value results in zero, with the sign determined by the rule already stated above. Division of a non-zero finite value by a zero results in a signed infinity. The sign is determined by the rule already stated above. In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the quotient is computed and rounded to the nearest representable value using IEEE 754 round-to-nearest mode. If the magnitude is too large to represent, we say the operation overflows; the result is then an infinity of appropriate sign. If the magnitude is too small to represent, we say the operation underflows and the result is a zero of the appropriate sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.5.2"; var VERSION = "ECMA_1"; var BUGNUMBER="111202"; startTest(); writeHeaderToLog( SECTION + " Applying the / operator"); // if either operand is NaN, the result is NaN. new TestCase( SECTION, "Number.NaN / Number.NaN", Number.NaN, Number.NaN / Number.NaN ); new TestCase( SECTION, "Number.NaN / 1", Number.NaN, Number.NaN / 1 ); new TestCase( SECTION, "1 / Number.NaN", Number.NaN, 1 / Number.NaN ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NaN", Number.NaN, Number.POSITIVE_INFINITY / Number.NaN ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY / Number.NaN ); // Division of an infinity by an infinity results in NaN. new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY ); // Division of an infinity by a zero results in an infinity. new TestCase( SECTION, "Number.POSITIVE_INFINITY / 0", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 0", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 0 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / -0", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -0", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -0 ); // Division of an infinity by a non-zero finite value results in a signed infinity. new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 1 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -1 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 1 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -1 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / Number.MAX_VALUE ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -Number.MAX_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / Number.MAX_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY / -Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -Number.MAX_VALUE ); // Division of a finite value by an infinity results in zero. new TestCase( SECTION, "1 / Number.NEGATIVE_INFINITY", -0, 1 / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "1 / Number.POSITIVE_INFINITY", 0, 1 / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-1 / Number.POSITIVE_INFINITY", -0, -1 / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-1 / Number.NEGATIVE_INFINITY", 0, -1 / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE / Number.NEGATIVE_INFINITY", -0, Number.MAX_VALUE / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE / Number.POSITIVE_INFINITY", 0, Number.MAX_VALUE / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-Number.MAX_VALUE / Number.POSITIVE_INFINITY", -0, -Number.MAX_VALUE / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-Number.MAX_VALUE / Number.NEGATIVE_INFINITY", 0, -Number.MAX_VALUE / Number.NEGATIVE_INFINITY ); // Division of a zero by a zero results in NaN new TestCase( SECTION, "0 / -0", Number.NaN, 0 / -0 ); new TestCase( SECTION, "-0 / 0", Number.NaN, -0 / 0 ); new TestCase( SECTION, "-0 / -0", Number.NaN, -0 / -0 ); new TestCase( SECTION, "0 / 0", Number.NaN, 0 / 0 ); // division of zero by any other finite value results in zero new TestCase( SECTION, "0 / 1", 0, 0 / 1 ); new TestCase( SECTION, "0 / -1", -0, 0 / -1 ); new TestCase( SECTION, "-0 / 1", -0, -0 / 1 ); new TestCase( SECTION, "-0 / -1", 0, -0 / -1 ); // Division of a non-zero finite value by a zero results in a signed infinity. new TestCase( SECTION, "1 / 0", Number.POSITIVE_INFINITY, 1/0 ); new TestCase( SECTION, "1 / -0", Number.NEGATIVE_INFINITY, 1/-0 ); new TestCase( SECTION, "-1 / 0", Number.NEGATIVE_INFINITY, -1/0 ); new TestCase( SECTION, "-1 / -0", Number.POSITIVE_INFINITY, -1/-0 ); new TestCase( SECTION, "0 / Number.POSITIVE_INFINITY", 0, 0 / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 / Number.NEGATIVE_INFINITY", -0, 0 / Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-0 / Number.POSITIVE_INFINITY", -0, -0 / Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-0 / Number.NEGATIVE_INFINITY", 0, -0 / Number.NEGATIVE_INFINITY ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.5.3.js0000644000175000017500000002374011545150464021754 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.5.3.js ECMA Section: 11.5.3 Applying the % operator Description: The binary % operator is said to yield the remainder of its operands from an implied division; the left operand is the dividend and the right operand is the divisor. In C and C++, the remainder operator accepts only integral operands, but in ECMAScript, it also accepts floating-point operands. The result of a floating-point remainder operation as computed by the % operator is not the same as the "remainder" operation defined by IEEE 754. The IEEE 754 "remainder" operation computes the remainder from a rounding division, not a truncating division, and so its behavior is not analogous to that of the usual integer remainder operator. Instead the ECMAScript language defines % on floating-point operations to behave in a manner analogous to that of the Java integer remainder operator; this may be compared with the C library function fmod. The result of a ECMAScript floating-point remainder operation is determined by the rules of IEEE arithmetic: If either operand is NaN, the result is NaN. The sign of the result equals the sign of the dividend. If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN. If the dividend is finite and the divisor is an infinity, the result equals the dividend. If the dividend is a zero and the divisor is finite, the result is the same as the dividend. In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r from a dividend n and a divisor d is defined by the mathematical relation r = n (d * q) where q is an integer that is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as possible without exceeding the magnitude of the true mathematical quotient of n and d. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.5.3"; var VERSION = "ECMA_1"; var BUGNUMBER="111202"; startTest(); writeHeaderToLog( SECTION + " Applying the % operator"); // if either operand is NaN, the result is NaN. new TestCase( SECTION, "Number.NaN % Number.NaN", Number.NaN, Number.NaN % Number.NaN ); new TestCase( SECTION, "Number.NaN % 1", Number.NaN, Number.NaN % 1 ); new TestCase( SECTION, "1 % Number.NaN", Number.NaN, 1 % Number.NaN ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NaN", Number.NaN, Number.POSITIVE_INFINITY % Number.NaN ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY % Number.NaN ); // If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN. // dividend is an infinity new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % 0", Number.NaN, Number.POSITIVE_INFINITY % 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 0", Number.NaN, Number.NEGATIVE_INFINITY % 0 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % -0", Number.NaN, Number.POSITIVE_INFINITY % -0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -0", Number.NaN, Number.NEGATIVE_INFINITY % -0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 1 ", Number.NaN, Number.NEGATIVE_INFINITY % 1 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -1 ", Number.NaN, Number.NEGATIVE_INFINITY % -1 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % 1 ", Number.NaN, Number.POSITIVE_INFINITY % 1 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % -1 ", Number.NaN, Number.POSITIVE_INFINITY % -1 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % Number.MAX_VALUE ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % -Number.MAX_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % Number.MAX_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % -Number.MAX_VALUE ); // divisor is 0 new TestCase( SECTION, "0 % -0", Number.NaN, 0 % -0 ); new TestCase( SECTION, "-0 % 0", Number.NaN, -0 % 0 ); new TestCase( SECTION, "-0 % -0", Number.NaN, -0 % -0 ); new TestCase( SECTION, "0 % 0", Number.NaN, 0 % 0 ); new TestCase( SECTION, "1 % 0", Number.NaN, 1%0 ); new TestCase( SECTION, "1 % -0", Number.NaN, 1%-0 ); new TestCase( SECTION, "-1 % 0", Number.NaN, -1%0 ); new TestCase( SECTION, "-1 % -0", Number.NaN, -1%-0 ); new TestCase( SECTION, "Number.MAX_VALUE % 0", Number.NaN, Number.MAX_VALUE%0 ); new TestCase( SECTION, "Number.MAX_VALUE % -0", Number.NaN, Number.MAX_VALUE%-0 ); new TestCase( SECTION, "-Number.MAX_VALUE % 0", Number.NaN, -Number.MAX_VALUE%0 ); new TestCase( SECTION, "-Number.MAX_VALUE % -0", Number.NaN, -Number.MAX_VALUE%-0 ); // If the dividend is finite and the divisor is an infinity, the result equals the dividend. new TestCase( SECTION, "1 % Number.NEGATIVE_INFINITY", 1, 1 % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "1 % Number.POSITIVE_INFINITY", 1, 1 % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-1 % Number.POSITIVE_INFINITY", -1, -1 % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-1 % Number.NEGATIVE_INFINITY", -1, -1 % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE % Number.NEGATIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE % Number.POSITIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-Number.MAX_VALUE % Number.POSITIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-Number.MAX_VALUE % Number.NEGATIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "0 % Number.POSITIVE_INFINITY", 0, 0 % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 % Number.NEGATIVE_INFINITY", 0, 0 % Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-0 % Number.POSITIVE_INFINITY", -0, -0 % Number.POSITIVE_INFINITY ); new TestCase( SECTION, "-0 % Number.NEGATIVE_INFINITY", -0, -0 % Number.NEGATIVE_INFINITY ); // If the dividend is a zero and the divisor is finite, the result is the same as the dividend. new TestCase( SECTION, "0 % 1", 0, 0 % 1 ); new TestCase( SECTION, "0 % -1", -0, 0 % -1 ); new TestCase( SECTION, "-0 % 1", -0, -0 % 1 ); new TestCase( SECTION, "-0 % -1", 0, -0 % -1 ); // In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r // from a dividend n and a divisor d is defined by the mathematical relation r = n (d * q) where q is an integer that // is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as // possible without exceeding the magnitude of the true mathematical quotient of n and d. test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.6.1-1.js0000644000175000017500000001456511545150464022116 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.6.1-1.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does not cover cases where the Additive or Mulplicative expression ToPrimitive is string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is // a boolean primitive and a boolean object. new TestCase( SECTION, "var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2", 1, eval("var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2", 1, eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2", 1, eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2", 1, eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2", 1, eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2", "[object Object][object Object]", eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") ); // tests for number primitive, number object, Object object, a "MyObject" whose value is // a number primitive and a number object. new TestCase( SECTION, "var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2", 99, eval("var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2", 99, eval("var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2", 99, eval("var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2", 99, eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2", 99, eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2", "[object Object][object Object]", eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") ); test(); function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.6.1-2.js0000644000175000017500000001641411545150464022112 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.6.1-2.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does only covers cases where the Additive or Mulplicative expression ToPrimitive is a string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is // a boolean primitive and a boolean object. new TestCase( SECTION, "var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2", "stringfalse", eval("var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2", "truestring", eval("var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2", "truestring", eval("var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2", "truestring", eval("var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2", "stringfalse", eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2", "truestring", eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2", "[object Object][object Object]", eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") ); // tests for number primitive, number object, Object object, a "MyObject" whose value is // a number primitive and a number object. new TestCase( SECTION, "var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2", "100string", eval("var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2", "string-1", eval("var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2", "100string", eval("var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2", "string-1", eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2", "100string", eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2", "[object Object][object Object]", eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") ); test(); function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.6.1-3.js0000644000175000017500000001266111545150464022113 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.6.1-3.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does only covers cases where the Additive or Mulplicative expression is a Date. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is // a boolean primitive and a boolean object. var DATE1 = new Date(); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + DATE1", DATE1.toString() + DATE1.toString(), DATE1 + DATE1 ); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + 0", DATE1.toString() + 0, DATE1 + 0 ); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + new Number(0)", DATE1.toString() + 0, DATE1 + new Number(0) ); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + true", DATE1.toString() + "true", DATE1 + true ); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + new Boolean(true)", DATE1.toString() + "true", DATE1 + new Boolean(true) ); new TestCase( SECTION, "var DATE1 = new Date(); DATE1 + new Boolean(true)", DATE1.toString() + "true", DATE1 + new Boolean(true) ); var MYOB1 = new MyObject( DATE1 ); new TestCase( SECTION, "MYOB1 = new MyObject(DATE1); MYOB1 + new Number(1)", "[object Object]1", MYOB1 + new Number(1) ); new TestCase( SECTION, "MYOB1 = new MyObject(DATE1); MYOB1 + 1", "[object Object]1", MYOB1 + 1 ); new TestCase( SECTION, "MYOB1 = new MyObject(DATE1); MYOB1 + true", "[object Object]true", MYOB1 + true ); test(); function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.6.2-1.js0000644000175000017500000001624211545150464022111 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.6.2-1.js ECMA Section: 11.6.2 The Subtraction operator ( - ) Description: The production AdditiveExpression : AdditiveExpression - MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToNumber(Result(2)). 6. Call ToNumber(Result(4)). 7. Apply the subtraction operation to Result(5) and Result(6). See the discussion below (11.6.3). 8. Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.2-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The subtraction operator ( - )"); // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is // a boolean primitive and a boolean object. new TestCase( SECTION, "var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2", 1, eval("var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2", 1, eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2", 1, eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2", 1, eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2", 1, eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2", Number.NaN, eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2", Number.NaN, eval("var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2") ); // tests for number primitive, number object, Object object, a "MyObject" whose value is // a number primitive and a number object. new TestCase( SECTION, "var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2", 99, eval("var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2", 99, eval("var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2", 99, eval("var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2", 99, eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2", 99, eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2", Number.NaN, eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2", 99, eval("var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2") ); // same thing with string! new TestCase( SECTION, "var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1'); EXP_1 - EXP_2", 254, eval("var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1')); EXP_1 - EXP_2") ); test(); function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } function MyOtherObject( value ) { this.valueOf = new Function( "return this.value" ); this.toString = new Function ( "return this.value + ''" ); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.6.3.js0000644000175000017500000001356011545150464021754 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.6.3.js ECMA Section: 11.6.3 Applying the additive operators (+, -) to numbers Description: The + operator performs addition when applied to two operands of numeric type, producing the sum of the operands. The - operator performs subtraction, producing the difference of two numeric operands. Addition is a commutative operation, but not always associative. The result of an addition is determined using the rules of IEEE 754 double-precision arithmetic: If either operand is NaN, the result is NaN. The sum of two infinities of opposite sign is NaN. The sum of two infinities of the same sign is the infinity of that sign. The sum of an infinity and a finite value is equal to the infinite operand. The sum of two negative zeros is 0. The sum of two positive zeros, or of two zeros of opposite sign, is +0. The sum of a zero and a nonzero finite value is equal to the nonzero operand. The sum of two nonzero finite values of the same magnitude and opposite sign is +0. In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, and the operands have the same sign or have different magnitudes, the sum is computed and rounded to the nearest representable value using IEEE 754 round-to-nearest mode. If the magnitude is too large to represent, the operation overflows and the result is then an infinity of appropriate sign. The ECMAScript language requires support of gradual underflow as defined by IEEE 754. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Applying the additive operators (+,-) to numbers"); new TestCase( SECTION, "Number.NaN + 1", Number.NaN, Number.NaN + 1 ); new TestCase( SECTION, "1 + Number.NaN", Number.NaN, 1 + Number.NaN ); new TestCase( SECTION, "Number.NaN - 1", Number.NaN, Number.NaN - 1 ); new TestCase( SECTION, "1 - Number.NaN", Number.NaN, 1 - Number.NaN ); new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY); new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY); new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY); new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY); new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY); new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY); new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY); new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY); new TestCase( SECTION, "-0 + -0", -0, -0 + -0 ); new TestCase( SECTION, "-0 - 0", -0, -0 - 0 ); new TestCase( SECTION, "0 + 0", 0, 0 + 0 ); new TestCase( SECTION, "0 + -0", 0, 0 + -0 ); new TestCase( SECTION, "0 - -0", 0, 0 - -0 ); new TestCase( SECTION, "0 - 0", 0, 0 - 0 ); new TestCase( SECTION, "-0 - -0", 0, -0 - -0 ); new TestCase( SECTION, "-0 + 0", 0, -0 + 0 ); new TestCase( SECTION, "Number.MAX_VALUE - Number.MAX_VALUE", 0, Number.MAX_VALUE - Number.MAX_VALUE ); new TestCase( SECTION, "1/Number.MAX_VALUE - 1/Number.MAX_VALUE", 0, 1/Number.MAX_VALUE - 1/Number.MAX_VALUE ); new TestCase( SECTION, "Number.MIN_VALUE - Number.MIN_VALUE", 0, Number.MIN_VALUE - Number.MIN_VALUE ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.7.1.js0000644000175000017500000001320211545150464021744 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.7.1.js ECMA Section: 11.7.1 The Left Shift Operator ( << ) Description: Performs a bitwise left shift operation on the left argument by the amount specified by the right argument. The production ShiftExpression : ShiftExpression << AdditiveExpression is evaluated as follows: 1. Evaluate ShiftExpression. 2. Call GetValue(Result(1)). 3. Evaluate AdditiveExpression. 4. Call GetValue(Result(3)). 5. Call ToInt32(Result(2)). 6. Call ToUint32(Result(4)). 7. Mask out all but the least significant 5 bits of Result(6), that is, compute Result(6) & 0x1F. 8. Left shift Result(5) by Result(7) bits. The result is a signed 32 bit integer. 9. Return Result(8). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.7.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The left shift operator ( << )"); for ( power = 0; power < 33; power++ ) { shiftexp = Math.pow( 2, power ); for ( addexp = 0; addexp < 33; addexp++ ) { new TestCase( SECTION, shiftexp + " << " + addexp, LeftShift( shiftexp, addexp ), shiftexp << addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function LeftShift( s, a ) { var shift = ToInt32( s ); var add = ToUint32( a ); add = Mask( add, 5 ); var exp = LShift( shift, add ); return ( exp ); } function LShift( s, a ) { s = ToInt32BitString( s ); for ( var z = 0; z < a; z++ ) { s += "0"; } s = s.substring( a, s.length); return ToInt32(ToInt32Decimal(s)); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.7.2.js0000644000175000017500000001414411545150464021753 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.7.2.js ECMA Section: 11.7.2 The signed right shift operator ( >> ) Description: Performs a sign-filling bitwise right shift operation on the left argument by the amount specified by the right argument. The production ShiftExpression : ShiftExpression >> AdditiveExpression is evaluated as follows: 1. Evaluate ShiftExpression. 2. Call GetValue(Result(1)). 3. Evaluate AdditiveExpression. 4. Call GetValue(Result(3)). 5. Call ToInt32(Result(2)). 6. Call ToUint32(Result(4)). 7. Mask out all but the least significant 5 bits of Result(6), that is, compute Result(6) & 0x1F. 8. Perform sign-extending right shift of Result(5) by Result(7) bits. The most significant bit is propagated. The result is a signed 32 bit integer. 9. Return Result(8). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.7.2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The signed right shift operator ( >> )"); var power = 0; var addexp = 0; for ( power = 0; power <= 32; power++ ) { shiftexp = Math.pow( 2, power ); for ( addexp = 0; addexp <= 32; addexp++ ) { new TestCase( SECTION, shiftexp + " >> " + addexp, SignedRightShift( shiftexp, addexp ), shiftexp >> addexp ); } } for ( power = 0; power <= 32; power++ ) { shiftexp = -Math.pow( 2, power ); for ( addexp = 0; addexp <= 32; addexp++ ) { new TestCase( SECTION, shiftexp + " >> " + addexp, SignedRightShift( shiftexp, addexp ), shiftexp >> addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function SignedRightShift( s, a ) { s = ToInt32( s ); a = ToUint32( a ); a = Mask( a, 5 ); return ( SignedRShift( s, a ) ); } function SignedRShift( s, a ) { s = ToInt32BitString( s ); var firstbit = s.substring(0,1); s = s.substring( 1, s.length ); for ( var z = 0; z < a; z++ ) { s = firstbit + s; } s = s.substring( 0, s.length - a); s = firstbit +s; return ToInt32(ToInt32Decimal(s)); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.7.3.js0000644000175000017500000001352311545150464021754 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.7.3.js ECMA Section: 11.7.3 The unsigned right shift operator ( >>> ) Description: 11.7.3 The unsigned right shift operator ( >>> ) Performs a zero-filling bitwise right shift operation on the left argument by the amount specified by the right argument. The production ShiftExpression : ShiftExpression >>> AdditiveExpression is evaluated as follows: 1. Evaluate ShiftExpression. 2. Call GetValue(Result(1)). 3. Evaluate AdditiveExpression. 4. Call GetValue(Result(3)). 5. Call ToUint32(Result(2)). 6. Call ToUint32(Result(4)). 7. Mask out all but the least significant 5 bits of Result(6), that is, compute Result(6) & 0x1F. 8. Perform zero-filling right shift of Result(5) by Result(7) bits. Vacated bits are filled with zero. The result is an unsigned 32 bit integer. 9. Return Result(8). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.7.3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The unsigned right shift operator ( >>> )"); var addexp = 0; var power = 0; for ( power = 0; power <= 32; power++ ) { shiftexp = Math.pow( 2, power ); for ( addexp = 0; addexp <= 32; addexp++ ) { new TestCase( SECTION, shiftexp + " >>> " + addexp, UnsignedRightShift( shiftexp, addexp ), shiftexp >>> addexp ); } } test(); function ToInteger( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( n != n ) { return 0; } if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) { return n; } return ( sign * Math.floor(Math.abs(n)) ); } function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; return ( n ); } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } function ToUint16( n ) { var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16); if (n <0) { n += Math.pow(2,16); } return ( n ); } function Mask( b, n ) { b = ToUint32BitString( b ); b = b.substring( b.length - n ); b = ToUint32Decimal( b ); return ( b ); } function ToUint32BitString( n ) { var b = ""; for ( p = 31; p >=0; p-- ) { if ( n >= Math.pow(2,p) ) { b += "1"; n -= Math.pow(2,p); } else { b += "0"; } } return b; } function ToInt32BitString( n ) { var b = ""; var sign = ( n < 0 ) ? -1 : 1; b += ( sign == 1 ) ? "0" : "1"; for ( p = 30; p >=0; p-- ) { if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) { b += ( sign == 1 ) ? "1" : "0"; n -= sign * Math.pow( 2, p ); } else { b += ( sign == 1 ) ? "0" : "1"; } } return b; } function ToInt32Decimal( bin ) { var r = 0; var sign; if ( Number(bin.charAt(0)) == 0 ) { sign = 1; r = 0; } else { sign = -1; r = -(Math.pow(2,31)); } for ( var j = 0; j < 31; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function ToUint32Decimal( bin ) { var r = 0; for ( l = bin.length; l < 32; l++ ) { bin = "0" + bin; } for ( j = 0; j < 32; j++ ) { r += Math.pow( 2, j ) * Number(bin.charAt(31-j)); } return r; } function RShift( s, a ) { s = ToUint32BitString( s ); for ( z = 0; z < a; z++ ) { s = "0" + s; } s = s.substring( 0, s.length - a ); return ToUint32Decimal(s); } function UnsignedRightShift( s, a ) { s = ToUint32( s ); a = ToUint32( a ); a = Mask( a, 5 ); return ( RShift( s, a ) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.8.1.js0000644000175000017500000001536211545150464021756 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.8.1.js ECMA Section: 11.8.1 The less-than operator ( < ) Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.8.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The less-than operator ( < )"); new TestCase( SECTION, "true < false", false, true < false ); new TestCase( SECTION, "false < true", true, false < true ); new TestCase( SECTION, "false < false", false, false < false ); new TestCase( SECTION, "true < true", false, true < true ); new TestCase( SECTION, "new Boolean(true) < new Boolean(true)", false, new Boolean(true) < new Boolean(true) ); new TestCase( SECTION, "new Boolean(true) < new Boolean(false)", false, new Boolean(true) < new Boolean(false) ); new TestCase( SECTION, "new Boolean(false) < new Boolean(true)", true, new Boolean(false) < new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) < new Boolean(false)", false, new Boolean(false) < new Boolean(false) ); new TestCase( SECTION, "new MyObject(Infinity) < new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(true)", true, new MyValueObject(false) < new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(true) < new MyValueObject(true)", false, new MyValueObject(true) < new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(false)", false, new MyValueObject(false) < new MyValueObject(false) ); new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(true)", true, new MyStringObject(false) < new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(true) < new MyStringObject(true)", false, new MyStringObject(true) < new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(false)", false, new MyStringObject(false) < new MyStringObject(false) ); new TestCase( SECTION, "Number.NaN < Number.NaN", false, Number.NaN < Number.NaN ); new TestCase( SECTION, "0 < Number.NaN", false, 0 < Number.NaN ); new TestCase( SECTION, "Number.NaN < 0", false, Number.NaN < 0 ); new TestCase( SECTION, "0 < -0", false, 0 < -0 ); new TestCase( SECTION, "-0 < 0", false, -0 < 0 ); new TestCase( SECTION, "Infinity < 0", false, Number.POSITIVE_INFINITY < 0 ); new TestCase( SECTION, "Infinity < Number.MAX_VALUE", false, Number.POSITIVE_INFINITY < Number.MAX_VALUE ); new TestCase( SECTION, "Infinity < Infinity", false, Number.POSITIVE_INFINITY < Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 < Infinity", true, 0 < Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE < Infinity", true, Number.MAX_VALUE < Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 < -Infinity", false, 0 < Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE < -Infinity", false, Number.MAX_VALUE < Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity < -Infinity", false, Number.NEGATIVE_INFINITY < Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity < 0", true, Number.NEGATIVE_INFINITY < 0 ); new TestCase( SECTION, "-Infinity < -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY < -Number.MAX_VALUE ); new TestCase( SECTION, "-Infinity < Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY < Number.MIN_VALUE ); new TestCase( SECTION, "'string' < 'string'", false, 'string' < 'string' ); new TestCase( SECTION, "'astring' < 'string'", true, 'astring' < 'string' ); new TestCase( SECTION, "'strings' < 'stringy'", true, 'strings' < 'stringy' ); new TestCase( SECTION, "'strings' < 'stringier'", false, 'strings' < 'stringier' ); new TestCase( SECTION, "'string' < 'astring'", false, 'string' < 'astring' ); new TestCase( SECTION, "'string' < 'strings'", true, 'string' < 'strings' ); test(); function MyObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); this.toString = new Function( "return this.value +''" ); } function MyValueObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); } function MyStringObject(value) { this.value = value; this.toString = new Function( "return this.value +''" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.8.2.js0000644000175000017500000001537511545150464021763 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.8.2.js ECMA Section: 11.8.2 The greater-than operator ( > ) Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.8.2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The greater-than operator ( > )"); new TestCase( SECTION, "true > false", true, true > false ); new TestCase( SECTION, "false > true", false, false > true ); new TestCase( SECTION, "false > false", false, false > false ); new TestCase( SECTION, "true > true", false, true > true ); new TestCase( SECTION, "new Boolean(true) > new Boolean(true)", false, new Boolean(true) > new Boolean(true) ); new TestCase( SECTION, "new Boolean(true) > new Boolean(false)", true, new Boolean(true) > new Boolean(false) ); new TestCase( SECTION, "new Boolean(false) > new Boolean(true)", false, new Boolean(false) > new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) > new Boolean(false)", false, new Boolean(false) > new Boolean(false) ); new TestCase( SECTION, "new MyObject(Infinity) > new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(true)", false, new MyValueObject(false) > new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(true) > new MyValueObject(true)", false, new MyValueObject(true) > new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(false)", false, new MyValueObject(false) > new MyValueObject(false) ); new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(true)", false, new MyStringObject(false) > new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(true) > new MyStringObject(true)", false, new MyStringObject(true) > new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(false)", false, new MyStringObject(false) > new MyStringObject(false) ); new TestCase( SECTION, "Number.NaN > Number.NaN", false, Number.NaN > Number.NaN ); new TestCase( SECTION, "0 > Number.NaN", false, 0 > Number.NaN ); new TestCase( SECTION, "Number.NaN > 0", false, Number.NaN > 0 ); new TestCase( SECTION, "0 > -0", false, 0 > -0 ); new TestCase( SECTION, "-0 > 0", false, -0 > 0 ); new TestCase( SECTION, "Infinity > 0", true, Number.POSITIVE_INFINITY > 0 ); new TestCase( SECTION, "Infinity > Number.MAX_VALUE", true, Number.POSITIVE_INFINITY > Number.MAX_VALUE ); new TestCase( SECTION, "Infinity > Infinity", false, Number.POSITIVE_INFINITY > Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 > Infinity", false, 0 > Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE > Infinity", false, Number.MAX_VALUE > Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 > -Infinity", true, 0 > Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE > -Infinity", true, Number.MAX_VALUE > Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity > -Infinity", false, Number.NEGATIVE_INFINITY > Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity > 0", false, Number.NEGATIVE_INFINITY > 0 ); new TestCase( SECTION, "-Infinity > -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY > -Number.MAX_VALUE ); new TestCase( SECTION, "-Infinity > Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY > Number.MIN_VALUE ); new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' ); new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' ); new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' ); new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' ); new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' ); new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' ); test(); function MyObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); this.toString = new Function( "return this.value +''" ); } function MyValueObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); } function MyStringObject(value) { this.value = value; this.toString = new Function( "return this.value +''" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.8.3.js0000644000175000017500000001550611545150464021760 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.8.3.js ECMA Section: 11.8.3 The less-than-or-equal operator ( <= ) Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.8.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The less-than-or-equal operator ( <= )"); new TestCase( SECTION, "true <= false", false, true <= false ); new TestCase( SECTION, "false <= true", true, false <= true ); new TestCase( SECTION, "false <= false", true, false <= false ); new TestCase( SECTION, "true <= true", true, true <= true ); new TestCase( SECTION, "new Boolean(true) <= new Boolean(true)", true, new Boolean(true) <= new Boolean(true) ); new TestCase( SECTION, "new Boolean(true) <= new Boolean(false)", false, new Boolean(true) <= new Boolean(false) ); new TestCase( SECTION, "new Boolean(false) <= new Boolean(true)", true, new Boolean(false) <= new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) <= new Boolean(false)", true, new Boolean(false) <= new Boolean(false) ); new TestCase( SECTION, "new MyObject(Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(true)", true, new MyValueObject(false) <= new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(true) <= new MyValueObject(true)", true, new MyValueObject(true) <= new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(false)", true, new MyValueObject(false) <= new MyValueObject(false) ); new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(true)", true, new MyStringObject(false) <= new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(true) <= new MyStringObject(true)", true, new MyStringObject(true) <= new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(false)", true, new MyStringObject(false) <= new MyStringObject(false) ); new TestCase( SECTION, "Number.NaN <= Number.NaN", false, Number.NaN <= Number.NaN ); new TestCase( SECTION, "0 <= Number.NaN", false, 0 <= Number.NaN ); new TestCase( SECTION, "Number.NaN <= 0", false, Number.NaN <= 0 ); new TestCase( SECTION, "0 <= -0", true, 0 <= -0 ); new TestCase( SECTION, "-0 <= 0", true, -0 <= 0 ); new TestCase( SECTION, "Infinity <= 0", false, Number.POSITIVE_INFINITY <= 0 ); new TestCase( SECTION, "Infinity <= Number.MAX_VALUE", false, Number.POSITIVE_INFINITY <= Number.MAX_VALUE ); new TestCase( SECTION, "Infinity <= Infinity", true, Number.POSITIVE_INFINITY <= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 <= Infinity", true, 0 <= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE <= Infinity", true, Number.MAX_VALUE <= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 <= -Infinity", false, 0 <= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE <= -Infinity", false, Number.MAX_VALUE <= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity <= -Infinity", true, Number.NEGATIVE_INFINITY <= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity <= 0", true, Number.NEGATIVE_INFINITY <= 0 ); new TestCase( SECTION, "-Infinity <= -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY <= -Number.MAX_VALUE ); new TestCase( SECTION, "-Infinity <= Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY <= Number.MIN_VALUE ); new TestCase( SECTION, "'string' <= 'string'", true, 'string' <= 'string' ); new TestCase( SECTION, "'astring' <= 'string'", true, 'astring' <= 'string' ); new TestCase( SECTION, "'strings' <= 'stringy'", true, 'strings' <= 'stringy' ); new TestCase( SECTION, "'strings' <= 'stringier'", false, 'strings' <= 'stringier' ); new TestCase( SECTION, "'string' <= 'astring'", false, 'string' <= 'astring' ); new TestCase( SECTION, "'string' <= 'strings'", true, 'string' <= 'strings' ); test(); function MyObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); this.toString = new Function( "return this.value +''" ); } function MyValueObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); } function MyStringObject(value) { this.value = value; this.toString = new Function( "return this.value +''" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.8.4.js0000644000175000017500000001550311545150464021756 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.8.4.js ECMA Section: 11.8.4 The greater-than-or-equal operator ( >= ) Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.8.4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The greater-than-or-equal operator ( >= )"); new TestCase( SECTION, "true >= false", true, true >= false ); new TestCase( SECTION, "false >= true", false, false >= true ); new TestCase( SECTION, "false >= false", true, false >= false ); new TestCase( SECTION, "true >= true", true, true >= true ); new TestCase( SECTION, "new Boolean(true) >= new Boolean(true)", true, new Boolean(true) >= new Boolean(true) ); new TestCase( SECTION, "new Boolean(true) >= new Boolean(false)", true, new Boolean(true) >= new Boolean(false) ); new TestCase( SECTION, "new Boolean(false) >= new Boolean(true)", false, new Boolean(false) >= new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) >= new Boolean(false)", true, new Boolean(false) >= new Boolean(false) ); new TestCase( SECTION, "new MyObject(Infinity) >= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(true)", false, new MyValueObject(false) >= new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(true) >= new MyValueObject(true)", true, new MyValueObject(true) >= new MyValueObject(true) ); new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(false)", true, new MyValueObject(false) >= new MyValueObject(false) ); new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(true)", false, new MyStringObject(false) >= new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(true) >= new MyStringObject(true)", true, new MyStringObject(true) >= new MyStringObject(true) ); new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(false)", true, new MyStringObject(false) >= new MyStringObject(false) ); new TestCase( SECTION, "Number.NaN >= Number.NaN", false, Number.NaN >= Number.NaN ); new TestCase( SECTION, "0 >= Number.NaN", false, 0 >= Number.NaN ); new TestCase( SECTION, "Number.NaN >= 0", false, Number.NaN >= 0 ); new TestCase( SECTION, "0 >= -0", true, 0 >= -0 ); new TestCase( SECTION, "-0 >= 0", true, -0 >= 0 ); new TestCase( SECTION, "Infinity >= 0", true, Number.POSITIVE_INFINITY >= 0 ); new TestCase( SECTION, "Infinity >= Number.MAX_VALUE", true, Number.POSITIVE_INFINITY >= Number.MAX_VALUE ); new TestCase( SECTION, "Infinity >= Infinity", true, Number.POSITIVE_INFINITY >= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 >= Infinity", false, 0 >= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE >= Infinity", false, Number.MAX_VALUE >= Number.POSITIVE_INFINITY ); new TestCase( SECTION, "0 >= -Infinity", true, 0 >= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "Number.MAX_VALUE >= -Infinity", true, Number.MAX_VALUE >= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity >= -Infinity", true, Number.NEGATIVE_INFINITY >= Number.NEGATIVE_INFINITY ); new TestCase( SECTION, "-Infinity >= 0", false, Number.NEGATIVE_INFINITY >= 0 ); new TestCase( SECTION, "-Infinity >= -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY >= -Number.MAX_VALUE ); new TestCase( SECTION, "-Infinity >= Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY >= Number.MIN_VALUE ); new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' ); new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' ); new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' ); new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' ); new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' ); new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' ); test(); function MyObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); this.toString = new Function( "return this.value +''" ); } function MyValueObject(value) { this.value = value; this.valueOf = new Function( "return this.value" ); } function MyStringObject(value) { this.value = value; this.toString = new Function( "return this.value +''" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.9.1.js0000644000175000017500000001756211545150464021763 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.9.1.js ECMA Section: 11.9.1 The equals operator ( == ) Description: The production EqualityExpression: EqualityExpression == RelationalExpression is evaluated as follows: 1. Evaluate EqualityExpression. 2. Call GetValue(Result(1)). 3. Evaluate RelationalExpression. 4. Call GetValue(Result(3)). 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3) 6. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.9.1"; var VERSION = "ECMA_1"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " The equals operator ( == )"); // type x and type y are the same. if type x is undefined or null, return true new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 ); new TestCase( SECTION, "null == null", true, null == null ); // if x is NaN, return false. if y is NaN, return false. new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN ); new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 ); new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN ); new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN ); // if x is the same number value as y, return true. new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE ); new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY ); // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true. new TestCase( SECTION, "0 == 0", true, 0 == 0 ); new TestCase( SECTION, "0 == -0", true, 0 == -0 ); new TestCase( SECTION, "-0 == 0", true, -0 == 0 ); new TestCase( SECTION, "-0 == -0", true, -0 == -0 ); // return false. new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 ); new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 ); new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 ); new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 ); // type x and type y are the same type, but not numbers. // x and y are strings. return true if x and y are exactly the same sequence of characters. // otherwise, return false. new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" ); // x and y are booleans. return true if both are true or both are false. new TestCase( SECTION, "true == true", true, true == true ); new TestCase( SECTION, "false == false", true, false == false ); new TestCase( SECTION, "true == false", false, true == false ); new TestCase( SECTION, "false == true", false, false == true ); // return true if x and y refer to the same object. otherwise return false. new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) ); new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") ); new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); // if x is null and y is undefined, return true. if x is undefined and y is null return true. new TestCase( SECTION, "null == void 0", true, null == void 0 ); new TestCase( SECTION, "void 0 == null", true, void 0 == null ); // if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y). new TestCase( SECTION, "1 == '1'", true, 1 == '1' ); new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' ); new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" ); new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" ); new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) ); new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) ); new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false ); new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false ); new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) ); new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) ); new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) ); new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.9.2.js0000644000175000017500000001760211545150464021757 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.9.2.js ECMA Section: 11.9.2 The equals operator ( == ) Description: The production EqualityExpression: EqualityExpression == RelationalExpression is evaluated as follows: 1. Evaluate EqualityExpression. 2. Call GetValue(Result(1)). 3. Evaluate RelationalExpression. 4. Call GetValue(Result(3)). 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3) 6. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.9.2"; var VERSION = "ECMA_1"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " The equals operator ( == )"); // type x and type y are the same. if type x is undefined or null, return true new TestCase( SECTION, "void 0 == void 0", false, void 0 != void 0 ); new TestCase( SECTION, "null == null", false, null != null ); // if x is NaN, return false. if y is NaN, return false. new TestCase( SECTION, "NaN != NaN", true, Number.NaN != Number.NaN ); new TestCase( SECTION, "NaN != 0", true, Number.NaN != 0 ); new TestCase( SECTION, "0 != NaN", true, 0 != Number.NaN ); new TestCase( SECTION, "NaN != Infinity", true, Number.NaN != Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Infinity != NaN", true, Number.POSITIVE_INFINITY != Number.NaN ); // if x is the same number value as y, return true. new TestCase( SECTION, "Number.MAX_VALUE != Number.MAX_VALUE", false, Number.MAX_VALUE != Number.MAX_VALUE ); new TestCase( SECTION, "Number.MIN_VALUE != Number.MIN_VALUE", false, Number.MIN_VALUE != Number.MIN_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY", false, Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY", false, Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY ); // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true. new TestCase( SECTION, "0 != 0", false, 0 != 0 ); new TestCase( SECTION, "0 != -0", false, 0 != -0 ); new TestCase( SECTION, "-0 != 0", false, -0 != 0 ); new TestCase( SECTION, "-0 != -0", false, -0 != -0 ); // return false. new TestCase( SECTION, "0.9 != 1", true, 0.9 != 1 ); new TestCase( SECTION, "0.999999 != 1", true, 0.999999 != 1 ); new TestCase( SECTION, "0.9999999999 != 1", true, 0.9999999999 != 1 ); new TestCase( SECTION, "0.9999999999999 != 1", true, 0.9999999999999 != 1 ); // type x and type y are the same type, but not numbers. // x and y are strings. return true if x and y are exactly the same sequence of characters. // otherwise, return false. new TestCase( SECTION, "'hello' != 'hello'", false, "hello" != "hello" ); // x and y are booleans. return true if both are true or both are false. new TestCase( SECTION, "true != true", false, true != true ); new TestCase( SECTION, "false != false", false, false != false ); new TestCase( SECTION, "true != false", true, true != false ); new TestCase( SECTION, "false != true", true, false != true ); // return true if x and y refer to the same object. otherwise return false. new TestCase( SECTION, "new MyObject(true) != new MyObject(true)", true, new MyObject(true) != new MyObject(true) ); new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) ); new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z != y", false, eval("x = new MyObject(true); y = x; z = x; z != y") ); new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z != y", false, eval("x = new MyObject(false); y = x; z = x; z != y") ); new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z != y", false, eval("x = new Boolean(true); y = x; z = x; z != y") ); new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z != y", false, eval("x = new Boolean(false); y = x; z = x; z != y") ); new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) ); // if x is null and y is undefined, return true. if x is undefined and y is null return true. new TestCase( SECTION, "null != void 0", false, null != void 0 ); new TestCase( SECTION, "void 0 != null", false, void 0 != null ); // if type(x) is Number and type(y) is string, return the result of the comparison x != ToNumber(y). new TestCase( SECTION, "1 != '1'", false, 1 != '1' ); new TestCase( SECTION, "255 != '0xff'", false, 255 != '0xff' ); new TestCase( SECTION, "0 != '\r'", false, 0 != "\r" ); new TestCase( SECTION, "1e19 != '1e19'", false, 1e19 != "1e19" ); new TestCase( SECTION, "new Boolean(true) != true", false, true != new Boolean(true) ); new TestCase( SECTION, "new MyObject(true) != true", false, true != new MyObject(true) ); new TestCase( SECTION, "new Boolean(false) != false", false, new Boolean(false) != false ); new TestCase( SECTION, "new MyObject(false) != false", false, new MyObject(false) != false ); new TestCase( SECTION, "true != new Boolean(true)", false, true != new Boolean(true) ); new TestCase( SECTION, "true != new MyObject(true)", false, true != new MyObject(true) ); new TestCase( SECTION, "false != new Boolean(false)", false, false != new Boolean(false) ); new TestCase( SECTION, "false != new MyObject(false)", false, false != new MyObject(false) ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/11.9.3.js0000644000175000017500000001756211545150464021765 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.9.3.js ECMA Section: 11.9.3 The equals operator ( == ) Description: The production EqualityExpression: EqualityExpression == RelationalExpression is evaluated as follows: 1. Evaluate EqualityExpression. 2. Call GetValue(Result(1)). 3. Evaluate RelationalExpression. 4. Call GetValue(Result(3)). 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3) 6. Return Result(5). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.9.3"; var VERSION = "ECMA_1"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " The equals operator ( == )"); // type x and type y are the same. if type x is undefined or null, return true new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 ); new TestCase( SECTION, "null == null", true, null == null ); // if x is NaN, return false. if y is NaN, return false. new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN ); new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 ); new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN ); new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN ); // if x is the same number value as y, return true. new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE ); new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE ); new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY ); // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true. new TestCase( SECTION, "0 == 0", true, 0 == 0 ); new TestCase( SECTION, "0 == -0", true, 0 == -0 ); new TestCase( SECTION, "-0 == 0", true, -0 == 0 ); new TestCase( SECTION, "-0 == -0", true, -0 == -0 ); // return false. new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 ); new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 ); new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 ); new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 ); // type x and type y are the same type, but not numbers. // x and y are strings. return true if x and y are exactly the same sequence of characters. // otherwise, return false. new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" ); // x and y are booleans. return true if both are true or both are false. new TestCase( SECTION, "true == true", true, true == true ); new TestCase( SECTION, "false == false", true, false == false ); new TestCase( SECTION, "true == false", false, true == false ); new TestCase( SECTION, "false == true", false, false == true ); // return true if x and y refer to the same object. otherwise return false. new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) ); new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") ); new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") ); new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) ); new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) ); // if x is null and y is undefined, return true. if x is undefined and y is null return true. new TestCase( SECTION, "null == void 0", true, null == void 0 ); new TestCase( SECTION, "void 0 == null", true, void 0 == null ); // if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y). new TestCase( SECTION, "1 == '1'", true, 1 == '1' ); new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' ); new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" ); new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" ); new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) ); new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) ); new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false ); new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false ); new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) ); new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) ); new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) ); new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/browser.js0000644000175000017500000000000011545150464022672 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/jstests.list0000644000175000017500000000245611545150464023266 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/Expressions/ script 11.1.1.js script 11.10-1.js script 11.10-2.js script 11.10-3.js script 11.12-1.js script 11.12-2-n.js script 11.12-3.js script 11.12-4.js script 11.13.1.js script 11.13.2-1.js script 11.13.2-2.js script 11.13.2-3.js script 11.13.2-4.js script 11.13.2-5.js script 11.13.js script 11.14-1.js script 11.2.1-1.js script 11.2.1-2.js script 11.2.1-3-n.js script 11.2.1-4-n.js script 11.2.1-5.js script 11.2.2-1-n.js script 11.2.2-1.js script 11.2.2-10-n.js script 11.2.2-11.js script 11.2.2-2-n.js script 11.2.2-3-n.js script 11.2.2-4-n.js script 11.2.2-5-n.js script 11.2.2-6-n.js script 11.2.2-7-n.js script 11.2.2-8-n.js script 11.2.2-9-n.js script 11.2.3-1.js script 11.2.3-2-n.js script 11.2.3-3-n.js script 11.2.3-4-n.js script 11.2.3-5.js script 11.3.1.js script 11.3.2.js script 11.4.1.js script 11.4.2.js script 11.4.3.js script 11.4.4.js script 11.4.5.js script 11.4.6.js script 11.4.7-01.js script 11.4.7-02.js script 11.4.8.js script 11.4.9.js script 11.5.1.js script 11.5.2.js script 11.5.3.js script 11.6.1-1.js script 11.6.1-2.js script 11.6.1-3.js script 11.6.2-1.js script 11.6.3.js script 11.7.1.js script 11.7.2.js script 11.7.3.js script 11.8.1.js script 11.8.2.js script 11.8.3.js script 11.8.4.js script 11.9.1.js script 11.9.2.js script 11.9.3.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Expressions/shell.js0000644000175000017500000000000011545150464022316 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/10.1.4-9.js0000644000175000017500000001050511545150464021766 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.4-9.js ECMA Section: 10.1.4 Scope Chain and Identifier Resolution Description: Every execution context has associated with it a scope chain. This is logically a list of objects that are searched when binding an Identifier. When control enters an execution context, the scope chain is created and is populated with an initial set of objects, depending on the type of code. When control leaves the execution context, the scope chain is destroyed. During execution, the scope chain of the execution context is affected only by WithStatement. When execution enters a with block, the object specified in the with statement is added to the front of the scope chain. When execution leaves a with block, whether normally or via a break or continue statement, the object is removed from the scope chain. The object being removed will always be the first object in the scope chain. During execution, the syntactic production PrimaryExpression : Identifier is evaluated using the following algorithm: 1. Get the next object in the scope chain. If there isn't one, go to step 5. 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as the property. 3. If Result(2) is true, return a value of type Reference whose base object is Result(l) and whose property name is the Identifier. 4. Go to step 1. 5. Return a value of type Reference whose base object is null and whose property name is the Identifier. The result of binding an identifier is always a value of type Reference with its member name component equal to the identifier string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.4-9"; var VERSION = "ECMA_2"; startTest(); writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution"); new TestCase( SECTION, "NEW_PROPERTY = " ); test(); function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { var MYOBJECT = new MyObject(); var RESULT = "hello"; with ( MYOBJECT ) { NEW_PROPERTY = RESULT; } gTestcases[gTc].actual = NEW_PROPERTY; gTestcases[gTc].expect = RESULT; gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +" = "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : "wrong value "; } stopTest(); return ( gTestcases ); } function MyObject( n ) { this.__proto__ = Number.prototype; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/10.1.6.js0000644000175000017500000001031111545150464021615 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.6 ECMA Section: Activation Object Description: If the function object being invoked has an arguments property, let x be the value of that property; the activation object is also given an internal property [[OldArguments]] whose initial value is x; otherwise, an arguments property is created for the function object but the activation object is not given an [[OldArguments]] property. Next, arguments object described below (the same one stored in the arguments property of the activation object) is used as the new value of the arguments property of the function object. This new value is installed even if the arguments property already exists and has the ReadOnly attribute (as it will for native Function objects). (These actions are taken to provide compatibility with a form of program syntax that is now discouraged: to access the arguments object for function f within the body of f by using the expression f.arguments. The recommended way to access the arguments object for function f within the body of f is simply to refer to the variable arguments.) Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Activation Object"; writeHeaderToLog( SECTION + " "+ TITLE); var arguments = "FAILED!"; var ARG_STRING = "value of the argument property"; new TestCase( SECTION, "(new TestObject(0,1,2,3,4,5)).length", 6, (new TestObject(0,1,2,3,4,5)).length ); for ( i = 0; i < 6; i++ ) { new TestCase( SECTION, "(new TestObject(0,1,2,3,4,5))["+i+"]", i, (new TestObject(0,1,2,3,4,5))[i]); } // The current object already has an arguments property. new TestCase( SECTION, "(new AnotherTestObject(1,2,3)).arguments", ARG_STRING, (new AnotherTestObject(1,2,3)).arguments ); // The function invoked with [[Call]] new TestCase( SECTION, "TestFunction(1,2,3)", ARG_STRING, TestFunction() + '' ); test(); function Prototype() { this.arguments = ARG_STRING; } function TestObject() { this.__proto__ = new Prototype(); return arguments; } function AnotherTestObject() { this.__proto__ = new Prototype(); return this; } function TestFunction() { arguments = ARG_STRING; return arguments; } function AnotherTestFunction() { this.__proto__ = new Prototype(); return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/10.1.8-1.js0000644000175000017500000001072311545150464021764 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 10.1.8 ECMA Section: Arguments Object Description: When control enters an execution context for declared function code, anonymous code, or implementation-supplied code, an arguments object is created and initialized as follows: The [[Prototype]] of the arguments object is to the original Object prototype object, the one that is the initial value of Object.prototype (section 15.2.3.1). A property is created with name callee and property attributes {DontEnum}. The initial value of this property is the function object being executed. This allows anonymous functions to be recursive. A property is created with name length and property attributes {DontEnum}. The initial value of this property is the number of actual parameter values supplied by the caller. For each non-negative integer, iarg, less than the value of the length property, a property is created with name ToString(iarg) and property attributes { DontEnum }. The initial value of this property is the value of the corresponding actual parameter supplied by the caller. The first actual parameter value corresponds to iarg = 0, the second to iarg = 1 and so on. In the case when iarg is less than the number of formal parameters for the function object, this property shares its value with the corresponding property of the activation object. This means that changing this property changes the corresponding property of the activation object and vice versa. The value sharing mechanism depends on the implementation. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "10.1.8"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Arguments Object"; writeHeaderToLog( SECTION + " "+ TITLE); var ARG_STRING = "value of the argument property"; new TestCase( SECTION, "GetCallee()", GetCallee, GetCallee() ); var LIMIT = 100; for ( var i = 0, args = "" ; i < LIMIT; i++ ) { args += String(i) + ( i+1 < LIMIT ? "," : "" ); } var LENGTH = eval( "GetLength("+ args +")" ); new TestCase( SECTION, "GetLength("+args+")", 100, LENGTH ); var ARGUMENTS = eval( "GetArguments( " +args+")" ); for ( var i = 0; i < 100; i++ ) { new TestCase( SECTION, "GetArguments("+args+")["+i+"]", i, ARGUMENTS[i] ); } test(); function TestFunction() { var arg_proto = arguments.__proto__; } function GetCallee() { var c = arguments.callee; return c; } function GetArguments() { var a = arguments; return a; } function GetLength() { var l = arguments.length; return l; } function AnotherTestFunction() { this.__proto__ = new Prototype(); return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/11.6.1-1.js0000644000175000017500000001317111545150464021763 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.6.1-1.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does not cover cases where the Additive or Mulplicative expression ToPrimitive is string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2", 1, eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2", "truefalse", eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") ); // tests for "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2", 99, eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2", "100-1", eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1", "truetrue", eval("var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1") ); test(); function MyProtoValuelessObject() { this.valueOf = new Function ( "" ); this.__proto__ = null; } function MyProtolessObject( value ) { this.valueOf = new Function( "return this.value" ); this.__proto__ = null; this.value = value; } function MyValuelessObject(value) { this.__proto__ = new MyPrototypeObject(value); } function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/11.6.1-2.js0000644000175000017500000001314711545150464021767 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.6.1-2.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does only covers cases where the Additive or Mulplicative expression ToPrimitive is a string. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2", "stringfalse", eval("var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2", "stringfalse", eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") ); // tests for "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2", "100string", eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2", "string-1", eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") ); test(); function MyProtoValuelessObject() { this.valueOf = new Function ( "" ); this.__proto__ = null; } function MyProtolessObject( value ) { this.valueOf = new Function( "return this.value" ); this.__proto__ = null; this.value = value; } function MyValuelessObject(value) { this.__proto__ = new MyPrototypeObject(value); } function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/11.6.1-3.js0000644000175000017500000001175611545150464021774 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.6.1-3.js ECMA Section: 11.6.1 The addition operator ( + ) Description: The addition operator either performs string concatenation or numeric addition. The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToPrimitive(Result(2)). 6. Call ToPrimitive(Result(4)). 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12. (Note that this step differs from step 3 in the algorithm for comparison for the relational operators in using or instead of and.) 8. Call ToNumber(Result(5)). 9. Call ToNumber(Result(6)). 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3). 11. Return Result(10). 12. Call ToString(Result(5)). 13. Call ToString(Result(6)). 14. Concatenate Result(12) followed by Result(13). 15. Return Result(14). Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6. All native ECMAScript objects except Date objects handle the absence of a hint as if the hint Number were given; Date objects handle the absence of a hint as if the hint String were given. Host objects may handle the absence of a hint in some other manner. This test does only covers cases where the Additive or Mulplicative expression is a Date. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.1-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The Addition operator ( + )"); // tests for a boolean primitive and a boolean object, and // "MyValuelessObject", where the value is set in the object's // prototype, not the object itself. var DATE1 = new Date(); var MYOB1 = new MyObject( DATE1 ); var MYOB2 = new MyValuelessObject( DATE1 ); var MYOB3 = new MyProtolessObject( DATE1 ); var MYOB4 = new MyProtoValuelessObject( DATE1 ); new TestCase( SECTION, "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + 'string'", DATE1.toString() + "string", MYOB2 + 'string' ); new TestCase( SECTION, "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + new String('string')", DATE1.toString() + "string", MYOB2 + new String('string') ); /* new TestCase( SECTION, "MYOB3 = new MyProtolessObject(DATE1); MYOB3 + new Boolean(true)", DATE1.toString() + "true", MYOB3 + new Boolean(true) ); */ test(); function MyProtoValuelessObject() { this.valueOf = new Function ( "" ); this.__proto__ = null; } function MyProtolessObject( value ) { this.valueOf = new Function( "return this.value" ); this.__proto__ = null; this.value = value; } function MyValuelessObject(value) { this.__proto__ = new MyPrototypeObject(value); } function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/11.6.2-1.js0000644000175000017500000001137111545150464021764 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 11.6.2-1.js ECMA Section: 11.6.2 The Subtraction operator ( - ) Description: The production AdditiveExpression : AdditiveExpression - MultiplicativeExpression is evaluated as follows: 1. Evaluate AdditiveExpression. 2. Call GetValue(Result(1)). 3. Evaluate MultiplicativeExpression. 4. Call GetValue(Result(3)). 5. Call ToNumber(Result(2)). 6. Call ToNumber(Result(4)). 7. Apply the subtraction operation to Result(5) and Result(6). See the discussion below (11.6.3). 8. Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "11.6.2-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The subtraction operator ( - )"); // tests "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2", 1, eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2") ); new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2", Number.NaN, eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2") ); // tests "MyValuelessObject", where the value is // set in the object's prototype, not the object itself. new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2", 99, eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2") ); /* new TestCase( SECTION, "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2", Number.NaN, eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2") ); */ // same thing with string! test(); function MyProtoValuelessObject() { this.valueOf = new Function ( "" ); this.__proto__ = null; } function MyProtolessObject( value ) { this.valueOf = new Function( "return this.value" ); this.__proto__ = null; this.value = value; } function MyValuelessObject(value) { this.__proto__ = new MyPrototypeObject(value); } function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } function MyOtherObject( value ) { this.valueOf = new Function( "return this.value" ); this.toString = new Function ( "return this.value + ''" ); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15-1.js0000644000175000017500000001142111545150464021460 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.js ECMA Section: 15 Native ECMAScript Objects Description: Every built-in prototype object has the Object prototype object, which is the value of the expression Object.prototype (15.2.3.1) as the value of its internal [[Prototype]] property, except the Object prototype object itself. Every native object associated with a program-created function also has the Object prototype object as the value of its internal [[Prototype]] property. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Native ECMAScript Objects"; writeHeaderToLog( SECTION + " "+ TITLE); /* new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ ); new TestCase( SECTION, "Array.prototype.__proto__", Object.prototype, Array.prototype.__proto__ ); new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ ); new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ ); new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ ); // new TestCase( SECTION, "Math.prototype.__proto__", Object.prototype, Math.prototype.__proto__ ); new TestCase( SECTION, "Date.prototype.__proto__", Object.prototype, Date.prototype.__proto__ ); new TestCase( SECTION, "TestCase.prototype.__proto__", Object.prototype, TestCase.prototype.__proto__ ); new TestCase( SECTION, "MyObject.prototype.__proto__", Object.prototype, MyObject.prototype.__proto__ ); */ new TestCase( SECTION, "Function.prototype.__proto__ == Object.prototype", true, Function.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "Array.prototype.__proto__ == Object.prototype", true, Array.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "String.prototype.__proto__ == Object.prototype", true, String.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "Boolean.prototype.__proto__ == Object.prototype", true, Boolean.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype ); // new TestCase( SECTION, "Math.prototype.__proto__ == Object.prototype", true, Math.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "Date.prototype.__proto__ == Object.prototype", true, Date.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "TestCase.prototype.__proto__ == Object.prototype", true, TestCase.prototype.__proto__ == Object.prototype ); new TestCase( SECTION, "MyObject.prototype.__proto__ == Object.prototype", true, MyObject.prototype.__proto__ == Object.prototype ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15-2.js0000644000175000017500000000661511545150464021472 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15-2.js ECMA Section: 15 Native ECMAScript Objects Description: Every built-in function and every built-in constructor has the Function prototype object, which is the value of the expression Function.prototype as the value of its internal [[Prototype]] property, except the Function prototype object itself. That is, the __proto__ property of builtin functions and constructors should be the Function.prototype object. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Native ECMAScript Objects"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ ); new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ ); new TestCase( SECTION, "String.__proto__", Function.prototype, String.__proto__ ); new TestCase( SECTION, "Boolean.__proto__", Function.prototype, Boolean.__proto__ ); new TestCase( SECTION, "Number.__proto__", Function.prototype, Number.__proto__ ); new TestCase( SECTION, "Date.__proto__", Function.prototype, Date.__proto__ ); new TestCase( SECTION, "TestCase.__proto__", Function.prototype, TestCase.__proto__ ); new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ ); new TestCase( SECTION, "Math.pow.__proto__", Function.prototype, Math.pow.__proto__ ); new TestCase( SECTION, "String.prototype.indexOf.__proto__", Function.prototype, String.prototype.indexOf.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.1.2.1-1.js0000644000175000017500000001163611545150464022126 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.1-1.js ECMA Section: 15.1.2.1 eval(x) if x is not a string object, return x. Description: Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.1.2.1-1"; var VERSION = "ECMA_1"; var TITLE = "eval(x)"; var BUGNUMBER = "none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "eval.length", 1, eval.length ); new TestCase( SECTION, "delete eval.length", false, delete eval.length ); new TestCase( SECTION, "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", "", eval("var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS") ); new TestCase( SECTION, "eval.length = null; eval.length", 1, eval( "eval.length = null; eval.length") ); // new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ ); // test cases where argument is not a string. should return the argument. new TestCase( SECTION, "eval()", void 0, eval() ); new TestCase( SECTION, "eval(void 0)", void 0, eval( void 0) ); new TestCase( SECTION, "eval(null)", null, eval( null ) ); new TestCase( SECTION, "eval(true)", true, eval( true ) ); new TestCase( SECTION, "eval(false)", false, eval( false ) ); new TestCase( SECTION, "typeof eval(new String('Infinity/-0')", "object", typeof eval(new String('Infinity/-0')) ); new TestCase( SECTION, "eval([1,2,3,4,5,6])", "1,2,3,4,5,6", ""+eval([1,2,3,4,5,6]) ); new TestCase( SECTION, "eval(new Array(0,1,2,3)", "1,2,3", ""+ eval(new Array(1,2,3)) ); new TestCase( SECTION, "eval(1)", 1, eval(1) ); new TestCase( SECTION, "eval(0)", 0, eval(0) ); new TestCase( SECTION, "eval(-1)", -1, eval(-1) ); new TestCase( SECTION, "eval(Number.NaN)", Number.NaN, eval(Number.NaN) ); new TestCase( SECTION, "eval(Number.MIN_VALUE)", 5e-308, eval(Number.MIN_VALUE) ); new TestCase( SECTION, "eval(-Number.MIN_VALUE)", -5e-308, eval(-Number.MIN_VALUE) ); new TestCase( SECTION, "eval(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, eval(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "eval(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, eval(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "eval( 4294967296 )", 4294967296, eval(4294967296) ); new TestCase( SECTION, "eval( 2147483648 )", 2147483648, eval(2147483648) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.2.1.1.js0000644000175000017500000000625611545150464021772 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.1.1.js ECMA Section: 15.2.1.1 The Object Constructor Called as a Function: Object(value) Description: When Object is called as a function rather than as a constructor, the following steps are taken: 1. If value is null or undefined, create and return a new object with no properties other than internal properties exactly as if the object constructor had been called on that same value (15.2.2.1). 2. Return ToObject (value), whose rules are: undefined generate a runtime error null generate a runtime error boolean create a new Boolean object whose default value is the value of the boolean. number Create a new Number object whose default value is the value of the number. string Create a new String object whose default value is the value of the string. object Return the input argument (no conversion). Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "15.2.1.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object( value )"; writeHeaderToLog( SECTION + " "+ TITLE); var NULL_OBJECT = Object(null); new TestCase( SECTION, "Object(null).__proto__", Object.prototype, (Object(null)).__proto__ ); new TestCase( SECTION, "Object(void 0).__proto__", Object.prototype, (Object(void 0)).__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.2.3-1.js0000644000175000017500000000474111545150464021770 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.3-1.js ECMA Section: 15.2.3 Properties of the Object Constructor Description: The value of the internal [[Prototype]] property of the Object constructor is the Function prototype object. Besides the call and construct propreties and the length property, the Object constructor has properties described in 15.2.3.1. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3"; var VERSION = "ECMA_2"; startTest(); writeHeaderToLog( SECTION + " Properties of the Object Constructor"); new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.2.4.js0000644000175000017500000000457011545150464021633 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.4.js ECMA Section: 15.2.4 Properties of the Object prototype object Description: The value of the internal [[Prototype]] property of the Object prototype object is null Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.4"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Properties of the Object.prototype object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Object.prototype.__proto__", null, Object.prototype.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.3.1.1-1.js0000644000175000017500000000621011545150464022117 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.1.1.js ECMA Section: 15.3.1.1 The Function Constructor Called as a Function Description: When the Function function is called with some arguments p1, p2, . . . , pn, body (where n might be 0, that is, there are no "p" arguments, and where body might also not be provided), the following steps are taken: 1. Create and return a new Function object exactly if the function constructor had been called with the same arguments (15.3.2.1). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.1.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); var MyObject = Function( "value", "this.value = value; this.valueOf = Function( 'return this.value' ); this.toString = Function( 'return String(this.value);' )" ); var myfunc = Function(); myfunc.toString = Object.prototype.toString; // not going to test toString here since it is implementation dependent. // new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() ); myfunc.toString = Object.prototype.toString; new TestCase( SECTION, "MyObject.__proto__ == Function.prototype", true, MyObject.__proto__ == Function.prototype ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.3.1.1-2.js0000644000175000017500000000604211545150464022123 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.1.1-2.js ECMA Section: 15.3.1.1 The Function Constructor Called as a Function Function(p1, p2, ..., pn, body ) Description: When the Function function is called with some arguments p1, p2, . . . , pn, body (where n might be 0, that is, there are no "p" arguments, and where body might also not be provided), the following steps are taken: 1. Create and return a new Function object exactly if the function constructor had been called with the same arguments (15.3.2.1). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.1.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); var myfunc2 = Function("a, b, c", "return a+b+c" ); var myfunc3 = Function("a,b", "c", "return a+b+c" ); myfunc2.toString = Object.prototype.toString; myfunc3.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ ); new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.3.2.1-1.js0000644000175000017500000000532611545150464022127 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.2.1.js ECMA Section: 15.3.2.1 The Function Constructor new Function(p1, p2, ..., pn, body ) Description: The last argument specifies the body (executable code) of a function; any preceding arguments sepcify formal parameters. See the text for description of this section. This test examples from the specification. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.2.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); var MyObject = new Function( "value", "this.value = value; this.valueOf = new Function( 'return this.value' ); this.toString = new Function( 'return String(this.value);' )" ); new TestCase( SECTION, "MyObject.__proto__ == Function.prototype", true, MyObject.__proto__ == Function.prototype ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.3.2.1-2.js0000644000175000017500000000532311545150464022125 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.2.1.js ECMA Section: 15.3.2.1 The Function Constructor new Function(p1, p2, ..., pn, body ) Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); var myfunc1 = new Function("a","b","c", "return a+b+c" ); var myfunc2 = new Function("a, b, c", "return a+b+c" ); var myfunc3 = new Function("a,b", "c", "return a+b+c" ); myfunc1.toString = Object.prototype.toString; myfunc2.toString = Object.prototype.toString; myfunc3.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ ); new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.3.3.1-1.js0000644000175000017500000000500111545150464022116 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.3.1-1.js ECMA Section: 15.3.3.1 Properties of the Function Constructor Function.prototype Description: The initial value of Function.prototype is the built-in Function prototype object. This property shall have the attributes [DontEnum | DontDelete | ReadOnly] This test the value of Function.prototype. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.3.1-1"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Function.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Function.prototype == Function.__proto__", true, Function.__proto__ == Function.prototype ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.4.3.js0000644000175000017500000000457711545150464021643 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.4.3.js ECMA Section: 15.4.3 Properties of the Array Constructor Description: The value of the internal [[Prototype]] property of the Array constructor is the Function prototype object. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.4.3"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Properties of the Array Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.5.3.js0000644000175000017500000000505711545150464021636 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.3.1.js ECMA Section: 15.5.3 Properties of the String Constructor Description: The value of the internal [[Prototype]] property of the String constructor is the Function prototype object. In addition to the internal [[Call]] and [[Construct]] properties, the String constructor also has the length property, as well as properties described in 15.5.3.1 and 15.5.3.2. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3"; var VERSION = "ECMA_2"; startTest(); var passed = true; writeHeaderToLog( SECTION + " Properties of the String Constructor" ); new TestCase( SECTION, "String.prototype", Function.prototype, String.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.5.4.2.js0000644000175000017500000000440411545150464021772 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.2.js ECMA Section: 15.5.4.2 String.prototype.toString Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.5.4.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.tostring"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.toString.__proto__", Function.prototype, String.prototype.toString.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.5.4.4-4.js0000644000175000017500000001666311545150464022147 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.4-4.js ECMA Section: 15.5.4.4 String.prototype.charAt(pos) Description: Returns a string containing the character at position pos in the string. If there is no character at that string, the result is the empty string. The result is a string value, not a String object. When the charAt method is called with one argument, pos, the following steps are taken: 1. Call ToString, with this value as its argument 2. Call ToInteger pos 3. Compute the number of characters in Result(1) 4. If Result(2) is less than 0 is or not less than Result(3), return the empty string 5. Return a string of length 1 containing one character from result (1), the character at position Result(2). Note that the charAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. This tests assiging charAt to primitive types.. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.4-4"; var VERSION = "ECMA_2"; startTest(); var TITLE = "String.prototype.charAt"; writeHeaderToLog( SECTION + " "+ TITLE); /* new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "n", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "u", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "u", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "n", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "d", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); */ new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "f", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "s", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(4)") ); new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "t", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "r", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "u", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.5.4.5-6.js0000644000175000017500000001044411545150464022141 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.5-6.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a number (a nonnegative integer less than 2^16) representing the Unicode encoding of the character at position pos in this string. If there is no character at that position, the number is NaN. When the charCodeAt method is called with one argument pos, the following steps are taken: 1. Call ToString, giving it the theis value as its argument 2. Call ToInteger(pos) 3. Compute the number of characters in result(1). 4. If Result(2) is less than 0 or is not less than Result(3), return NaN. 5. Return a value of Number type, of positive sign, whose magnitude is the Unicode encoding of one character from result 1, namely the characer at position Result (2), where the first character in Result(1) is considered to be at position 0. Note that the charCodeAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.5-6"; var VERSION = "ECMA_2"; startTest(); var TITLE = "String.prototype.charCodeAt"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s", "true", eval("var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") ); new TestCase( SECTION, "var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s", "1234", eval("var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") ); new TestCase( SECTION, "var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s", "hello", eval("var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.5.4.7-3.js0000644000175000017500000001344311545150464022142 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.7-3.js ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos) Description: If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the left of the specified position, then the index of the rightmost such position is returned; otherwise -1 is returned. If position is undefined or not supplied, the length of this string value is assumed, so as to search all of the string. When the lastIndexOf method is called with two arguments searchString and position, the following steps are taken: 1.Call ToString, giving it the this value as its argument. 2.Call ToString(searchString). 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN). 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)). 5.Compute the number of characters in Result(1). 6.Compute min(max(Result(4), 0), Result(5)). 7.Compute the number of characters in the string that is Result(2). 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then compute the value -1. 1.Return Result(8). Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.7-3"; var VERSION = "ECMA_2"; startTest(); var TITLE = "String.protoype.lastIndexOf"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )", -1, eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )") ); new TestCase( SECTION, "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )", 1, eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )") ); new TestCase( SECTION, "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )", 1, eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )") ); new TestCase( SECTION, "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )", 1, eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )") ); new TestCase( SECTION, "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )", 1, eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )") ); test(); function LastIndexOf( string, search, position ) { string = String( string ); search = String( search ); position = Number( position ) if ( isNaN( position ) ) { position = Infinity; } else { position = ToInteger( position ); } result5= string.length; result6 = Math.min(Math.max(position, 0), result5); result7 = search.length; if (result7 == 0) { return Math.min(position, result5); } result8 = -1; for ( k = 0; k <= result6; k++ ) { if ( k+ result7 > result5 ) { break; } for ( j = 0; j < result7; j++ ) { if ( string.charAt(k+j) != search.charAt(j) ){ break; } else { if ( j == result7 -1 ) { result8 = k; } } } } return result8; } function ToInteger( n ) { n = Number( n ); if ( isNaN(n) ) { return 0; } if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) { return n; } var sign = ( n < 0 ) ? -1 : 1; return ( sign * Math.floor(Math.abs(n)) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.6.3.1-5.js0000644000175000017500000000437011545150464022135 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.3.1-5.js ECMA Section: 15.6.3.1 Boolean.prototype Description: Author: christine@netscape.com Date: 28 october 1997 */ var VERSION = "ECMA_2"; startTest(); var SECTION = "15.6.3.1-5"; var TITLE = "Boolean.prototype" writeHeaderToLog( SECTION + " " + TITLE ); new TestCase( SECTION, "Function.prototype == Boolean.__proto__", true, Function.prototype == Boolean.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.6.3.js0000644000175000017500000000503511545150464021633 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.3.js ECMA Section: 15.6.3 Properties of the Boolean Constructor Description: The value of the internal prototype property is the Function prototype object. It has the internal [[Call]] and [[Construct]] properties, and the length property. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "15.6.3"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Properties of the Boolean Constructor" writeHeaderToLog( SECTION + TITLE ); new TestCase( SECTION, "Boolean.__proto__ == Function.prototype", true, Boolean.__proto__ == Function.prototype ); new TestCase( SECTION, "Boolean.length", 1, Boolean.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.6.4-2.js0000644000175000017500000000500611545150464021771 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.6.4-2.js ECMA Section: 15.6.4 Properties of the Boolean Prototype Object Description: The Boolean prototype object is itself a Boolean object (its [[Class]] is "Boolean") whose value is false. The value of the internal [[Prototype]] property of the Boolean prototype object is the Object prototype object (15.2.3.1). Author: christine@netscape.com Date: 30 september 1997 */ var VERSION = "ECMA_2" startTest(); var SECTION = "15.6.4-2"; writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object"); new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.7.3.js0000644000175000017500000000501411545150464021631 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.js 15.7.3 Properties of the Number Constructor Description: The value of the internal [[Prototype]] property of the Number constructor is the Function prototype object. The Number constructor also has the internal [[Call]] and [[Construct]] properties, and the length property. Other properties are in subsequent tests. Author: christine@netscape.com Date: 29 september 1997 */ var SECTION = "15.7.3"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Properties of the Number Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase(SECTION, "Number.__proto__", Function.prototype, Number.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.7.4.js0000644000175000017500000000721311545150464021635 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.4.js ECMA Section: 15.7.4 Description: The Number prototype object is itself a Number object (its [[Class]] is "Number") whose value is +0. The value of the internal [[Prototype]] property of the Number prototype object is the Object prototype object (15.2.3.1). In following descriptions of functions that are properties of the Number prototype object, the phrase "this Number object" refers to the object that is the this value for the invocation of the function; it is an error if this does not refer to an object for which the value of the internal [[Class]] property is "Number". Also, the phrase "this number value" refers to the number value represented by this Number object, that is, the value of the internal [[Value]] property of this Number object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.7.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Number Prototype Object"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()", "[object Number]", eval("Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()") ); new TestCase( SECTION, "typeof Number.prototype", "object", typeof Number.prototype ); new TestCase( SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() ); // The __proto__ property cannot be used in ECMA_1 tests. // new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ ); // new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.8-1.js0000644000175000017500000000567411545150464021643 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8-1.js ECMA Section: 15.8 The Math Object Description: The Math object is merely a single object that has some named properties, some of which are functions. The value of the internal [[Prototype]] property of the Math object is the Object prototype object (15.2.3.1). The Math object does not have a [[Construct]] property; it is not possible to use the Math object as a constructor with the new operator. The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a function. Recall that, in this specification, the phrase "the number value for x" has a technical meaning defined in section 8.5. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.8-1"; var VERSION = "ECMA_2"; startTest(); var TITLE = "The Math Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.__proto__ == Object.prototype", true, Math.__proto__ == Object.prototype ); new TestCase( SECTION, "Math.__proto__", Object.prototype, Math.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/15.9.5.js0000644000175000017500000000604311545150464021640 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.9.5.js ECMA Section: 15.9.5 Properties of the Date prototype object Description: The Date prototype object is itself a Date object (its [[Class]] is "Date") whose value is NaN. The value of the internal [[Prototype]] property of the Date prototype object is the Object prototype object (15.2.3.1). In following descriptions of functions that are properties of the Date prototype object, the phrase "this Date object" refers to the object that is the this value for the invocation of the function; it is an error if this does not refer to an object for which the value of the internal [[Class]] property is "Date". Also, the phrase "this time value" refers to the number value for the time represented by this Date object, that is, the value of the internal [[Value]] property of this Date object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.9.5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Date Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Date.prototype.__proto__ == Object.prototype", true, Date.prototype.__proto__ == Object.prototype ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/8.6.2.1-1.js0000644000175000017500000001120211545150464022042 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 8.6.2.1-1.js ECMA Section: 8.6.2.1 Get (Value) Description: When the [[Get]] method of O is called with property name P, the following steps are taken: 1. If O doesn't have a property with name P, go to step 4. 2. Get the value of the property. 3. Return Result(2). 4. If the [[Prototype]] of O is null, return undefined. 5. Call the [[Get]] method of [[Prototype]] with property name P. 6. Return Result(5). This tests [[Get]] (Value). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "8.6.2.1-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " [[Get]] (Value)"); new TestCase( SECTION, "var OBJ = new MyValuelessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyValuelessObject(true); OBJ.valueOf()") ); // new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(true); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") ); new TestCase( SECTION, "var OBJ = new MyProtolessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyProtolessObject(true); OBJ.valueOf()") ); new TestCase( SECTION, "var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") ); // new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(Number.POSITIVE_INFINITY); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") ); new TestCase( SECTION, "var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") ); new TestCase( SECTION, "var OBJ = new MyValuelessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyValuelessObject('string'); OBJ.valueOf()") ); // new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject('string'); OJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") ); new TestCase( SECTION, "var OBJ = new MyProtolessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyProtolessObject('string'); OBJ.valueOf()") ); test(); function MyProtoValuelessObject(value) { this.valueOf = new Function ( "" ); this.__proto__ = null; } function MyProtolessObject( value ) { this.valueOf = new Function( "return this.value" ); this.__proto__ = null; this.value = value; } function MyValuelessObject(value) { this.__proto__ = new MyPrototypeObject(value); } function MyPrototypeObject(value) { this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return (this.value + '');" ); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/9.9-1.js0000644000175000017500000001075511545150464021563 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.9-1.js ECMA Section: 9.9 Type Conversion: ToObject Description: undefined generate a runtime error null generate a runtime error boolean create a new Boolean object whose default value is the value of the boolean. number Create a new Number object whose default value is the value of the number. string Create a new String object whose default value is the value of the string. object Return the input argument (no conversion). Author: christine@netscape.com Date: 17 july 1997 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "9.9-1"; writeHeaderToLog( SECTION + " Type Conversion: ToObject" ); new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ ); new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ ); new TestCase( SECTION, "(Object(0)).__proto__", Number.prototype, (Object(0)).__proto__ ); new TestCase( SECTION, "(Object(-0)).__proto__", Number.prototype, (Object(-0)).__proto__ ); new TestCase( SECTION, "(Object(1)).__proto__", Number.prototype, (Object(1)).__proto__ ); new TestCase( SECTION, "(Object(-1)).__proto__", Number.prototype, (Object(-1)).__proto__ ); new TestCase( SECTION, "(Object(Number.MAX_VALUE)).__proto__", Number.prototype, (Object(Number.MAX_VALUE)).__proto__ ); new TestCase( SECTION, "(Object(Number.MIN_VALUE)).__proto__", Number.prototype, (Object(Number.MIN_VALUE)).__proto__ ); new TestCase( SECTION, "(Object(Number.POSITIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.POSITIVE_INFINITY)).__proto__ ); new TestCase( SECTION, "(Object(Number.NEGATIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.NEGATIVE_INFINITY)).__proto__ ); new TestCase( SECTION, "(Object(Number.NaN)).__proto__", Number.prototype, (Object(Number.NaN)).__proto__ ); new TestCase( SECTION, "(Object('a string')).__proto__", String.prototype, (Object("a string")).__proto__ ); new TestCase( SECTION, "(Object('')).__proto__", String.prototype, (Object("")).__proto__ ); new TestCase( SECTION, "(Object('\\r\\t\\b\\n\\v\\f')).__proto__", String.prototype, (Object("\\r\\t\\b\\n\\v\\f")).__proto__ ); new TestCase( SECTION, "Object( '\\\'\\\"\\' ).__proto__", String.prototype, (Object("\'\"\\")).__proto__ ); new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function ( "return this.value" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/browser.js0000644000175000017500000000000011545150464022547 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/jstests.list0000644000175000017500000000130011545150464023126 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/extensions/ script 10.1.4-9.js script 10.1.6.js script 10.1.8-1.js script 11.6.1-1.js script 11.6.1-2.js script 11.6.1-3.js script 11.6.2-1.js script 15-1.js script 15-2.js script 15.1.2.1-1.js script 15.2.1.1.js script 15.2.3-1.js script 15.2.4.js script 15.3.1.1-1.js script 15.3.1.1-2.js script 15.3.2.1-1.js script 15.3.2.1-2.js script 15.3.3.1-1.js script 15.4.3.js script 15.5.3.js script 15.5.4.2.js script 15.5.4.4-4.js script 15.5.4.5-6.js script 15.5.4.7-3.js script 15.6.3.1-5.js script 15.6.3.js script 15.6.4-2.js script 15.7.3.js script 15.7.4.js script 15.8-1.js script 15.9.5.js script 8.6.2.1-1.js script 9.9-1.js skip script trapflatclosure.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/shell.js0000644000175000017500000000000011545150464022173 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/extensions/trapflatclosure.js0000644000175000017500000000101311545150464024303 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var BUGNUMBER = 549617; var summary = 'flat closure debugged via trap while still active'; var expect = "abc"; var actual = expect; function a(x, y) { return function () { return x; }; } var f = a("abc", 123); if (this.trap && this.setDebug) { setDebug(true); trap(f, "try {actual = x} catch (e) {actual = e}"); } f(); reportCompare(expect, actual, summary); printStatus("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.1.1-1.js0000644000175000017500000001142111545150464023017 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.1.1.js ECMA Section: 15.3.1.1 The Function Constructor Called as a Function Description: When the Function function is called with some arguments p1, p2, . . . , pn, body (where n might be 0, that is, there are no "p" arguments, and where body might also not be provided), the following steps are taken: 1. Create and return a new Function object exactly if the function constructor had been called with the same arguments (15.3.2.1). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.1.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); var MyObject = Function( "value", "this.value = value; this.valueOf = Function( 'return this.value' ); this.toString = Function( 'return String(this.value);' )" ); var myfunc = Function(); myfunc.toString = Object.prototype.toString; // not going to test toString here since it is implementation dependent. // new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() ); myfunc.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc = Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc.toString() ); new TestCase( SECTION, "myfunc.length", 0, myfunc.length ); new TestCase( SECTION, "myfunc.prototype.toString()", "[object Object]", myfunc.prototype.toString() ); new TestCase( SECTION, "myfunc.prototype.constructor", myfunc, myfunc.prototype.constructor ); new TestCase( SECTION, "myfunc.arguments", null, myfunc.arguments ); new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") ); new TestCase( SECTION, "OBJ.toString()", "true", OBJ.toString() ); new TestCase( SECTION, "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]", eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") ); new TestCase( SECTION, "MyObject.toString = Object.prototype.toString; MyObject.toString()", "[object Function]", eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") ); new TestCase( SECTION, "MyObject.length", 1, MyObject.length ); new TestCase( SECTION, "MyObject.prototype.constructor", MyObject, MyObject.prototype.constructor ); new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.1.1-2.js0000644000175000017500000001443511545150464023030 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.1.1-2.js ECMA Section: 15.3.1.1 The Function Constructor Called as a Function Function(p1, p2, ..., pn, body ) Description: When the Function function is called with some arguments p1, p2, . . . , pn, body (where n might be 0, that is, there are no "p" arguments, and where body might also not be provided), the following steps are taken: 1. Create and return a new Function object exactly if the function constructor had been called with the same arguments (15.3.2.1). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.1.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); var myfunc1 = Function("a","b","c", "return a+b+c" ); var myfunc2 = Function("a, b, c", "return a+b+c" ); var myfunc3 = Function("a,b", "c", "return a+b+c" ); myfunc1.toString = Object.prototype.toString; myfunc2.toString = Object.prototype.toString; myfunc3.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc1 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc1.toString() ); new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length ); new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() ); new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor ); new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments ); new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") ); new TestCase( SECTION, "myfunc2 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc2.toString() ); new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length ); new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() ); new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor ); new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments ); new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") ); new TestCase( SECTION, "myfunc3 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc3.toString() ); new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length ); new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() ); new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' ); new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor ); new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments ); new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.1.1-3.js0000644000175000017500000000762411545150464023033 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.1.1-3.js ECMA Section: 15.3.1.1 The Function Constructor Called as a Function new Function(p1, p2, ..., pn, body ) Description: The last argument specifies the body (executable code) of a function; any preceding arguments sepcify formal parameters. See the text for description of this section. This test examples from the specification. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.1.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); var args = ""; for ( var i = 0; i < 2000; i++ ) { args += "arg"+i; if ( i != 1999 ) { args += ","; } } var s = ""; for ( var i = 0; i < 2000; i++ ) { s += ".0005"; if ( i != 1999 ) { s += ","; } } MyFunc = Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r"); MyObject = Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };"); var MY_OB = eval( "MyFunc("+ s +")" ); new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length ); new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, MY_OB ); new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") ); new TestCase( SECTION, "MyObject.length", 2000, MyObject.length ); new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") ); new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()") ); new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.2.1-1.js0000644000175000017500000001062611545150464023026 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.2.1.js ECMA Section: 15.3.2.1 The Function Constructor new Function(p1, p2, ..., pn, body ) Description: The last argument specifies the body (executable code) of a function; any preceding arguments sepcify formal parameters. See the text for description of this section. This test examples from the specification. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.2.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); var MyObject = new Function( "value", "this.value = value; this.valueOf = new Function( 'return this.value' ); this.toString = new Function( 'return String(this.value);' )" ); var myfunc = new Function(); // not going to test toString here since it is implementation dependent. // new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() ); myfunc.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc = new Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc.toString() ); new TestCase( SECTION, "myfunc.length", 0, myfunc.length ); new TestCase( SECTION, "myfunc.prototype.toString()", "[object Object]", myfunc.prototype.toString() ); new TestCase( SECTION, "myfunc.prototype.constructor", myfunc, myfunc.prototype.constructor ); new TestCase( SECTION, "myfunc.arguments", null, myfunc.arguments ); new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") ); new TestCase( SECTION, "OBJ.toString()", "true", OBJ.toString() ); new TestCase( SECTION, "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]", eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") ); new TestCase( SECTION, "MyObject.toString = Object.prototype.toString; MyObject.toString()", "[object Function]", eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") ); new TestCase( SECTION, "MyObject.length", 1, MyObject.length ); new TestCase( SECTION, "MyObject.prototype.constructor", MyObject, MyObject.prototype.constructor ); new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.2.1-2.js0000644000175000017500000001302211545150464023020 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.2.1.js ECMA Section: 15.3.2.1 The Function Constructor new Function(p1, p2, ..., pn, body ) Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); var myfunc1 = new Function("a","b","c", "return a+b+c" ); var myfunc2 = new Function("a, b, c", "return a+b+c" ); var myfunc3 = new Function("a,b", "c", "return a+b+c" ); myfunc1.toString = Object.prototype.toString; myfunc2.toString = Object.prototype.toString; myfunc3.toString = Object.prototype.toString; new TestCase( SECTION, "myfunc1 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc1.toString() ); new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length ); new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() ); new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor ); new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments ); new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") ); new TestCase( SECTION, "myfunc2 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc2.toString() ); new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length ); new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() ); new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor ); new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments ); new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") ); new TestCase( SECTION, "myfunc3 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", myfunc3.toString() ); new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length ); new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() ); new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' ); new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor ); new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments ); new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) ); new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS", "", eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.2.1-3.js0000644000175000017500000000741411545150464023031 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.2.1-3.js ECMA Section: 15.3.2.1 The Function Constructor new Function(p1, p2, ..., pn, body ) Description: The last argument specifies the body (executable code) of a function; any preceding arguments sepcify formal parameters. See the text for description of this section. This test examples from the specification. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.2.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Function Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); var args = ""; for ( var i = 0; i < 2000; i++ ) { args += "arg"+i; if ( i != 1999 ) { args += ","; } } var s = ""; for ( var i = 0; i < 2000; i++ ) { s += ".0005"; if ( i != 1999 ) { s += ","; } } MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r"); MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };"); new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length ); new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") ); new TestCase( SECTION, "MyObject.length", 2000, MyObject.length ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.3.1-2.js0000644000175000017500000000506011545150464023024 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.3.1-2.js ECMA Section: 15.3.3.1 Properties of the Function Constructor Function.prototype Description: The initial value of Function.prototype is the built-in Function prototype object. This property shall have the attributes [DontEnum | DontDelete | ReadOnly] This test the DontEnum property of Function.prototype. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var str='';for (prop in Function ) str += prop; str;", "", eval("var str='';for (prop in Function) str += prop; str;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.3.1-3.js0000644000175000017500000000526511545150464023034 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.3.1-3.js ECMA Section: 15.3.3.1 Properties of the Function Constructor Function.prototype Description: The initial value of Function.prototype is the built-in Function prototype object. This property shall have the attributes [DontEnum | DontDelete | ReadOnly] This test the DontDelete property of Function.prototype. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.3.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); var FUN_PROTO = Function.prototype; new TestCase( SECTION, "delete Function.prototype", false, delete Function.prototype ); new TestCase( SECTION, "delete Function.prototype; Function.prototype", FUN_PROTO, eval("delete Function.prototype; Function.prototype") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.3.1-4.js0000644000175000017500000000506311545150464023031 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.3.1-4.js ECMA Section: 15.3.3.1 Properties of the Function Constructor Function.prototype Description: The initial value of Function.prototype is the built-in Function prototype object. This property shall have the attributes [DontEnum | DontDelete | ReadOnly] This test the ReadOnly property of Function.prototype. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.3.1-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Function.prototype = null; Function.prototype", Function.prototype, eval("Function.prototype = null; Function.prototype") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.3.2.js0000644000175000017500000000441111545150464022665 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.3.2.js ECMA Section: 15.3.3.2 Properties of the Function Constructor Function.length Description: The length property is 1. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.3.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.length"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Function.length", 1, Function.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.4-1.js0000644000175000017500000000700511545150464022666 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.4-1.js ECMA Section: 15.3.4 Properties of the Function Prototype Object Description: The Function prototype object is itself a Function object ( its [[Class]] is "Function") that, when invoked, accepts any arguments and returns undefined. The value of the internal [[Prototype]] property object is the Object prototype object. It is a function with an "empty body"; if it is invoked, it merely returns undefined. The Function prototype object does not have a valueOf property of its own; however it inherits the valueOf property from the Object prototype Object. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Function Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()")); // new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ ); new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf ); new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() ); new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.4.1.js0000644000175000017500000000454311545150464022673 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.4.1.js ECMA Section: 15.3.4.1 Function.prototype.constructor Description: The initial value of Function.prototype.constructor is the built-in Function constructor. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.prototype.constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Function.prototype.constructor", Function, Function.prototype.constructor ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.4.js0000644000175000017500000000666111545150464022537 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.4.js ECMA Section: 15.3.4 Properties of the Function Prototype Object Description: The Function prototype object is itself a Function object ( its [[Class]] is "Function") that, when invoked, accepts any arguments and returns undefined. The value of the internal [[Prototype]] property object is the Object prototype object. It is a function with an "empty body"; if it is invoked, it merely returns undefined. The Function prototype object does not have a valueOf property of its own; however it inherits the valueOf property from the Object prototype Object. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Function Prototype Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()", "[object Function]", eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()")); // new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ ); new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf ); new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() ); new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.5-1.js0000644000175000017500000001167511545150464022677 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.5-1.js ECMA Section: 15.3.5 Properties of Function Instances new Function(p1, p2, ..., pn, body ) Description: 15.3.5.1 length The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function. However, the language permits the function to be invoked with some other number of arguments. The behavior of a function when invoked on a number of arguments other than the number specified by its length property depends on the function. 15.3.5.2 prototype The value of the prototype property is used to initialize the internal [[ Prototype]] property of a newly created object before the Function object is invoked as a constructor for that newly created object. 15.3.5.3 arguments The value of the arguments property is normally null if there is no outstanding invocation of the function in progress (that is, the function has been called but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its arguments property is "dynamically bound" to a newly created object that contains the arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this property is discouraged; it is provided principally for compatibility with existing old code. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of Function Instances"; writeHeaderToLog( SECTION + " "+TITLE); var args = ""; for ( var i = 0; i < 2000; i++ ) { args += "arg"+i; if ( i != 1999 ) { args += ","; } } var s = ""; for ( var i = 0; i < 2000; i++ ) { s += ".0005"; if ( i != 1999 ) { s += ","; } } MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r"); MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };"); new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length ); new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") ); new TestCase( SECTION, "MyFunc.prototype.toString()", "[object Object]", MyFunc.prototype.toString() ); new TestCase( SECTION, "typeof MyFunc.prototype", "object", typeof MyFunc.prototype ); new TestCase( SECTION, "MyObject.length", 2000, MyObject.length ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") ); new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.5-2.js0000644000175000017500000000765611545150464022704 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.5-1.js ECMA Section: 15.3.5 Properties of Function Instances new Function(p1, p2, ..., pn, body ) Description: 15.3.5.1 length The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function. However, the language permits the function to be invoked with some other number of arguments. The behavior of a function when invoked on a number of arguments other than the number specified by its length property depends on the function. 15.3.5.2 prototype The value of the prototype property is used to initialize the internal [[ Prototype]] property of a newly created object before the Function object is invoked as a constructor for that newly created object. 15.3.5.3 arguments The value of the arguments property is normally null if there is no outstanding invocation of the function in progress (that is, the function has been called but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its arguments property is "dynamically bound" to a newly created object that contains the arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this property is discouraged; it is provided principally for compatibility with existing old code. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.3.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of Function Instances"; writeHeaderToLog( SECTION + " "+TITLE); var MyObject = new Function( 'a', 'b', 'c', 'this.a = a; this.b = b; this.c = c; this.value = a+b+c; this.valueOf = new Function( "return this.value" )' ); new TestCase( SECTION, "MyObject.length", 3, MyObject.length ); new TestCase( SECTION, "typeof MyObject.prototype", "object", typeof MyObject.prototype ); new TestCase( SECTION, "typeof MyObject.prototype.constructor", "function", typeof MyObject.prototype.constructor ); new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.5.1.js0000644000175000017500000000564511545150464022700 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.5.1.js ECMA Section: Function.length Description: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function. However, the language permits the function to be invoked with some other number of arguments. The behavior of a function when invoked on a number of arguments other than the number specified by its length property depends on the function. this test needs a 1.2 version check. http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.3.5.1"; var VERSION = "ECMA_1"; var TITLE = "Function.length"; var BUGNUMBER="104204"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var f = new Function( "a","b", "c", "return f.length"); new TestCase( SECTION, 'var f = new Function( "a","b", "c", "return f.length"); f()', 3, f() ); new TestCase( SECTION, 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)', 3, f(1,2,3,4,5) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/15.3.5.3.js0000644000175000017500000000562211545150464022675 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.5.3.js ECMA Section: Function.arguments Description: The value of the arguments property is normally null if there is no outstanding invocation of the function in progress (that is, the function has been called but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its arguments property is "dynamically bound" to a newly created object that contains the arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this property is discouraged; it is provided principally for compatibility with existing old code. See sections 10.1.6 and 10.1.8 for more extensive tests. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.3.5.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Function.arguments"; writeHeaderToLog( SECTION + " "+ TITLE); var MYFUNCTION = new Function( "return this.arguments" ); new TestCase( SECTION, "var MYFUNCTION = new Function( 'return this.arguments' ); MYFUNCTION.arguments", null, MYFUNCTION.arguments ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/browser.js0000644000175000017500000000000011545150464023447 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/jstests.list0000644000175000017500000000061611545150464024037 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/FunctionObjects/ script 15.3.1.1-1.js script 15.3.1.1-2.js script 15.3.1.1-3.js script 15.3.2.1-1.js script 15.3.2.1-2.js script 15.3.2.1-3.js script 15.3.3.1-2.js script 15.3.3.1-3.js script 15.3.3.1-4.js script 15.3.3.2.js script 15.3.4-1.js script 15.3.4.1.js script 15.3.4.js script 15.3.5-1.js script 15.3.5-2.js script 15.3.5.1.js script 15.3.5.3.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/FunctionObjects/shell.js0000644000175000017500000000000011545150464023073 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1-1-n.js0000644000175000017500000000466611545150464022217 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1-1-n.js ECMA Section: The global object Description: The global object does not have a [[Construct]] property; it is not possible to use the global object as a constructor with the new operator. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.1-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Global Object"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var MY_GLOBAL = new this()"; EXPECTED = "error"; new TestCase( SECTION, "var MY_GLOBAL = new this()", "error", eval("var MY_GLOBAL = new this()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1-2-n.js0000644000175000017500000000461411545150464022211 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1-2-n.js ECMA Section: The global object Description: The global object does not have a [[Call]] property; it is not possible to invoke the global object as a function. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.1-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Global Object"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var MY_GLOBAL = this()"; EXPECTED = "error"; new TestCase( SECTION, "var MY_GLOBAL = this()", "error", eval("var MY_GLOBAL = this()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.1.1.js0000644000175000017500000000453511545150464022117 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.1.1.js ECMA Section: 15.1.1.1 NaN Description: The initial value of NaN is NaN. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.1.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "NaN"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "NaN", Number.NaN, NaN ); new TestCase( SECTION, "this.NaN", Number.NaN, this.NaN ); new TestCase( SECTION, "typeof NaN", "number", typeof NaN ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.1.2.js0000644000175000017500000000467411545150464022124 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.1.2.js ECMA Section: 15.1.1.2 Infinity Description: The initial value of Infinity is +Infinity. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.1.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Infinity"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Infinity", Number.POSITIVE_INFINITY, Infinity ); new TestCase( SECTION, "this.Infinity", Number.POSITIVE_INFINITY, this.Infinity ); new TestCase( SECTION, "typeof Infinity", "number", typeof Infinity ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.2.1-2.js0000644000175000017500000000511511545150464022252 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.1-2.js ECMA Section: 15.1.2.1 eval(x) Parse x as an ECMAScript Program. If the parse fails, generate a runtime error. Evaluate the program. If result is "Normal completion after value V", return the value V. Else, return undefined. Description: Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.1.2.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "eval(x)"; var BUGNUMBER = "none"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x", "0/1/1970", eval( "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x" )); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.2.2-1.js0000644000175000017500000003555611545150464022266 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.2-1.js ECMA Section: 15.1.2.2 Function properties of the global object parseInt( string, radix ) Description: The parseInt function produces an integer value dictated by intepretation of the contents of the string argument according to the specified radix. When the parseInt function is called, the following steps are taken: 1. Call ToString(string). 2. Compute a substring of Result(1) consisting of the leftmost character that is not a StrWhiteSpaceChar and all characters to the right of that character. (In other words, remove leading whitespace.) 3. Let sign be 1. 4. If Result(2) is not empty and the first character of Result(2) is a minus sign -, let sign be -1. 5. If Result(2) is not empty and the first character of Result(2) is a plus sign + or a minus sign -, then Result(5) is the substring of Result(2) produced by removing the first character; otherwise, Result(5) is Result(2). 6. If the radix argument is not supplied, go to step 12. 7. Call ToInt32(radix). 8. If Result(7) is zero, go to step 12; otherwise, if Result(7) < 2 or Result(7) > 36, return NaN. 9. Let R be Result(7). 10. If R = 16 and the length of Result(5) is at least 2 and the first two characters of Result(5) are either "0x" or "0X", let S be the substring of Result(5) consisting of all but the first two characters; otherwise, let S be Result(5). 11. Go to step 22. 12. If Result(5) is empty or the first character of Result(5) is not 0, go to step 20. 13. If the length of Result(5) is at least 2 and the second character of Result(5) is x or X, go to step 17. 14. Let R be 8. 15. Let S be Result(5). 16. Go to step 22. 17. Let R be 16. 18. Let S be the substring of Result(5) consisting of all but the first two characters. 19. Go to step 22. 20. Let R be 10. 21. Let S be Result(5). 22. If S contains any character that is not a radix-R digit, then let Z be the substring of S consisting of all characters to the left of the leftmost such character; otherwise, let Z be S. 23. If Z is empty, return NaN. 24. Compute the mathematical integer value that is represented by Z in radix-R notation. (But if R is 10 and Z contains more than 20 significant digits, every digit after the 20th may be replaced by a 0 digit, at the option of the implementation; and if R is not 2, 4, 8, 10, 16, or 32, then Result(24) may be an implementation-dependent approximation to the mathematical integer value that is represented by Z in radix-R notation.) 25. Compute the number value for Result(24). 26. Return sign Result(25). Note that parseInt may interpret only a leading portion of the string as an integer value; it ignores any characters that cannot be interpreted as part of the notation of an integer, and no indication is given that any such characters were ignored. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.2-1"; var VERSION = "ECMA_1"; var TITLE = "parseInt(string, radix)"; var BUGNUMBER = "none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var HEX_STRING = "0x0"; var HEX_VALUE = 0; new TestCase( SECTION, "parseInt.length", 2, parseInt.length ); new TestCase( SECTION, "parseInt.length = 0; parseInt.length", 2, eval("parseInt.length = 0; parseInt.length") ); new TestCase( SECTION, "var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS", "", eval("var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS") ); new TestCase( SECTION, "delete parseInt.length", false, delete parseInt.length ); new TestCase( SECTION, "delete parseInt.length; parseInt.length", 2, eval("delete parseInt.length; parseInt.length") ); new TestCase( SECTION, "parseInt.length = null; parseInt.length", 2, eval("parseInt.length = null; parseInt.length") ); new TestCase( SECTION, "parseInt()", NaN, parseInt() ); new TestCase( SECTION, "parseInt('')", NaN, parseInt("") ); new TestCase( SECTION, "parseInt('','')", NaN, parseInt("","") ); new TestCase( SECTION, "parseInt(\" 0xabcdef ", 11259375, parseInt( " 0xabcdef " )); new TestCase( SECTION, "parseInt(\" 0XABCDEF ", 11259375, parseInt( " 0XABCDEF " ) ); new TestCase( SECTION, "parseInt( 0xabcdef )", 11259375, parseInt( "0xabcdef") ); new TestCase( SECTION, "parseInt( 0XABCDEF )", 11259375, parseInt( "0XABCDEF") ); for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+",null)", HEX_VALUE, parseInt(HEX_STRING,null) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+", void 0)", HEX_VALUE, parseInt(HEX_STRING, void 0) ); HEX_VALUE += Math.pow(16,POWER)*15; } // a few tests with spaces for ( var space = " ", HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f", space += " ") { new TestCase( SECTION, "parseInt("+space+HEX_STRING+space+", void 0)", HEX_VALUE, parseInt(space+HEX_STRING+space, void 0) ); HEX_VALUE += Math.pow(16,POWER)*15; } new TestCase(SECTION, "parseInt(BOM + '123', 10)", 123, parseInt("\uFEFF" + "123", 10)); // a few tests with negative numbers for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); HEX_VALUE -= Math.pow(16,POWER)*15; } // we should stop parsing when we get to a value that is not a numeric literal for the type we expect for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"g",16) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"G",16) ); HEX_VALUE += Math.pow(16,POWER)*15; } for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); HEX_VALUE -= Math.pow(16,POWER)*15; } for ( HEX_STRING = "-0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) ); HEX_VALUE -= Math.pow(16,POWER)*15; } for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); HEX_VALUE -= Math.pow(16,POWER)*15; } for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) { new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) ); HEX_VALUE -= Math.pow(16,POWER)*15; } // let us do some octal tests. numbers that start with 0 and do not provid a radix should // default to using "0" as a radix. var OCT_STRING = "0"; var OCT_VALUE = 0; for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) ); OCT_VALUE += Math.pow(8,POWER)*7; } for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) ); OCT_VALUE -= Math.pow(8,POWER)*7; } // should get the same results as above if we provid the radix of 8 (or 010) for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+",8)", OCT_VALUE, parseInt(OCT_STRING,8) ); OCT_VALUE += Math.pow(8,POWER)*7; } for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+",010)", OCT_VALUE, parseInt(OCT_STRING,010) ); OCT_VALUE -= Math.pow(8,POWER)*7; } // we shall stop parsing digits when we get one that isn't a numeric literal of the type we think // it should be. for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+"8,8)", OCT_VALUE, parseInt(OCT_STRING+"8",8) ); OCT_VALUE += Math.pow(8,POWER)*7; } for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) { new TestCase( SECTION, "parseInt("+OCT_STRING+"8,010)", OCT_VALUE, parseInt(OCT_STRING+"8",010) ); OCT_VALUE -= Math.pow(8,POWER)*7; } new TestCase( SECTION, "parseInt( '0x' )", NaN, parseInt("0x") ); new TestCase( SECTION, "parseInt( '0X' )", NaN, parseInt("0X") ); new TestCase( SECTION, "parseInt( '11111111112222222222' )", 11111111112222222222, parseInt("11111111112222222222") ); new TestCase( SECTION, "parseInt( '111111111122222222223' )", 111111111122222222220, parseInt("111111111122222222223") ); new TestCase( SECTION, "parseInt( '11111111112222222222',10 )", 11111111112222222222, parseInt("11111111112222222222",10) ); new TestCase( SECTION, "parseInt( '111111111122222222223',10 )", 111111111122222222220, parseInt("111111111122222222223",10) ); new TestCase( SECTION, "parseInt( '01234567890', -1 )", Number.NaN, parseInt("01234567890",-1) ); new TestCase( SECTION, "parseInt( '01234567890', 0 )", Number.NaN, parseInt("01234567890",1) ); new TestCase( SECTION, "parseInt( '01234567890', 1 )", Number.NaN, parseInt("01234567890",1) ); new TestCase( SECTION, "parseInt( '01234567890', 2 )", 1, parseInt("01234567890",2) ); new TestCase( SECTION, "parseInt( '01234567890', 3 )", 5, parseInt("01234567890",3) ); new TestCase( SECTION, "parseInt( '01234567890', 4 )", 27, parseInt("01234567890",4) ); new TestCase( SECTION, "parseInt( '01234567890', 5 )", 194, parseInt("01234567890",5) ); new TestCase( SECTION, "parseInt( '01234567890', 6 )", 1865, parseInt("01234567890",6) ); new TestCase( SECTION, "parseInt( '01234567890', 7 )", 22875, parseInt("01234567890",7) ); new TestCase( SECTION, "parseInt( '01234567890', 8 )", 342391, parseInt("01234567890",8) ); new TestCase( SECTION, "parseInt( '01234567890', 9 )", 6053444, parseInt("01234567890",9) ); new TestCase( SECTION, "parseInt( '01234567890', 10 )", 1234567890, parseInt("01234567890",10) ); // need more test cases with hex radix new TestCase( SECTION, "parseInt( '1234567890', '0xa')", 1234567890, parseInt("1234567890","0xa") ); new TestCase( SECTION, "parseInt( '012345', 11 )", 17715, parseInt("012345",11) ); new TestCase( SECTION, "parseInt( '012345', 35 )", 1590195, parseInt("012345",35) ); new TestCase( SECTION, "parseInt( '012345', 36 )", 1776965, parseInt("012345",36) ); new TestCase( SECTION, "parseInt( '012345', 37 )", Number.NaN, parseInt("012345",37) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.2.2-2.js0000644000175000017500000001634511545150464022262 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.2-1.js ECMA Section: 15.1.2.2 Function properties of the global object parseInt( string, radix ) Description: parseInt test cases written by waldemar, and documented in http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123874. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.2-2"; var VERSION = "ECMA_1"; var TITLE = "parseInt(string, radix)"; var BUGNUMBER = "none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, 'parseInt("000000100000000100100011010001010110011110001001101010111100",2)', 9027215253084860, parseInt("000000100000000100100011010001010110011110001001101010111100",2) ); new TestCase( SECTION, 'parseInt("000000100000000100100011010001010110011110001001101010111101",2)', 9027215253084860, parseInt("000000100000000100100011010001010110011110001001101010111101",2)); new TestCase( SECTION, 'parseInt("000000100000000100100011010001010110011110001001101010111111",2)', 9027215253084864, parseInt("000000100000000100100011010001010110011110001001101010111111",2) ); new TestCase( SECTION, 'parseInt("0000001000000001001000110100010101100111100010011010101111010",2)', 18054430506169720, parseInt("0000001000000001001000110100010101100111100010011010101111010",2) ); new TestCase( SECTION, 'parseInt("0000001000000001001000110100010101100111100010011010101111011",2)', 18054430506169724, parseInt("0000001000000001001000110100010101100111100010011010101111011",2)); new TestCase( SECTION, 'parseInt("0000001000000001001000110100010101100111100010011010101111100",2)', 18054430506169724, parseInt("0000001000000001001000110100010101100111100010011010101111100",2) ); new TestCase( SECTION, 'parseInt("0000001000000001001000110100010101100111100010011010101111110",2)', 18054430506169728, parseInt("0000001000000001001000110100010101100111100010011010101111110",2) ); new TestCase( SECTION, 'parseInt("yz",35)', 34, parseInt("yz",35) ); new TestCase( SECTION, 'parseInt("yz",36)', 1259, parseInt("yz",36) ); new TestCase( SECTION, 'parseInt("yz",37)', NaN, parseInt("yz",37) ); new TestCase( SECTION, 'parseInt("+77")', 77, parseInt("+77") ); new TestCase( SECTION, 'parseInt("-77",9)', -70, parseInt("-77",9) ); new TestCase( SECTION, 'parseInt("\u20001234\u2000")', 1234, parseInt("\u20001234\u2000") ); new TestCase( SECTION, 'parseInt("123456789012345678")', 123456789012345680, parseInt("123456789012345678") ); new TestCase( SECTION, 'parseInt("9",8)', NaN, parseInt("9",8) ); new TestCase( SECTION, 'parseInt("1e2")', 1, parseInt("1e2") ); new TestCase( SECTION, 'parseInt("1.9999999999999999999")', 1, parseInt("1.9999999999999999999") ); new TestCase( SECTION, 'parseInt("0x10")', 16, parseInt("0x10") ); new TestCase( SECTION, 'parseInt("0x10",10)', 0, parseInt("0x10",10)); new TestCase( SECTION, 'parseInt("0022")', 18, parseInt("0022")); new TestCase( SECTION, 'parseInt("0022",10)', 22, parseInt("0022",10) ); new TestCase( SECTION, 'parseInt("0x1000000000000080")', 1152921504606847000, parseInt("0x1000000000000080") ); new TestCase( SECTION, 'parseInt("0x1000000000000081")', 1152921504606847200, parseInt("0x1000000000000081") ); s = "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" s += "0000000000000000000000000000000000000"; new TestCase( SECTION, "s = " + s +"; -s", -1.7976931348623157e+308, -s ); s = "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; s += "0000000000000000000000000000000000001"; new TestCase( SECTION, "s = " + s +"; -s", -1.7976931348623157e+308, -s ); s = "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; s += "0000000000000000000000000000000000000" new TestCase( SECTION, "s = " + s + "; -s", -Infinity, -s ); s = "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; s += "0000000000000000000000000000000000001"; new TestCase( SECTION, "s = " + s + "; -s", -1.7976931348623157e+308, -s ); s += "0" new TestCase( SECTION, "s = " + s + "; -s", -Infinity, -s ); new TestCase( SECTION, 'parseInt(s)', Infinity, parseInt(s) ); new TestCase( SECTION, 'parseInt(s,32)', 0, parseInt(s,32) ); new TestCase( SECTION, 'parseInt(s,36)', Infinity, parseInt(s,36)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.2.3-1.js0000644000175000017500000006333011545150464022256 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.3.js ECMA Section: 15.1.2.3 Function properties of the global object: parseFloat( string ) Description: The parseFloat function produces a number value dictated by the interpretation of the contents of the string argument defined as a decimal literal. When the parseFloat function is called, the following steps are taken: 1. Call ToString( string ). 2. Remove leading whitespace Result(1). 3. If neither Result(2) nor any prefix of Result(2) satisfies the syntax of a StrDecimalLiteral, return NaN. 4. Compute the longest prefix of Result(2) which might be Resusult(2) itself, that satisfies the syntax of a StrDecimalLiteral 5. Return the number value for the MV of Result(4). Note that parseFloate may interpret only a leading portion of the string as a number value; it ignores any characters that cannot be interpreted as part of the notation of a decimal literal, and no indication is given that such characters were ignored. StrDecimalLiteral:: Infinity DecimalDigits.DecimalDigits opt ExponentPart opt .DecimalDigits ExponentPart opt DecimalDigits ExponentPart opt Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.3-1"; var VERSION = "ECMA_1"; var TITLE = "parseFloat(string)"; var BUGNUMBER="none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "parseFloat.length", 1, parseFloat.length ); new TestCase( SECTION, "parseFloat.length = null; parseFloat.length", 1, eval("parseFloat.length = null; parseFloat.length") ); new TestCase( SECTION, "delete parseFloat.length", false, delete parseFloat.length ); new TestCase( SECTION, "delete parseFloat.length; parseFloat.length", 1, eval("delete parseFloat.length; parseFloat.length") ); new TestCase( SECTION, "var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS") ); new TestCase( SECTION, "parseFloat()", Number.NaN, parseFloat() ); new TestCase( SECTION, "parseFloat('')", Number.NaN, parseFloat('') ); new TestCase( SECTION, "parseFloat(' ')", Number.NaN, parseFloat(' ') ); new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) ); new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) ); new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") ); new TestCase( SECTION, "parseFloat(' Infinity')", Infinity, parseFloat("Infinity") ); new TestCase( SECTION, "parseFloat(' Infinity ')", Infinity, parseFloat(' Infinity ') ); new TestCase( SECTION, "parseFloat('Infinity')", Infinity, parseFloat("Infinity") ); new TestCase( SECTION, "parseFloat(Infinity)", Infinity, parseFloat(Infinity) ); new TestCase( SECTION, "parseFloat(' +Infinity')", +Infinity, parseFloat("+Infinity") ); new TestCase( SECTION, "parseFloat(' -Infinity ')", -Infinity, parseFloat(' -Infinity ') ); new TestCase( SECTION, "parseFloat('+Infinity')", +Infinity, parseFloat("+Infinity") ); new TestCase( SECTION, "parseFloat(-Infinity)", -Infinity, parseFloat(-Infinity) ); new TestCase( SECTION, "parseFloat('0')", 0, parseFloat("0") ); new TestCase( SECTION, "parseFloat('-0')", -0, parseFloat("-0") ); new TestCase( SECTION, "parseFloat('+0')", 0, parseFloat("+0") ); new TestCase( SECTION, "parseFloat('1')", 1, parseFloat("1") ); new TestCase( SECTION, "parseFloat('-1')", -1, parseFloat("-1") ); new TestCase( SECTION, "parseFloat('+1')", 1, parseFloat("+1") ); new TestCase( SECTION, "parseFloat('2')", 2, parseFloat("2") ); new TestCase( SECTION, "parseFloat('-2')", -2, parseFloat("-2") ); new TestCase( SECTION, "parseFloat('+2')", 2, parseFloat("+2") ); new TestCase( SECTION, "parseFloat('3')", 3, parseFloat("3") ); new TestCase( SECTION, "parseFloat('-3')", -3, parseFloat("-3") ); new TestCase( SECTION, "parseFloat('+3')", 3, parseFloat("+3") ); new TestCase( SECTION, "parseFloat('4')", 4, parseFloat("4") ); new TestCase( SECTION, "parseFloat('-4')", -4, parseFloat("-4") ); new TestCase( SECTION, "parseFloat('+4')", 4, parseFloat("+4") ); new TestCase( SECTION, "parseFloat('5')", 5, parseFloat("5") ); new TestCase( SECTION, "parseFloat('-5')", -5, parseFloat("-5") ); new TestCase( SECTION, "parseFloat('+5')", 5, parseFloat("+5") ); new TestCase( SECTION, "parseFloat('6')", 6, parseFloat("6") ); new TestCase( SECTION, "parseFloat('-6')", -6, parseFloat("-6") ); new TestCase( SECTION, "parseFloat('+6')", 6, parseFloat("+6") ); new TestCase( SECTION, "parseFloat('7')", 7, parseFloat("7") ); new TestCase( SECTION, "parseFloat('-7')", -7, parseFloat("-7") ); new TestCase( SECTION, "parseFloat('+7')", 7, parseFloat("+7") ); new TestCase( SECTION, "parseFloat('8')", 8, parseFloat("8") ); new TestCase( SECTION, "parseFloat('-8')", -8, parseFloat("-8") ); new TestCase( SECTION, "parseFloat('+8')", 8, parseFloat("+8") ); new TestCase( SECTION, "parseFloat('9')", 9, parseFloat("9") ); new TestCase( SECTION, "parseFloat('-9')", -9, parseFloat("-9") ); new TestCase( SECTION, "parseFloat('+9')", 9, parseFloat("+9") ); new TestCase( SECTION, "parseFloat('3.14159')", 3.14159, parseFloat("3.14159") ); new TestCase( SECTION, "parseFloat('-3.14159')", -3.14159, parseFloat("-3.14159") ); new TestCase( SECTION, "parseFloat('+3.14159')", 3.14159, parseFloat("+3.14159") ); new TestCase( SECTION, "parseFloat('3.')", 3, parseFloat("3.") ); new TestCase( SECTION, "parseFloat('-3.')", -3, parseFloat("-3.") ); new TestCase( SECTION, "parseFloat('+3.')", 3, parseFloat("+3.") ); new TestCase( SECTION, "parseFloat('3.e1')", 30, parseFloat("3.e1") ); new TestCase( SECTION, "parseFloat('-3.e1')", -30, parseFloat("-3.e1") ); new TestCase( SECTION, "parseFloat('+3.e1')", 30, parseFloat("+3.e1") ); new TestCase( SECTION, "parseFloat('3.e+1')", 30, parseFloat("3.e+1") ); new TestCase( SECTION, "parseFloat('-3.e+1')", -30, parseFloat("-3.e+1") ); new TestCase( SECTION, "parseFloat('+3.e+1')", 30, parseFloat("+3.e+1") ); new TestCase( SECTION, "parseFloat('3.e-1')", .30, parseFloat("3.e-1") ); new TestCase( SECTION, "parseFloat('-3.e-1')", -.30, parseFloat("-3.e-1") ); new TestCase( SECTION, "parseFloat('+3.e-1')", .30, parseFloat("+3.e-1") ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat('.00001')", 0.00001, parseFloat(".00001") ); new TestCase( SECTION, "parseFloat('+.00001')", 0.00001, parseFloat("+.00001") ); new TestCase( SECTION, "parseFloat('-0.0001')", -0.00001, parseFloat("-.00001") ); new TestCase( SECTION, "parseFloat('.01e2')", 1, parseFloat(".01e2") ); new TestCase( SECTION, "parseFloat('+.01e2')", 1, parseFloat("+.01e2") ); new TestCase( SECTION, "parseFloat('-.01e2')", -1, parseFloat("-.01e2") ); new TestCase( SECTION, "parseFloat('.01e+2')", 1, parseFloat(".01e+2") ); new TestCase( SECTION, "parseFloat('+.01e+2')", 1, parseFloat("+.01e+2") ); new TestCase( SECTION, "parseFloat('-.01e+2')", -1, parseFloat("-.01e+2") ); new TestCase( SECTION, "parseFloat('.01e-2')", 0.0001, parseFloat(".01e-2") ); new TestCase( SECTION, "parseFloat('+.01e-2')", 0.0001, parseFloat("+.01e-2") ); new TestCase( SECTION, "parseFloat('-.01e-2')", -0.0001, parseFloat("-.01e-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat('1234e5')", 123400000, parseFloat("1234e5") ); new TestCase( SECTION, "parseFloat('+1234e5')", 123400000, parseFloat("+1234e5") ); new TestCase( SECTION, "parseFloat('-1234e5')", -123400000, parseFloat("-1234e5") ); new TestCase( SECTION, "parseFloat('1234e+5')", 123400000, parseFloat("1234e+5") ); new TestCase( SECTION, "parseFloat('+1234e+5')", 123400000, parseFloat("+1234e+5") ); new TestCase( SECTION, "parseFloat('-1234e+5')", -123400000, parseFloat("-1234e+5") ); new TestCase( SECTION, "parseFloat('1234e-5')", 0.01234, parseFloat("1234e-5") ); new TestCase( SECTION, "parseFloat('+1234e-5')", 0.01234, parseFloat("+1234e-5") ); new TestCase( SECTION, "parseFloat('-1234e-5')", -0.01234, parseFloat("-1234e-5") ); new TestCase( SECTION, "parseFloat(0)", 0, parseFloat(0) ); new TestCase( SECTION, "parseFloat(-0)", -0, parseFloat(-0) ); new TestCase( SECTION, "parseFloat(1)", 1, parseFloat(1) ); new TestCase( SECTION, "parseFloat(-1)", -1, parseFloat(-1) ); new TestCase( SECTION, "parseFloat(2)", 2, parseFloat(2) ); new TestCase( SECTION, "parseFloat(-2)", -2, parseFloat(-2) ); new TestCase( SECTION, "parseFloat(3)", 3, parseFloat(3) ); new TestCase( SECTION, "parseFloat(-3)", -3, parseFloat(-3) ); new TestCase( SECTION, "parseFloat(4)", 4, parseFloat(4) ); new TestCase( SECTION, "parseFloat(-4)", -4, parseFloat(-4) ); new TestCase( SECTION, "parseFloat(5)", 5, parseFloat(5) ); new TestCase( SECTION, "parseFloat(-5)", -5, parseFloat(-5) ); new TestCase( SECTION, "parseFloat(6)", 6, parseFloat(6) ); new TestCase( SECTION, "parseFloat(-6)", -6, parseFloat(-6) ); new TestCase( SECTION, "parseFloat(7)", 7, parseFloat(7) ); new TestCase( SECTION, "parseFloat(-7)", -7, parseFloat(-7) ); new TestCase( SECTION, "parseFloat(8)", 8, parseFloat(8) ); new TestCase( SECTION, "parseFloat(-8)", -8, parseFloat(-8) ); new TestCase( SECTION, "parseFloat(9)", 9, parseFloat(9) ); new TestCase( SECTION, "parseFloat(-9)", -9, parseFloat(-9) ); new TestCase( SECTION, "parseFloat(3.14159)", 3.14159, parseFloat(3.14159) ); new TestCase( SECTION, "parseFloat(-3.14159)", -3.14159, parseFloat(-3.14159) ); new TestCase( SECTION, "parseFloat(3.)", 3, parseFloat(3.) ); new TestCase( SECTION, "parseFloat(-3.)", -3, parseFloat(-3.) ); new TestCase( SECTION, "parseFloat(3.e1)", 30, parseFloat(3.e1) ); new TestCase( SECTION, "parseFloat(-3.e1)", -30, parseFloat(-3.e1) ); new TestCase( SECTION, "parseFloat(3.e+1)", 30, parseFloat(3.e+1) ); new TestCase( SECTION, "parseFloat(-3.e+1)", -30, parseFloat(-3.e+1) ); new TestCase( SECTION, "parseFloat(3.e-1)", .30, parseFloat(3.e-1) ); new TestCase( SECTION, "parseFloat(-3.e-1)", -.30, parseFloat(-3.e-1) ); new TestCase( SECTION, "parseFloat(3.E1)", 30, parseFloat(3.E1) ); new TestCase( SECTION, "parseFloat(-3.E1)", -30, parseFloat(-3.E1) ); new TestCase( SECTION, "parseFloat(3.E+1)", 30, parseFloat(3.E+1) ); new TestCase( SECTION, "parseFloat(-3.E+1)", -30, parseFloat(-3.E+1) ); new TestCase( SECTION, "parseFloat(3.E-1)", .30, parseFloat(3.E-1) ); new TestCase( SECTION, "parseFloat(-3.E-1)", -.30, parseFloat(-3.E-1) ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat(.00001)", 0.00001, parseFloat(.00001) ); new TestCase( SECTION, "parseFloat(-0.0001)", -0.00001, parseFloat(-.00001) ); new TestCase( SECTION, "parseFloat(.01e2)", 1, parseFloat(.01e2) ); new TestCase( SECTION, "parseFloat(-.01e2)", -1, parseFloat(-.01e2) ); new TestCase( SECTION, "parseFloat(.01e+2)", 1, parseFloat(.01e+2) ); new TestCase( SECTION, "parseFloat(-.01e+2)", -1, parseFloat(-.01e+2) ); new TestCase( SECTION, "parseFloat(.01e-2)", 0.0001, parseFloat(.01e-2) ); new TestCase( SECTION, "parseFloat(-.01e-2)", -0.0001, parseFloat(-.01e-2) ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat(1234e5)", 123400000, parseFloat(1234e5) ); new TestCase( SECTION, "parseFloat(-1234e5)", -123400000, parseFloat(-1234e5) ); new TestCase( SECTION, "parseFloat(1234e+5)", 123400000, parseFloat(1234e+5) ); new TestCase( SECTION, "parseFloat(-1234e+5)", -123400000, parseFloat(-1234e+5) ); new TestCase( SECTION, "parseFloat(1234e-5)", 0.01234, parseFloat(1234e-5) ); new TestCase( SECTION, "parseFloat(-1234e-5)", -0.01234, parseFloat(-1234e-5) ); // hex cases should all return 0 (0 is the longest string that satisfies a StringDecimalLiteral) new TestCase( SECTION, "parseFloat('0x0')", 0, parseFloat("0x0")); new TestCase( SECTION, "parseFloat('0x1')", 0, parseFloat("0x1")); new TestCase( SECTION, "parseFloat('0x2')", 0, parseFloat("0x2")); new TestCase( SECTION, "parseFloat('0x3')", 0, parseFloat("0x3")); new TestCase( SECTION, "parseFloat('0x4')", 0, parseFloat("0x4")); new TestCase( SECTION, "parseFloat('0x5')", 0, parseFloat("0x5")); new TestCase( SECTION, "parseFloat('0x6')", 0, parseFloat("0x6")); new TestCase( SECTION, "parseFloat('0x7')", 0, parseFloat("0x7")); new TestCase( SECTION, "parseFloat('0x8')", 0, parseFloat("0x8")); new TestCase( SECTION, "parseFloat('0x9')", 0, parseFloat("0x9")); new TestCase( SECTION, "parseFloat('0xa')", 0, parseFloat("0xa")); new TestCase( SECTION, "parseFloat('0xb')", 0, parseFloat("0xb")); new TestCase( SECTION, "parseFloat('0xc')", 0, parseFloat("0xc")); new TestCase( SECTION, "parseFloat('0xd')", 0, parseFloat("0xd")); new TestCase( SECTION, "parseFloat('0xe')", 0, parseFloat("0xe")); new TestCase( SECTION, "parseFloat('0xf')", 0, parseFloat("0xf")); new TestCase( SECTION, "parseFloat('0xA')", 0, parseFloat("0xA")); new TestCase( SECTION, "parseFloat('0xB')", 0, parseFloat("0xB")); new TestCase( SECTION, "parseFloat('0xC')", 0, parseFloat("0xC")); new TestCase( SECTION, "parseFloat('0xD')", 0, parseFloat("0xD")); new TestCase( SECTION, "parseFloat('0xE')", 0, parseFloat("0xE")); new TestCase( SECTION, "parseFloat('0xF')", 0, parseFloat("0xF")); new TestCase( SECTION, "parseFloat('0X0')", 0, parseFloat("0X0")); new TestCase( SECTION, "parseFloat('0X1')", 0, parseFloat("0X1")); new TestCase( SECTION, "parseFloat('0X2')", 0, parseFloat("0X2")); new TestCase( SECTION, "parseFloat('0X3')", 0, parseFloat("0X3")); new TestCase( SECTION, "parseFloat('0X4')", 0, parseFloat("0X4")); new TestCase( SECTION, "parseFloat('0X5')", 0, parseFloat("0X5")); new TestCase( SECTION, "parseFloat('0X6')", 0, parseFloat("0X6")); new TestCase( SECTION, "parseFloat('0X7')", 0, parseFloat("0X7")); new TestCase( SECTION, "parseFloat('0X8')", 0, parseFloat("0X8")); new TestCase( SECTION, "parseFloat('0X9')", 0, parseFloat("0X9")); new TestCase( SECTION, "parseFloat('0Xa')", 0, parseFloat("0Xa")); new TestCase( SECTION, "parseFloat('0Xb')", 0, parseFloat("0Xb")); new TestCase( SECTION, "parseFloat('0Xc')", 0, parseFloat("0Xc")); new TestCase( SECTION, "parseFloat('0Xd')", 0, parseFloat("0Xd")); new TestCase( SECTION, "parseFloat('0Xe')", 0, parseFloat("0Xe")); new TestCase( SECTION, "parseFloat('0Xf')", 0, parseFloat("0Xf")); new TestCase( SECTION, "parseFloat('0XA')", 0, parseFloat("0XA")); new TestCase( SECTION, "parseFloat('0XB')", 0, parseFloat("0XB")); new TestCase( SECTION, "parseFloat('0XC')", 0, parseFloat("0XC")); new TestCase( SECTION, "parseFloat('0XD')", 0, parseFloat("0XD")); new TestCase( SECTION, "parseFloat('0XE')", 0, parseFloat("0XE")); new TestCase( SECTION, "parseFloat('0XF')", 0, parseFloat("0XF")); new TestCase( SECTION, "parseFloat(' 0XF ')", 0, parseFloat(" 0XF ")); // hex literals should still succeed new TestCase( SECTION, "parseFloat(0x0)", 0, parseFloat(0x0)); new TestCase( SECTION, "parseFloat(0x1)", 1, parseFloat(0x1)); new TestCase( SECTION, "parseFloat(0x2)", 2, parseFloat(0x2)); new TestCase( SECTION, "parseFloat(0x3)", 3, parseFloat(0x3)); new TestCase( SECTION, "parseFloat(0x4)", 4, parseFloat(0x4)); new TestCase( SECTION, "parseFloat(0x5)", 5, parseFloat(0x5)); new TestCase( SECTION, "parseFloat(0x6)", 6, parseFloat(0x6)); new TestCase( SECTION, "parseFloat(0x7)", 7, parseFloat(0x7)); new TestCase( SECTION, "parseFloat(0x8)", 8, parseFloat(0x8)); new TestCase( SECTION, "parseFloat(0x9)", 9, parseFloat(0x9)); new TestCase( SECTION, "parseFloat(0xa)", 10, parseFloat(0xa)); new TestCase( SECTION, "parseFloat(0xb)", 11, parseFloat(0xb)); new TestCase( SECTION, "parseFloat(0xc)", 12, parseFloat(0xc)); new TestCase( SECTION, "parseFloat(0xd)", 13, parseFloat(0xd)); new TestCase( SECTION, "parseFloat(0xe)", 14, parseFloat(0xe)); new TestCase( SECTION, "parseFloat(0xf)", 15, parseFloat(0xf)); new TestCase( SECTION, "parseFloat(0xA)", 10, parseFloat(0xA)); new TestCase( SECTION, "parseFloat(0xB)", 11, parseFloat(0xB)); new TestCase( SECTION, "parseFloat(0xC)", 12, parseFloat(0xC)); new TestCase( SECTION, "parseFloat(0xD)", 13, parseFloat(0xD)); new TestCase( SECTION, "parseFloat(0xE)", 14, parseFloat(0xE)); new TestCase( SECTION, "parseFloat(0xF)", 15, parseFloat(0xF)); new TestCase( SECTION, "parseFloat(0X0)", 0, parseFloat(0X0)); new TestCase( SECTION, "parseFloat(0X1)", 1, parseFloat(0X1)); new TestCase( SECTION, "parseFloat(0X2)", 2, parseFloat(0X2)); new TestCase( SECTION, "parseFloat(0X3)", 3, parseFloat(0X3)); new TestCase( SECTION, "parseFloat(0X4)", 4, parseFloat(0X4)); new TestCase( SECTION, "parseFloat(0X5)", 5, parseFloat(0X5)); new TestCase( SECTION, "parseFloat(0X6)", 6, parseFloat(0X6)); new TestCase( SECTION, "parseFloat(0X7)", 7, parseFloat(0X7)); new TestCase( SECTION, "parseFloat(0X8)", 8, parseFloat(0X8)); new TestCase( SECTION, "parseFloat(0X9)", 9, parseFloat(0X9)); new TestCase( SECTION, "parseFloat(0Xa)", 10, parseFloat(0Xa)); new TestCase( SECTION, "parseFloat(0Xb)", 11, parseFloat(0Xb)); new TestCase( SECTION, "parseFloat(0Xc)", 12, parseFloat(0Xc)); new TestCase( SECTION, "parseFloat(0Xd)", 13, parseFloat(0Xd)); new TestCase( SECTION, "parseFloat(0Xe)", 14, parseFloat(0Xe)); new TestCase( SECTION, "parseFloat(0Xf)", 15, parseFloat(0Xf)); new TestCase( SECTION, "parseFloat(0XA)", 10, parseFloat(0XA)); new TestCase( SECTION, "parseFloat(0XB)", 11, parseFloat(0XB)); new TestCase( SECTION, "parseFloat(0XC)", 12, parseFloat(0XC)); new TestCase( SECTION, "parseFloat(0XD)", 13, parseFloat(0XD)); new TestCase( SECTION, "parseFloat(0XE)", 14, parseFloat(0XE)); new TestCase( SECTION, "parseFloat(0XF)", 15, parseFloat(0XF)); // A StringNumericLiteral may not use octal notation new TestCase( SECTION, "parseFloat('00')", 0, parseFloat("00")); new TestCase( SECTION, "parseFloat('01')", 1, parseFloat("01")); new TestCase( SECTION, "parseFloat('02')", 2, parseFloat("02")); new TestCase( SECTION, "parseFloat('03')", 3, parseFloat("03")); new TestCase( SECTION, "parseFloat('04')", 4, parseFloat("04")); new TestCase( SECTION, "parseFloat('05')", 5, parseFloat("05")); new TestCase( SECTION, "parseFloat('06')", 6, parseFloat("06")); new TestCase( SECTION, "parseFloat('07')", 7, parseFloat("07")); new TestCase( SECTION, "parseFloat('010')", 10, parseFloat("010")); new TestCase( SECTION, "parseFloat('011')", 11, parseFloat("011")); // A StringNumericLIteral may have any number of leading 0 digits new TestCase( SECTION, "parseFloat('001')", 1, parseFloat("001")); new TestCase( SECTION, "parseFloat('0001')", 1, parseFloat("0001")); new TestCase( SECTION, "parseFloat(' 0001 ')", 1, parseFloat(" 0001 ")); // an octal numeric literal should be treated as an octal new TestCase( SECTION, "parseFloat(00)", 0, parseFloat(00)); new TestCase( SECTION, "parseFloat(01)", 1, parseFloat(01)); new TestCase( SECTION, "parseFloat(02)", 2, parseFloat(02)); new TestCase( SECTION, "parseFloat(03)", 3, parseFloat(03)); new TestCase( SECTION, "parseFloat(04)", 4, parseFloat(04)); new TestCase( SECTION, "parseFloat(05)", 5, parseFloat(05)); new TestCase( SECTION, "parseFloat(06)", 6, parseFloat(06)); new TestCase( SECTION, "parseFloat(07)", 7, parseFloat(07)); new TestCase( SECTION, "parseFloat(010)", 8, parseFloat(010)); new TestCase( SECTION, "parseFloat(011)", 9, parseFloat(011)); // A StringNumericLIteral may have any number of leading 0 digits new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001)); new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001)); // make sure it's reflexive new TestCase( SECTION, "parseFloat(Math.PI)", Math.PI, parseFloat(Math.PI)); new TestCase( SECTION, "parseFloat(Math.LN2)", Math.LN2, parseFloat(Math.LN2)); new TestCase( SECTION, "parseFloat(Math.LN10)", Math.LN10, parseFloat(Math.LN10)); new TestCase( SECTION, "parseFloat(Math.LOG2E)", Math.LOG2E, parseFloat(Math.LOG2E)); new TestCase( SECTION, "parseFloat(Math.LOG10E)", Math.LOG10E, parseFloat(Math.LOG10E)); new TestCase( SECTION, "parseFloat(Math.SQRT2)", Math.SQRT2, parseFloat(Math.SQRT2)); new TestCase( SECTION, "parseFloat(Math.SQRT1_2)", Math.SQRT1_2, parseFloat(Math.SQRT1_2)); new TestCase( SECTION, "parseFloat(Math.PI+'')", Math.PI, parseFloat(Math.PI+'')); new TestCase( SECTION, "parseFloat(Math.LN2+'')", Math.LN2, parseFloat(Math.LN2+'')); new TestCase( SECTION, "parseFloat(Math.LN10+'')", Math.LN10, parseFloat(Math.LN10+'')); new TestCase( SECTION, "parseFloat(Math.LOG2E+'')", Math.LOG2E, parseFloat(Math.LOG2E+'')); new TestCase( SECTION, "parseFloat(Math.LOG10E+'')", Math.LOG10E, parseFloat(Math.LOG10E+'')); new TestCase( SECTION, "parseFloat(Math.SQRT2+'')", Math.SQRT2, parseFloat(Math.SQRT2+'')); new TestCase( SECTION, "parseFloat(Math.SQRT1_2+'')", Math.SQRT1_2, parseFloat(Math.SQRT1_2+'')); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.2.3-2.js0000644000175000017500000004761411545150464022266 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.3-2.js ECMA Section: 15.1.2.3 Function properties of the global object: parseFloat( string ) Description: The parseFloat function produces a number value dictated by the interpretation of the contents of the string argument defined as a decimal literal. When the parseFloat function is called, the following steps are taken: 1. Call ToString( string ). 2. Remove leading whitespace Result(1). 3. If neither Result(2) nor any prefix of Result(2) satisfies the syntax of a StrDecimalLiteral, return NaN. 4. Compute the longest prefix of Result(2) which might be Resusult(2) itself, that satisfies the syntax of a StrDecimalLiteral 5. Return the number value for the MV of Result(4). Note that parseFloate may interpret only a leading portion of the string as a number value; it ignores any characters that cannot be interpreted as part of the notation of a decimal literal, and no indication is given that such characters were ignored. StrDecimalLiteral:: Infinity DecimalDigits.DecimalDigits opt ExponentPart opt .DecimalDigits ExponentPart opt DecimalDigits ExponentPart opt Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.3-2"; var VERSION = "ECMA_1"; startTest(); var BUGNUMBER="none"; new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) ); new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) ); new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") ); new TestCase( SECTION, "parseFloat(' Infinity')", Number.POSITIVE_INFINITY, parseFloat("Infinity") ); // new TestCase( SECTION, "parseFloat(Infinity)", Number.POSITIVE_INFINITY, parseFloat(Infinity) ); new TestCase( SECTION, "parseFloat(' 0')", 0, parseFloat(" 0") ); new TestCase( SECTION, "parseFloat(' -0')", -0, parseFloat(" -0") ); new TestCase( SECTION, "parseFloat(' +0')", 0, parseFloat(" +0") ); new TestCase( SECTION, "parseFloat(' 1')", 1, parseFloat(" 1") ); new TestCase( SECTION, "parseFloat(' -1')", -1, parseFloat(" -1") ); new TestCase( SECTION, "parseFloat(' +1')", 1, parseFloat(" +1") ); new TestCase( SECTION, "parseFloat(' 2')", 2, parseFloat(" 2") ); new TestCase( SECTION, "parseFloat(' -2')", -2, parseFloat(" -2") ); new TestCase( SECTION, "parseFloat(' +2')", 2, parseFloat(" +2") ); new TestCase( SECTION, "parseFloat(' 3')", 3, parseFloat(" 3") ); new TestCase( SECTION, "parseFloat(' -3')", -3, parseFloat(" -3") ); new TestCase( SECTION, "parseFloat(' +3')", 3, parseFloat(" +3") ); new TestCase( SECTION, "parseFloat(' 4')", 4, parseFloat(" 4") ); new TestCase( SECTION, "parseFloat(' -4')", -4, parseFloat(" -4") ); new TestCase( SECTION, "parseFloat(' +4')", 4, parseFloat(" +4") ); new TestCase( SECTION, "parseFloat(' 5')", 5, parseFloat(" 5") ); new TestCase( SECTION, "parseFloat(' -5')", -5, parseFloat(" -5") ); new TestCase( SECTION, "parseFloat(' +5')", 5, parseFloat(" +5") ); new TestCase( SECTION, "parseFloat(' 6')", 6, parseFloat(" 6") ); new TestCase( SECTION, "parseFloat(' -6')", -6, parseFloat(" -6") ); new TestCase( SECTION, "parseFloat(' +6')", 6, parseFloat(" +6") ); new TestCase( SECTION, "parseFloat(' 7')", 7, parseFloat(" 7") ); new TestCase( SECTION, "parseFloat(' -7')", -7, parseFloat(" -7") ); new TestCase( SECTION, "parseFloat(' +7')", 7, parseFloat(" +7") ); new TestCase( SECTION, "parseFloat(' 8')", 8, parseFloat(" 8") ); new TestCase( SECTION, "parseFloat(' -8')", -8, parseFloat(" -8") ); new TestCase( SECTION, "parseFloat(' +8')", 8, parseFloat(" +8") ); new TestCase( SECTION, "parseFloat(' 9')", 9, parseFloat(" 9") ); new TestCase( SECTION, "parseFloat(' -9')", -9, parseFloat(" -9") ); new TestCase( SECTION, "parseFloat(' +9')", 9, parseFloat(" +9") ); new TestCase( SECTION, "parseFloat(' 3.14159')", 3.14159, parseFloat(" 3.14159") ); new TestCase( SECTION, "parseFloat(' -3.14159')", -3.14159, parseFloat(" -3.14159") ); new TestCase( SECTION, "parseFloat(' +3.14159')", 3.14159, parseFloat(" +3.14159") ); new TestCase( SECTION, "parseFloat(' 3.')", 3, parseFloat(" 3.") ); new TestCase( SECTION, "parseFloat(' -3.')", -3, parseFloat(" -3.") ); new TestCase( SECTION, "parseFloat(' +3.')", 3, parseFloat(" +3.") ); new TestCase( SECTION, "parseFloat(' 3.e1')", 30, parseFloat(" 3.e1") ); new TestCase( SECTION, "parseFloat(' -3.e1')", -30, parseFloat(" -3.e1") ); new TestCase( SECTION, "parseFloat(' +3.e1')", 30, parseFloat(" +3.e1") ); new TestCase( SECTION, "parseFloat(' 3.e+1')", 30, parseFloat(" 3.e+1") ); new TestCase( SECTION, "parseFloat(' -3.e+1')", -30, parseFloat(" -3.e+1") ); new TestCase( SECTION, "parseFloat(' +3.e+1')", 30, parseFloat(" +3.e+1") ); new TestCase( SECTION, "parseFloat(' 3.e-1')", .30, parseFloat(" 3.e-1") ); new TestCase( SECTION, "parseFloat(' -3.e-1')", -.30, parseFloat(" -3.e-1") ); new TestCase( SECTION, "parseFloat(' +3.e-1')", .30, parseFloat(" +3.e-1") ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat(' .00001')", 0.00001, parseFloat(" .00001") ); new TestCase( SECTION, "parseFloat(' +.00001')", 0.00001, parseFloat(" +.00001") ); new TestCase( SECTION, "parseFloat(' -0.0001')", -0.00001, parseFloat(" -.00001") ); new TestCase( SECTION, "parseFloat(' .01e2')", 1, parseFloat(" .01e2") ); new TestCase( SECTION, "parseFloat(' +.01e2')", 1, parseFloat(" +.01e2") ); new TestCase( SECTION, "parseFloat(' -.01e2')", -1, parseFloat(" -.01e2") ); new TestCase( SECTION, "parseFloat(' .01e+2')", 1, parseFloat(" .01e+2") ); new TestCase( SECTION, "parseFloat(' +.01e+2')", 1, parseFloat(" +.01e+2") ); new TestCase( SECTION, "parseFloat(' -.01e+2')", -1, parseFloat(" -.01e+2") ); new TestCase( SECTION, "parseFloat(' .01e-2')", 0.0001, parseFloat(" .01e-2") ); new TestCase( SECTION, "parseFloat(' +.01e-2')", 0.0001, parseFloat(" +.01e-2") ); new TestCase( SECTION, "parseFloat(' -.01e-2')", -0.0001, parseFloat(" -.01e-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat(' 1234e5')", 123400000, parseFloat(" 1234e5") ); new TestCase( SECTION, "parseFloat(' +1234e5')", 123400000, parseFloat(" +1234e5") ); new TestCase( SECTION, "parseFloat(' -1234e5')", -123400000, parseFloat(" -1234e5") ); new TestCase( SECTION, "parseFloat(' 1234e+5')", 123400000, parseFloat(" 1234e+5") ); new TestCase( SECTION, "parseFloat(' +1234e+5')", 123400000, parseFloat(" +1234e+5") ); new TestCase( SECTION, "parseFloat(' -1234e+5')", -123400000, parseFloat(" -1234e+5") ); new TestCase( SECTION, "parseFloat(' 1234e-5')", 0.01234, parseFloat(" 1234e-5") ); new TestCase( SECTION, "parseFloat(' +1234e-5')", 0.01234, parseFloat(" +1234e-5") ); new TestCase( SECTION, "parseFloat(' -1234e-5')", -0.01234, parseFloat(" -1234e-5") ); new TestCase( SECTION, "parseFloat(' .01E2')", 1, parseFloat(" .01E2") ); new TestCase( SECTION, "parseFloat(' +.01E2')", 1, parseFloat(" +.01E2") ); new TestCase( SECTION, "parseFloat(' -.01E2')", -1, parseFloat(" -.01E2") ); new TestCase( SECTION, "parseFloat(' .01E+2')", 1, parseFloat(" .01E+2") ); new TestCase( SECTION, "parseFloat(' +.01E+2')", 1, parseFloat(" +.01E+2") ); new TestCase( SECTION, "parseFloat(' -.01E+2')", -1, parseFloat(" -.01E+2") ); new TestCase( SECTION, "parseFloat(' .01E-2')", 0.0001, parseFloat(" .01E-2") ); new TestCase( SECTION, "parseFloat(' +.01E-2')", 0.0001, parseFloat(" +.01E-2") ); new TestCase( SECTION, "parseFloat(' -.01E-2')", -0.0001, parseFloat(" -.01E-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "parseFloat(' 1234E5')", 123400000, parseFloat(" 1234E5") ); new TestCase( SECTION, "parseFloat(' +1234E5')", 123400000, parseFloat(" +1234E5") ); new TestCase( SECTION, "parseFloat(' -1234E5')", -123400000, parseFloat(" -1234E5") ); new TestCase( SECTION, "parseFloat(' 1234E+5')", 123400000, parseFloat(" 1234E+5") ); new TestCase( SECTION, "parseFloat(' +1234E+5')", 123400000, parseFloat(" +1234E+5") ); new TestCase( SECTION, "parseFloat(' -1234E+5')", -123400000, parseFloat(" -1234E+5") ); new TestCase( SECTION, "parseFloat(' 1234E-5')", 0.01234, parseFloat(" 1234E-5") ); new TestCase( SECTION, "parseFloat(' +1234E-5')", 0.01234, parseFloat(" +1234E-5") ); new TestCase( SECTION, "parseFloat(' -1234E-5')", -0.01234, parseFloat(" -1234E-5") ); // hex cases should all return NaN new TestCase( SECTION, "parseFloat(' 0x0')", 0, parseFloat(" 0x0")); new TestCase( SECTION, "parseFloat(' 0x1')", 0, parseFloat(" 0x1")); new TestCase( SECTION, "parseFloat(' 0x2')", 0, parseFloat(" 0x2")); new TestCase( SECTION, "parseFloat(' 0x3')", 0, parseFloat(" 0x3")); new TestCase( SECTION, "parseFloat(' 0x4')", 0, parseFloat(" 0x4")); new TestCase( SECTION, "parseFloat(' 0x5')", 0, parseFloat(" 0x5")); new TestCase( SECTION, "parseFloat(' 0x6')", 0, parseFloat(" 0x6")); new TestCase( SECTION, "parseFloat(' 0x7')", 0, parseFloat(" 0x7")); new TestCase( SECTION, "parseFloat(' 0x8')", 0, parseFloat(" 0x8")); new TestCase( SECTION, "parseFloat(' 0x9')", 0, parseFloat(" 0x9")); new TestCase( SECTION, "parseFloat(' 0xa')", 0, parseFloat(" 0xa")); new TestCase( SECTION, "parseFloat(' 0xb')", 0, parseFloat(" 0xb")); new TestCase( SECTION, "parseFloat(' 0xc')", 0, parseFloat(" 0xc")); new TestCase( SECTION, "parseFloat(' 0xd')", 0, parseFloat(" 0xd")); new TestCase( SECTION, "parseFloat(' 0xe')", 0, parseFloat(" 0xe")); new TestCase( SECTION, "parseFloat(' 0xf')", 0, parseFloat(" 0xf")); new TestCase( SECTION, "parseFloat(' 0xA')", 0, parseFloat(" 0xA")); new TestCase( SECTION, "parseFloat(' 0xB')", 0, parseFloat(" 0xB")); new TestCase( SECTION, "parseFloat(' 0xC')", 0, parseFloat(" 0xC")); new TestCase( SECTION, "parseFloat(' 0xD')", 0, parseFloat(" 0xD")); new TestCase( SECTION, "parseFloat(' 0xE')", 0, parseFloat(" 0xE")); new TestCase( SECTION, "parseFloat(' 0xF')", 0, parseFloat(" 0xF")); new TestCase( SECTION, "parseFloat(' 0X0')", 0, parseFloat(" 0X0")); new TestCase( SECTION, "parseFloat(' 0X1')", 0, parseFloat(" 0X1")); new TestCase( SECTION, "parseFloat(' 0X2')", 0, parseFloat(" 0X2")); new TestCase( SECTION, "parseFloat(' 0X3')", 0, parseFloat(" 0X3")); new TestCase( SECTION, "parseFloat(' 0X4')", 0, parseFloat(" 0X4")); new TestCase( SECTION, "parseFloat(' 0X5')", 0, parseFloat(" 0X5")); new TestCase( SECTION, "parseFloat(' 0X6')", 0, parseFloat(" 0X6")); new TestCase( SECTION, "parseFloat(' 0X7')", 0, parseFloat(" 0X7")); new TestCase( SECTION, "parseFloat(' 0X8')", 0, parseFloat(" 0X8")); new TestCase( SECTION, "parseFloat(' 0X9')", 0, parseFloat(" 0X9")); new TestCase( SECTION, "parseFloat(' 0Xa')", 0, parseFloat(" 0Xa")); new TestCase( SECTION, "parseFloat(' 0Xb')", 0, parseFloat(" 0Xb")); new TestCase( SECTION, "parseFloat(' 0Xc')", 0, parseFloat(" 0Xc")); new TestCase( SECTION, "parseFloat(' 0Xd')", 0, parseFloat(" 0Xd")); new TestCase( SECTION, "parseFloat(' 0Xe')", 0, parseFloat(" 0Xe")); new TestCase( SECTION, "parseFloat(' 0Xf')", 0, parseFloat(" 0Xf")); new TestCase( SECTION, "parseFloat(' 0XA')", 0, parseFloat(" 0XA")); new TestCase( SECTION, "parseFloat(' 0XB')", 0, parseFloat(" 0XB")); new TestCase( SECTION, "parseFloat(' 0XC')", 0, parseFloat(" 0XC")); new TestCase( SECTION, "parseFloat(' 0XD')", 0, parseFloat(" 0XD")); new TestCase( SECTION, "parseFloat(' 0XE')", 0, parseFloat(" 0XE")); new TestCase( SECTION, "parseFloat(' 0XF')", 0, parseFloat(" 0XF")); // A StringNumericLiteral may not use octal notation new TestCase( SECTION, "parseFloat(' 00')", 0, parseFloat(" 00")); new TestCase( SECTION, "parseFloat(' 01')", 1, parseFloat(" 01")); new TestCase( SECTION, "parseFloat(' 02')", 2, parseFloat(" 02")); new TestCase( SECTION, "parseFloat(' 03')", 3, parseFloat(" 03")); new TestCase( SECTION, "parseFloat(' 04')", 4, parseFloat(" 04")); new TestCase( SECTION, "parseFloat(' 05')", 5, parseFloat(" 05")); new TestCase( SECTION, "parseFloat(' 06')", 6, parseFloat(" 06")); new TestCase( SECTION, "parseFloat(' 07')", 7, parseFloat(" 07")); new TestCase( SECTION, "parseFloat(' 010')", 10, parseFloat(" 010")); new TestCase( SECTION, "parseFloat(' 011')", 11, parseFloat(" 011")); // A StringNumericLIteral may have any number of leading 0 digits new TestCase( SECTION, "parseFloat(' 001')", 1, parseFloat(" 001")); new TestCase( SECTION, "parseFloat(' 0001')", 1, parseFloat(" 0001")); // A StringNumericLIteral may have any number of leading 0 digits new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001)); new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001)); // make sure it' s reflexive new TestCase( SECTION, "parseFloat( ' ' +Math.PI+' ')", Math.PI, parseFloat( ' ' +Math.PI+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.LN2+' ')", Math.LN2, parseFloat( ' ' +Math.LN2+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.LN10+' ')", Math.LN10, parseFloat( ' ' +Math.LN10+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.LOG2E+' ')", Math.LOG2E, parseFloat( ' ' +Math.LOG2E+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.LOG10E+' ')", Math.LOG10E, parseFloat( ' ' +Math.LOG10E+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT2+' ')", Math.SQRT2, parseFloat( ' ' +Math.SQRT2+' ')); new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT1_2+' ')", Math.SQRT1_2, parseFloat( ' ' +Math.SQRT1_2+' ')); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.2.4.js0000644000175000017500000001712111545150464022116 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.4.js ECMA Section: 15.1.2.4 Function properties of the global object escape( string ) Description: The escape function computes a new version of a string value in which certain characters have been replaced by a hexadecimal escape sequence. The result thus contains no special characters that might have special meaning within a URL. For characters whose Unicode encoding is 0xFF or less, a two-digit escape sequence of the form %xx is used in accordance with RFC1738. For characters whose Unicode encoding is greater than 0xFF, a four- digit escape sequence of the form %uxxxx is used. When the escape function is called with one argument string, the following steps are taken: 1. Call ToString(string). 2. Compute the number of characters in Result(1). 3. Let R be the empty string. 4. Let k be 0. 5. If k equals Result(2), return R. 6. Get the character at position k within Result(1). 7. If Result(6) is one of the 69 nonblank ASCII characters ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 @*_+-./, go to step 14. 8. Compute the 16-bit unsigned integer that is the Unicode character encoding of Result(6). 9. If Result(8), is less than 256, go to step 12. 10. Let S be a string containing six characters "%uwxyz" where wxyz are four hexadecimal digits encoding the value of Result(8). 11. Go to step 15. 12. Let S be a string containing three characters "%xy" where xy are two hexadecimal digits encoding the value of Result(8). 13. Go to step 15. 14. Let S be a string containing the single character Result(6). 15. Let R be a new string value computed by concatenating the previous value of R and S. 16. Increase k by 1. 17. Go to step 5. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "escape(string)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "escape.length", 1, escape.length ); new TestCase( SECTION, "escape.length = null; escape.length", 1, eval("escape.length = null; escape.length") ); new TestCase( SECTION, "delete escape.length", false, delete escape.length ); new TestCase( SECTION, "delete escape.length; escape.length", 1, eval("delete escape.length; escape.length") ); new TestCase( SECTION, "var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS", "", eval("var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS") ); new TestCase( SECTION, "escape()", "undefined", escape() ); new TestCase( SECTION, "escape('')", "", escape('') ); new TestCase( SECTION, "escape( null )", "null", escape(null) ); new TestCase( SECTION, "escape( void 0 )", "undefined", escape(void 0) ); new TestCase( SECTION, "escape( true )", "true", escape( true ) ); new TestCase( SECTION, "escape( false )", "false", escape( false ) ); new TestCase( SECTION, "escape( new Boolean(true) )", "true", escape(new Boolean(true)) ); new TestCase( SECTION, "escape( new Boolean(false) )", "false", escape(new Boolean(false)) ); new TestCase( SECTION, "escape( Number.NaN )", "NaN", escape(Number.NaN) ); new TestCase( SECTION, "escape( -0 )", "0", escape( -0 ) ); new TestCase( SECTION, "escape( 'Infinity' )", "Infinity", escape( "Infinity" ) ); new TestCase( SECTION, "escape( Number.POSITIVE_INFINITY )", "Infinity", escape( Number.POSITIVE_INFINITY ) ); new TestCase( SECTION, "escape( Number.NEGATIVE_INFINITY )", "-Infinity", escape( Number.NEGATIVE_INFINITY ) ); var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./"; new TestCase( SECTION, "escape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, escape( ASCII_TEST_STRING ) ); // ASCII value less than for ( var CHARCODE = 0; CHARCODE < 32; CHARCODE++ ) { new TestCase( SECTION, "escape(String.fromCharCode("+CHARCODE+"))", "%"+ToHexString(CHARCODE), escape(String.fromCharCode(CHARCODE)) ); } for ( var CHARCODE = 128; CHARCODE < 256; CHARCODE++ ) { new TestCase( SECTION, "escape(String.fromCharCode("+CHARCODE+"))", "%"+ToHexString(CHARCODE), escape(String.fromCharCode(CHARCODE)) ); } for ( var CHARCODE = 256; CHARCODE < 1024; CHARCODE++ ) { new TestCase( SECTION, "escape(String.fromCharCode("+CHARCODE+"))", "%u"+ ToUnicodeString(CHARCODE), escape(String.fromCharCode(CHARCODE)) ); } for ( var CHARCODE = 65500; CHARCODE < 65536; CHARCODE++ ) { new TestCase( SECTION, "escape(String.fromCharCode("+CHARCODE+"))", "%u"+ ToUnicodeString(CHARCODE), escape(String.fromCharCode(CHARCODE)) ); } test(); function ToUnicodeString( n ) { var string = ToHexString(n); for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { string = "0" + string; } return string; } function ToHexString( n ) { var hex = new Array(); for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { ; } for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { hex[index] = Math.floor( n / Math.pow(16,mag) ); n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); } hex[hex.length] = n % 16; var string =""; for ( var index = 0 ; index < hex.length ; index++ ) { switch ( hex[index] ) { case 10: string += "A"; break; case 11: string += "B"; break; case 12: string += "C"; break; case 13: string += "D"; break; case 14: string += "E"; break; case 15: string += "F"; break; default: string += hex[index]; } } if ( string.length == 1 ) { string = "0" + string; } return string; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.2.5-1.js0000644000175000017500000001731011545150464022255 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.5-1.js ECMA Section: 15.1.2.5 Function properties of the global object unescape( string ) Description: The unescape function computes a new version of a string value in which each escape sequences of the sort that might be introduced by the escape function is replaced with the character that it represents. When the unescape function is called with one argument string, the following steps are taken: 1. Call ToString(string). 2. Compute the number of characters in Result(1). 3. Let R be the empty string. 4. Let k be 0. 5. If k equals Result(2), return R. 6. Let c be the character at position k within Result(1). 7. If c is not %, go to step 18. 8. If k is greater than Result(2)-6, go to step 14. 9. If the character at position k+1 within result(1) is not u, go to step 14. 10. If the four characters at positions k+2, k+3, k+4, and k+5 within Result(1) are not all hexadecimal digits, go to step 14. 11. Let c be the character whose Unicode encoding is the integer represented by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5 within Result(1). 12. Increase k by 5. 13. Go to step 18. 14. If k is greater than Result(2)-3, go to step 18. 15. If the two characters at positions k+1 and k+2 within Result(1) are not both hexadecimal digits, go to step 18. 16. Let c be the character whose Unicode encoding is the integer represented by two zeroes plus the two hexadecimal digits at positions k+1 and k+2 within Result(1). 17. Increase k by 2. 18. Let R be a new string value computed by concatenating the previous value of R and c. 19. Increase k by 1. 20. Go to step 5. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "unescape(string)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "unescape.length", 1, unescape.length ); new TestCase( SECTION, "unescape.length = null; unescape.length", 1, eval("unescape.length=null; unescape.length") ); new TestCase( SECTION, "delete unescape.length", false, delete unescape.length ); new TestCase( SECTION, "delete unescape.length; unescape.length", 1, eval("delete unescape.length; unescape.length") ); new TestCase( SECTION, "var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS") ); new TestCase( SECTION, "unescape()", "undefined", unescape() ); new TestCase( SECTION, "unescape('')", "", unescape('') ); new TestCase( SECTION, "unescape( null )", "null", unescape(null) ); new TestCase( SECTION, "unescape( void 0 )", "undefined", unescape(void 0) ); new TestCase( SECTION, "unescape( true )", "true", unescape( true ) ); new TestCase( SECTION, "unescape( false )", "false", unescape( false ) ); new TestCase( SECTION, "unescape( new Boolean(true) )", "true", unescape(new Boolean(true)) ); new TestCase( SECTION, "unescape( new Boolean(false) )", "false", unescape(new Boolean(false)) ); new TestCase( SECTION, "unescape( Number.NaN )", "NaN", unescape(Number.NaN) ); new TestCase( SECTION, "unescape( -0 )", "0", unescape( -0 ) ); new TestCase( SECTION, "unescape( 'Infinity' )", "Infinity", unescape( "Infinity" ) ); new TestCase( SECTION, "unescape( Number.POSITIVE_INFINITY )", "Infinity", unescape( Number.POSITIVE_INFINITY ) ); new TestCase( SECTION, "unescape( Number.NEGATIVE_INFINITY )", "-Infinity", unescape( Number.NEGATIVE_INFINITY ) ); var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./"; new TestCase( SECTION, "unescape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, unescape( ASCII_TEST_STRING ) ); // escaped chars with ascii values less than 256 for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { new TestCase( SECTION, "unescape( %"+ ToHexString(CHARCODE)+" )", String.fromCharCode(CHARCODE), unescape( "%" + ToHexString(CHARCODE) ) ); } // unicode chars represented by two hex digits for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { new TestCase( SECTION, "unescape( %u"+ ToHexString(CHARCODE)+" )", "%u"+ToHexString(CHARCODE), unescape( "%u" + ToHexString(CHARCODE) ) ); } /* for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { new TestCase( SECTION, "unescape( %u"+ ToUnicodeString(CHARCODE)+" )", String.fromCharCode(CHARCODE), unescape( "%u" + ToUnicodeString(CHARCODE) ) ); } for ( var CHARCODE = 256; CHARCODE < 65536; CHARCODE+= 333 ) { new TestCase( SECTION, "unescape( %u"+ ToUnicodeString(CHARCODE)+" )", String.fromCharCode(CHARCODE), unescape( "%u" + ToUnicodeString(CHARCODE) ) ); } */ test(); function ToUnicodeString( n ) { var string = ToHexString(n); for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { string = "0" + string; } return string; } function ToHexString( n ) { var hex = new Array(); for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { ; } for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { hex[index] = Math.floor( n / Math.pow(16,mag) ); n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); } hex[hex.length] = n % 16; var string =""; for ( var index = 0 ; index < hex.length ; index++ ) { switch ( hex[index] ) { case 10: string += "A"; break; case 11: string += "B"; break; case 12: string += "C"; break; case 13: string += "D"; break; case 14: string += "E"; break; case 15: string += "F"; break; default: string += hex[index]; } } if ( string.length == 1 ) { string = "0" + string; } return string; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.2.5-2.js0000644000175000017500000001356211545150464022263 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.5-2.js ECMA Section: 15.1.2.5 Function properties of the global object unescape( string ) Description: This tests the cases where there are fewer than 4 characters following "%u", or fewer than 2 characters following "%" or "%u". The unescape function computes a new version of a string value in which each escape sequences of the sort that might be introduced by the escape function is replaced with the character that it represents. When the unescape function is called with one argument string, the following steps are taken: 1. Call ToString(string). 2. Compute the number of characters in Result(1). 3. Let R be the empty string. 4. Let k be 0. 5. If k equals Result(2), return R. 6. Let c be the character at position k within Result(1). 7. If c is not %, go to step 18. 8. If k is greater than Result(2)-6, go to step 14. 9. If the character at position k+1 within result(1) is not u, go to step 14. 10. If the four characters at positions k+2, k+3, k+4, and k+5 within Result(1) are not all hexadecimal digits, go to step 14. 11. Let c be the character whose Unicode encoding is the integer represented by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5 within Result(1). 12. Increase k by 5. 13. Go to step 18. 14. If k is greater than Result(2)-3, go to step 18. 15. If the two characters at positions k+1 and k+2 within Result(1) are not both hexadecimal digits, go to step 18. 16. Let c be the character whose Unicode encoding is the integer represented by two zeroes plus the two hexadecimal digits at positions k+1 and k+2 within Result(1). 17. Increase k by 2. 18. Let R be a new string value computed by concatenating the previous value of R and c. 19. Increase k by 1. 20. Go to step 5. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "unescape(string)"; writeHeaderToLog( SECTION + " "+ TITLE); // since there is only one character following "%", no conversion should occur. for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE += 16 ) { new TestCase( SECTION, "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) +" )", "%"+(ToHexString(CHARCODE)).substring(0,1), unescape( "%" + (ToHexString(CHARCODE)).substring(0,1) ) ); } // since there is only one character following "%u", no conversion should occur. for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE +=16 ) { new TestCase( SECTION, "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) +" )", "%u"+(ToHexString(CHARCODE)).substring(0,1), unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1) ) ); } // three char unicode string. no conversion should occur for ( var CHARCODE = 1024; CHARCODE < 65536; CHARCODE+= 1234 ) { new TestCase ( SECTION, "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3)+ " )", "%u"+(ToUnicodeString(CHARCODE)).substring(0,3), unescape( "%u"+(ToUnicodeString(CHARCODE)).substring(0,3) ) ); } test(); function ToUnicodeString( n ) { var string = ToHexString(n); for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { string = "0" + string; } return string; } function ToHexString( n ) { var hex = new Array(); for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { ; } for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { hex[index] = Math.floor( n / Math.pow(16,mag) ); n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); } hex[hex.length] = n % 16; var string =""; for ( var index = 0 ; index < hex.length ; index++ ) { switch ( hex[index] ) { case 10: string += "A"; break; case 11: string += "B"; break; case 12: string += "C"; break; case 13: string += "D"; break; case 14: string += "E"; break; case 15: string += "F"; break; default: string += hex[index]; } } if ( string.length == 1 ) { string = "0" + string; } return string; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.2.5-3.js0000644000175000017500000001570311545150464022263 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.5-3.js ECMA Section: 15.1.2.5 Function properties of the global object unescape( string ) Description: This tests the cases where one of the four characters following "%u" is not a hexidecimal character, or one of the two characters following "%" or "%u" is not a hexidecimal character. The unescape function computes a new version of a string value in which each escape sequences of the sort that might be introduced by the escape function is replaced with the character that it represents. When the unescape function is called with one argument string, the following steps are taken: 1. Call ToString(string). 2. Compute the number of characters in Result(1). 3. Let R be the empty string. 4. Let k be 0. 5. If k equals Result(2), return R. 6. Let c be the character at position k within Result(1). 7. If c is not %, go to step 18. 8. If k is greater than Result(2)-6, go to step 14. 9. If the character at position k+1 within result(1) is not u, go to step 14. 10. If the four characters at positions k+2, k+3, k+4, and k+5 within Result(1) are not all hexadecimal digits, go to step 14. 11. Let c be the character whose Unicode encoding is the integer represented by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5 within Result(1). 12. Increase k by 5. 13. Go to step 18. 14. If k is greater than Result(2)-3, go to step 18. 15. If the two characters at positions k+1 and k+2 within Result(1) are not both hexadecimal digits, go to step 18. 16. Let c be the character whose Unicode encoding is the integer represented by two zeroes plus the two hexadecimal digits at positions k+1 and k+2 within Result(1). 17. Increase k by 2. 18. Let R be a new string value computed by concatenating the previous value of R and c. 19. Increase k by 1. 20. Go to step 5. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.5-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "unescape(string)"; writeHeaderToLog( SECTION + " "+ TITLE); for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) { NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE ); new TestCase( SECTION, "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) + String.fromCharCode( NONHEXCHARCODE ) +" )" + "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]", "%"+(ToHexString(CHARCODE)).substring(0,1)+ String.fromCharCode( NONHEXCHARCODE ), unescape( "%" + (ToHexString(CHARCODE)).substring(0,1)+ String.fromCharCode( NONHEXCHARCODE ) ) ); } for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) { NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE ); new TestCase( SECTION, "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) + String.fromCharCode( NONHEXCHARCODE ) +" )" + "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]", "%u"+(ToHexString(CHARCODE)).substring(0,1)+ String.fromCharCode( NONHEXCHARCODE ), unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1)+ String.fromCharCode( NONHEXCHARCODE ) ) ); } for ( var CHARCODE = 0, NONHEXCHARCODE = 0 ; CHARCODE < 65536; CHARCODE+= 54321, NONHEXCHARCODE++ ) { NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE ); new TestCase( SECTION, "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3) + String.fromCharCode( NONHEXCHARCODE ) +" )" + "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]", String.fromCharCode(eval("0x"+ (ToUnicodeString(CHARCODE)).substring(0,2))) + (ToUnicodeString(CHARCODE)).substring(2,3) + String.fromCharCode( NONHEXCHARCODE ), unescape( "%" + (ToUnicodeString(CHARCODE)).substring(0,3)+ String.fromCharCode( NONHEXCHARCODE ) ) ); } test(); function getNextNonHexCharCode( n ) { for ( ; n < Math.pow(2,16); n++ ) { if ( ( n == 43 || n == 45 || n == 46 || n == 47 || (n >= 71 && n <= 90) || (n >= 103 && n <= 122) || n == 64 || n == 95 ) ) { break; } else { n = ( n > 122 ) ? 0 : n; } } return n; } function ToUnicodeString( n ) { var string = ToHexString(n); for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) { string = "0" + string; } return string; } function ToHexString( n ) { var hex = new Array(); for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) { ; } for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) { hex[index] = Math.floor( n / Math.pow(16,mag) ); n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) ); } hex[hex.length] = n % 16; var string =""; for ( var index = 0 ; index < hex.length ; index++ ) { switch ( hex[index] ) { case 10: string += "A"; break; case 11: string += "B"; break; case 12: string += "C"; break; case 13: string += "D"; break; case 14: string += "E"; break; case 15: string += "F"; break; default: string += hex[index]; } } if ( string.length == 1 ) { string = "0" + string; } return string; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.2.6.js0000644000175000017500000001475311545150464022130 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.6.js ECMA Section: 15.1.2.6 isNaN( x ) Description: Applies ToNumber to its argument, then returns true if the result isNaN and otherwise returns false. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.6"; var VERSION = "ECMA_1"; var TITLE = "isNaN( x )"; var BUGNUMBER = "none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "isNaN.length", 1, isNaN.length ); new TestCase( SECTION, "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS") ); new TestCase( SECTION, "isNaN.length = null; isNaN.length", 1, eval("isNaN.length=null; isNaN.length") ); new TestCase( SECTION, "delete isNaN.length", false, delete isNaN.length ); new TestCase( SECTION, "delete isNaN.length; isNaN.length", 1, eval("delete isNaN.length; isNaN.length") ); // new TestCase( SECTION, "isNaN.__proto__", Function.prototype, isNaN.__proto__ ); new TestCase( SECTION, "isNaN()", true, isNaN() ); new TestCase( SECTION, "isNaN( null )", false, isNaN(null) ); new TestCase( SECTION, "isNaN( void 0 )", true, isNaN(void 0) ); new TestCase( SECTION, "isNaN( true )", false, isNaN(true) ); new TestCase( SECTION, "isNaN( false)", false, isNaN(false) ); new TestCase( SECTION, "isNaN( ' ' )", false, isNaN( " " ) ); new TestCase( SECTION, "isNaN( 0 )", false, isNaN(0) ); new TestCase( SECTION, "isNaN( 1 )", false, isNaN(1) ); new TestCase( SECTION, "isNaN( 2 )", false, isNaN(2) ); new TestCase( SECTION, "isNaN( 3 )", false, isNaN(3) ); new TestCase( SECTION, "isNaN( 4 )", false, isNaN(4) ); new TestCase( SECTION, "isNaN( 5 )", false, isNaN(5) ); new TestCase( SECTION, "isNaN( 6 )", false, isNaN(6) ); new TestCase( SECTION, "isNaN( 7 )", false, isNaN(7) ); new TestCase( SECTION, "isNaN( 8 )", false, isNaN(8) ); new TestCase( SECTION, "isNaN( 9 )", false, isNaN(9) ); new TestCase( SECTION, "isNaN( '0' )", false, isNaN('0') ); new TestCase( SECTION, "isNaN( '1' )", false, isNaN('1') ); new TestCase( SECTION, "isNaN( '2' )", false, isNaN('2') ); new TestCase( SECTION, "isNaN( '3' )", false, isNaN('3') ); new TestCase( SECTION, "isNaN( '4' )", false, isNaN('4') ); new TestCase( SECTION, "isNaN( '5' )", false, isNaN('5') ); new TestCase( SECTION, "isNaN( '6' )", false, isNaN('6') ); new TestCase( SECTION, "isNaN( '7' )", false, isNaN('7') ); new TestCase( SECTION, "isNaN( '8' )", false, isNaN('8') ); new TestCase( SECTION, "isNaN( '9' )", false, isNaN('9') ); new TestCase( SECTION, "isNaN( 0x0a )", false, isNaN( 0x0a ) ); new TestCase( SECTION, "isNaN( 0xaa )", false, isNaN( 0xaa ) ); new TestCase( SECTION, "isNaN( 0x0A )", false, isNaN( 0x0A ) ); new TestCase( SECTION, "isNaN( 0xAA )", false, isNaN( 0xAA ) ); new TestCase( SECTION, "isNaN( '0x0a' )", false, isNaN( "0x0a" ) ); new TestCase( SECTION, "isNaN( '0xaa' )", false, isNaN( "0xaa" ) ); new TestCase( SECTION, "isNaN( '0x0A' )", false, isNaN( "0x0A" ) ); new TestCase( SECTION, "isNaN( '0xAA' )", false, isNaN( "0xAA" ) ); new TestCase( SECTION, "isNaN( 077 )", false, isNaN( 077 ) ); new TestCase( SECTION, "isNaN( '077' )", false, isNaN( "077" ) ); new TestCase( SECTION, "isNaN( Number.NaN )", true, isNaN(Number.NaN) ); new TestCase( SECTION, "isNaN( Number.POSITIVE_INFINITY )", false, isNaN(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "isNaN( Number.NEGATIVE_INFINITY )", false, isNaN(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "isNaN( Number.MAX_VALUE )", false, isNaN(Number.MAX_VALUE) ); new TestCase( SECTION, "isNaN( Number.MIN_VALUE )", false, isNaN(Number.MIN_VALUE) ); new TestCase( SECTION, "isNaN( NaN )", true, isNaN(NaN) ); new TestCase( SECTION, "isNaN( Infinity )", false, isNaN(Infinity) ); new TestCase( SECTION, "isNaN( 'Infinity' )", false, isNaN("Infinity") ); new TestCase( SECTION, "isNaN( '-Infinity' )", false, isNaN("-Infinity") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/15.1.2.7.js0000644000175000017500000001633311545150464022125 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.1.2.7.js ECMA Section: 15.1.2.7 isFinite(number) Description: Applies ToNumber to its argument, then returns false if the result is NaN, Infinity, or -Infinity, and otherwise returns true. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.1.2.7"; var VERSION = "ECMA_1"; var TITLE = "isFinite( x )"; var BUGNUMBER= "none"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "isFinite.length", 1, isFinite.length ); new TestCase( SECTION, "isFinite.length = null; isFinite.length", 1, eval("isFinite.length=null; isFinite.length") ); new TestCase( SECTION, "delete isFinite.length", false, delete isFinite.length ); new TestCase( SECTION, "delete isFinite.length; isFinite.length", 1, eval("delete isFinite.length; isFinite.length") ); new TestCase( SECTION, "var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( p in isFinite ) { MYPROPS += p }; MYPROPS") ); new TestCase( SECTION, "isFinite()", false, isFinite() ); new TestCase( SECTION, "isFinite( null )", true, isFinite(null) ); new TestCase( SECTION, "isFinite( void 0 )", false, isFinite(void 0) ); new TestCase( SECTION, "isFinite( false )", true, isFinite(false) ); new TestCase( SECTION, "isFinite( true)", true, isFinite(true) ); new TestCase( SECTION, "isFinite( ' ' )", true, isFinite( " " ) ); new TestCase( SECTION, "isFinite( new Boolean(true) )", true, isFinite(new Boolean(true)) ); new TestCase( SECTION, "isFinite( new Boolean(false) )", true, isFinite(new Boolean(false)) ); new TestCase( SECTION, "isFinite( 0 )", true, isFinite(0) ); new TestCase( SECTION, "isFinite( 1 )", true, isFinite(1) ); new TestCase( SECTION, "isFinite( 2 )", true, isFinite(2) ); new TestCase( SECTION, "isFinite( 3 )", true, isFinite(3) ); new TestCase( SECTION, "isFinite( 4 )", true, isFinite(4) ); new TestCase( SECTION, "isFinite( 5 )", true, isFinite(5) ); new TestCase( SECTION, "isFinite( 6 )", true, isFinite(6) ); new TestCase( SECTION, "isFinite( 7 )", true, isFinite(7) ); new TestCase( SECTION, "isFinite( 8 )", true, isFinite(8) ); new TestCase( SECTION, "isFinite( 9 )", true, isFinite(9) ); new TestCase( SECTION, "isFinite( '0' )", true, isFinite('0') ); new TestCase( SECTION, "isFinite( '1' )", true, isFinite('1') ); new TestCase( SECTION, "isFinite( '2' )", true, isFinite('2') ); new TestCase( SECTION, "isFinite( '3' )", true, isFinite('3') ); new TestCase( SECTION, "isFinite( '4' )", true, isFinite('4') ); new TestCase( SECTION, "isFinite( '5' )", true, isFinite('5') ); new TestCase( SECTION, "isFinite( '6' )", true, isFinite('6') ); new TestCase( SECTION, "isFinite( '7' )", true, isFinite('7') ); new TestCase( SECTION, "isFinite( '8' )", true, isFinite('8') ); new TestCase( SECTION, "isFinite( '9' )", true, isFinite('9') ); new TestCase( SECTION, "isFinite( 0x0a )", true, isFinite( 0x0a ) ); new TestCase( SECTION, "isFinite( 0xaa )", true, isFinite( 0xaa ) ); new TestCase( SECTION, "isFinite( 0x0A )", true, isFinite( 0x0A ) ); new TestCase( SECTION, "isFinite( 0xAA )", true, isFinite( 0xAA ) ); new TestCase( SECTION, "isFinite( '0x0a' )", true, isFinite( "0x0a" ) ); new TestCase( SECTION, "isFinite( '0xaa' )", true, isFinite( "0xaa" ) ); new TestCase( SECTION, "isFinite( '0x0A' )", true, isFinite( "0x0A" ) ); new TestCase( SECTION, "isFinite( '0xAA' )", true, isFinite( "0xAA" ) ); new TestCase( SECTION, "isFinite( 077 )", true, isFinite( 077 ) ); new TestCase( SECTION, "isFinite( '077' )", true, isFinite( "077" ) ); new TestCase( SECTION, "isFinite( new String('Infinity') )", false, isFinite(new String("Infinity")) ); new TestCase( SECTION, "isFinite( new String('-Infinity') )", false, isFinite(new String("-Infinity")) ); new TestCase( SECTION, "isFinite( 'Infinity' )", false, isFinite("Infinity") ); new TestCase( SECTION, "isFinite( '-Infinity' )", false, isFinite("-Infinity") ); new TestCase( SECTION, "isFinite( Number.POSITIVE_INFINITY )", false, isFinite(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "isFinite( Number.NEGATIVE_INFINITY )", false, isFinite(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "isFinite( Number.NaN )", false, isFinite(Number.NaN) ); new TestCase( SECTION, "isFinite( Infinity )", false, isFinite(Infinity) ); new TestCase( SECTION, "isFinite( -Infinity )", false, isFinite(-Infinity) ); new TestCase( SECTION, "isFinite( NaN )", false, isFinite(NaN) ); new TestCase( SECTION, "isFinite( Number.MAX_VALUE )", true, isFinite(Number.MAX_VALUE) ); new TestCase( SECTION, "isFinite( Number.MIN_VALUE )", true, isFinite(Number.MIN_VALUE) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/browser.js0000644000175000017500000000000011545150464022677 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/jstests.list0000644000175000017500000000054511545150464023270 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/GlobalObject/ script 15.1-1-n.js script 15.1-2-n.js script 15.1.1.1.js script 15.1.1.2.js script 15.1.2.1-2.js script 15.1.2.2-1.js script 15.1.2.2-2.js script 15.1.2.3-1.js script 15.1.2.3-2.js script 15.1.2.4.js script 15.1.2.5-1.js script 15.1.2.5-2.js script 15.1.2.5-3.js script 15.1.2.6.js script 15.1.2.7.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/GlobalObject/shell.js0000644000175000017500000000000011545150464022323 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.1-1.js0000644000175000017500000000645211545150464023160 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.1-1.js ECMA Section: 7.1 White Space Description: - readability - separate tokens - otherwise should be insignificant - in strings, white space characters are significant - cannot appear within any other kind of token white space characters are: unicode name formal name string representation \u0009 tab \t \u000B veritical tab \v \U000C form feed \f \u0020 space " " Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "White Space"; writeHeaderToLog( SECTION + " "+ TITLE); // whitespace between var keyword and identifier new TestCase( SECTION, 'var'+'\t'+'MYVAR1=10;MYVAR1', 10, eval('var'+'\t'+'MYVAR1=10;MYVAR1') ); new TestCase( SECTION, 'var'+'\f'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\f'+'MYVAR2=10;MYVAR2') ); new TestCase( SECTION, 'var'+'\v'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\v'+'MYVAR2=10;MYVAR2') ); new TestCase( SECTION, 'var'+'\ '+'MYVAR2=10;MYVAR2', 10, eval('var'+'\ '+'MYVAR2=10;MYVAR2') ); // use whitespace between tokens object name, dot operator, and object property new TestCase( SECTION, "var a = new Array(12345); a\t\v\f .\\u0009\\000B\\u000C\\u0020length", 12345, eval("var a = new Array(12345); a\t\v\f .\u0009\u0020\u000C\u000Blength") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.1-2.js0000644000175000017500000000601611545150464023155 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.1-2.js ECMA Section: 7.1 White Space Description: - readability - separate tokens - otherwise should be insignificant - in strings, white space characters are significant - cannot appear within any other kind of token white space characters are: unicode name formal name string representation \u0009 tab \t \u000B veritical tab ?? \U000C form feed \f \u0020 space " " Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "White Space"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') ); new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') ); new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') ); new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.1-3.js0000644000175000017500000000667511545150464023171 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.1-3.js ECMA Section: 7.1 White Space Description: - readability - separate tokens - otherwise should be insignificant - in strings, white space characters are significant - cannot appear within any other kind of token white space characters are: unicode name formal name string representation \u0009 tab \t \u000B veritical tab ?? \U000C form feed \f \u0020 space " " Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "White Space"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') ); new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') ); new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') ); new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') ); // ++ should be interpreted as the unary + operator twice, not as a post or prefix increment operator new TestCase( SECTION, "var VAR = 12345; + + VAR", 12345, eval("var VAR = 12345; + + VAR") ); new TestCase( SECTION, "var VAR = 12345;VAR+ + VAR", 24690, eval("var VAR = 12345;VAR+ +VAR") ); new TestCase( SECTION, "var VAR = 12345;VAR - - VAR", 24690, eval("var VAR = 12345;VAR- -VAR") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.2-1.js0000644000175000017500000000613311545150464023155 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.2-1.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var a\nb = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") ); new TestCase( SECTION, "var a\nb = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") ); new TestCase( SECTION, "var a\rb = 5; ab=10;ab;", 10, eval("var a\rb = 5; ab=10;ab") ); new TestCase( SECTION, "var a\rb = 5; ab=10;b;", 5, eval("var a\rb = 5; ab=10;b") ); new TestCase( SECTION, "var a\r\nb = 5; ab=10;ab;", 10, eval("var a\r\nb = 5; ab=10;ab") ); new TestCase( SECTION, "var a\r\nb = 5; ab=10;b;", 5, eval("var a\r\nb = 5; ab=10;b") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.2-2-n.js0000644000175000017500000000535411545150464023415 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.2.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r this test uses onerror to capture line numbers. because we use on error, we can only have one test case per file. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "\r\r\r\nb"; EXPECTED = "error" new TestCase( SECTION, DESCRIPTION, "error", eval("\r\r\r\nb")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.2-3-n.js0000644000175000017500000000534311545150464023414 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.2-3.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r this test uses onerror to capture line numbers. because we use on error, we can only have one test case per file. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "\r\nb"; EXPECTED = "error" new TestCase( SECTION, "a", "error", eval("\r\nb")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.2-4-n.js0000644000175000017500000000533111545150464023412 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.2.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r this test uses onerror to capture line numbers. because we use on error, we can only have one test case per file. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "\nb"; EXPECTED = "error"; new TestCase( SECTION, "\nb", "error", eval("\nb")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.2-5-n.js0000644000175000017500000000532211545150464023413 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.2.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r this test uses onerror to capture line numbers. because we use on error, we can only have one test case per file. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = EXPECTED = "error"; new TestCase( SECTION, "\rb", "error", eval("\rb")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.2-6.js0000644000175000017500000000531011545150464023156 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.2-6.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.2-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Line Terminators"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var a\u000Ab = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") ); new TestCase( SECTION, "var a\u000Db = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-1.js0000644000175000017500000000561211545150464023157 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-1.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase; testcase = new TestCase( SECTION, "a comment with a line terminator string, and text following", "pass", "pass"); // "\u000A" testcase.actual = "fail"; testcase = new TestCase( SECTION, "// test \\n testcase.actual = \"pass\"", "pass", "" ); var x = "// test \n testcase.actual = 'pass'"; testcase.actual = eval(x); test(); // XXX bc replace test() function test() { for ( gTc=0; gTc < gTestcases.length; gTc++ ) { gTestcases[gTc].passed = writeTestCaseResult( gTestcases[gTc].expect, gTestcases[gTc].actual, gTestcases[gTc].description +": "+ gTestcases[gTc].actual ); gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; } stopTest(); return ( gTestcases ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-10.js0000644000175000017500000000436311545150464023241 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-10.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "code following multiline comment", "pass", "fail"); /*//*/testcase.actual="pass"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-11.js0000644000175000017500000000436611545150464023245 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-11.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "code following multiline comment", "pass", "pass"); ////testcase.actual="fail"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-12.js0000644000175000017500000000436511545150464023245 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-12.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "code following multiline comment", "pass", "pass"); /*testcase.actual="fail";**/ test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-13-n.js0000644000175000017500000000441711545150464023477 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-13-n.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-13-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "nested comment"; EXPECTED = "error"; var testcase = new TestCase( SECTION, "nested comment", "error", eval("/*/*\"fail\";*/*/")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-2.js0000644000175000017500000000441511545150464023160 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-2.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "a comment with a carriage return, and text following", "pass", "pass"); // "\u000D" testcase.actual = "fail"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-3.js0000644000175000017500000000443011545150464023156 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-3.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "source text directly following a single-line comment", "pass", "fail"); // a comment string testcase.actual = "pass"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-4.js0000644000175000017500000000434311545150464023162 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-4.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "multiline comment ", "pass", "pass"); /*testcase.actual = "fail";*/ test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-5.js0000644000175000017500000000441511545150464023163 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-5.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "a comment with a carriage return, and text following", "pass", "pass"); // "\u000A" testcase.actual = "fail"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-6.js0000644000175000017500000000436011545150464023163 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-6.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "comment with multiple asterisks", "pass", "fail"); /* ***/testcase.actual="pass"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-7.js0000644000175000017500000000440311545150464023162 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-7.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-7"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "single line comment following multiline comment", "pass", "pass"); /* ***///testcase.actual="fail"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-8.js0000644000175000017500000000435711545150464023173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-7.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-8"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "code following multiline comment", "pass", "fail"); /**/testcase.actual="pass"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.3-9.js0000644000175000017500000000436011545150464023166 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.3-9.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.3-9"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Comments"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "code following multiline comment", "pass", "fail"); /*/*/testcase.actual="pass"; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.1-1-n.js0000644000175000017500000000456411545150464023557 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.1-1-n.js ECMA Section: 7.4.1 Description: Reserved words cannot be used as identifiers. ReservedWord :: Keyword FutureReservedWord NullLiteral BooleanLiteral Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var null = true"; EXPECTED = "error"; new TestCase( SECTION, "var null = true", "error", eval("var null = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.1-2-n.js0000644000175000017500000000456511545150464023561 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.1-2.js ECMA Section: 7.4.1 Description: Reserved words cannot be used as identifiers. ReservedWord :: Keyword FutureReservedWord NullLiteral BooleanLiteral Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var true = false"; EXPECTED = "error"; new TestCase( SECTION, "var true = false", "error", eval("var true = false") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.1-3-n.js0000644000175000017500000000451511545150464023555 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.1-3-n.js ECMA Section: 7.4.1 Description: Reserved words cannot be used as identifiers. ReservedWord :: Keyword FutureReservedWord NullLiteral BooleanLiteral Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; DESCRIPTION = "var false = true"; EXPECTED = "error"; new TestCase( SECTION, "var false = true", "error", eval("var false = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-1-n.js0000644000175000017500000000536211545150464023555 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-1.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var break = true"; EXPECTED = "error"; new TestCase( SECTION, "var break = true", "error", eval("var break = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-10-n.js0000644000175000017500000000535311545150464023635 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-10.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-10-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var if = true"; EXPECTED = "error"; new TestCase( SECTION, "var if = true", "error", eval("var if = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-11-n.js0000644000175000017500000000536311545150464023637 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-11-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-11-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var this = true"; EXPECTED = "error"; new TestCase( SECTION, "var this = true", "error", eval("var this = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-12-n.js0000644000175000017500000000536611545150464023643 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-12-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-12-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var while = true"; EXPECTED = "error"; new TestCase( SECTION, "var while = true", "error", eval("var while = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-13-n.js0000644000175000017500000000536311545150464023641 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-13-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-13-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var else = true"; EXPECTED = "error"; new TestCase( SECTION, "var else = true", "error", eval("var else = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-14-n.js0000644000175000017500000000535511545150464023643 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-14-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-14-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var in = true"; EXPECTED = "error"; new TestCase( SECTION, "var in = true", "error", eval("var in = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-15-n.js0000644000175000017500000000537111545150464023642 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-15-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-15-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var typeof = true"; EXPECTED = "error"; new TestCase( SECTION, "var typeof = true", "error", eval("var typeof = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-16-n.js0000644000175000017500000000536311545150464023644 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-16-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-16-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var with = true"; EXPECTED = "error"; new TestCase( SECTION, "var with = true", "error", eval("var with = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-2-n.js0000644000175000017500000000535611545150464023561 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-2-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var for = true"; EXPECTED = "error"; new TestCase( SECTION, "var for = true", "error", eval("var for = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-3-n.js0000644000175000017500000000535611545150464023562 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-3-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var new = true"; EXPECTED = "error"; new TestCase( SECTION, "var new = true", "error", eval("var new = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-4-n.js0000644000175000017500000000535211545150464023557 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-4-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var var = true"; EXPECTED = "error"; TestCase( SECTION, "var var = true", "error", eval("var var = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-5-n.js0000644000175000017500000000537511545150464023565 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-5-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-5-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var continue = true"; EXPECTED = "error"; new TestCase( SECTION, "var continue = true", "error", eval("var continue = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-6-n.js0000644000175000017500000000537311545150464023564 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-6.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-6-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var function = true"; EXPECTED = "error"; new TestCase( SECTION, "var function = true", "error", eval("var function = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-7-n.js0000644000175000017500000000533311545150464023561 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-7-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-7"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Keywords"); DESCRIPTION = "var return = true"; EXPECTED = "error"; new TestCase( SECTION, "var return = true", "error", eval("var return = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-8-n.js0000644000175000017500000000532611545150464023564 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-8-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.2-8"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Keywords"); DESCRIPTION = "var void = true"; EXPECTED = "error"; new TestCase( SECTION, "var void = true", "error", eval("var void = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.2-9-n.js0000644000175000017500000000536711545150464023572 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-9-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.1-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Keywords"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var delete = true"; EXPECTED = "error"; new TestCase( SECTION, "var delete = true", "error", eval("var delete = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-1-n.js0000644000175000017500000000514511545150464023555 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-1-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var case = true"; EXPECTED = "error"; new TestCase( SECTION, "var case = true", "error", eval("var case = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-10-n.js0000644000175000017500000000514111545150464023631 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-10-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-10-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var do = true"; EXPECTED = "error"; new TestCase( SECTION, "var do = true", "error", eval("var do = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-11-n.js0000644000175000017500000000516011545150464023633 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-11-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-11-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var finally = true"; EXPECTED = "error"; new TestCase( SECTION, "var finally = true", "error", eval("var finally = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-12-n.js0000644000175000017500000000515211545150464023635 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-12-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-12-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var throw = true"; EXPECTED = "error"; new TestCase( SECTION, "var throw = true", "error", eval("var throw = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-13-n.js0000644000175000017500000000515211545150464023636 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-13-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-13-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var const = true"; EXPECTED = "error"; new TestCase( SECTION, "var const = true", "error", eval("var const = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-14-n.js0000644000175000017500000000600511545150464023635 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-14-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-14-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var actual = 'no error'; var prefValue; print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } try { eval("var enum = true"); } catch(e) { actual = 'error'; } DESCRIPTION = "var enum = true"; EXPECTED = "error"; // force exception since this is a negative test if (actual == 'error') { throw actual; } new TestCase( SECTION, "var enum = true", "error", actual ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-15-n.js0000644000175000017500000000567511545150464023652 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-15-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-15-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var actual = 'no error'; var prefValue; print("This test requires option javascript.options.strict enabled"); options('strict'); options('werror'); try { eval("var import = true"); } catch(e) { actual = 'error'; } DESCRIPTION = "var import = true"; EXPECTED = "error"; // force exception since this is a negative test if (actual == 'error') { throw actual; } new TestCase( SECTION, "var import = true", "error", actual ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-16-n.js0000644000175000017500000000553011545150464023641 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-023.js Corresponds To: 7.4.3-16-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-023.js"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; /* try { try = true; } catch ( e ) { result = expect; exception = e.toString(); } */ DESCRIPTION = "try = true"; EXPECTED = "error"; new TestCase( SECTION, "try = true" + " (threw " + exception +")", "error", eval("try = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-2-n.js0000644000175000017500000000516111545150464023554 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-2-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var debugger = true"; EXPECTED = "error"; new TestCase( SECTION, "var debugger = true", "error", eval("var debugger = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-3-n.js0000644000175000017500000000515311545150464023556 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-3-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var export = true"; EXPECTED = "error"; new TestCase( SECTION, "var export = true", "error", eval("var export = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-4-n.js0000644000175000017500000000600611545150464023555 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-4-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var actual = 'no error'; var prefValue; print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } try { eval("var super = true"); } catch(e) { actual = 'error'; } DESCRIPTION = "var super = true" EXPECTED = "error"; // force exception since this is a negative test if (actual == 'error') { throw actual; } new TestCase( SECTION, "var super = true", "error", actual ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-5-n.js0000644000175000017500000000515311545150464023560 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-5-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-5-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var catch = true"; EXPECTED = "error"; new TestCase( SECTION, "var catch = true", "error", eval("var catch = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-6-n.js0000644000175000017500000000515611545150464023564 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-6-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-6-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var default = true"; EXPECTED = "error"; new TestCase( SECTION, "var default = true", "error", eval("var default = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-7-n.js0000644000175000017500000000601311545150464023556 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-7-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-7-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var actual = 'no error'; var prefValue; print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } try { eval("var extends = true"); } catch(e) { actual = 'error'; } DESCRIPTION = "var extends = true"; EXPECTED = "error"; // force exception since this is a negative test if (actual == 'error') { throw actual; } new TestCase( SECTION, "var extends = true", "error", actual); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-8-n.js0000644000175000017500000000515311545150464023563 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-8-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var switch = true"; EXPECTED = "error"; new TestCase( SECTION, "var switch = true", "error", eval("var switch = true") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.4.3-9-n.js0000644000175000017500000000600711545150464023563 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.3-9-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.4.3-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Future Reserved Words"; writeHeaderToLog( SECTION + " "+ TITLE); var actual = 'no error'; var prefValue; DESCRIPTION = "var class = true"; EXPECTED = "error"; print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } try { eval("var class = true"); } catch(e) { actual = 'error'; } // force exception since this is a negative test if (actual == 'error') { throw actual; } new TestCase( SECTION, "var class = true", "error", actual ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.5-1.js0000644000175000017500000000470311545150464023161 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.5-1.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var $123 = 5", 5, eval("var $123 = 5;$123") ); new TestCase( SECTION, "var _123 = 5", 5, eval("var _123 = 5;_123") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.5-10-n.js0000644000175000017500000000467011545150464023477 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.5-9-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 123=\"hi\""; EXPECTED = "error"; new TestCase( SECTION, "var 123=\"hi\"", "error", eval("123 = \"hi\"; array[item] = 123;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.5-2-n.js0000644000175000017500000000462411545150464023417 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.5-2-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 0abc"; EXPECTED = "error"; new TestCase( SECTION, "var 0abc", "error", eval("var 0abc") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.5-3-n.js0000644000175000017500000000462211545150464023416 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.5-2.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 1abc"; EXPECTED = "error"; new TestCase( SECTION, "var 1abc", "error", eval("var 1abc") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.5-4-n.js0000644000175000017500000000462411545150464023421 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.5-4-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-4-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 2abc"; EXPECTED = "error"; new TestCase( SECTION, "var 2abc", "error", eval("var 2abc") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.5-5-n.js0000644000175000017500000000462411545150464023422 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.5-5-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-5-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 3abc"; EXPECTED = "error"; new TestCase( SECTION, "var 3abc", "error", eval("var 3abc") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.5-6.js0000644000175000017500000000455411545150464023172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.5-6.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var _0abc = 5", 5, eval("var _0abc = 5; _0abc") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.5-7.js0000644000175000017500000000455411545150464023173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.5-7.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-7"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var $0abc = 5", 5, eval("var $0abc = 5; $0abc") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.5-8-n.js0000644000175000017500000000467011545150464023426 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.5-8-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-8-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var @0abc = 5; @0abc"; EXPECTED = "error"; new TestCase( SECTION, "var @0abc = 5; @0abc", "error", eval("var @0abc = 5; @0abc") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.5-9-n.js0000644000175000017500000000467311545150464023432 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.5-9-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "7.5-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Identifiers"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var 123=\"hi\""; EXPECTED = "error"; new TestCase( SECTION, "var 123=\"hi\"", "error", eval("var 123 = \"hi\";array[item] = 123;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.6.js0000644000175000017500000001621511545150464023025 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.6.js ECMA Section: Punctuators Description: This tests verifies that all ECMA punctutors are recognized as a token separator, but does not attempt to verify the functionality of any punctuator. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "7.6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Punctuators"; writeHeaderToLog( SECTION + " "+ TITLE); // == new TestCase( SECTION, "var c,d;c==d", true, eval("var c,d;c==d") ); // = new TestCase( SECTION, "var a=true;a", true, eval("var a=true;a") ); // > new TestCase( SECTION, "var a=true,b=false;a>b", true, eval("var a=true,b=false;a>b") ); // < new TestCase( SECTION, "var a=true,b=false;a= new TestCase( SECTION, "var a=0xFFFF,b=0XFFFE;a>=b", true, eval("var a=0xFFFF,b=0XFFFE;a>=b") ); // != new TestCase( SECTION, "var a=true,b=false;a!=b", true, eval("var a=true,b=false;a!=b") ); new TestCase( SECTION, "var a=false,b=false;a!=b", false, eval("var a=false,b=false;a!=b") ); // , new TestCase( SECTION, "var a=true,b=false;a,b", false, eval("var a=true,b=false;a,b") ); // ! new TestCase( SECTION, "var a=true,b=false;!a", false, eval("var a=true,b=false;!a") ); // ~ new TestCase( SECTION, "var a=true;~a", -2, eval("var a=true;~a") ); // ? new TestCase( SECTION, "var a=true; (a ? 'PASS' : '')", "PASS", eval("var a=true; (a ? 'PASS' : '')") ); // : new TestCase( SECTION, "var a=false; (a ? 'FAIL' : 'PASS')", "PASS", eval("var a=false; (a ? 'FAIL' : 'PASS')") ); // . new TestCase( SECTION, "var a=Number;a.NaN", NaN, eval("var a=Number;a.NaN") ); // && new TestCase( SECTION, "var a=true,b=true;if(a&&b)'PASS';else'FAIL'", "PASS", eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") ); // || new TestCase( SECTION, "var a=false,b=false;if(a||b)'FAIL';else'PASS'", "PASS", eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") ); // ++ new TestCase( SECTION, "var a=false,b=false;++a", 1, eval("var a=false,b=false;++a") ); // -- new TestCase( SECTION, "var a=true,b=false--a", 0, eval("var a=true,b=false;--a") ); // + new TestCase( SECTION, "var a=true,b=true;a+b", 2, eval("var a=true,b=true;a+b") ); // - new TestCase( SECTION, "var a=true,b=true;a-b", 0, eval("var a=true,b=true;a-b") ); // * new TestCase( SECTION, "var a=true,b=true;a*b", 1, eval("var a=true,b=true;a*b") ); // / new TestCase( SECTION, "var a=true,b=true;a/b", 1, eval("var a=true,b=true;a/b") ); // & new TestCase( SECTION, "var a=3,b=2;a&b", 2, eval("var a=3,b=2;a&b") ); // | new TestCase( SECTION, "var a=4,b=3;a|b", 7, eval("var a=4,b=3;a|b") ); // | new TestCase( SECTION, "var a=4,b=3;a^b", 7, eval("var a=4,b=3;a^b") ); // % new TestCase( SECTION, "var a=4,b=3;a|b", 1, eval("var a=4,b=3;a%b") ); // << new TestCase( SECTION, "var a=4,b=3;a<> new TestCase( SECTION, "var a=4,b=1;a>>b", 2, eval("var a=4,b=1;a>>b") ); // >>> new TestCase( SECTION, "var a=1,b=1;a>>>b", 0, eval("var a=1,b=1;a>>>b") ); // += new TestCase( SECTION, "var a=4,b=3;a+=b;a", 7, eval("var a=4,b=3;a+=b;a") ); // -= new TestCase( SECTION, "var a=4,b=3;a-=b;a", 1, eval("var a=4,b=3;a-=b;a") ); // *= new TestCase( SECTION, "var a=4,b=3;a*=b;a", 12, eval("var a=4,b=3;a*=b;a") ); // += new TestCase( SECTION, "var a=4,b=3;a+=b;a", 7, eval("var a=4,b=3;a+=b;a") ); // /= new TestCase( SECTION, "var a=12,b=3;a/=b;a", 4, eval("var a=12,b=3;a/=b;a") ); // &= new TestCase( SECTION, "var a=4,b=5;a&=b;a", 4, eval("var a=4,b=5;a&=b;a") ); // |= new TestCase( SECTION, "var a=4,b=5;a&=b;a", 5, eval("var a=4,b=5;a|=b;a") ); // ^= new TestCase( SECTION, "var a=4,b=5;a^=b;a", 1, eval("var a=4,b=5;a^=b;a") ); // %= new TestCase( SECTION, "var a=12,b=5;a%=b;a", 2, eval("var a=12,b=5;a%=b;a") ); // <<= new TestCase( SECTION, "var a=4,b=3;a<<=b;a", 32, eval("var a=4,b=3;a<<=b;a") ); // >> new TestCase( SECTION, "var a=4,b=1;a>>=b;a", 2, eval("var a=4,b=1;a>>=b;a") ); // >>> new TestCase( SECTION, "var a=1,b=1;a>>>=b;a", 0, eval("var a=1,b=1;a>>>=b;a") ); // () new TestCase( SECTION, "var a=4,b=3;(a)", 4, eval("var a=4,b=3;(a)") ); // {} new TestCase( SECTION, "var a=4,b=3;{b}", 3, eval("var a=4,b=3;{b}") ); // [] new TestCase( SECTION, "var a=new Array('hi');a[0]", "hi", eval("var a=new Array('hi');a[0]") ); // [] new TestCase( SECTION, ";", void 0, eval(";") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.7.1.js0000644000175000017500000000443111545150464023162 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.7.1.js ECMA Section: 7.7.1 Null Literals Description: NullLiteral:: null The value of the null literal null is the sole value of the Null type, namely null. Author: christine@netscape.com Date: 21 october 1997 */ var SECTION = "7.7.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Null Literals"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "null", null, null); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.7.2.js0000644000175000017500000000475411545150464023173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.7.2.js ECMA Section: 7.7.2 Boolean Literals Description: BooleanLiteral:: true false The value of the Boolean literal true is a value of the Boolean type, namely true. The value of the Boolean literal false is a value of the Boolean type, namely false. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "7.7.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Boolean Literals"; writeHeaderToLog( SECTION + " "+ TITLE); // StringLiteral:: "" and '' new TestCase( SECTION, "true", Boolean(true), true ); new TestCase( SECTION, "false", Boolean(false), false ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.7.3-1.js0000644000175000017500000001221211545150464023316 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.7.3-1.js ECMA Section: 7.7.3 Numeric Literals Description: A numeric literal stands for a value of the Number type This value is determined in two steps: first a mathematical value (MV) is derived from the literal; second, this mathematical value is rounded, ideally using IEEE 754 round-to-nearest mode, to a reprentable value of of the number type. These test cases came from Waldemar. Author: christine@netscape.com Date: 12 June 1998 */ var SECTION = "7.7.3-1"; var VERSION = "ECMA_1"; var TITLE = "Numeric Literals"; var BUGNUMBER="122877"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "0x12345678", 305419896, 0x12345678 ); new TestCase( SECTION, "0x80000000", 2147483648, 0x80000000 ); new TestCase( SECTION, "0xffffffff", 4294967295, 0xffffffff ); new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 ); new TestCase( SECTION, "077777777777777777", 2251799813685247, 077777777777777777 ); new TestCase( SECTION, "077777777777777776", 2251799813685246, 077777777777777776 ); new TestCase( SECTION, "0x1fffffffffffff", 9007199254740991, 0x1fffffffffffff ); new TestCase( SECTION, "0x20000000000000", 9007199254740992, 0x20000000000000 ); new TestCase( SECTION, "0x20123456789abc", 9027215253084860, 0x20123456789abc ); new TestCase( SECTION, "0x20123456789abd", 9027215253084860, 0x20123456789abd ); new TestCase( SECTION, "0x20123456789abe", 9027215253084862, 0x20123456789abe ); new TestCase( SECTION, "0x20123456789abf", 9027215253084864, 0x20123456789abf ); new TestCase( SECTION, "0x1000000000000080", 1152921504606847000, 0x1000000000000080 ); new TestCase( SECTION, "0x1000000000000081", 1152921504606847200, 0x1000000000000081 ); new TestCase( SECTION, "0x1000000000000100", 1152921504606847200, 0x1000000000000100 ); new TestCase( SECTION, "0x100000000000017f", 1152921504606847200, 0x100000000000017f ); new TestCase( SECTION, "0x1000000000000180", 1152921504606847500, 0x1000000000000180 ); new TestCase( SECTION, "0x1000000000000181", 1152921504606847500, 0x1000000000000181 ); new TestCase( SECTION, "0x10000000000001f0", 1152921504606847500, 0x10000000000001f0 ); new TestCase( SECTION, "0x1000000000000200", 1152921504606847500, 0x1000000000000200 ); new TestCase( SECTION, "0x100000000000027f", 1152921504606847500, 0x100000000000027f ); new TestCase( SECTION, "0x1000000000000280", 1152921504606847500, 0x1000000000000280 ); new TestCase( SECTION, "0x1000000000000281", 1152921504606847700, 0x1000000000000281 ); new TestCase( SECTION, "0x10000000000002ff", 1152921504606847700, 0x10000000000002ff ); new TestCase( SECTION, "0x1000000000000300", 1152921504606847700, 0x1000000000000300 ); new TestCase( SECTION, "0x10000000000000000", 18446744073709552000, 0x10000000000000000 ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.7.3-2.js0000644000175000017500000000566511545150464023335 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.7.3-2.js ECMA Section: 7.7.3 Numeric Literals Description: This is a regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122884 Waldemar's comments: A numeric literal that starts with either '08' or '09' is interpreted as a decimal literal; it should be an error instead. (Strictly speaking, according to ECMA v1 such literals should be interpreted as two integers -- a zero followed by a decimal number whose first digit is 8 or 9, but this is a bug in ECMA that will be fixed in v2. In any case, there is no place in the grammar where two consecutive numbers would be legal.) Author: christine@netscape.com Date: 15 june 1998 */ var SECTION = "7.7.3-2"; var VERSION = "ECMA_1"; var TITLE = "Numeric Literals"; var BUGNUMBER="122884"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "9", 9, 9 ); new TestCase( SECTION, "09", 9, 09 ); new TestCase( SECTION, "099", 99, 099 ); new TestCase( SECTION, "077", 63, 077 ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.7.3.js0000644000175000017500000003142111545150464023163 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.7.3.js ECMA Section: 7.7.3 Numeric Literals Description: A numeric literal stands for a value of the Number type This value is determined in two steps: first a mathematical value (MV) is derived from the literal; second, this mathematical value is rounded, ideally using IEEE 754 round-to-nearest mode, to a reprentable value of of the number type. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "7.7.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Numeric Literals"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "0", 0, 0 ); new TestCase( SECTION, "1", 1, 1 ); new TestCase( SECTION, "2", 2, 2 ); new TestCase( SECTION, "3", 3, 3 ); new TestCase( SECTION, "4", 4, 4 ); new TestCase( SECTION, "5", 5, 5 ); new TestCase( SECTION, "6", 6, 6 ); new TestCase( SECTION, "7", 7, 7 ); new TestCase( SECTION, "8", 8, 8 ); new TestCase( SECTION, "9", 9, 9 ); new TestCase( SECTION, "0.", 0, 0. ); new TestCase( SECTION, "1.", 1, 1. ); new TestCase( SECTION, "2.", 2, 2. ); new TestCase( SECTION, "3.", 3, 3. ); new TestCase( SECTION, "4.", 4, 4. ); new TestCase( SECTION, "0.e0", 0, 0.e0 ); new TestCase( SECTION, "1.e1", 10, 1.e1 ); new TestCase( SECTION, "2.e2", 200, 2.e2 ); new TestCase( SECTION, "3.e3", 3000, 3.e3 ); new TestCase( SECTION, "4.e4", 40000, 4.e4 ); new TestCase( SECTION, "0.1e0", .1, 0.1e0 ); new TestCase( SECTION, "1.1e1", 11, 1.1e1 ); new TestCase( SECTION, "2.2e2", 220, 2.2e2 ); new TestCase( SECTION, "3.3e3", 3300, 3.3e3 ); new TestCase( SECTION, "4.4e4", 44000, 4.4e4 ); new TestCase( SECTION, ".1e0", .1, .1e0 ); new TestCase( SECTION, ".1e1", 1, .1e1 ); new TestCase( SECTION, ".2e2", 20, .2e2 ); new TestCase( SECTION, ".3e3", 300, .3e3 ); new TestCase( SECTION, ".4e4", 4000, .4e4 ); new TestCase( SECTION, "0e0", 0, 0e0 ); new TestCase( SECTION, "1e1", 10, 1e1 ); new TestCase( SECTION, "2e2", 200, 2e2 ); new TestCase( SECTION, "3e3", 3000, 3e3 ); new TestCase( SECTION, "4e4", 40000, 4e4 ); new TestCase( SECTION, "0e0", 0, 0e0 ); new TestCase( SECTION, "1e1", 10, 1e1 ); new TestCase( SECTION, "2e2", 200, 2e2 ); new TestCase( SECTION, "3e3", 3000, 3e3 ); new TestCase( SECTION, "4e4", 40000, 4e4 ); new TestCase( SECTION, "0E0", 0, 0E0 ); new TestCase( SECTION, "1E1", 10, 1E1 ); new TestCase( SECTION, "2E2", 200, 2E2 ); new TestCase( SECTION, "3E3", 3000, 3E3 ); new TestCase( SECTION, "4E4", 40000, 4E4 ); new TestCase( SECTION, "1.e-1", 0.1, 1.e-1 ); new TestCase( SECTION, "2.e-2", 0.02, 2.e-2 ); new TestCase( SECTION, "3.e-3", 0.003, 3.e-3 ); new TestCase( SECTION, "4.e-4", 0.0004, 4.e-4 ); new TestCase( SECTION, "0.1e-0", .1, 0.1e-0 ); new TestCase( SECTION, "1.1e-1", 0.11, 1.1e-1 ); new TestCase( SECTION, "2.2e-2", .022, 2.2e-2 ); new TestCase( SECTION, "3.3e-3", .0033, 3.3e-3 ); new TestCase( SECTION, "4.4e-4", .00044, 4.4e-4 ); new TestCase( SECTION, ".1e-0", .1, .1e-0 ); new TestCase( SECTION, ".1e-1", .01, .1e-1 ); new TestCase( SECTION, ".2e-2", .002, .2e-2 ); new TestCase( SECTION, ".3e-3", .0003, .3e-3 ); new TestCase( SECTION, ".4e-4", .00004, .4e-4 ); new TestCase( SECTION, "1.e+1", 10, 1.e+1 ); new TestCase( SECTION, "2.e+2", 200, 2.e+2 ); new TestCase( SECTION, "3.e+3", 3000, 3.e+3 ); new TestCase( SECTION, "4.e+4", 40000, 4.e+4 ); new TestCase( SECTION, "0.1e+0", .1, 0.1e+0 ); new TestCase( SECTION, "1.1e+1", 11, 1.1e+1 ); new TestCase( SECTION, "2.2e+2", 220, 2.2e+2 ); new TestCase( SECTION, "3.3e+3", 3300, 3.3e+3 ); new TestCase( SECTION, "4.4e+4", 44000, 4.4e+4 ); new TestCase( SECTION, ".1e+0", .1, .1e+0 ); new TestCase( SECTION, ".1e+1", 1, .1e+1 ); new TestCase( SECTION, ".2e+2", 20, .2e+2 ); new TestCase( SECTION, ".3e+3", 300, .3e+3 ); new TestCase( SECTION, ".4e+4", 4000, .4e+4 ); new TestCase( SECTION, "0x0", 0, 0x0 ); new TestCase( SECTION, "0x1", 1, 0x1 ); new TestCase( SECTION, "0x2", 2, 0x2 ); new TestCase( SECTION, "0x3", 3, 0x3 ); new TestCase( SECTION, "0x4", 4, 0x4 ); new TestCase( SECTION, "0x5", 5, 0x5 ); new TestCase( SECTION, "0x6", 6, 0x6 ); new TestCase( SECTION, "0x7", 7, 0x7 ); new TestCase( SECTION, "0x8", 8, 0x8 ); new TestCase( SECTION, "0x9", 9, 0x9 ); new TestCase( SECTION, "0xa", 10, 0xa ); new TestCase( SECTION, "0xb", 11, 0xb ); new TestCase( SECTION, "0xc", 12, 0xc ); new TestCase( SECTION, "0xd", 13, 0xd ); new TestCase( SECTION, "0xe", 14, 0xe ); new TestCase( SECTION, "0xf", 15, 0xf ); new TestCase( SECTION, "0X0", 0, 0X0 ); new TestCase( SECTION, "0X1", 1, 0X1 ); new TestCase( SECTION, "0X2", 2, 0X2 ); new TestCase( SECTION, "0X3", 3, 0X3 ); new TestCase( SECTION, "0X4", 4, 0X4 ); new TestCase( SECTION, "0X5", 5, 0X5 ); new TestCase( SECTION, "0X6", 6, 0X6 ); new TestCase( SECTION, "0X7", 7, 0X7 ); new TestCase( SECTION, "0X8", 8, 0X8 ); new TestCase( SECTION, "0X9", 9, 0X9 ); new TestCase( SECTION, "0Xa", 10, 0Xa ); new TestCase( SECTION, "0Xb", 11, 0Xb ); new TestCase( SECTION, "0Xc", 12, 0Xc ); new TestCase( SECTION, "0Xd", 13, 0Xd ); new TestCase( SECTION, "0Xe", 14, 0Xe ); new TestCase( SECTION, "0Xf", 15, 0Xf ); new TestCase( SECTION, "0x0", 0, 0x0 ); new TestCase( SECTION, "0x1", 1, 0x1 ); new TestCase( SECTION, "0x2", 2, 0x2 ); new TestCase( SECTION, "0x3", 3, 0x3 ); new TestCase( SECTION, "0x4", 4, 0x4 ); new TestCase( SECTION, "0x5", 5, 0x5 ); new TestCase( SECTION, "0x6", 6, 0x6 ); new TestCase( SECTION, "0x7", 7, 0x7 ); new TestCase( SECTION, "0x8", 8, 0x8 ); new TestCase( SECTION, "0x9", 9, 0x9 ); new TestCase( SECTION, "0xA", 10, 0xA ); new TestCase( SECTION, "0xB", 11, 0xB ); new TestCase( SECTION, "0xC", 12, 0xC ); new TestCase( SECTION, "0xD", 13, 0xD ); new TestCase( SECTION, "0xE", 14, 0xE ); new TestCase( SECTION, "0xF", 15, 0xF ); new TestCase( SECTION, "0X0", 0, 0X0 ); new TestCase( SECTION, "0X1", 1, 0X1 ); new TestCase( SECTION, "0X2", 2, 0X2 ); new TestCase( SECTION, "0X3", 3, 0X3 ); new TestCase( SECTION, "0X4", 4, 0X4 ); new TestCase( SECTION, "0X5", 5, 0X5 ); new TestCase( SECTION, "0X6", 6, 0X6 ); new TestCase( SECTION, "0X7", 7, 0X7 ); new TestCase( SECTION, "0X8", 8, 0X8 ); new TestCase( SECTION, "0X9", 9, 0X9 ); new TestCase( SECTION, "0XA", 10, 0XA ); new TestCase( SECTION, "0XB", 11, 0XB ); new TestCase( SECTION, "0XC", 12, 0XC ); new TestCase( SECTION, "0XD", 13, 0XD ); new TestCase( SECTION, "0XE", 14, 0XE ); new TestCase( SECTION, "0XF", 15, 0XF ); new TestCase( SECTION, "00", 0, 00 ); new TestCase( SECTION, "01", 1, 01 ); new TestCase( SECTION, "02", 2, 02 ); new TestCase( SECTION, "03", 3, 03 ); new TestCase( SECTION, "04", 4, 04 ); new TestCase( SECTION, "05", 5, 05 ); new TestCase( SECTION, "06", 6, 06 ); new TestCase( SECTION, "07", 7, 07 ); new TestCase( SECTION, "000", 0, 000 ); new TestCase( SECTION, "011", 9, 011 ); new TestCase( SECTION, "022", 18, 022 ); new TestCase( SECTION, "033", 27, 033 ); new TestCase( SECTION, "044", 36, 044 ); new TestCase( SECTION, "055", 45, 055 ); new TestCase( SECTION, "066", 54, 066 ); new TestCase( SECTION, "077", 63, 077 ); new TestCase( SECTION, "0.00000000001", 0.00000000001, 0.00000000001 ); new TestCase( SECTION, "0.00000000001e-2", 0.0000000000001, 0.00000000001e-2 ); new TestCase( SECTION, "123456789012345671.9999", "123456789012345660", 123456789012345671.9999 +""); new TestCase( SECTION, "123456789012345672", "123456789012345660", 123456789012345672 +""); new TestCase( SECTION, "123456789012345672.000000000000000000000000000", "123456789012345660", 123456789012345672.000000000000000000000000000 +""); new TestCase( SECTION, "123456789012345672.01", "123456789012345680", 123456789012345672.01 +""); new TestCase( SECTION, "123456789012345672.000000000000000000000000001+'' == 123456789012345680 || 123456789012345660", true, ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345680 ) || ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345660) ); new TestCase( SECTION, "123456789012345673", "123456789012345680", 123456789012345673 +"" ); new TestCase( SECTION, "-123456789012345671.9999", "-123456789012345660", -123456789012345671.9999 +"" ); new TestCase( SECTION, "-123456789012345672", "-123456789012345660", -123456789012345672+""); new TestCase( SECTION, "-123456789012345672.000000000000000000000000000", "-123456789012345660", -123456789012345672.000000000000000000000000000 +""); new TestCase( SECTION, "-123456789012345672.01", "-123456789012345680", -123456789012345672.01 +"" ); new TestCase( SECTION, "-123456789012345672.000000000000000000000000001 == -123456789012345680 or -123456789012345660", true, (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345680) || (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345660)); new TestCase( SECTION, -123456789012345673, "-123456789012345680", -123456789012345673 +""); new TestCase( SECTION, "12345678901234567890", "12345678901234567000", 12345678901234567890 +"" ); /* new TestCase( SECTION, "12345678901234567", "12345678901234567", 12345678901234567+"" ); new TestCase( SECTION, "123456789012345678", "123456789012345678", 123456789012345678+"" ); new TestCase( SECTION, "1234567890123456789", "1234567890123456789", 1234567890123456789+"" ); new TestCase( SECTION, "12345678901234567890", "12345678901234567890", 12345678901234567890+"" ); new TestCase( SECTION, "123456789012345678900", "123456789012345678900", 123456789012345678900+"" ); new TestCase( SECTION, "1234567890123456789000", "1234567890123456789000", 1234567890123456789000+"" ); */ new TestCase( SECTION, "0x1", 1, 0x1 ); new TestCase( SECTION, "0x10", 16, 0x10 ); new TestCase( SECTION, "0x100", 256, 0x100 ); new TestCase( SECTION, "0x1000", 4096, 0x1000 ); new TestCase( SECTION, "0x10000", 65536, 0x10000 ); new TestCase( SECTION, "0x100000", 1048576, 0x100000 ); new TestCase( SECTION, "0x1000000", 16777216, 0x1000000 ); new TestCase( SECTION, "0x10000000", 268435456, 0x10000000 ); /* new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 ); new TestCase( SECTION, "0x1000000000", 68719476736, 0x1000000000 ); new TestCase( SECTION, "0x10000000000", 1099511627776, 0x10000000000 ); */ test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.7.4.js0000644000175000017500000003551711545150464023176 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.7.4.js ECMA Section: 7.7.4 String Literals Description: A string literal is zero or more characters enclosed in single or double quotes. Each character may be represented by an escape sequence. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "7.7.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String Literals"; writeHeaderToLog( SECTION + " "+ TITLE); // StringLiteral:: "" and '' new TestCase( SECTION, "\"\"", "", "" ); new TestCase( SECTION, "\'\'", "", '' ); // DoubleStringCharacters:: DoubleStringCharacter :: EscapeSequence :: CharacterEscapeSequence new TestCase( SECTION, "\\\"", String.fromCharCode(0x0022), "\"" ); new TestCase( SECTION, "\\\'", String.fromCharCode(0x0027), "\'" ); new TestCase( SECTION, "\\", String.fromCharCode(0x005C), "\\" ); new TestCase( SECTION, "\\b", String.fromCharCode(0x0008), "\b" ); new TestCase( SECTION, "\\f", String.fromCharCode(0x000C), "\f" ); new TestCase( SECTION, "\\n", String.fromCharCode(0x000A), "\n" ); new TestCase( SECTION, "\\r", String.fromCharCode(0x000D), "\r" ); new TestCase( SECTION, "\\t", String.fromCharCode(0x0009), "\t" ); new TestCase( SECTION, "\\v", String.fromCharCode(0x000B), "\v" ); // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::OctalEscapeSequence new TestCase( SECTION, "\\00", String.fromCharCode(0x0000), "\00" ); new TestCase( SECTION, "\\01", String.fromCharCode(0x0001), "\01" ); new TestCase( SECTION, "\\02", String.fromCharCode(0x0002), "\02" ); new TestCase( SECTION, "\\03", String.fromCharCode(0x0003), "\03" ); new TestCase( SECTION, "\\04", String.fromCharCode(0x0004), "\04" ); new TestCase( SECTION, "\\05", String.fromCharCode(0x0005), "\05" ); new TestCase( SECTION, "\\06", String.fromCharCode(0x0006), "\06" ); new TestCase( SECTION, "\\07", String.fromCharCode(0x0007), "\07" ); new TestCase( SECTION, "\\010", String.fromCharCode(0x0008), "\010" ); new TestCase( SECTION, "\\011", String.fromCharCode(0x0009), "\011" ); new TestCase( SECTION, "\\012", String.fromCharCode(0x000A), "\012" ); new TestCase( SECTION, "\\013", String.fromCharCode(0x000B), "\013" ); new TestCase( SECTION, "\\014", String.fromCharCode(0x000C), "\014" ); new TestCase( SECTION, "\\015", String.fromCharCode(0x000D), "\015" ); new TestCase( SECTION, "\\016", String.fromCharCode(0x000E), "\016" ); new TestCase( SECTION, "\\017", String.fromCharCode(0x000F), "\017" ); new TestCase( SECTION, "\\020", String.fromCharCode(0x0010), "\020" ); new TestCase( SECTION, "\\042", String.fromCharCode(0x0022), "\042" ); new TestCase( SECTION, "\\0", String.fromCharCode(0x0000), "\0" ); new TestCase( SECTION, "\\1", String.fromCharCode(0x0001), "\1" ); new TestCase( SECTION, "\\2", String.fromCharCode(0x0002), "\2" ); new TestCase( SECTION, "\\3", String.fromCharCode(0x0003), "\3" ); new TestCase( SECTION, "\\4", String.fromCharCode(0x0004), "\4" ); new TestCase( SECTION, "\\5", String.fromCharCode(0x0005), "\5" ); new TestCase( SECTION, "\\6", String.fromCharCode(0x0006), "\6" ); new TestCase( SECTION, "\\7", String.fromCharCode(0x0007), "\7" ); new TestCase( SECTION, "\\10", String.fromCharCode(0x0008), "\10" ); new TestCase( SECTION, "\\11", String.fromCharCode(0x0009), "\11" ); new TestCase( SECTION, "\\12", String.fromCharCode(0x000A), "\12" ); new TestCase( SECTION, "\\13", String.fromCharCode(0x000B), "\13" ); new TestCase( SECTION, "\\14", String.fromCharCode(0x000C), "\14" ); new TestCase( SECTION, "\\15", String.fromCharCode(0x000D), "\15" ); new TestCase( SECTION, "\\16", String.fromCharCode(0x000E), "\16" ); new TestCase( SECTION, "\\17", String.fromCharCode(0x000F), "\17" ); new TestCase( SECTION, "\\20", String.fromCharCode(0x0010), "\20" ); new TestCase( SECTION, "\\42", String.fromCharCode(0x0022), "\42" ); new TestCase( SECTION, "\\000", String.fromCharCode(0), "\000" ); new TestCase( SECTION, "\\111", String.fromCharCode(73), "\111" ); new TestCase( SECTION, "\\222", String.fromCharCode(146), "\222" ); new TestCase( SECTION, "\\333", String.fromCharCode(219), "\333" ); // following line commented out as it causes a compile time error // new TestCase( SECTION, "\\444", "444", "\444" ); // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::HexEscapeSequence /* new TestCase( SECTION, "\\x0", String.fromCharCode(0), "\x0" ); new TestCase( SECTION, "\\x1", String.fromCharCode(1), "\x1" ); new TestCase( SECTION, "\\x2", String.fromCharCode(2), "\x2" ); new TestCase( SECTION, "\\x3", String.fromCharCode(3), "\x3" ); new TestCase( SECTION, "\\x4", String.fromCharCode(4), "\x4" ); new TestCase( SECTION, "\\x5", String.fromCharCode(5), "\x5" ); new TestCase( SECTION, "\\x6", String.fromCharCode(6), "\x6" ); new TestCase( SECTION, "\\x7", String.fromCharCode(7), "\x7" ); new TestCase( SECTION, "\\x8", String.fromCharCode(8), "\x8" ); new TestCase( SECTION, "\\x9", String.fromCharCode(9), "\x9" ); new TestCase( SECTION, "\\xA", String.fromCharCode(10), "\xA" ); new TestCase( SECTION, "\\xB", String.fromCharCode(11), "\xB" ); new TestCase( SECTION, "\\xC", String.fromCharCode(12), "\xC" ); new TestCase( SECTION, "\\xD", String.fromCharCode(13), "\xD" ); new TestCase( SECTION, "\\xE", String.fromCharCode(14), "\xE" ); new TestCase( SECTION, "\\xF", String.fromCharCode(15), "\xF" ); */ new TestCase( SECTION, "\\xF0", String.fromCharCode(240), "\xF0" ); new TestCase( SECTION, "\\xE1", String.fromCharCode(225), "\xE1" ); new TestCase( SECTION, "\\xD2", String.fromCharCode(210), "\xD2" ); new TestCase( SECTION, "\\xC3", String.fromCharCode(195), "\xC3" ); new TestCase( SECTION, "\\xB4", String.fromCharCode(180), "\xB4" ); new TestCase( SECTION, "\\xA5", String.fromCharCode(165), "\xA5" ); new TestCase( SECTION, "\\x96", String.fromCharCode(150), "\x96" ); new TestCase( SECTION, "\\x87", String.fromCharCode(135), "\x87" ); new TestCase( SECTION, "\\x78", String.fromCharCode(120), "\x78" ); new TestCase( SECTION, "\\x69", String.fromCharCode(105), "\x69" ); new TestCase( SECTION, "\\x5A", String.fromCharCode(90), "\x5A" ); new TestCase( SECTION, "\\x4B", String.fromCharCode(75), "\x4B" ); new TestCase( SECTION, "\\x3C", String.fromCharCode(60), "\x3C" ); new TestCase( SECTION, "\\x2D", String.fromCharCode(45), "\x2D" ); new TestCase( SECTION, "\\x1E", String.fromCharCode(30), "\x1E" ); new TestCase( SECTION, "\\x0F", String.fromCharCode(15), "\x0F" ); // string literals only take up to two hext digits. therefore, the third character in this string // should be interpreted as a StringCharacter and not part of the HextEscapeSequence new TestCase( SECTION, "\\xF0F", String.fromCharCode(240)+"F", "\xF0F" ); new TestCase( SECTION, "\\xE1E", String.fromCharCode(225)+"E", "\xE1E" ); new TestCase( SECTION, "\\xD2D", String.fromCharCode(210)+"D", "\xD2D" ); new TestCase( SECTION, "\\xC3C", String.fromCharCode(195)+"C", "\xC3C" ); new TestCase( SECTION, "\\xB4B", String.fromCharCode(180)+"B", "\xB4B" ); new TestCase( SECTION, "\\xA5A", String.fromCharCode(165)+"A", "\xA5A" ); new TestCase( SECTION, "\\x969", String.fromCharCode(150)+"9", "\x969" ); new TestCase( SECTION, "\\x878", String.fromCharCode(135)+"8", "\x878" ); new TestCase( SECTION, "\\x787", String.fromCharCode(120)+"7", "\x787" ); new TestCase( SECTION, "\\x696", String.fromCharCode(105)+"6", "\x696" ); new TestCase( SECTION, "\\x5A5", String.fromCharCode(90)+"5", "\x5A5" ); new TestCase( SECTION, "\\x4B4", String.fromCharCode(75)+"4", "\x4B4" ); new TestCase( SECTION, "\\x3C3", String.fromCharCode(60)+"3", "\x3C3" ); new TestCase( SECTION, "\\x2D2", String.fromCharCode(45)+"2", "\x2D2" ); new TestCase( SECTION, "\\x1E1", String.fromCharCode(30)+"1", "\x1E1" ); new TestCase( SECTION, "\\x0F0", String.fromCharCode(15)+"0", "\x0F0" ); // G is out of hex range new TestCase( SECTION, "\\xG", "xG", "\xG" ); new TestCase( SECTION, "\\xCG", "xCG", "\xCG" ); // DoubleStringCharacter::EscapeSequence::CharacterEscapeSequence::\ NonEscapeCharacter new TestCase( SECTION, "\\a", "a", "\a" ); new TestCase( SECTION, "\\c", "c", "\c" ); new TestCase( SECTION, "\\d", "d", "\d" ); new TestCase( SECTION, "\\e", "e", "\e" ); new TestCase( SECTION, "\\g", "g", "\g" ); new TestCase( SECTION, "\\h", "h", "\h" ); new TestCase( SECTION, "\\i", "i", "\i" ); new TestCase( SECTION, "\\j", "j", "\j" ); new TestCase( SECTION, "\\k", "k", "\k" ); new TestCase( SECTION, "\\l", "l", "\l" ); new TestCase( SECTION, "\\m", "m", "\m" ); new TestCase( SECTION, "\\o", "o", "\o" ); new TestCase( SECTION, "\\p", "p", "\p" ); new TestCase( SECTION, "\\q", "q", "\q" ); new TestCase( SECTION, "\\s", "s", "\s" ); new TestCase( SECTION, "\\u", "u", "\u" ); new TestCase( SECTION, "\\w", "w", "\w" ); new TestCase( SECTION, "\\x", "x", "\x" ); new TestCase( SECTION, "\\y", "y", "\y" ); new TestCase( SECTION, "\\z", "z", "\z" ); new TestCase( SECTION, "\\9", "9", "\9" ); new TestCase( SECTION, "\\A", "A", "\A" ); new TestCase( SECTION, "\\B", "B", "\B" ); new TestCase( SECTION, "\\C", "C", "\C" ); new TestCase( SECTION, "\\D", "D", "\D" ); new TestCase( SECTION, "\\E", "E", "\E" ); new TestCase( SECTION, "\\F", "F", "\F" ); new TestCase( SECTION, "\\G", "G", "\G" ); new TestCase( SECTION, "\\H", "H", "\H" ); new TestCase( SECTION, "\\I", "I", "\I" ); new TestCase( SECTION, "\\J", "J", "\J" ); new TestCase( SECTION, "\\K", "K", "\K" ); new TestCase( SECTION, "\\L", "L", "\L" ); new TestCase( SECTION, "\\M", "M", "\M" ); new TestCase( SECTION, "\\N", "N", "\N" ); new TestCase( SECTION, "\\O", "O", "\O" ); new TestCase( SECTION, "\\P", "P", "\P" ); new TestCase( SECTION, "\\Q", "Q", "\Q" ); new TestCase( SECTION, "\\R", "R", "\R" ); new TestCase( SECTION, "\\S", "S", "\S" ); new TestCase( SECTION, "\\T", "T", "\T" ); new TestCase( SECTION, "\\U", "U", "\U" ); new TestCase( SECTION, "\\V", "V", "\V" ); new TestCase( SECTION, "\\W", "W", "\W" ); new TestCase( SECTION, "\\X", "X", "\X" ); new TestCase( SECTION, "\\Y", "Y", "\Y" ); new TestCase( SECTION, "\\Z", "Z", "\Z" ); // DoubleStringCharacter::EscapeSequence::UnicodeEscapeSequence new TestCase( SECTION, "\\u0020", " ", "\u0020" ); new TestCase( SECTION, "\\u0021", "!", "\u0021" ); new TestCase( SECTION, "\\u0022", "\"", "\u0022" ); new TestCase( SECTION, "\\u0023", "#", "\u0023" ); new TestCase( SECTION, "\\u0024", "$", "\u0024" ); new TestCase( SECTION, "\\u0025", "%", "\u0025" ); new TestCase( SECTION, "\\u0026", "&", "\u0026" ); new TestCase( SECTION, "\\u0027", "'", "\u0027" ); new TestCase( SECTION, "\\u0028", "(", "\u0028" ); new TestCase( SECTION, "\\u0029", ")", "\u0029" ); new TestCase( SECTION, "\\u002A", "*", "\u002A" ); new TestCase( SECTION, "\\u002B", "+", "\u002B" ); new TestCase( SECTION, "\\u002C", ",", "\u002C" ); new TestCase( SECTION, "\\u002D", "-", "\u002D" ); new TestCase( SECTION, "\\u002E", ".", "\u002E" ); new TestCase( SECTION, "\\u002F", "/", "\u002F" ); new TestCase( SECTION, "\\u0030", "0", "\u0030" ); new TestCase( SECTION, "\\u0031", "1", "\u0031" ); new TestCase( SECTION, "\\u0032", "2", "\u0032" ); new TestCase( SECTION, "\\u0033", "3", "\u0033" ); new TestCase( SECTION, "\\u0034", "4", "\u0034" ); new TestCase( SECTION, "\\u0035", "5", "\u0035" ); new TestCase( SECTION, "\\u0036", "6", "\u0036" ); new TestCase( SECTION, "\\u0037", "7", "\u0037" ); new TestCase( SECTION, "\\u0038", "8", "\u0038" ); new TestCase( SECTION, "\\u0039", "9", "\u0039" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/7.8.2-n.js0000644000175000017500000000467011545150464023424 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.8.2.js ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion Description: compare some specific examples of the automatic insertion rules in the EMCA specification. Author: christine@netscape.com Date: 15 september 1997 */ var SECTION="7.8.2"; var VERSION="ECMA_1" startTest(); writeHeaderToLog(SECTION+" "+"Examples of Semicolon Insertion"); // new TestCase( "7.8.2", "{ 1 \n 2 } 3", 3, eval("{ 1 \n 2 } 3") ); DESCRIPTION = "{ 1 2 } 3"; EXPECTED = "error"; new TestCase( "7.8.2", "{ 1 2 } 3", "error", eval("{1 2 } 3") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/browser.js0000644000175000017500000000000011545150464024157 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/jstests.list0000644000175000017500000000267611545150464024557 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/LexicalConventions/ script 7.1-1.js script 7.1-2.js script 7.1-3.js script 7.2-1.js script 7.2-2-n.js script 7.2-3-n.js script 7.2-4-n.js script 7.2-5-n.js script 7.2-6.js script 7.3-1.js script 7.3-10.js script 7.3-11.js script 7.3-12.js script 7.3-13-n.js script 7.3-2.js script 7.3-3.js script 7.3-4.js script 7.3-5.js script 7.3-6.js script 7.3-7.js script 7.3-8.js script 7.3-9.js script 7.4.1-1-n.js script 7.4.1-2-n.js script 7.4.1-3-n.js script 7.4.2-1-n.js script 7.4.2-10-n.js script 7.4.2-11-n.js script 7.4.2-12-n.js script 7.4.2-13-n.js script 7.4.2-14-n.js script 7.4.2-15-n.js script 7.4.2-16-n.js script 7.4.2-2-n.js script 7.4.2-3-n.js script 7.4.2-4-n.js script 7.4.2-5-n.js script 7.4.2-6-n.js script 7.4.2-7-n.js script 7.4.2-8-n.js script 7.4.2-9-n.js script 7.4.3-1-n.js script 7.4.3-10-n.js script 7.4.3-11-n.js script 7.4.3-12-n.js script 7.4.3-13-n.js script 7.4.3-14-n.js script 7.4.3-15-n.js script 7.4.3-16-n.js script 7.4.3-2-n.js skip script 7.4.3-3-n.js # obsolete test script 7.4.3-4-n.js script 7.4.3-5-n.js script 7.4.3-6-n.js script 7.4.3-7-n.js script 7.4.3-8-n.js script 7.4.3-9-n.js script 7.5-1.js script 7.5-10-n.js script 7.5-2-n.js script 7.5-3-n.js script 7.5-4-n.js script 7.5-5-n.js script 7.5-6.js script 7.5-7.js script 7.5-8-n.js script 7.5-9-n.js script 7.6.js script 7.7.1.js script 7.7.2.js script 7.7.3-1.js script 7.7.3-2.js script 7.7.3.js script 7.7.4.js script 7.8.2-n.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/LexicalConventions/shell.js0000644000175000017500000000000011545150464023603 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8-2-n.js0000644000175000017500000000560211545150464020560 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8-2.js ECMA Section: 15.8 The Math Object Description: The Math object is merely a single object that has some named properties, some of which are functions. The value of the internal [[Prototype]] property of the Math object is the Object prototype object (15.2.3.1). The Math object does not have a [[Construct]] property; it is not possible to use the Math object as a constructor with the new operator. The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a function. Recall that, in this specification, the phrase "the number value for x" has a technical meaning defined in section 8.5. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.8-2-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Math Object"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "MYMATH = new Math()"; EXPECTED = "error"; new TestCase( SECTION, "MYMATH = new Math()", "error", eval("MYMATH = new Math()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8-3-n.js0000644000175000017500000000556511545150464020571 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8-3.js ECMA Section: 15.8 The Math Object Description: The Math object is merely a single object that has some named properties, some of which are functions. The value of the internal [[Prototype]] property of the Math object is the Object prototype object (15.2.3.1). The Math object does not have a [[Construct]] property; it is not possible to use the Math object as a constructor with the new operator. The Math object does not have a [[Call]] property; it is not possible to invoke the Math object as a function. Recall that, in this specification, the phrase "the number value for x" has a technical meaning defined in section 8.5. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.8-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Math Object"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "MYMATH = Math()"; EXPECTED = "error"; new TestCase( SECTION, "MYMATH = Math()", "error", eval("MYMATH = Math()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.1-1.js0000644000175000017500000000460411545150464020623 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.1-1.js ECMA Section: 15.8.1.1.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.E"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.E = 0; Math.E", 2.7182818284590452354, eval("Math.E=0;Math.E") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.1-2.js0000644000175000017500000000501111545150464020615 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.1-2.js ECMA Section: 15.8.1.1.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.E"; writeHeaderToLog( SECTION + " "+ TITLE); var MATH_E = 2.7182818284590452354 new TestCase( SECTION, "delete(Math.E)", false, eval("delete Math.E") ); new TestCase( SECTION, "delete(Math.E); Math.E", MATH_E, eval("delete Math.E; Math.E") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.2-1.js0000644000175000017500000000461711545150464020630 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.2-1.js ECMA Section: 15.8.2.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.LN10 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LN10"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.LN10=0; Math.LN10", 2.302585092994046, eval("Math.LN10=0; Math.LN10") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.2-2.js0000644000175000017500000000505011545150464020621 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.2-1.js ECMA Section: 15.8.2.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.LN10 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LN10"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( Math.LN10 ); Math.LN10", 2.302585092994046, eval("delete(Math.LN10); Math.LN10") ); new TestCase( SECTION, "delete( Math.LN10 ); ", false, eval("delete(Math.LN10)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.3-1.js0000644000175000017500000000461611545150464020630 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.3-1.js ECMA Section: 15.8.1.3.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.LN2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LN2"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.LN2=0; Math.LN2", 0.6931471805599453, eval("Math.LN2=0; Math.LN2") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.3-2.js0000644000175000017500000000506111545150464020624 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.3-3.js ECMA Section: 15.8.1.3.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.LN2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LN2"; writeHeaderToLog( SECTION + " "+ TITLE); var MATH_LN2 = 0.6931471805599453; new TestCase( SECTION, "delete(Math.LN2)", false, eval("delete(Math.LN2)") ); new TestCase( SECTION, "delete(Math.LN2); Math.LN2", MATH_LN2, eval("delete(Math.LN2); Math.LN2") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.4-1.js0000644000175000017500000000462611545150464020632 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.4-1.js ECMA Section: 15.8.1.4.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.LOG2E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LOG2E"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.L0G2E=0; Math.LOG2E", 1.4426950408889634, eval("Math.LOG2E=0; Math.LOG2E") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.4-2.js0000644000175000017500000000504511545150464020627 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.4-2.js ECMA Section: 15.8.1.4.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.LOG2E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.4-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LOG2E"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete(Math.L0G2E);Math.LOG2E", 1.4426950408889634, eval("delete(Math.LOG2E);Math.LOG2E") ); new TestCase( SECTION, "delete(Math.L0G2E)", false, eval("delete(Math.LOG2E)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.5-1.js0000644000175000017500000000463311545150464020631 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.5-1.js ECMA Section: 15.8.1.5.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.LOG10E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LOG10E"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.LOG10E=0; Math.LOG10E", 0.4342944819032518, eval("Math.LOG10E=0; Math.LOG10E") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.5-2.js0000644000175000017500000000506211545150464020627 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.5-2.js ECMA Section: 15.8.1.5.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.LOG10E Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.LOG10E"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete Math.LOG10E; Math.LOG10E", 0.4342944819032518, eval("delete Math.LOG10E; Math.LOG10E") ); new TestCase( SECTION, "delete Math.LOG10E", false, eval("delete Math.LOG10E") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.6-1.js0000644000175000017500000000461211545150464020627 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.6-1.js ECMA Section: 15.8.1.6.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.PI Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.6-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.PI"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.PI=0; Math.PI", 3.1415926535897923846, eval("Math.PI=0; Math.PI") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.6-2.js0000644000175000017500000000500711545150464020627 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.6-2.js ECMA Section: 15.8.1.6.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.PI Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.6-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.PI"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete Math.PI; Math.PI", 3.1415926535897923846, eval("delete Math.PI; Math.PI") ); new TestCase( SECTION, "delete Math.PI; Math.PI", false, eval("delete Math.PI") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.7-1.js0000644000175000017500000000463611545150464020636 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.7-1.js ECMA Section: 15.8.1.7.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.SQRT1_2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.7-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.SQRT1_2"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.SQRT1_2=0; Math.SQRT1_2", 0.7071067811865476, eval("Math.SQRT1_2=0; Math.SQRT1_2") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.7-2.js0000644000175000017500000000506011545150464020627 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.7-2.js ECMA Section: 15.8.1.7.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.SQRT1_2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.7-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.SQRT1_2"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete Math.SQRT1_2; Math.SQRT1_2", 0.7071067811865476, eval("delete Math.SQRT1_2; Math.SQRT1_2") ); new TestCase( SECTION, "delete Math.SQRT1_2", false, eval("delete Math.SQRT1_2") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.8-1.js0000644000175000017500000000462611545150464020636 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.8-1.js ECMA Section: 15.8.1.8.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Math.SQRT2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.8-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.SQRT2"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.SQRT2=0; Math.SQRT2", 1.4142135623730951, eval("Math.SQRT2=0; Math.SQRT2") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.8-2.js0000644000175000017500000000504411545150464020632 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.8-2.js ECMA Section: 15.8.1.8.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.SQRT2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.8-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.SQRT2"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete Math.SQRT2; Math.SQRT2", 1.4142135623730951, eval("delete Math.SQRT2; Math.SQRT2") ); new TestCase( SECTION, "delete Math.SQRT2", false, eval("delete Math.SQRT2") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.8-3.js0000644000175000017500000000456011545150464020635 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.8-3.js ECMA Section: 15.8.1.8.js Description: All value properties of the Math object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Math.SQRT2 Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.1.8-3"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Math.SQRT2: DontDelete"); new TestCase( SECTION, "delete Math.SQRT2", false, eval("delete Math.SQRT2") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.1.js0000644000175000017500000001040411545150464020321 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.1.js ECMA Section: 15.8.1.js Value Properties of the Math Object 15.8.1.1 E 15.8.1.2 LN10 15.8.1.3 LN2 15.8.1.4 LOG2E 15.8.1.5 LOG10E 15.8.1.6 PI 15.8.1.7 SQRT1_2 15.8.1.8 SQRT2 Description: verify the values of some math constants Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.1" var VERSION = "ECMA_1"; startTest(); var TITLE = "Value Properties of the Math Object"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( "15.8.1.1", "Math.E", 2.7182818284590452354, Math.E ); new TestCase( "15.8.1.1", "typeof Math.E", "number", typeof Math.E ); new TestCase( "15.8.1.2", "Math.LN10", 2.302585092994046, Math.LN10 ); new TestCase( "15.8.1.2", "typeof Math.LN10", "number", typeof Math.LN10 ); new TestCase( "15.8.1.3", "Math.LN2", 0.6931471805599453, Math.LN2 ); new TestCase( "15.8.1.3", "typeof Math.LN2", "number", typeof Math.LN2 ); new TestCase( "15.8.1.4", "Math.LOG2E", 1.4426950408889634, Math.LOG2E ); new TestCase( "15.8.1.4", "typeof Math.LOG2E", "number", typeof Math.LOG2E ); new TestCase( "15.8.1.5", "Math.LOG10E", 0.4342944819032518, Math.LOG10E); new TestCase( "15.8.1.5", "typeof Math.LOG10E", "number", typeof Math.LOG10E); new TestCase( "15.8.1.6", "Math.PI", 3.14159265358979323846, Math.PI ); new TestCase( "15.8.1.6", "typeof Math.PI", "number", typeof Math.PI ); new TestCase( "15.8.1.7", "Math.SQRT1_2", 0.7071067811865476, Math.SQRT1_2); new TestCase( "15.8.1.7", "typeof Math.SQRT1_2", "number", typeof Math.SQRT1_2); new TestCase( "15.8.1.8", "Math.SQRT2", 1.4142135623730951, Math.SQRT2 ); new TestCase( "15.8.1.8", "typeof Math.SQRT2", "number", typeof Math.SQRT2 ); new TestCase( SECTION, "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS", "", eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.1.js0000644000175000017500000001360011545150464020462 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.1.js ECMA Section: 15.8.2.1 abs( x ) Description: return the absolute value of the argument, which should be the magnitude of the argument with a positive sign. - if x is NaN, return NaN - if x is -0, result is +0 - if x is -Infinity, result is +Infinity Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.1"; var VERSION = "ECMA_1"; var TITLE = "Math.abs()"; var BUGNUMBER = "77391"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.abs.length", 1, Math.abs.length ); new TestCase( SECTION, "Math.abs()", Number.NaN, Math.abs() ); new TestCase( SECTION, "Math.abs( void 0 )", Number.NaN, Math.abs(void 0) ); new TestCase( SECTION, "Math.abs( null )", 0, Math.abs(null) ); new TestCase( SECTION, "Math.abs( true )", 1, Math.abs(true) ); new TestCase( SECTION, "Math.abs( false )", 0, Math.abs(false) ); new TestCase( SECTION, "Math.abs( string primitive)", Number.NaN, Math.abs("a string primitive") ); new TestCase( SECTION, "Math.abs( string object )", Number.NaN, Math.abs(new String( 'a String object' )) ); new TestCase( SECTION, "Math.abs( Number.NaN )", Number.NaN, Math.abs(Number.NaN) ); new TestCase( SECTION, "Math.abs(0)", 0, Math.abs( 0 ) ); new TestCase( SECTION, "Math.abs( -0 )", 0, Math.abs(-0) ); new TestCase( SECTION, "Infinity/Math.abs(-0)", Infinity, Infinity/Math.abs(-0) ); new TestCase( SECTION, "Math.abs( -Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.NEGATIVE_INFINITY ) ); new TestCase( SECTION, "Math.abs( Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.POSITIVE_INFINITY ) ); new TestCase( SECTION, "Math.abs( - MAX_VALUE )", Number.MAX_VALUE, Math.abs( - Number.MAX_VALUE ) ); new TestCase( SECTION, "Math.abs( - MIN_VALUE )", Number.MIN_VALUE, Math.abs( -Number.MIN_VALUE ) ); new TestCase( SECTION, "Math.abs( MAX_VALUE )", Number.MAX_VALUE, Math.abs( Number.MAX_VALUE ) ); new TestCase( SECTION, "Math.abs( MIN_VALUE )", Number.MIN_VALUE, Math.abs( Number.MIN_VALUE ) ); new TestCase( SECTION, "Math.abs( -1 )", 1, Math.abs( -1 ) ); new TestCase( SECTION, "Math.abs( new Number( -1 ) )", 1, Math.abs( new Number(-1) ) ); new TestCase( SECTION, "Math.abs( 1 )", 1, Math.abs( 1 ) ); new TestCase( SECTION, "Math.abs( Math.PI )", Math.PI, Math.abs( Math.PI ) ); new TestCase( SECTION, "Math.abs( -Math.PI )", Math.PI, Math.abs( -Math.PI ) ); new TestCase( SECTION, "Math.abs(-1/100000000)", 1/100000000, Math.abs(-1/100000000) ); new TestCase( SECTION, "Math.abs(-Math.pow(2,32))", Math.pow(2,32), Math.abs(-Math.pow(2,32)) ); new TestCase( SECTION, "Math.abs(Math.pow(2,32))", Math.pow(2,32), Math.abs(Math.pow(2,32)) ); new TestCase( SECTION, "Math.abs( -0xfff )", 4095, Math.abs( -0xfff ) ); new TestCase( SECTION, "Math.abs( -0777 )", 511, Math.abs(-0777 ) ); new TestCase( SECTION, "Math.abs('-1e-1')", 0.1, Math.abs('-1e-1') ); new TestCase( SECTION, "Math.abs('0xff')", 255, Math.abs('0xff') ); new TestCase( SECTION, "Math.abs('077')", 77, Math.abs('077') ); new TestCase( SECTION, "Math.abs( 'Infinity' )", Infinity, Math.abs('Infinity') ); new TestCase( SECTION, "Math.abs( '-Infinity' )", Infinity, Math.abs('-Infinity') ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.10.js0000644000175000017500000001006111545150464020540 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.10.js ECMA Section: 15.8.2.10 Math.log(x) Description: return an approximiation to the natural logarithm of the argument. special cases: - if arg is NaN result is NaN - if arg is <0 result is NaN - if arg is 0 or -0 result is -Infinity - if arg is 1 result is 0 - if arg is Infinity result is Infinity Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.10"; var VERSION = "ECMA_1"; var TITLE = "Math.log(x)"; var BUGNUMBER = "77391"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.log.length", 1, Math.log.length ); new TestCase( SECTION, "Math.log()", Number.NaN, Math.log() ); new TestCase( SECTION, "Math.log(void 0)", Number.NaN, Math.log(void 0) ); new TestCase( SECTION, "Math.log(null)", Number.NEGATIVE_INFINITY, Math.log(null) ); new TestCase( SECTION, "Math.log(true)", 0, Math.log(true) ); new TestCase( SECTION, "Math.log(false)", -Infinity, Math.log(false) ); new TestCase( SECTION, "Math.log('0')", -Infinity, Math.log('0') ); new TestCase( SECTION, "Math.log('1')", 0, Math.log('1') ); new TestCase( SECTION, "Math.log('Infinity')", Infinity, Math.log("Infinity") ); new TestCase( SECTION, "Math.log(NaN)", Number.NaN, Math.log(Number.NaN) ); new TestCase( SECTION, "Math.log(-0.0000001)", Number.NaN, Math.log(-0.000001) ); new TestCase( SECTION, "Math.log(-1)", Number.NaN, Math.log(-1) ); new TestCase( SECTION, "Math.log(0)", Number.NEGATIVE_INFINITY, Math.log(0) ); new TestCase( SECTION, "Math.log(-0)", Number.NEGATIVE_INFINITY, Math.log(-0)); new TestCase( SECTION, "Math.log(1)", 0, Math.log(1) ); new TestCase( SECTION, "Math.log(Infinity)", Number.POSITIVE_INFINITY, Math.log(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.log(-Infinity)", Number.NaN, Math.log(Number.NEGATIVE_INFINITY) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.11.js0000644000175000017500000001264711545150464020555 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.11.js ECMA Section: 15.8.2.11 Math.max(x, y) Description: return the smaller of the two arguments. special cases: - if x is NaN or y is NaN return NaN - if x < y return x - if y > x return y - if x is +0 and y is +0 return +0 - if x is +0 and y is -0 return -0 - if x is -0 and y is +0 return -0 - if x is -0 and y is -0 return -0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.11"; var VERSION = "ECMA_1"; var TITLE = "Math.max(x, y)"; var BUGNUMBER="76439"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.max.length", 2, Math.max.length ); new TestCase( SECTION, "Math.max()", -Infinity, Math.max() ); new TestCase( SECTION, "Math.max(void 0, 1)", Number.NaN, Math.max( void 0, 1 ) ); new TestCase( SECTION, "Math.max(void 0, void 0)", Number.NaN, Math.max( void 0, void 0 ) ); new TestCase( SECTION, "Math.max(null, 1)", 1, Math.max( null, 1 ) ); new TestCase( SECTION, "Math.max(-1, null)", 0, Math.max( -1, null ) ); new TestCase( SECTION, "Math.max(true, false)", 1, Math.max(true,false) ); new TestCase( SECTION, "Math.max('-99','99')", 99, Math.max( "-99","99") ); new TestCase( SECTION, "Math.max(NaN, Infinity)", Number.NaN, Math.max(Number.NaN,Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.max(NaN, 0)", Number.NaN, Math.max(Number.NaN, 0) ); new TestCase( SECTION, "Math.max('a string', 0)", Number.NaN, Math.max("a string", 0) ); new TestCase( SECTION, "Math.max(NaN, 1)", Number.NaN, Math.max(Number.NaN,1) ); new TestCase( SECTION, "Math.max('a string',Infinity)", Number.NaN, Math.max("a string", Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.max(Infinity, NaN)", Number.NaN, Math.max( Number.POSITIVE_INFINITY, Number.NaN) ); new TestCase( SECTION, "Math.max(NaN, NaN)", Number.NaN, Math.max(Number.NaN, Number.NaN) ); new TestCase( SECTION, "Math.max(0,NaN)", Number.NaN, Math.max(0,Number.NaN) ); new TestCase( SECTION, "Math.max(1, NaN)", Number.NaN, Math.max(1, Number.NaN) ); new TestCase( SECTION, "Math.max(0,0)", 0, Math.max(0,0) ); new TestCase( SECTION, "Math.max(0,-0)", 0, Math.max(0,-0) ); new TestCase( SECTION, "Math.max(-0,0)", 0, Math.max(-0,0) ); new TestCase( SECTION, "Math.max(-0,-0)", -0, Math.max(-0,-0) ); new TestCase( SECTION, "Infinity/Math.max(-0,-0)", -Infinity, Infinity/Math.max(-0,-0) ); new TestCase( SECTION, "Math.max(Infinity, Number.MAX_VALUE)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY, Number.MAX_VALUE) ); new TestCase( SECTION, "Math.max(Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.max(-Infinity,-Infinity)", Number.NEGATIVE_INFINITY, Math.max(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.max(1,.99999999999999)", 1, Math.max(1,.99999999999999) ); new TestCase( SECTION, "Math.max(-1,-.99999999999999)", -.99999999999999, Math.max(-1,-.99999999999999) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.12.js0000644000175000017500000001116311545150464020546 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.12.js ECMA Section: 15.8.2.12 Math.min(x, y) Description: return the smaller of the two arguments. special cases: - if x is NaN or y is NaN return NaN - if x < y return x - if y > x return y - if x is +0 and y is +0 return +0 - if x is +0 and y is -0 return -0 - if x is -0 and y is +0 return -0 - if x is -0 and y is -0 return -0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.12"; var VERSION = "ECMA_1"; var TITLE = "Math.min(x, y)"; var BUGNUMBER="76439"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.min.length", 2, Math.min.length ); new TestCase( SECTION, "Math.min()", Infinity, Math.min() ); new TestCase( SECTION, "Math.min(void 0, 1)", Number.NaN, Math.min( void 0, 1 ) ); new TestCase( SECTION, "Math.min(void 0, void 0)", Number.NaN, Math.min( void 0, void 0 ) ); new TestCase( SECTION, "Math.min(null, 1)", 0, Math.min( null, 1 ) ); new TestCase( SECTION, "Math.min(-1, null)", -1, Math.min( -1, null ) ); new TestCase( SECTION, "Math.min(true, false)", 0, Math.min(true,false) ); new TestCase( SECTION, "Math.min('-99','99')", -99, Math.min( "-99","99") ); new TestCase( SECTION, "Math.min(NaN,0)", Number.NaN, Math.min(Number.NaN,0) ); new TestCase( SECTION, "Math.min(NaN,1)", Number.NaN, Math.min(Number.NaN,1) ); new TestCase( SECTION, "Math.min(NaN,-1)", Number.NaN, Math.min(Number.NaN,-1) ); new TestCase( SECTION, "Math.min(0,NaN)", Number.NaN, Math.min(0,Number.NaN) ); new TestCase( SECTION, "Math.min(1,NaN)", Number.NaN, Math.min(1,Number.NaN) ); new TestCase( SECTION, "Math.min(-1,NaN)", Number.NaN, Math.min(-1,Number.NaN) ); new TestCase( SECTION, "Math.min(NaN,NaN)", Number.NaN, Math.min(Number.NaN,Number.NaN) ); new TestCase( SECTION, "Math.min(1,1.0000000001)", 1, Math.min(1,1.0000000001) ); new TestCase( SECTION, "Math.min(1.0000000001,1)", 1, Math.min(1.0000000001,1) ); new TestCase( SECTION, "Math.min(0,0)", 0, Math.min(0,0) ); new TestCase( SECTION, "Math.min(0,-0)", -0, Math.min(0,-0) ); new TestCase( SECTION, "Math.min(-0,-0)", -0, Math.min(-0,-0) ); new TestCase( SECTION, "Infinity/Math.min(0,-0)", -Infinity, Infinity/Math.min(0,-0) ); new TestCase( SECTION, "Infinity/Math.min(-0,-0)", -Infinity, Infinity/Math.min(-0,-0) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.13.js0000644000175000017500000002342611545150464020554 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.13.js ECMA Section: 15.8.2.13 Math.pow(x, y) Description: return an approximation to the result of x to the power of y. there are many special cases; refer to the spec. Author: christine@netscape.com Date: 9 july 1997 */ var SECTION = "15.8.2.13"; var VERSION = "ECMA_1"; var TITLE = "Math.pow(x, y)"; var BUGNUMBER="77141"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.pow.length", 2, Math.pow.length ); new TestCase( SECTION, "Math.pow()", Number.NaN, Math.pow() ); new TestCase( SECTION, "Math.pow(null, null)", 1, Math.pow(null,null) ); new TestCase( SECTION, "Math.pow(void 0, void 0)", Number.NaN, Math.pow(void 0, void 0)); new TestCase( SECTION, "Math.pow(true, false)", 1, Math.pow(true, false) ); new TestCase( SECTION, "Math.pow(false,true)", 0, Math.pow(false,true) ); new TestCase( SECTION, "Math.pow('2','32')", 4294967296, Math.pow('2','32') ); new TestCase( SECTION, "Math.pow(1,NaN)", Number.NaN, Math.pow(1,Number.NaN) ); new TestCase( SECTION, "Math.pow(0,NaN)", Number.NaN, Math.pow(0,Number.NaN) ); new TestCase( SECTION, "Math.pow(NaN,0)", 1, Math.pow(Number.NaN,0) ); new TestCase( SECTION, "Math.pow(NaN,-0)", 1, Math.pow(Number.NaN,-0) ); new TestCase( SECTION, "Math.pow(NaN,1)", Number.NaN, Math.pow(Number.NaN, 1) ); new TestCase( SECTION, "Math.pow(NaN,.5)", Number.NaN, Math.pow(Number.NaN, .5) ); new TestCase( SECTION, "Math.pow(1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(1.00000001, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(1.00000001, -Infinity)", 0, Math.pow(1.00000001, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(-1.00000001,Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-1.00000001, -Infinity)", 0, Math.pow(-1.00000001,Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(1, Infinity)", Number.NaN, Math.pow(1, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(1, -Infinity)", Number.NaN, Math.pow(1, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-1, Infinity)", Number.NaN, Math.pow(-1, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-1, -Infinity)", Number.NaN, Math.pow(-1, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(.0000000009, Infinity)", 0, Math.pow(.0000000009, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-.0000000009, Infinity)", 0, Math.pow(-.0000000009, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(.0000000009, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(-.0000000009, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(Infinity, .00000000001)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY,.00000000001) ); new TestCase( SECTION, "Math.pow(Infinity, 1)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 1) ); new TestCase( SECTION, "Math.pow(Infinity, -.00000000001)", 0, Math.pow(Number.POSITIVE_INFINITY, -.00000000001) ); new TestCase( SECTION, "Math.pow(Infinity, -1)", 0, Math.pow(Number.POSITIVE_INFINITY, -1) ); new TestCase( SECTION, "Math.pow(-Infinity, 1)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 1) ); new TestCase( SECTION, "Math.pow(-Infinity, 333)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 333) ); new TestCase( SECTION, "Math.pow(Infinity, 2)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 2) ); new TestCase( SECTION, "Math.pow(-Infinity, 666)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 666) ); new TestCase( SECTION, "Math.pow(-Infinity, 0.5)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 0.5) ); new TestCase( SECTION, "Math.pow(-Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-Infinity, -1)", -0, Math.pow(Number.NEGATIVE_INFINITY, -1) ); new TestCase( SECTION, "Infinity/Math.pow(-Infinity, -1)", -Infinity, Infinity/Math.pow(Number.NEGATIVE_INFINITY, -1) ); new TestCase( SECTION, "Math.pow(-Infinity, -3)", -0, Math.pow(Number.NEGATIVE_INFINITY, -3) ); new TestCase( SECTION, "Math.pow(-Infinity, -2)", 0, Math.pow(Number.NEGATIVE_INFINITY, -2) ); new TestCase( SECTION, "Math.pow(-Infinity, -0.5)", 0, Math.pow(Number.NEGATIVE_INFINITY,-0.5) ); new TestCase( SECTION, "Math.pow(-Infinity, -Infinity)", 0, Math.pow(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(0, 1)", 0, Math.pow(0,1) ); new TestCase( SECTION, "Math.pow(0, 0)", 1, Math.pow(0,0) ); new TestCase( SECTION, "Math.pow(1, 0)", 1, Math.pow(1,0) ); new TestCase( SECTION, "Math.pow(-1, 0)", 1, Math.pow(-1,0) ); new TestCase( SECTION, "Math.pow(0, 0.5)", 0, Math.pow(0,0.5) ); new TestCase( SECTION, "Math.pow(0, 1000)", 0, Math.pow(0,1000) ); new TestCase( SECTION, "Math.pow(0, Infinity)", 0, Math.pow(0, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(0, -1)", Number.POSITIVE_INFINITY, Math.pow(0, -1) ); new TestCase( SECTION, "Math.pow(0, -0.5)", Number.POSITIVE_INFINITY, Math.pow(0, -0.5) ); new TestCase( SECTION, "Math.pow(0, -1000)", Number.POSITIVE_INFINITY, Math.pow(0, -1000) ); new TestCase( SECTION, "Math.pow(0, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(0, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-0, 1)", -0, Math.pow(-0, 1) ); new TestCase( SECTION, "Math.pow(-0, 3)", -0, Math.pow(-0,3) ); new TestCase( SECTION, "Infinity/Math.pow(-0, 1)", -Infinity, Infinity/Math.pow(-0, 1) ); new TestCase( SECTION, "Infinity/Math.pow(-0, 3)", -Infinity, Infinity/Math.pow(-0,3) ); new TestCase( SECTION, "Math.pow(-0, 2)", 0, Math.pow(-0,2) ); new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-0, -1)", Number.NEGATIVE_INFINITY, Math.pow(-0, -1) ); new TestCase( SECTION, "Math.pow(-0, -10001)", Number.NEGATIVE_INFINITY, Math.pow(-0, -10001) ); new TestCase( SECTION, "Math.pow(-0, -2)", Number.POSITIVE_INFINITY, Math.pow(-0, -2) ); new TestCase( SECTION, "Math.pow(-0, 0.5)", 0, Math.pow(-0, 0.5) ); new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.pow(-1, 0.5)", Number.NaN, Math.pow(-1, 0.5) ); new TestCase( SECTION, "Math.pow(-1, NaN)", Number.NaN, Math.pow(-1, Number.NaN) ); new TestCase( SECTION, "Math.pow(-1, -0.5)", Number.NaN, Math.pow(-1, -0.5) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.14.js0000644000175000017500000000530011545150464020544 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.14.js ECMA Section: 15.8.2.14 Math.random() returns a number value x with a positive sign with 1 > x >= 0 with approximately uniform distribution over that range, using an implementation-dependent algorithm or strategy. This function takes no arguments. Description: Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.8.2.14"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.random()"; writeHeaderToLog( SECTION + " "+ TITLE); for ( var item = 0; item < 100; item++ ) { var testcase = new TestCase( SECTION, "Math.random()", "pass", null ); testcase.reason = Math.random(); testcase.actual = "pass"; if ( ! ( testcase.reason >= 0) ) { testcase.actual = "fail"; } if ( ! (testcase.reason < 1) ) { testcase.actual = "fail"; } } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.15.js0000644000175000017500000001222111545150464020545 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.15.js ECMA Section: 15.8.2.15 Math.round(x) Description: return the greatest number value that is closest to the argument and is an integer. if two integers are equally close to the argument. then the result is the number value that is closer to Infinity. if the argument is an integer, return the argument. special cases: - if x is NaN return NaN - if x = +0 return +0 - if x = -0 return -0 - if x = Infinity return Infinity - if x = -Infinity return -Infinity - if 0 < x < 0.5 return 0 - if -0.5 <= x < 0 return -0 example: Math.round( 3.5 ) == 4 Math.round( -3.5 ) == 3 also: - Math.round(x) == Math.floor( x + 0.5 ) except if x = -0. in that case, Math.round(x) = -0 and Math.floor( x+0.5 ) = +0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.15"; var VERSION = "ECMA_1"; var TITLE = "Math.round(x)"; var BUGNUMBER="331411"; var EXCLUDE = "true"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.round.length", 1, Math.round.length ); new TestCase( SECTION, "Math.round()", Number.NaN, Math.round() ); new TestCase( SECTION, "Math.round(null)", 0, Math.round(0) ); new TestCase( SECTION, "Math.round(void 0)", Number.NaN, Math.round(void 0) ); new TestCase( SECTION, "Math.round(true)", 1, Math.round(true) ); new TestCase( SECTION, "Math.round(false)", 0, Math.round(false) ); new TestCase( SECTION, "Math.round('.99999')", 1, Math.round('.99999') ); new TestCase( SECTION, "Math.round('12345e-2')", 123, Math.round('12345e-2') ); new TestCase( SECTION, "Math.round(NaN)", Number.NaN, Math.round(Number.NaN) ); new TestCase( SECTION, "Math.round(0)", 0, Math.round(0) ); new TestCase( SECTION, "Math.round(-0)", -0, Math.round(-0)); new TestCase( SECTION, "Infinity/Math.round(-0)", -Infinity, Infinity/Math.round(-0) ); new TestCase( SECTION, "Math.round(Infinity)", Number.POSITIVE_INFINITY, Math.round(Number.POSITIVE_INFINITY)); new TestCase( SECTION, "Math.round(-Infinity)", Number.NEGATIVE_INFINITY, Math.round(Number.NEGATIVE_INFINITY)); new TestCase( SECTION, "Math.round(0.49)", 0, Math.round(0.49)); new TestCase( SECTION, "Math.round(0.5)", 1, Math.round(0.5)); new TestCase( SECTION, "Math.round(0.51)", 1, Math.round(0.51)); new TestCase( SECTION, "Math.round(-0.49)", -0, Math.round(-0.49)); new TestCase( SECTION, "Math.round(-0.5)", -0, Math.round(-0.5)); new TestCase( SECTION, "Infinity/Math.round(-0.49)", -Infinity, Infinity/Math.round(-0.49)); new TestCase( SECTION, "Infinity/Math.round(-0.5)", -Infinity, Infinity/Math.round(-0.5)); new TestCase( SECTION, "Math.round(-0.51)", -1, Math.round(-0.51)); new TestCase( SECTION, "Math.round(3.5)", 4, Math.round(3.5)); new TestCase( SECTION, "Math.round(-3.5)", -3, Math.round(-3)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.16.js0000644000175000017500000000723411545150464020556 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.16.js ECMA Section: 15.8.2.16 sin( x ) Description: return an approximation to the sine of the argument. argument is expressed in radians Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.16"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.sin(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.sin.length", 1, Math.sin.length ); new TestCase( SECTION, "Math.sin()", Number.NaN, Math.sin() ); new TestCase( SECTION, "Math.sin(null)", 0, Math.sin(null) ); new TestCase( SECTION, "Math.sin(void 0)", Number.NaN, Math.sin(void 0) ); new TestCase( SECTION, "Math.sin(false)", 0, Math.sin(false) ); new TestCase( SECTION, "Math.sin('2.356194490192')", 0.7071067811865, Math.sin('2.356194490192') ); new TestCase( SECTION, "Math.sin(NaN)", Number.NaN, Math.sin(Number.NaN) ); new TestCase( SECTION, "Math.sin(0)", 0, Math.sin(0) ); new TestCase( SECTION, "Math.sin(-0)", -0, Math.sin(-0)); new TestCase( SECTION, "Math.sin(Infinity)", Number.NaN, Math.sin(Number.POSITIVE_INFINITY)); new TestCase( SECTION, "Math.sin(-Infinity)", Number.NaN, Math.sin(Number.NEGATIVE_INFINITY)); new TestCase( SECTION, "Math.sin(0.7853981633974)", 0.7071067811865, Math.sin(0.7853981633974)); new TestCase( SECTION, "Math.sin(1.570796326795)", 1, Math.sin(1.570796326795)); new TestCase( SECTION, "Math.sin(2.356194490192)", 0.7071067811865, Math.sin(2.356194490192)); new TestCase( SECTION, "Math.sin(3.14159265359)", 0, Math.sin(3.14159265359)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.17.js0000644000175000017500000001214411545150464020553 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.17.js ECMA Section: 15.8.2.17 Math.sqrt(x) Description: return an approximation to the squareroot of the argument. special cases: - if x is NaN return NaN - if x < 0 return NaN - if x == 0 return 0 - if x == -0 return -0 - if x == Infinity return Infinity Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.17"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.sqrt(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.sqrt.length", 1, Math.sqrt.length ); new TestCase( SECTION, "Math.sqrt()", Number.NaN, Math.sqrt() ); new TestCase( SECTION, "Math.sqrt(void 0)", Number.NaN, Math.sqrt(void 0) ); new TestCase( SECTION, "Math.sqrt(null)", 0, Math.sqrt(null) ); new TestCase( SECTION, "Math.sqrt(true)", 1, Math.sqrt(1) ); new TestCase( SECTION, "Math.sqrt(false)", 0, Math.sqrt(false) ); new TestCase( SECTION, "Math.sqrt('225')", 15, Math.sqrt('225') ); new TestCase( SECTION, "Math.sqrt(NaN)", Number.NaN, Math.sqrt(Number.NaN) ); new TestCase( SECTION, "Math.sqrt(-Infinity)", Number.NaN, Math.sqrt(Number.NEGATIVE_INFINITY)); new TestCase( SECTION, "Math.sqrt(-1)", Number.NaN, Math.sqrt(-1)); new TestCase( SECTION, "Math.sqrt(-0.5)", Number.NaN, Math.sqrt(-0.5)); new TestCase( SECTION, "Math.sqrt(0)", 0, Math.sqrt(0)); new TestCase( SECTION, "Math.sqrt(-0)", -0, Math.sqrt(-0)); new TestCase( SECTION, "Infinity/Math.sqrt(-0)", -Infinity, Infinity/Math.sqrt(-0) ); new TestCase( SECTION, "Math.sqrt(Infinity)", Number.POSITIVE_INFINITY, Math.sqrt(Number.POSITIVE_INFINITY)); new TestCase( SECTION, "Math.sqrt(1)", 1, Math.sqrt(1)); new TestCase( SECTION, "Math.sqrt(2)", Math.SQRT2, Math.sqrt(2)); new TestCase( SECTION, "Math.sqrt(0.5)", Math.SQRT1_2, Math.sqrt(0.5)); new TestCase( SECTION, "Math.sqrt(4)", 2, Math.sqrt(4)); new TestCase( SECTION, "Math.sqrt(9)", 3, Math.sqrt(9)); new TestCase( SECTION, "Math.sqrt(16)", 4, Math.sqrt(16)); new TestCase( SECTION, "Math.sqrt(25)", 5, Math.sqrt(25)); new TestCase( SECTION, "Math.sqrt(36)", 6, Math.sqrt(36)); new TestCase( SECTION, "Math.sqrt(49)", 7, Math.sqrt(49)); new TestCase( SECTION, "Math.sqrt(64)", 8, Math.sqrt(64)); new TestCase( SECTION, "Math.sqrt(256)", 16, Math.sqrt(256)); new TestCase( SECTION, "Math.sqrt(10000)", 100, Math.sqrt(10000)); new TestCase( SECTION, "Math.sqrt(65536)", 256, Math.sqrt(65536)); new TestCase( SECTION, "Math.sqrt(0.09)", 0.3, Math.sqrt(0.09)); new TestCase( SECTION, "Math.sqrt(0.01)", 0.1, Math.sqrt(0.01)); new TestCase( SECTION, "Math.sqrt(0.00000001)", 0.0001, Math.sqrt(0.00000001)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.18.js0000644000175000017500000001145411545150464020557 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.18.js ECMA Section: 15.8.2.18 tan( x ) Description: return an approximation to the tan of the argument. argument is expressed in radians special cases: - if x is NaN result is NaN - if x is 0 result is 0 - if x is -0 result is -0 - if x is Infinity or -Infinity result is NaN Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.18"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.tan(x)"; var EXCLUDE = "true"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.tan.length", 1, Math.tan.length ); new TestCase( SECTION, "Math.tan()", Number.NaN, Math.tan() ); new TestCase( SECTION, "Math.tan(void 0)", Number.NaN, Math.tan(void 0)); new TestCase( SECTION, "Math.tan(null)", 0, Math.tan(null) ); new TestCase( SECTION, "Math.tan(false)", 0, Math.tan(false) ); new TestCase( SECTION, "Math.tan(NaN)", Number.NaN, Math.tan(Number.NaN) ); new TestCase( SECTION, "Math.tan(0)", 0, Math.tan(0)); new TestCase( SECTION, "Math.tan(-0)", -0, Math.tan(-0)); new TestCase( SECTION, "Math.tan(Infinity)", Number.NaN, Math.tan(Number.POSITIVE_INFINITY)); new TestCase( SECTION, "Math.tan(-Infinity)", Number.NaN, Math.tan(Number.NEGATIVE_INFINITY)); new TestCase( SECTION, "Math.tan(Math.PI/4)", 1, Math.tan(Math.PI/4)); new TestCase( SECTION, "Math.tan(3*Math.PI/4)", -1, Math.tan(3*Math.PI/4)); new TestCase( SECTION, "Math.tan(Math.PI)", -0, Math.tan(Math.PI)); new TestCase( SECTION, "Math.tan(5*Math.PI/4)", 1, Math.tan(5*Math.PI/4)); new TestCase( SECTION, "Math.tan(7*Math.PI/4)", -1, Math.tan(7*Math.PI/4)); new TestCase( SECTION, "Infinity/Math.tan(-0)", -Infinity, Infinity/Math.tan(-0) ); /* Arctan (x) ~ PI/2 - 1/x for large x. For x = 1.6x10^16, 1/x is about the last binary digit of double precision PI/2. That is to say, perturbing PI/2 by this much is about the smallest rounding error possible. This suggests that the answer Christine is getting and a real Infinity are "adjacent" results from the tangent function. I suspect that tan (PI/2 + one ulp) is a negative result about the same size as tan (PI/2) and that this pair are the closest results to infinity that the algorithm can deliver. In any case, my call is that the answer we're seeing is "right". I suggest the test pass on any result this size or larger. = C = */ new TestCase( SECTION, "Math.tan(3*Math.PI/2) >= 5443000000000000", true, Math.tan(3*Math.PI/2) >= 5443000000000000 ); new TestCase( SECTION, "Math.tan(Math.PI/2) >= 5443000000000000", true, Math.tan(Math.PI/2) >= 5443000000000000 ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.2.js0000644000175000017500000001031511545150464020463 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.2.js ECMA Section: 15.8.2.2 acos( x ) Description: return an approximation to the arc cosine of the argument. the result is expressed in radians and range is from +0 to +PI. special cases: - if x is NaN, return NaN - if x > 1, the result is NaN - if x < -1, the result is NaN - if x == 1, the result is +0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.acos()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.acos.length", 1, Math.acos.length ); new TestCase( SECTION, "Math.acos(void 0)", Number.NaN, Math.acos(void 0) ); new TestCase( SECTION, "Math.acos()", Number.NaN, Math.acos() ); new TestCase( SECTION, "Math.acos(null)", Math.PI/2, Math.acos(null) ); new TestCase( SECTION, "Math.acos(NaN)", Number.NaN, Math.acos(Number.NaN) ); new TestCase( SECTION, "Math.acos(a string)", Number.NaN, Math.acos("a string") ); new TestCase( SECTION, "Math.acos('0')", Math.PI/2, Math.acos('0') ); new TestCase( SECTION, "Math.acos('1')", 0, Math.acos('1') ); new TestCase( SECTION, "Math.acos('-1')", Math.PI, Math.acos('-1') ); new TestCase( SECTION, "Math.acos(1.00000001)", Number.NaN, Math.acos(1.00000001) ); new TestCase( SECTION, "Math.acos(11.00000001)", Number.NaN, Math.acos(-1.00000001) ); new TestCase( SECTION, "Math.acos(1)", 0, Math.acos(1) ); new TestCase( SECTION, "Math.acos(-1)", Math.PI, Math.acos(-1) ); new TestCase( SECTION, "Math.acos(0)", Math.PI/2, Math.acos(0) ); new TestCase( SECTION, "Math.acos(-0)", Math.PI/2, Math.acos(-0) ); new TestCase( SECTION, "Math.acos(Math.SQRT1_2)", Math.PI/4, Math.acos(Math.SQRT1_2)); new TestCase( SECTION, "Math.acos(-Math.SQRT1_2)", Math.PI/4*3, Math.acos(-Math.SQRT1_2)); new TestCase( SECTION, "Math.acos(0.9999619230642)", Math.PI/360, Math.acos(0.9999619230642)); new TestCase( SECTION, "Math.acos(-3.0)", Number.NaN, Math.acos(-3.0)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.3.js0000644000175000017500000001047011545150464020466 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.3.js ECMA Section: 15.8.2.3 asin( x ) Description: return an approximation to the arc sine of the argument. the result is expressed in radians and range is from -PI/2 to +PI/2. special cases: - if x is NaN, the result is NaN - if x > 1, the result is NaN - if x < -1, the result is NaN - if x == +0, the result is +0 - if x == -0, the result is -0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.asin()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.asin()", Number.NaN, Math.asin() ); new TestCase( SECTION, "Math.asin(void 0)", Number.NaN, Math.asin(void 0) ); new TestCase( SECTION, "Math.asin(null)", 0, Math.asin(null) ); new TestCase( SECTION, "Math.asin(NaN)", Number.NaN, Math.asin(Number.NaN) ); new TestCase( SECTION, "Math.asin('string')", Number.NaN, Math.asin("string") ); new TestCase( SECTION, "Math.asin('0')", 0, Math.asin("0") ); new TestCase( SECTION, "Math.asin('1')", Math.PI/2, Math.asin("1") ); new TestCase( SECTION, "Math.asin('-1')", -Math.PI/2, Math.asin("-1") ); new TestCase( SECTION, "Math.asin(Math.SQRT1_2+'')", Math.PI/4, Math.asin(Math.SQRT1_2+'') ); new TestCase( SECTION, "Math.asin(-Math.SQRT1_2+'')", -Math.PI/4, Math.asin(-Math.SQRT1_2+'') ); new TestCase( SECTION, "Math.asin(1.000001)", Number.NaN, Math.asin(1.000001) ); new TestCase( SECTION, "Math.asin(-1.000001)", Number.NaN, Math.asin(-1.000001) ); new TestCase( SECTION, "Math.asin(0)", 0, Math.asin(0) ); new TestCase( SECTION, "Math.asin(-0)", -0, Math.asin(-0) ); new TestCase( SECTION, "Infinity/Math.asin(-0)", -Infinity, Infinity/Math.asin(-0) ); new TestCase( SECTION, "Math.asin(1)", Math.PI/2, Math.asin(1) ); new TestCase( SECTION, "Math.asin(-1)", -Math.PI/2, Math.asin(-1) ); new TestCase( SECTION, "Math.asin(Math.SQRT1_2))", Math.PI/4, Math.asin(Math.SQRT1_2) ); new TestCase( SECTION, "Math.asin(-Math.SQRT1_2))", -Math.PI/4, Math.asin(-Math.SQRT1_2)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.4.js0000644000175000017500000001036311545150464020470 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.4.js ECMA Section: 15.8.2.4 atan( x ) Description: return an approximation to the arc tangent of the argument. the result is expressed in radians and range is from -PI/2 to +PI/2. special cases: - if x is NaN, the result is NaN - if x == +0, the result is +0 - if x == -0, the result is -0 - if x == +Infinity, the result is approximately +PI/2 - if x == -Infinity, the result is approximately -PI/2 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.4"; var VERSION = "ECMA_1"; var TITLE = "Math.atan()"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.atan.length", 1, Math.atan.length ); new TestCase( SECTION, "Math.atan()", Number.NaN, Math.atan() ); new TestCase( SECTION, "Math.atan(void 0)", Number.NaN, Math.atan(void 0) ); new TestCase( SECTION, "Math.atan(null)", 0, Math.atan(null) ); new TestCase( SECTION, "Math.atan(NaN)", Number.NaN, Math.atan(Number.NaN) ); new TestCase( SECTION, "Math.atan('a string')", Number.NaN, Math.atan("a string") ); new TestCase( SECTION, "Math.atan('0')", 0, Math.atan('0') ); new TestCase( SECTION, "Math.atan('1')", Math.PI/4, Math.atan('1') ); new TestCase( SECTION, "Math.atan('-1')", -Math.PI/4, Math.atan('-1') ); new TestCase( SECTION, "Math.atan('Infinity)", Math.PI/2, Math.atan('Infinity') ); new TestCase( SECTION, "Math.atan('-Infinity)", -Math.PI/2, Math.atan('-Infinity') ); new TestCase( SECTION, "Math.atan(0)", 0, Math.atan(0) ); new TestCase( SECTION, "Math.atan(-0)", -0, Math.atan(-0) ); new TestCase( SECTION, "Infinity/Math.atan(-0)", -Infinity, Infinity/Math.atan(-0) ); new TestCase( SECTION, "Math.atan(Infinity)", Math.PI/2, Math.atan(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.atan(-Infinity)", -Math.PI/2, Math.atan(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.atan(1)", Math.PI/4, Math.atan(1) ); new TestCase( SECTION, "Math.atan(-1)", -Math.PI/4, Math.atan(-1) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.5.js0000644000175000017500000001455711545150464020502 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.5.js ECMA Section: 15.8.2.5 atan2( y, x ) Description: Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.5"; var VERSION = "ECMA_1"; var TITLE = "Math.atan2(x,y)"; var BUGNUMBER="76111"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.atan2.length", 2, Math.atan2.length ); new TestCase( SECTION, "Math.atan2(NaN, 0)", Number.NaN, Math.atan2(Number.NaN,0) ); new TestCase( SECTION, "Math.atan2(null, null)", 0, Math.atan2(null, null) ); new TestCase( SECTION, "Math.atan2(void 0, void 0)", Number.NaN, Math.atan2(void 0, void 0) ); new TestCase( SECTION, "Math.atan2()", Number.NaN, Math.atan2() ); new TestCase( SECTION, "Math.atan2(0, NaN)", Number.NaN, Math.atan2(0,Number.NaN) ); new TestCase( SECTION, "Math.atan2(1, 0)", Math.PI/2, Math.atan2(1,0) ); new TestCase( SECTION, "Math.atan2(1,-0)", Math.PI/2, Math.atan2(1,-0) ); new TestCase( SECTION, "Math.atan2(0,0.001)", 0, Math.atan2(0,0.001) ); new TestCase( SECTION, "Math.atan2(0,0)", 0, Math.atan2(0,0) ); new TestCase( SECTION, "Math.atan2(0, -0)", Math.PI, Math.atan2(0,-0) ); new TestCase( SECTION, "Math.atan2(0, -1)", Math.PI, Math.atan2(0, -1) ); new TestCase( SECTION, "Math.atan2(-0, 1)", -0, Math.atan2(-0, 1) ); new TestCase( SECTION, "Infinity/Math.atan2(-0, 1)", -Infinity, Infinity/Math.atan2(-0,1) ); new TestCase( SECTION, "Math.atan2(-0, 0)", -0, Math.atan2(-0,0) ); new TestCase( SECTION, "Math.atan2(-0, -0)", -Math.PI, Math.atan2(-0, -0) ); new TestCase( SECTION, "Math.atan2(-0, -1)", -Math.PI, Math.atan2(-0, -1) ); new TestCase( SECTION, "Math.atan2(-1, 0)", -Math.PI/2, Math.atan2(-1, 0) ); new TestCase( SECTION, "Math.atan2(-1, -0)", -Math.PI/2, Math.atan2(-1, -0) ); new TestCase( SECTION, "Math.atan2(1, Infinity)", 0, Math.atan2(1, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(1,-Infinity)", Math.PI, Math.atan2(1, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(-1, Infinity)", -0, Math.atan2(-1,Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Infinity/Math.atan2(-1, Infinity)", -Infinity, Infinity/Math.atan2(-1,Infinity) ); new TestCase( SECTION, "Math.atan2(-1,-Infinity)", -Math.PI, Math.atan2(-1,Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(Infinity, 0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 0) ); new TestCase( SECTION, "Math.atan2(Infinity, 1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 1) ); new TestCase( SECTION, "Math.atan2(Infinity,-1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-1) ); new TestCase( SECTION, "Math.atan2(Infinity,-0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-0) ); new TestCase( SECTION, "Math.atan2(-Infinity, 0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 0) ); new TestCase( SECTION, "Math.atan2(-Infinity,-0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-0) ); new TestCase( SECTION, "Math.atan2(-Infinity, 1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 1) ); new TestCase( SECTION, "Math.atan2(-Infinity, -1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-1) ); new TestCase( SECTION, "Math.atan2(Infinity, Infinity)", Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(Infinity, -Infinity)", 3*Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(-Infinity, Infinity)", -Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(-Infinity, -Infinity)", -3*Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.atan2(-1, 1)", -Math.PI/4, Math.atan2( -1, 1) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.6.js0000644000175000017500000001363311545150464020475 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.6.js ECMA Section: 15.8.2.6 Math.ceil(x) Description: return the smallest number value that is not less than the argument and is equal to a mathematical integer. if the number is already an integer, return the number itself. special cases: - if x is NaN return NaN - if x = +0 return +0 - if x = 0 return -0 - if x = Infinity return Infinity - if x = -Infinity return -Infinity - if ( -1 < x < 0 ) return -0 also: - the value of Math.ceil(x) == -Math.ceil(-x) Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.ceil(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.ceil.length", 1, Math.ceil.length ); new TestCase( SECTION, "Math.ceil(NaN)", Number.NaN, Math.ceil(Number.NaN) ); new TestCase( SECTION, "Math.ceil(null)", 0, Math.ceil(null) ); new TestCase( SECTION, "Math.ceil()", Number.NaN, Math.ceil() ); new TestCase( SECTION, "Math.ceil(void 0)", Number.NaN, Math.ceil(void 0) ); new TestCase( SECTION, "Math.ceil('0')", 0, Math.ceil('0') ); new TestCase( SECTION, "Math.ceil('-0')", -0, Math.ceil('-0') ); new TestCase( SECTION, "Infinity/Math.ceil('0')", Infinity, Infinity/Math.ceil('0')); new TestCase( SECTION, "Infinity/Math.ceil('-0')", -Infinity, Infinity/Math.ceil('-0')); new TestCase( SECTION, "Math.ceil(0)", 0, Math.ceil(0) ); new TestCase( SECTION, "Math.ceil(-0)", -0, Math.ceil(-0) ); new TestCase( SECTION, "Infinity/Math.ceil(0)", Infinity, Infinity/Math.ceil(0)); new TestCase( SECTION, "Infinity/Math.ceil(-0)", -Infinity, Infinity/Math.ceil(-0)); new TestCase( SECTION, "Math.ceil(Infinity)", Number.POSITIVE_INFINITY, Math.ceil(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.ceil(-Infinity)", Number.NEGATIVE_INFINITY, Math.ceil(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -0, Math.ceil(-Number.MIN_VALUE) ); new TestCase( SECTION, "Infinity/Math.ceil(-Number.MIN_VALUE)", -Infinity, Infinity/Math.ceil(-Number.MIN_VALUE) ); new TestCase( SECTION, "Math.ceil(1)", 1, Math.ceil(1) ); new TestCase( SECTION, "Math.ceil(-1)", -1, Math.ceil(-1) ); new TestCase( SECTION, "Math.ceil(-0.9)", -0, Math.ceil(-0.9) ); new TestCase( SECTION, "Infinity/Math.ceil(-0.9)", -Infinity, Infinity/Math.ceil(-0.9) ); new TestCase( SECTION, "Math.ceil(0.9 )", 1, Math.ceil( 0.9) ); new TestCase( SECTION, "Math.ceil(-1.1)", -1, Math.ceil( -1.1)); new TestCase( SECTION, "Math.ceil( 1.1)", 2, Math.ceil( 1.1)); new TestCase( SECTION, "Math.ceil(Infinity)", -Math.floor(-Infinity), Math.ceil(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.ceil(-Infinity)", -Math.floor(Infinity), Math.ceil(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -Math.floor(Number.MIN_VALUE), Math.ceil(-Number.MIN_VALUE) ); new TestCase( SECTION, "Math.ceil(1)", -Math.floor(-1), Math.ceil(1) ); new TestCase( SECTION, "Math.ceil(-1)", -Math.floor(1), Math.ceil(-1) ); new TestCase( SECTION, "Math.ceil(-0.9)", -Math.floor(0.9), Math.ceil(-0.9) ); new TestCase( SECTION, "Math.ceil(0.9 )", -Math.floor(-0.9), Math.ceil( 0.9) ); new TestCase( SECTION, "Math.ceil(-1.1)", -Math.floor(1.1), Math.ceil( -1.1)); new TestCase( SECTION, "Math.ceil( 1.1)", -Math.floor(-1.1), Math.ceil( 1.1)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.7.js0000644000175000017500000001566011545150464020500 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.7.js ECMA Section: 15.8.2.7 cos( x ) Description: return an approximation to the cosine of the argument. argument is expressed in radians Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.7"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.cos(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.cos.length", 1, Math.cos.length ); new TestCase( SECTION, "Math.cos()", Number.NaN, Math.cos() ); new TestCase( SECTION, "Math.cos(void 0)", Number.NaN, Math.cos(void 0) ); new TestCase( SECTION, "Math.cos(false)", 1, Math.cos(false) ); new TestCase( SECTION, "Math.cos(null)", 1, Math.cos(null) ); new TestCase( SECTION, "Math.cos('0')", 1, Math.cos('0') ); new TestCase( SECTION, "Math.cos('Infinity')", Number.NaN, Math.cos("Infinity") ); new TestCase( SECTION, "Math.cos('3.14159265359')", -1, Math.cos('3.14159265359') ); new TestCase( SECTION, "Math.cos(NaN)", Number.NaN, Math.cos(Number.NaN) ); new TestCase( SECTION, "Math.cos(0)", 1, Math.cos(0) ); new TestCase( SECTION, "Math.cos(-0)", 1, Math.cos(-0) ); new TestCase( SECTION, "Math.cos(Infinity)", Number.NaN, Math.cos(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.cos(-Infinity)", Number.NaN, Math.cos(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.cos(0.7853981633974)", 0.7071067811865, Math.cos(0.7853981633974) ); new TestCase( SECTION, "Math.cos(1.570796326795)", 0, Math.cos(1.570796326795) ); new TestCase( SECTION, "Math.cos(2.356194490192)", -0.7071067811865, Math.cos(2.356194490192) ); new TestCase( SECTION, "Math.cos(3.14159265359)", -1, Math.cos(3.14159265359) ); new TestCase( SECTION, "Math.cos(3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) ); new TestCase( SECTION, "Math.cos(4.712388980385)", 0, Math.cos(4.712388980385) ); new TestCase( SECTION, "Math.cos(5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) ); new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(Math.PI*2) ); new TestCase( SECTION, "Math.cos(Math.PI/4)", Math.SQRT2/2, Math.cos(Math.PI/4) ); new TestCase( SECTION, "Math.cos(Math.PI/2)", 0, Math.cos(Math.PI/2) ); new TestCase( SECTION, "Math.cos(3*Math.PI/4)", -Math.SQRT2/2, Math.cos(3*Math.PI/4) ); new TestCase( SECTION, "Math.cos(Math.PI)", -1, Math.cos(Math.PI) ); new TestCase( SECTION, "Math.cos(5*Math.PI/4)", -Math.SQRT2/2, Math.cos(5*Math.PI/4) ); new TestCase( SECTION, "Math.cos(3*Math.PI/2)", 0, Math.cos(3*Math.PI/2) ); new TestCase( SECTION, "Math.cos(7*Math.PI/4)", Math.SQRT2/2, Math.cos(7*Math.PI/4) ); new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(2*Math.PI) ); new TestCase( SECTION, "Math.cos(-0.7853981633974)", 0.7071067811865, Math.cos(-0.7853981633974) ); new TestCase( SECTION, "Math.cos(-1.570796326795)", 0, Math.cos(-1.570796326795) ); new TestCase( SECTION, "Math.cos(-2.3561944901920)", -.7071067811865, Math.cos(2.3561944901920) ); new TestCase( SECTION, "Math.cos(-3.14159265359)", -1, Math.cos(3.14159265359) ); new TestCase( SECTION, "Math.cos(-3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) ); new TestCase( SECTION, "Math.cos(-4.712388980385)", 0, Math.cos(4.712388980385) ); new TestCase( SECTION, "Math.cos(-5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) ); new TestCase( SECTION, "Math.cos(-6.28318530718)", 1, Math.cos(6.28318530718) ); new TestCase( SECTION, "Math.cos(-Math.PI/4)", Math.SQRT2/2, Math.cos(-Math.PI/4) ); new TestCase( SECTION, "Math.cos(-Math.PI/2)", 0, Math.cos(-Math.PI/2) ); new TestCase( SECTION, "Math.cos(-3*Math.PI/4)", -Math.SQRT2/2, Math.cos(-3*Math.PI/4) ); new TestCase( SECTION, "Math.cos(-Math.PI)", -1, Math.cos(-Math.PI) ); new TestCase( SECTION, "Math.cos(-5*Math.PI/4)", -Math.SQRT2/2, Math.cos(-5*Math.PI/4) ); new TestCase( SECTION, "Math.cos(-3*Math.PI/2)", 0, Math.cos(-3*Math.PI/2) ); new TestCase( SECTION, "Math.cos(-7*Math.PI/4)", Math.SQRT2/2, Math.cos(-7*Math.PI/4) ); new TestCase( SECTION, "Math.cos(-Math.PI*2)", 1, Math.cos(-Math.PI*2) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.8.js0000644000175000017500000000727411545150464020503 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.8.js ECMA Section: 15.8.2.8 Math.exp(x) Description: return an approximation to the exponential function of the argument (e raised to the power of the argument) special cases: - if x is NaN return NaN - if x is 0 return 1 - if x is -0 return 1 - if x is Infinity return Infinity - if x is -Infinity return 0 Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.8"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.exp(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.exp.length", 1, Math.exp.length ); new TestCase( SECTION, "Math.exp()", Number.NaN, Math.exp() ); new TestCase( SECTION, "Math.exp(null)", 1, Math.exp(null) ); new TestCase( SECTION, "Math.exp(void 0)", Number.NaN, Math.exp(void 0) ); new TestCase( SECTION, "Math.exp(1)", Math.E, Math.exp(1) ); new TestCase( SECTION, "Math.exp(true)", Math.E, Math.exp(true) ); new TestCase( SECTION, "Math.exp(false)", 1, Math.exp(false) ); new TestCase( SECTION, "Math.exp('1')", Math.E, Math.exp('1') ); new TestCase( SECTION, "Math.exp('0')", 1, Math.exp('0') ); new TestCase( SECTION, "Math.exp(NaN)", Number.NaN, Math.exp(Number.NaN) ); new TestCase( SECTION, "Math.exp(0)", 1, Math.exp(0) ); new TestCase( SECTION, "Math.exp(-0)", 1, Math.exp(-0) ); new TestCase( SECTION, "Math.exp(Infinity)", Number.POSITIVE_INFINITY, Math.exp(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.exp(-Infinity)", 0, Math.exp(Number.NEGATIVE_INFINITY) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/15.8.2.9.js0000644000175000017500000001251311545150464020474 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.8.2.9.js ECMA Section: 15.8.2.9 Math.floor(x) Description: return the greatest number value that is not greater than the argument and is equal to a mathematical integer. if the number is already an integer, return the number itself. special cases: - if x is NaN return NaN - if x = +0 return +0 - if x = -0 return -0 - if x = Infinity return Infinity - if x = -Infinity return -Infinity - if ( -1 < x < 0 ) return -0 also: - the value of Math.floor(x) == -Math.ceil(-x) Author: christine@netscape.com Date: 7 july 1997 */ var SECTION = "15.8.2.9"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Math.floor(x)"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Math.floor.length", 1, Math.floor.length ); new TestCase( SECTION, "Math.floor()", Number.NaN, Math.floor() ); new TestCase( SECTION, "Math.floor(void 0)", Number.NaN, Math.floor(void 0) ); new TestCase( SECTION, "Math.floor(null)", 0, Math.floor(null) ); new TestCase( SECTION, "Math.floor(true)", 1, Math.floor(true) ); new TestCase( SECTION, "Math.floor(false)", 0, Math.floor(false) ); new TestCase( SECTION, "Math.floor('1.1')", 1, Math.floor("1.1") ); new TestCase( SECTION, "Math.floor('-1.1')", -2, Math.floor("-1.1") ); new TestCase( SECTION, "Math.floor('0.1')", 0, Math.floor("0.1") ); new TestCase( SECTION, "Math.floor('-0.1')", -1, Math.floor("-0.1") ); new TestCase( SECTION, "Math.floor(NaN)", Number.NaN, Math.floor(Number.NaN) ); new TestCase( SECTION, "Math.floor(NaN)==-Math.ceil(-NaN)", false, Math.floor(Number.NaN) == -Math.ceil(-Number.NaN) ); new TestCase( SECTION, "Math.floor(0)", 0, Math.floor(0) ); new TestCase( SECTION, "Math.floor(0)==-Math.ceil(-0)", true, Math.floor(0) == -Math.ceil(-0) ); new TestCase( SECTION, "Math.floor(-0)", -0, Math.floor(-0) ); new TestCase( SECTION, "Infinity/Math.floor(-0)", -Infinity, Infinity/Math.floor(-0) ); new TestCase( SECTION, "Math.floor(-0)==-Math.ceil(0)", true, Math.floor(-0)== -Math.ceil(0) ); new TestCase( SECTION, "Math.floor(Infinity)", Number.POSITIVE_INFINITY, Math.floor(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.floor(Infinity)==-Math.ceil(-Infinity)", true, Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.floor(-Infinity)", Number.NEGATIVE_INFINITY, Math.floor(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Math.floor(-Infinity)==-Math.ceil(Infinity)", true, Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Math.floor(0.0000001)", 0, Math.floor(0.0000001) ); new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(0.0000001)==-Math.ceil(-0.0000001) ); new TestCase( SECTION, "Math.floor(-0.0000001)", -1, Math.floor(-0.0000001) ); new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(-0.0000001)==-Math.ceil(0.0000001) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/browser.js0000644000175000017500000000000011545150464021241 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/jstests.list0000644000175000017500000000145311545150464021631 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/Math/ script 15.8-2-n.js script 15.8-3-n.js script 15.8.1.1-1.js script 15.8.1.1-2.js script 15.8.1.2-1.js script 15.8.1.2-2.js script 15.8.1.3-1.js script 15.8.1.3-2.js script 15.8.1.4-1.js script 15.8.1.4-2.js script 15.8.1.5-1.js script 15.8.1.5-2.js script 15.8.1.6-1.js script 15.8.1.6-2.js script 15.8.1.7-1.js script 15.8.1.7-2.js script 15.8.1.8-1.js script 15.8.1.8-2.js script 15.8.1.8-3.js script 15.8.1.js script 15.8.2.1.js script 15.8.2.10.js script 15.8.2.11.js script 15.8.2.12.js script 15.8.2.13.js script 15.8.2.14.js script 15.8.2.15.js script 15.8.2.16.js script 15.8.2.17.js script 15.8.2.18.js script 15.8.2.2.js script 15.8.2.3.js script 15.8.2.4.js script 15.8.2.5.js script 15.8.2.6.js script 15.8.2.7.js script 15.8.2.8.js script 15.8.2.9.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Math/shell.js0000644000175000017500000000000011545150464020665 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/NativeObjects/browser.js0000644000175000017500000000000011545150464023110 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/NativeObjects/jstests.list0000644000175000017500000000000011545150464023463 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/NativeObjects/shell.js0000644000175000017500000000000011545150464022534 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/0x-without-following-hexdigits.js0000644000175000017500000000136011545150464026143 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 582643; var summary = "'0x' not followed by hex digits should be a syntax error"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ try { eval("0x"); throw new Error("didn't throw parsing 0x (with no subsequent hex digits)"); } catch (e) { assertEq(e instanceof SyntaxError, true, "bad exception thrown: " + e); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.1.js0000644000175000017500000000737011545150464020667 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.1.js ECMA Section: 15.7.1 The Number Constructor Called as a Function 15.7.1.1 15.7.1.2 Description: When Number is called as a function rather than as a constructor, it performs a type conversion. 15.7.1.1 Return a number value (not a Number object) computed by ToNumber( value ) 15.7.1.2 Number() returns 0. need to add more test cases. see the testcases for TypeConversion ToNumber. Author: christine@netscape.com Date: 29 september 1997 */ var SECTION = "15.7.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Number Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase(SECTION, "Number()", 0, Number() ); new TestCase(SECTION, "Number(void 0)", Number.NaN, Number(void 0) ); new TestCase(SECTION, "Number(null)", 0, Number(null) ); new TestCase(SECTION, "Number()", 0, Number() ); new TestCase(SECTION, "Number(new Number())", 0, Number( new Number() ) ); new TestCase(SECTION, "Number(0)", 0, Number(0) ); new TestCase(SECTION, "Number(1)", 1, Number(1) ); new TestCase(SECTION, "Number(-1)", -1, Number(-1) ); new TestCase(SECTION, "Number(NaN)", Number.NaN, Number( Number.NaN ) ); new TestCase(SECTION, "Number('string')", Number.NaN, Number( "string") ); new TestCase(SECTION, "Number(new String())", 0, Number( new String() ) ); new TestCase(SECTION, "Number('')", 0, Number( "" ) ); new TestCase(SECTION, "Number(Infinity)", Number.POSITIVE_INFINITY, Number("Infinity") ); new TestCase(SECTION, "Number(new MyObject(100))", 100, Number(new MyObject(100)) ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.2.js0000644000175000017500000002304411545150464020664 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.2.js ECMA Section: 15.7.2 The Number Constructor 15.7.2.1 15.7.2.2 Description: 15.7.2 When Number is called as part of a new expression, it is a constructor: it initializes the newly created object. 15.7.2.1 The [[Prototype]] property of the newly constructed object is set to othe original Number prototype object, the one that is the initial value of Number.prototype(0). The [[Class]] property is set to "Number". The [[Value]] property of the newly constructed object is set to ToNumber(value) 15.7.2.2 new Number(). same as in 15.7.2.1, except the [[Value]] property is set to +0. need to add more test cases. see the testcases for TypeConversion ToNumber. Author: christine@netscape.com Date: 29 september 1997 */ var SECTION = "15.7.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The Number Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); // To verify that the object's prototype is the Number.prototype, check to see if the object's // constructor property is the same as Number.prototype.constructor. new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor ); new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) ); new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() ); new TestCase(SECTION, "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(0)).constructor", Number.prototype.constructor, (new Number(0)).constructor ); new TestCase(SECTION, "typeof (new Number(0))", "object", typeof (new Number(0)) ); new TestCase(SECTION, "(new Number(0)).valueOf()", 0, (new Number(0)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(1)).constructor", Number.prototype.constructor, (new Number(1)).constructor ); new TestCase(SECTION, "typeof (new Number(1))", "object", typeof (new Number(1)) ); new TestCase(SECTION, "(new Number(1)).valueOf()", 1, (new Number(1)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(-1)).constructor", Number.prototype.constructor, (new Number(-1)).constructor ); new TestCase(SECTION, "typeof (new Number(-1))", "object", typeof (new Number(-1)) ); new TestCase(SECTION, "(new Number(-1)).valueOf()", -1, (new Number(-1)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(Number.NaN)).constructor", Number.prototype.constructor, (new Number(Number.NaN)).constructor ); new TestCase(SECTION, "typeof (new Number(Number.NaN))", "object", typeof (new Number(Number.NaN)) ); new TestCase(SECTION, "(new Number(Number.NaN)).valueOf()", Number.NaN, (new Number(Number.NaN)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number('string')).constructor", Number.prototype.constructor, (new Number('string')).constructor ); new TestCase(SECTION, "typeof (new Number('string'))", "object", typeof (new Number('string')) ); new TestCase(SECTION, "(new Number('string')).valueOf()", Number.NaN, (new Number('string')).valueOf() ); new TestCase(SECTION, "NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(new String())).constructor", Number.prototype.constructor, (new Number(new String())).constructor ); new TestCase(SECTION, "typeof (new Number(new String()))", "object", typeof (new Number(new String())) ); new TestCase(SECTION, "(new Number(new String())).valueOf()", 0, (new Number(new String())).valueOf() ); new TestCase(SECTION, "NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number('')).constructor", Number.prototype.constructor, (new Number('')).constructor ); new TestCase(SECTION, "typeof (new Number(''))", "object", typeof (new Number('')) ); new TestCase(SECTION, "(new Number('')).valueOf()", 0, (new Number('')).valueOf() ); new TestCase(SECTION, "NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.POSITIVE_INFINITY)).constructor ); new TestCase(SECTION, "typeof (new Number(Number.POSITIVE_INFINITY))", "object", typeof (new Number(Number.POSITIVE_INFINITY)) ); new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, (new Number(Number.POSITIVE_INFINITY)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.NEGATIVE_INFINITY)).constructor ); new TestCase(SECTION, "typeof (new Number(Number.NEGATIVE_INFINITY))", "object", typeof (new Number(Number.NEGATIVE_INFINITY)) ); new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).valueOf()", Number.NEGATIVE_INFINITY, (new Number(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase(SECTION, "NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") ); new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor ); new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) ); new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() ); new TestCase(SECTION, "NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()", "[object Number]", eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.1-1.js0000644000175000017500000000524711545150464021167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.1-2.js ECMA Section: 15.7.3.1 Number.prototype Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.prototype Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.prototype"; writeHeaderToLog( SECTION +" "+ TITLE); new TestCase(SECTION, "var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype", true, eval("var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype") ); new TestCase(SECTION, "delete( Number.prototype )", false, eval("delete( Number.prototype )") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.1-2.js0000644000175000017500000000523211545150464021162 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.1-2.js ECMA Section: 15.7.3.1 Number.prototype Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.prototype Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT", true, eval("var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT") ); new TestCase( SECTION, "Number.prototype=0; Number.prototype", Number.prototype, eval("Number.prototype=0; Number.prototype") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.1-3.js0000644000175000017500000000510211545150464021157 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.1-4.js ECMA Section: 15.7.3.1 Number.prototype Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.prototype Author: christine@netscape.com Date: 16 september 1997 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "15.7.3.1-3"; var TITLE = "Number.prototype"; writeHeaderToLog( SECTION + " Number.prototype: DontEnum Attribute"); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop: '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop : '' } string;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.2-1.js0000644000175000017500000000461611545150464021167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.2-1.js ECMA Section: 15.7.3.2 Number.MAX_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the value of MAX_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MAX_VALUE"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Number.MAX_VALUE", 1.7976931348623157e308, Number.MAX_VALUE ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.2-2.js0000644000175000017500000000516011545150464021163 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.2-2.js ECMA Section: 15.7.3.2 Number.MAX_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.MAX_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MAX_VALUE: DontDelete Attribute"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( Number.MAX_VALUE ); Number.MAX_VALUE", 1.7976931348623157e308, eval("delete( Number.MAX_VALUE );Number.MAX_VALUE") ); new TestCase( SECTION, "delete( Number.MAX_VALUE )", false, eval("delete( Number.MAX_VALUE )") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.2-3.js0000644000175000017500000000474311545150464021172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.2-3.js ECMA Section: 15.7.3.2 Number.MAX_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.MAX_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MAX_VALUE"; writeHeaderToLog( SECTION + " "+ TITLE ); var MAX_VAL = 1.7976931348623157e308; new TestCase( SECTION, "Number.MAX_VALUE=0; Number.MAX_VALUE", MAX_VAL, eval("Number.MAX_VALUE=0; Number.MAX_VALUE") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.2-4.js0000644000175000017500000000510511545150464021164 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.2-4.js ECMA Section: 15.7.3.2 Number.MAX_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.MAX_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.2-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MAX_VALUE: DontEnum Attribute"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.3-1.js0000644000175000017500000000464211545150464021167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.3-1.js ECMA Section: 15.7.3.3 Number.MIN_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the value of Number.MIN_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MIN_VALUE"; writeHeaderToLog( SECTION + " "+ TITLE ); var MIN_VAL = 5e-324; new TestCase( SECTION, "Number.MIN_VALUE", MIN_VAL, Number.MIN_VALUE ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.3-2.js0000644000175000017500000000515011545150464021163 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.3-2.js ECMA Section: 15.7.3.3 Number.MIN_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.MIN_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MIN_VALUE"; writeHeaderToLog( SECTION + " "+ TITLE ); var MIN_VAL = 5e-324; new TestCase( SECTION, "delete( Number.MIN_VALUE )", false, eval("delete( Number.MIN_VALUE )") ); new TestCase( SECTION, "delete( Number.MIN_VALUE ); Number.MIN_VALUE", MIN_VAL, eval("delete( Number.MIN_VALUE );Number.MIN_VALUE") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.3-3.js0000644000175000017500000000473011545150464021167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.3-3.js ECMA Section: 15.7.3.3 Number.MIN_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.MIN_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.3-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.MIN_VALUE: ReadOnly Attribute"; writeHeaderToLog( SECTION + " "+TITLE ); new TestCase( SECTION, "Number.MIN_VALUE=0; Number.MIN_VALUE", Number.MIN_VALUE, eval("Number.MIN_VALUE=0; Number.MIN_VALUE" )); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.3-4.js0000644000175000017500000000505711545150464021173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.3-4.js ECMA Section: 15.7.3.3 Number.MIN_VALUE Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.MIN_VALUE Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.3-4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.MIN_VALUE: DontEnum Attribute"); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.4-1.js0000644000175000017500000000454111545150464021166 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.4-1.js ECMA Section: 15.7.3.4 Number.NaN Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the value of Number.NaN Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NaN"; writeHeaderToLog( SECTION + " "+ TITLE ); new TestCase(SECTION, "NaN", NaN, Number.NaN ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.4-2.js0000644000175000017500000000503011545150464021161 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.4-2.js ECMA Section: 15.7.3.4 Number.NaN Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.NaN Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.4-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NaN"; writeHeaderToLog( SECTION + " "+ TITLE ); new TestCase(SECTION, "delete( Number.NaN ); Number.NaN", NaN, eval("delete( Number.NaN );Number.NaN" )); new TestCase( SECTION, "delete( Number.NaN )", false, eval("delete( Number.NaN )") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.4-3.js0000644000175000017500000000462511545150464021173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.4-3.js ECMA Section: 15.7.3.4 Number.NaN Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.NaN Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.4-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NaN"; writeHeaderToLog( SECTION + " "+ TITLE ); new TestCase( SECTION, "Number.NaN=0; Number.NaN", Number.NaN, eval("Number.NaN=0; Number.NaN") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.4-4.js0000644000175000017500000000502511545150464021167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.4-4.js ECMA Section: 15.7.3.4 Number.NaN Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.NaN Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.4-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NaN"; writeHeaderToLog( SECTION + " " + TITLE); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.5-1.js0000644000175000017500000000465211545150464021172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.5-1.js ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the value of Number.NEGATIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NEGATIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase(SECTION, "Number.NEGATIVE_INFINITY", -Infinity, Number.NEGATIVE_INFINITY ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.5-2.js0000644000175000017500000000516311545150464021171 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.5-2.js ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.NEGATIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NEGATIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "delete( Number.NEGATIVE_INFINITY )", false, eval("delete( Number.NEGATIVE_INFINITY )") ); new TestCase( SECTION, "delete( Number.NEGATIVE_INFINITY ); Number.NEGATIVE_INFINITY", -Infinity, eval("delete( Number.NEGATIVE_INFINITY );Number.NEGATIVE_INFINITY") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.5-3.js0000644000175000017500000000476411545150464021200 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.5-3.js ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.NEGATIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.5-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NEGATIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY", -Infinity, eval("Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.5-4.js0000644000175000017500000000513111545150464021166 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.5-4.js ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.NEGATIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.5-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.NEGATIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.6-1.js0000644000175000017500000000465511545150464021176 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.6-1.js ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the value of Number.POSITIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.6-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.POSITIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "Number.POSITIVE_INFINITY", Infinity, Number.POSITIVE_INFINITY ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.6-2.js0000644000175000017500000000521011545150464021163 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.6-2.js ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontDelete attribute of Number.POSITIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.6-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.POSITIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase(SECTION, "delete( Number.POSITIVE_INFINITY )", false, eval("delete( Number.POSITIVE_INFINITY )") ); new TestCase(SECTION, "delete( Number.POSITIVE_INFINITY ); Number.POSITIVE_INFINITY", Infinity, eval("delete( Number.POSITIVE_INFINITY );Number.POSITIVE_INFINITY") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.6-3.js0000644000175000017500000000500311545150464021164 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.6-3.js ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the ReadOnly attribute of Number.POSITIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.6-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.POSITIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, eval("Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.6-4.js0000644000175000017500000000513111545150464021167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.6-4.js ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY Description: All value properties of the Number object should have the attributes [DontEnum, DontDelete, ReadOnly] this test checks the DontEnum attribute of Number.POSITIVE_INFINITY Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.3.6-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.POSITIVE_INFINITY"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;", "", eval("var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.3.js0000644000175000017500000000501111545150464020657 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.3.js 15.7.3 Properties of the Number Constructor Description: The value of the internal [[Prototype]] property of the Number constructor is the Function prototype object. The Number constructor also has the internal [[Call]] and [[Construct]] properties, and the length property. Other properties are in subsequent tests. Author: christine@netscape.com Date: 29 september 1997 */ var SECTION = "15.7.3"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Properties of the Number Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase(SECTION, "Number.length", 1, Number.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.4-1.js0000644000175000017500000000512511545150464021024 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.4-1.js ECMA Section: 15.7.4.1 Properties of the Number Prototype Object Description: Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + "Properties of the Number prototype object"); new TestCase(SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() ); new TestCase(SECTION, "typeof(Number.prototype)", "object", typeof(Number.prototype) ); new TestCase(SECTION, "Number.prototype.constructor == Number", true, Number.prototype.constructor == Number ); // new TestCase(SECTION, "Number.prototype == Number.__proto__", true, Number.prototype == Number.__proto__ ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.4.1.js0000644000175000017500000000447511545150464021034 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.4.1.js ECMA Section: 15.7.4.1.1 Number.prototype.constructor Number.prototype.constructor is the built-in Number constructor. Description: Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Number.prototype.constructor"; writeHeaderToLog( SECTION + " "+TITLE); new TestCase( SECTION, "Number.prototype.constructor", Number, Number.prototype.constructor ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.4.2-1.js0000644000175000017500000001050211545150464021157 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.4.2.js ECMA Section: 15.7.4.2.1 Number.prototype.toString() Description: If the radix is the number 10 or not supplied, then this number value is given as an argument to the ToString operator; the resulting string value is returned. If the radix is supplied and is an integer from 2 to 36, but not 10, the result is a string, the choice of which is implementation dependent. The toString function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.2-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.toString()"); // the following two lines cause navigator to crash -- cmb 9/16/97 new TestCase(SECTION, "Number.prototype.toString()", "0", eval("Number.prototype.toString()") ); new TestCase(SECTION, "typeof(Number.prototype.toString())", "string", eval("typeof(Number.prototype.toString())") ); new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()", "0", eval("s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()") ); new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()", "1", eval("s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()") ); new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()", "-1", eval("s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()") ); new TestCase(SECTION, "var MYNUM = new Number(255); MYNUM.toString(10)", "255", eval("var MYNUM = new Number(255); MYNUM.toString(10)") ); new TestCase(SECTION, "var MYNUM = new Number(Number.NaN); MYNUM.toString(10)", "NaN", eval("var MYNUM = new Number(Number.NaN); MYNUM.toString(10)") ); new TestCase(SECTION, "var MYNUM = new Number(Infinity); MYNUM.toString(10)", "Infinity", eval("var MYNUM = new Number(Infinity); MYNUM.toString(10)") ); new TestCase(SECTION, "var MYNUM = new Number(-Infinity); MYNUM.toString(10)", "-Infinity", eval("var MYNUM = new Number(-Infinity); MYNUM.toString(10)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.4.2-2-n.js0000644000175000017500000000651011545150464021417 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.4.2-2-n.js ECMA Section: 15.7.4.2.1 Number.prototype.toString() Description: If the radix is the number 10 or not supplied, then this number value is given as an argument to the ToString operator; the resulting string value is returned. If the radix is supplied and is an integer from 2 to 36, but not 10, the result is a string, the choice of which is implementation dependent. The toString function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.2-2-n"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.toString()"); DESCRIPTION = "o = new Object(); o.toString = Number.prototype.toString; o.toString()"; EXPECTED = "error"; new TestCase(SECTION, "o = new Object(); o.toString = Number.prototype.toString; o.toString()", "error", eval("o = new Object(); o.toString = Number.prototype.toString; o.toString()") ); // new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", eval("o = new String(); o.toString = Number.prototype.toString; o.toString()") ); // new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "error", eval("o = 3; o.toString = Number.prototype.toString; o.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.4.2-3-n.js0000644000175000017500000000570611545150464021426 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.4.2-3-n.js ECMA Section: 15.7.4.2.1 Number.prototype.toString() Description: If the radix is the number 10 or not supplied, then this number value is given as an argument to the ToString operator; the resulting string value is returned. If the radix is supplied and is an integer from 2 to 36, but not 10, the result is a string, the choice of which is implementation dependent. The toString function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.2-3-n"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.toString()"); DESCRIPTION = "o = new String(); o.toString = Number.prototype.toString; o.toString()"; EXPECTED = "error"; new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", eval("o = new String(); o.toString = Number.prototype.toString; o.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.4.2-4.js0000644000175000017500000000550611545150464021172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.4.2-4.js ECMA Section: 15.7.4.2.1 Number.prototype.toString() Description: If the radix is the number 10 or not supplied, then this number value is given as an argument to the ToString operator; the resulting string value is returned. If the radix is supplied and is an integer from 2 to 36, but not 10, the result is a string, the choice of which is implementation dependent. The toString function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.2-4"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.toString()"); new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "3", eval("o = 3; o.toString = Number.prototype.toString; o.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.4.3-1.js0000644000175000017500000000653411545150464021172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.4.3-1.js ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() Description: Returns this number value. The valueOf function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.3-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); // the following two line causes navigator to crash -- cmb 9/16/97 new TestCase("SECTION", "Number.prototype.valueOf()", 0, eval("Number.prototype.valueOf()") ); new TestCase("SECTION", "(new Number(1)).valueOf()", 1, eval("(new Number(1)).valueOf()") ); new TestCase("SECTION", "(new Number(-1)).valueOf()", -1, eval("(new Number(-1)).valueOf()") ); new TestCase("SECTION", "(new Number(0)).valueOf()", 0, eval("(new Number(0)).valueOf()") ); new TestCase("SECTION", "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, eval("(new Number(Number.POSITIVE_INFINITY)).valueOf()") ); new TestCase("SECTION", "(new Number(Number.NaN)).valueOf()", Number.NaN, eval("(new Number(Number.NaN)).valueOf()") ); new TestCase("SECTION", "(new Number()).valueOf()", 0, eval("(new Number()).valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.4.3-2.js0000644000175000017500000000504611545150464021170 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.4.3-2.js ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() Description: Returns this number value. The valueOf function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.3-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); new TestCase(SECTION, "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", 3, eval("v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/15.7.4.3-3-n.js0000644000175000017500000000613411545150464021423 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.7.4.3-3.js ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() Description: Returns this number value. The valueOf function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "15.7.4.3-3-n"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); // new TestCase("15.7.4.1", "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", "error", eval("v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()") ); DESCRIPTION = "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()"; EXPECTED = "error"; new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()", "error", eval("v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()") ); // new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()", "error", eval("v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/browser.js0000644000175000017500000000000011545150464021600 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/jstests.list0000644000175000017500000000146011545150464022166 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/Number/ script 15.7.1.js script 15.7.2.js script 15.7.3.1-1.js script 15.7.3.1-2.js script 15.7.3.1-3.js script 15.7.3.2-1.js script 15.7.3.2-2.js script 15.7.3.2-3.js script 15.7.3.2-4.js script 15.7.3.3-1.js script 15.7.3.3-2.js script 15.7.3.3-3.js script 15.7.3.3-4.js script 15.7.3.4-1.js script 15.7.3.4-2.js script 15.7.3.4-3.js script 15.7.3.4-4.js script 15.7.3.5-1.js script 15.7.3.5-2.js script 15.7.3.5-3.js script 15.7.3.5-4.js script 15.7.3.6-1.js script 15.7.3.6-2.js script 15.7.3.6-3.js script 15.7.3.6-4.js script 15.7.3.js script 15.7.4-1.js script 15.7.4.1.js script 15.7.4.2-1.js script 15.7.4.2-2-n.js script 15.7.4.2-3-n.js script 15.7.4.2-4.js script 15.7.4.3-1.js script 15.7.4.3-2.js script 15.7.4.3-3-n.js script 0x-without-following-hexdigits.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Number/shell.js0000644000175000017500000000000011545150464021224 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.1.1.js0000644000175000017500000002461611545150464022313 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.1.1.js ECMA Section: 15.2.1.1 The Object Constructor Called as a Function: Object(value) Description: When Object is called as a function rather than as a constructor, the following steps are taken: 1. If value is null or undefined, create and return a new object with no properties other than internal properties exactly as if the object constructor had been called on that same value (15.2.2.1). 2. Return ToObject (value), whose rules are: undefined generate a runtime error null generate a runtime error boolean create a new Boolean object whose default value is the value of the boolean. number Create a new Number object whose default value is the value of the number. string Create a new String object whose default value is the value of the string. object Return the input argument (no conversion). Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "15.2.1.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object( value )"; writeHeaderToLog( SECTION + " "+ TITLE); var NULL_OBJECT = Object(null); new TestCase( SECTION, "Object(null).valueOf()", NULL_OBJECT, (NULL_OBJECT).valueOf() ); new TestCase( SECTION, "typeof Object(null)", "object", typeof (Object(null)) ); var UNDEFINED_OBJECT = Object( void 0 ); new TestCase( SECTION, "Object(void 0).valueOf()", UNDEFINED_OBJECT, (UNDEFINED_OBJECT).valueOf() ); new TestCase( SECTION, "typeof Object(void 0)", "object", typeof (Object(void 0)) ); new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() ); new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) ); new TestCase( SECTION, "var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() ); new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) ); new TestCase( SECTION, "var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() ); new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) ); new TestCase( SECTION, "var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() ); new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) ); new TestCase( SECTION, "var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() ); new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) ); new TestCase( SECTION, "var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() ); new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) ); new TestCase( SECTION, "var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) ); new TestCase( SECTION, "var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) ); new TestCase( SECTION, "var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) ); new TestCase( SECTION, "var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() ); new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) ); new TestCase( SECTION, "var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() ); new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) ); new TestCase( SECTION, "var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() ); new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) ); new TestCase( SECTION, "var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() ); new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") ); // new TestCase( SECTION, "var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.1.2.js0000644000175000017500000000642411545150464022311 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.1.2.js ECMA Section: 15.2.1.2 The Object Constructor Called as a Function: Object(value) Description: When Object is called as a function rather than as a constructor, the following steps are taken: 1. If value is null or undefined, create and return a new object with no proerties other than internal properties exactly as if the object constructor had been called on that same value (15.2.2.1). 2. Return ToObject (value), whose rules are: undefined generate a runtime error null generate a runtime error boolean create a new Boolean object whose default value is the value of the boolean. number Create a new Number object whose default value is the value of the number. string Create a new String object whose default value is the value of the string. object Return the input argument (no conversion). Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "15.2.1.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object()"; writeHeaderToLog( SECTION + " "+ TITLE); var MYOB = Object(); new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()", MYOB, MYOB.valueOf() ); new TestCase( SECTION, "typeof Object()", "object", typeof (Object(null)) ); new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()", "[object Object]", eval("var MYOB = Object(); MYOB.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.2.1.js0000644000175000017500000002277511545150464022320 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.2.1.js ECMA Section: 15.2.2.1 The Object Constructor: new Object( value ) 1.If the type of the value is not Object, go to step 4. 2.If the value is a native ECMAScript object, do not create a new object; simply return value. 3.If the value is a host object, then actions are taken and a result is returned in an implementation-dependent manner that may depend on the host object. 4.If the type of the value is String, return ToObject(value). 5.If the type of the value is Boolean, return ToObject(value). 6.If the type of the value is Number, return ToObject(value). 7.(The type of the value must be Null or Undefined.) Create a new native ECMAScript object. The [[Prototype]] property of the newly constructed object is set to the Object prototype object. The [[Class]] property of the newly constructed object is set to "Object". The newly constructed object has no [[Value]] property. Return the newly created native object. Description: This does not test cases where the object is a host object. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.2.2.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Object( value )"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof new Object(null)", "object", typeof new Object(null) ); new TestCase( SECTION, "MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "typeof new Object(void 0)", "object", typeof new Object(void 0) ); new TestCase( SECTION, "MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "typeof new Object('string')", "object", typeof new Object('string') ); new TestCase( SECTION, "MYOB = (new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object('string').valueOf()", "string", (new Object('string')).valueOf() ); new TestCase( SECTION, "typeof new Object('')", "object", typeof new Object('') ); new TestCase( SECTION, "MYOB = (new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object('').valueOf()", "", (new Object('')).valueOf() ); new TestCase( SECTION, "typeof new Object(Number.NaN)", "object", typeof new Object(Number.NaN) ); new TestCase( SECTION, "MYOB = (new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(Number.NaN).valueOf()", Number.NaN, (new Object(Number.NaN)).valueOf() ); new TestCase( SECTION, "typeof new Object(0)", "object", typeof new Object(0) ); new TestCase( SECTION, "MYOB = (new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(0).valueOf()", 0, (new Object(0)).valueOf() ); new TestCase( SECTION, "typeof new Object(-0)", "object", typeof new Object(-0) ); new TestCase( SECTION, "MYOB = (new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(-0).valueOf()", -0, (new Object(-0)).valueOf() ); new TestCase( SECTION, "typeof new Object(1)", "object", typeof new Object(1) ); new TestCase( SECTION, "MYOB = (new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(1).valueOf()", 1, (new Object(1)).valueOf() ); new TestCase( SECTION, "typeof new Object(-1)", "object", typeof new Object(-1) ); new TestCase( SECTION, "MYOB = (new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(-1).valueOf()", -1, (new Object(-1)).valueOf() ); new TestCase( SECTION, "typeof new Object(true)", "object", typeof new Object(true) ); new TestCase( SECTION, "MYOB = (new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(true).valueOf()", true, (new Object(true)).valueOf() ); new TestCase( SECTION, "typeof new Object(false)", "object", typeof new Object(false) ); new TestCase( SECTION, "MYOB = (new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(false).valueOf()", false, (new Object(false)).valueOf() ); new TestCase( SECTION, "typeof new Object(Boolean())", "object", typeof new Object(Boolean()) ); new TestCase( SECTION, "MYOB = (new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()") ); new TestCase( SECTION, "(new Object(Boolean()).valueOf()", Boolean(), (new Object(Boolean())).valueOf() ); var myglobal = this; var myobject = new Object( "my new object" ); var myarray = new Array(); var myboolean = new Boolean(); var mynumber = new Number(); var mystring = new String(); var myobject = new Object(); var myfunction = new Function( "x", "return x"); var mymath = Math; new TestCase( SECTION, "myglobal = new Object( this )", myglobal, new Object(this) ); new TestCase( SECTION, "myobject = new Object('my new object'); new Object(myobject)", myobject, new Object(myobject) ); new TestCase( SECTION, "myarray = new Array(); new Object(myarray)", myarray, new Object(myarray) ); new TestCase( SECTION, "myboolean = new Boolean(); new Object(myboolean)", myboolean, new Object(myboolean) ); new TestCase( SECTION, "mynumber = new Number(); new Object(mynumber)", mynumber, new Object(mynumber) ); new TestCase( SECTION, "mystring = new String9); new Object(mystring)", mystring, new Object(mystring) ); new TestCase( SECTION, "myobject = new Object(); new Object(mynobject)", myobject, new Object(myobject) ); new TestCase( SECTION, "myfunction = new Function(); new Object(myfunction)", myfunction, new Object(myfunction) ); new TestCase( SECTION, "mymath = Math; new Object(mymath)", mymath, new Object(mymath) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.2.2.js0000644000175000017500000000550411545150464022310 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.2.2.js ECMA Section: 15.2.2.2 new Object() Description: When the Object constructor is called with no argument, the following step is taken: 1. Create a new native ECMAScript object. The [[Prototype]] property of the newly constructed object is set to the Object prototype object. The [[Class]] property of the newly constructed object is set to "Object". The newly constructed object has no [[Value]] property. Return the newly created native object. Author: christine@netscape.com Date: 7 october 1997 */ var SECTION = "15.2.2.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "new Object()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof new Object()", "object", typeof new Object() ); new TestCase( SECTION, "Object.prototype.toString()", "[object Object]", Object.prototype.toString() ); new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.3-1.js0000644000175000017500000000473611545150464022315 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.3-1.js ECMA Section: 15.2.3 Properties of the Object Constructor Description: The value of the internal [[Prototype]] property of the Object constructor is the Function prototype object. Besides the call and construct propreties and the length property, the Object constructor has properties described in 15.2.3.1. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3"; var VERSION = "ECMA_2"; startTest(); writeHeaderToLog( SECTION + " Properties of the Object Constructor"); new TestCase( SECTION, "Object.length", 1, Object.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.3.1-1.js0000644000175000017500000000501411545150464022442 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.3.1-1.js ECMA Section: 15.2.3.1 Object.prototype Description: The initial value of Object.prototype is the built-in Object prototype object. This property shall have the attributes [ DontEnum, DontDelete ReadOnly ] This tests the [DontEnum] property of Object.prototype Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var str = '';for ( p in Object ) { str += p; }; str", "", eval( "var str = ''; for ( p in Object ) { str += p; }; str" ) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.3.1-2.js0000644000175000017500000000473511545150464022454 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.3.1-2.js ECMA Section: 15.2.3.1 Object.prototype Description: The initial value of Object.prototype is the built-in Object prototype object. This property shall have the attributes [ DontEnum, DontDelete ReadOnly ] This tests the [DontDelete] property of Object.prototype Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( Object.prototype )", false, eval("delete( Object.prototype )") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.3.1-3.js0000644000175000017500000000500311545150464022442 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.3.1-3.js ECMA Section: 15.2.3.1 Object.prototype Description: The initial value of Object.prototype is the built-in Object prototype object. This property shall have the attributes [ DontEnum, DontDelete ReadOnly ] This tests the [ReadOnly] property of Object.prototype Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Object.prototype = null; Object.prototype", Object.prototype, eval("Object.prototype = null; Object.prototype")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.3.1-4.js0000644000175000017500000000501211545150464022443 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.3.1-4.js ECMA Section: 15.2.3.1 Object.prototype Description: The initial value of Object.prototype is the built-in Object prototype object. This property shall have the attributes [ DontEnum, DontDelete ReadOnly ] This tests the [DontDelete] property of Object.prototype Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3.1-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( Object.prototype ); Object.prototype", Object.prototype, eval("delete(Object.prototype); Object.prototype") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.3.js0000644000175000017500000000513111545150464022145 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.3.js ECMA Section: 15.2.3 Properties of the Object Constructor Description: The value of the internal [[Prototype]] property of the Object constructor is the Function prototype object. Besides the call and construct propreties and the length property, the Object constructor has properties described in 15.2.3.1. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the Object Constructor"; writeHeaderToLog( SECTION + " " + TITLE); // new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ ); new TestCase( SECTION, "Object.length", 1, Object.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.4.1.js0000644000175000017500000000455011545150464022311 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.4.1.js ECMA Section: 15.2.4 Object.prototype.constructor Description: The initial value of the Object.prototype.constructor is the built-in Object constructor. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype.constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Object.prototype.constructor", Object, Object.prototype.constructor ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.4.2.js0000644000175000017500000001333511545150464022313 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.4.2.js ECMA Section: 15.2.4.2 Object.prototype.toString() Description: When the toString method is called, the following steps are taken: 1. Get the [[Class]] property of this object 2. Call ToString( Result(1) ) 3. Compute a string value by concatenating the three strings "[object " + Result(2) + "]" 4. Return Result(3). Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.4.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype.toString()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() ); new TestCase( SECTION, "myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()", GLOBAL.replace(/ @ 0x[0-9a-fA-F]+ \(native @ 0x[0-9a-fA-F]+\)/, ''), eval("myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()", "[object Function]", eval("myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()", '[object Object]', eval("myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()", "[object Number]", eval("myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()", "[object String]", eval("myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()", "[object Math]", eval("myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()", "[object Function]", eval("myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()", "[object Array]", eval("myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()", "[object Boolean]", eval("myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()", "[object Date]", eval("myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()") ); new TestCase( SECTION, "var MYVAR = new Object( this ); MYVAR.toString()", GLOBAL.replace(/ @ 0x[0-9a-fA-F]+ \(native @ 0x[0-9a-fA-F]+\)/, ''), eval("var MYVAR = new Object( this ); MYVAR.toString()") ); new TestCase( SECTION, "var MYVAR = new Object(); MYVAR.toString()", "[object Object]", eval("var MYVAR = new Object(); MYVAR.toString()") ); new TestCase( SECTION, "var MYVAR = new Object(void 0); MYVAR.toString()", "[object Object]", eval("var MYVAR = new Object(void 0); MYVAR.toString()") ); new TestCase( SECTION, "var MYVAR = new Object(null); MYVAR.toString()", "[object Object]", eval("var MYVAR = new Object(null); MYVAR.toString()") ); function MyObject( value ) { this.value = new Function( "return this.value" ); this.toString = new Function ( "return this.value+''"); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/15.2.4.3.js0000644000175000017500000001061011545150464022305 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.2.4.3.js ECMA Section: 15.2.4.3 Object.prototype.valueOf() Description: As a rule, the valueOf method for an object simply returns the object; but if the object is a "wrapper" for a host object, as may perhaps be created by the Object constructor, then the contained host object should be returned. This only covers native objects. Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.2.4.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Object.prototype.valueOf()"; writeHeaderToLog( SECTION + " "+ TITLE); var myarray = new Array(); myarray.valueOf = Object.prototype.valueOf; var myboolean = new Boolean(); myboolean.valueOf = Object.prototype.valueOf; var myfunction = new Function(); myfunction.valueOf = Object.prototype.valueOf; var myobject = new Object(); myobject.valueOf = Object.prototype.valueOf; var mymath = Math; mymath.valueOf = Object.prototype.valueOf; var mydate = new Date(); mydate.valueOf = Object.prototype.valueOf; var mynumber = new Number(); mynumber.valueOf = Object.prototype.valueOf; var mystring = new String(); mystring.valueOf = Object.prototype.valueOf; new TestCase( SECTION, "Object.prototype.valueOf.length", 0, Object.prototype.valueOf.length ); new TestCase( SECTION, "myarray = new Array(); myarray.valueOf = Object.prototype.valueOf; myarray.valueOf()", myarray, myarray.valueOf() ); new TestCase( SECTION, "myboolean = new Boolean(); myboolean.valueOf = Object.prototype.valueOf; myboolean.valueOf()", myboolean, myboolean.valueOf() ); new TestCase( SECTION, "myfunction = new Function(); myfunction.valueOf = Object.prototype.valueOf; myfunction.valueOf()", myfunction, myfunction.valueOf() ); new TestCase( SECTION, "myobject = new Object(); myobject.valueOf = Object.prototype.valueOf; myobject.valueOf()", myobject, myobject.valueOf() ); new TestCase( SECTION, "mymath = Math; mymath.valueOf = Object.prototype.valueOf; mymath.valueOf()", mymath, mymath.valueOf() ); new TestCase( SECTION, "mynumber = new Number(); mynumber.valueOf = Object.prototype.valueOf; mynumber.valueOf()", mynumber, mynumber.valueOf() ); new TestCase( SECTION, "mystring = new String(); mystring.valueOf = Object.prototype.valueOf; mystring.valueOf()", mystring, mystring.valueOf() ); new TestCase( SECTION, "mydate = new Date(); mydate.valueOf = Object.prototype.valueOf; mydate.valueOf()", mydate, mydate.valueOf() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/browser.js0000644000175000017500000000000011545150464023070 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/jstests.list0000644000175000017500000000046611545150464023463 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/ObjectObjects/ script 15.2.1.1.js script 15.2.1.2.js script 15.2.2.1.js script 15.2.2.2.js script 15.2.3-1.js script 15.2.3.1-1.js script 15.2.3.1-2.js script 15.2.3.1-3.js script 15.2.3.1-4.js script 15.2.3.js script 15.2.4.1.js script 15.2.4.2.js script 15.2.4.3.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/ObjectObjects/shell.js0000644000175000017500000000000011545150464022514 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/SourceText/6-1.js0000644000175000017500000001246711545150464021321 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 6-1.js ECMA Section: Source Text Description: ECMAScript source text is represented as a sequence of characters representable using the Unicode version 2.0 character encoding. SourceCharacter :: any Unicode character However, it is possible to represent every ECMAScript program using only ASCII characters (which are equivalent to the first 128 Unicode characters). Non-ASCII Unicode characters may appear only within comments and string literals. In string literals, any Unicode character may also be expressed as a Unicode escape sequence consisting of six ASCII characters, namely \u plus four hexadecimal digits. Within a comment, such an escape sequence is effectively ignored as part of the comment. Within a string literal, the Unicode escape sequence contributes one character to the string value of the literal. Note that ECMAScript differs from the Java programming language in the behavior of Unicode escape sequences. In a Java program, if the Unicode escape sequence \u000A, for example, occurs within a single-line comment, it is interpreted as a line terminator (Unicode character 000A is line feed) and therefore the next character is not part of the comment. Similarly, if the Unicode escape sequence \u000A occurs within a string literal in a Java program, it is likewise interpreted as a line terminator, which is not allowed within a string literal-one must write \n instead of \u000A to cause a line feed to be part of the string value of a string literal. In an ECMAScript program, a Unicode escape sequence occurring within a comment is never interpreted and therefore cannot contribute to termination of the comment. Similarly, a Unicode escape sequence occurring within a string literal in an ECMAScript program always contributes a character to the string value of the literal and is never interpreted as a line terminator or as a quote mark that might terminate the string literal. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "6-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Source Text"; writeHeaderToLog( SECTION + " "+ TITLE); var testcase = new TestCase( SECTION, "// the following character should not be interpreted as a line terminator in a comment: \u000A", 'PASSED', "PASSED" ); // \u000A testcase.actual = "FAILED!"; testcase = new TestCase( SECTION, "// the following character should not be interpreted as a line terminator in a comment: \\n 'FAILED'", 'PASSED', 'PASSED' ); // the following character should noy be interpreted as a line terminator: \\n testcase.actual = "FAILED" testcase = new TestCase( SECTION, "// the following character should not be interpreted as a line terminator in a comment: \\u000A 'FAILED'", 'PASSED', 'PASSED' ); // the following character should not be interpreted as a line terminator: \u000A testcase.actual = "FAILED" testcase = new TestCase( SECTION, "// the following character should not be interpreted as a line terminator in a comment: \n 'PASSED'", 'PASSED', 'PASSED' ); // the following character should not be interpreted as a line terminator: \n testcase.actual = 'FAILED' testcase = new TestCase( SECTION, "// the following character should not be interpreted as a line terminator in a comment: u000D", 'PASSED', 'PASSED' ); // the following character should not be interpreted as a line terminator: \u000D testcase.actual = "FAILED" test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/SourceText/6-2.js0000644000175000017500000001153611545150464021316 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 6-1.js ECMA Section: Source Text Description: ECMAScript source text is represented as a sequence of characters representable using the Unicode version 2.0 character encoding. SourceCharacter :: any Unicode character However, it is possible to represent every ECMAScript program using only ASCII characters (which are equivalent to the first 128 Unicode characters). Non-ASCII Unicode characters may appear only within comments and string literals. In string literals, any Unicode character may also be expressed as a Unicode escape sequence consisting of six ASCII characters, namely \u plus four hexadecimal digits. Within a comment, such an escape sequence is effectively ignored as part of the comment. Within a string literal, the Unicode escape sequence contributes one character to the string value of the literal. Note that ECMAScript differs from the Java programming language in the behavior of Unicode escape sequences. In a Java program, if the Unicode escape sequence \u000A, for example, occurs within a single-line comment, it is interpreted as a line terminator (Unicode character 000A is line feed) and therefore the next character is not part of the comment. Similarly, if the Unicode escape sequence \u000A occurs within a string literal in a Java program, it is likewise interpreted as a line terminator, which is not allowed within a string literal-one must write \n instead of \u000A to cause a line feed to be part of the string value of a string literal. In an ECMAScript program, a Unicode escape sequence occurring within a comment is never interpreted and therefore cannot contribute to termination of the comment. Similarly, a Unicode escape sequence occurring within a string literal in an ECMAScript program always contributes a character to the string value of the literal and is never interpreted as a line terminator or as a quote mark that might terminate the string literal. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "6-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Source Text"; writeHeaderToLog( SECTION + " "+ TITLE); // encoded quotes should not end a quote new TestCase( SECTION, "var s = 'PAS\\u0022SED'; s", "PAS\"SED", eval("var s = 'PAS\\u0022SED'; s") ); new TestCase( SECTION, 'var s = "PAS\\u0022SED"; s', "PAS\"SED", eval('var s = "PAS\\u0022SED"; s') ); new TestCase( SECTION, "var s = 'PAS\\u0027SED'; s", "PAS\'SED", eval("var s = 'PAS\\u0027SED'; s") ); new TestCase( SECTION, 'var s = "PAS\\u0027SED"; s', "PAS\'SED", eval('var s = "PAS\\u0027SED"; s') ); var testcase = new TestCase( SECTION, 'var s="PAS\\u0027SED"; s', "PAS\'SED", "" ); var s = "PAS\u0027SED"; testcase.actual = s; testcase = new TestCase( SECTION, 'var s = "PAS\\u0022SED"; s', "PAS\"SED", "" ); var s = "PAS\u0022SED"; testcase.actual = s; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/SourceText/browser.js0000644000175000017500000000000011545150464022455 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/SourceText/jstests.list0000644000175000017500000000012211545150464023035 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/SourceText/ script 6-1.js script 6-2.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/SourceText/shell.js0000644000175000017500000000000011545150464022101 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.10-1.js0000644000175000017500000001210211545150464021621 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.10-1.js ECMA Section: 12.10 The with statement Description: WithStatement : with ( Expression ) Statement The with statement adds a computed object to the front of the scope chain of the current execution context, then executes a statement with this augmented scope chain, then restores the scope chain. Semantics The production WithStatement : with ( Expression ) Statement is evaluated as follows: 1. Evaluate Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Add Result(3) to the front of the scope chain. 5. Evaluate Statement using the augmented scope chain from step 4. 6. Remove Result(3) from the front of the scope chain. 7. Return Result(5). Discussion Note that no matter how control leaves the embedded Statement, whether normally or by some form of abrupt completion, the scope chain is always restored to its former state. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.10-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The with statement"; writeHeaderToLog( SECTION + " "+ TITLE); // although the scope chain changes, the this value is immutable for a given // execution context. new TestCase( SECTION, "with( new Number() ) { this +'' }", GLOBAL, eval("with( new Number() ) { this +'' }") ); // the object's functions and properties should override those of the // global object. new TestCase( SECTION, "var MYOB = new WithObject(true); with (MYOB) { parseInt() }", true, eval("var MYOB = new WithObject(true); with (MYOB) { parseInt() }") ); new TestCase( SECTION, "var MYOB = new WithObject(false); with (MYOB) { NaN }", false, eval("var MYOB = new WithObject(false); with (MYOB) { NaN }") ); new TestCase( SECTION, "var MYOB = new WithObject(NaN); with (MYOB) { Infinity }", Number.NaN, eval("var MYOB = new WithObject(NaN); with (MYOB) { Infinity }") ); new TestCase( SECTION, "var MYOB = new WithObject(false); with (MYOB) { }; Infinity", Number.POSITIVE_INFINITY, eval("var MYOB = new WithObject(false); with (MYOB) { }; Infinity") ); new TestCase( SECTION, "var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }", Number.POSITIVE_INFINITY, eval("var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }") ); // let us leave the with block via a break. new TestCase( SECTION, "var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity", Number.POSITIVE_INFINITY, eval("var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity") ); test(); function WithObject( value ) { this.prop1 = 1; this.prop2 = new Boolean(true); this.prop3 = "a string"; this.value = value; // now we will override global functions this.parseInt = new Function( "return this.value" ); this.NaN = value; this.Infinity = value; this.unescape = new Function( "return this.value" ); this.escape = new Function( "return this.value" ); this.eval = new Function( "return this.value" ); this.parseFloat = new Function( "return this.value" ); this.isNaN = new Function( "return this.value" ); this.isFinite = new Function( "return this.value" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.10.js0000644000175000017500000000437711545150464021502 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.10-1.js ECMA Section: 12.10 The with statement Description: Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.10-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The with statement"; writeHeaderToLog( SECTION +" "+ TITLE); new TestCase( SECTION, "var x; with (7) x = valueOf(); typeof x;", "number", eval("var x; with(7) x = valueOf(); typeof x;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.2-1.js0000644000175000017500000000577611545150464021565 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.2-1.js ECMA Section: The variable statement Description: If the variable statement occurs inside a FunctionDeclaration, the variables are defined with function-local scope in that function, as described in section 10.1.3. Otherwise, they are defined with global scope, that is, they are created as members of the global object, as described in section 0. Variables are created when the execution scope is entered. A Block does not define a new execution scope. Only Program and FunctionDeclaration produce a new scope. Variables are initialized to the undefined value when created. A variable with an Initializer is assigned the value of its AssignmentExpression when the VariableStatement is executed, not when the variable is created. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The variable statement"; writeHeaderToLog( SECTION +" "+ TITLE); new TestCase( "SECTION", "var x = 3; function f() { var a = x; var x = 23; return a; }; f()", void 0, eval("var x = 3; function f() { var a = x; var x = 23; return a; }; f()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.5-1.js0000644000175000017500000000713211545150464021554 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.5-1.js ECMA Section: The if statement Description: The production IfStatement : if ( Expression ) Statement else Statement is evaluated as follows: 1.Evaluate Expression. 2.Call GetValue(Result(1)). 3.Call ToBoolean(Result(2)). 4.If Result(3) is false, go to step 7. 5.Evaluate the first Statement. 6.Return Result(5). 7.Evaluate the second Statement. 8.Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The if statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';", "PASSED", eval("var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); new TestCase( SECTION, "var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';", "PASSED", eval("var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';") ); new TestCase( SECTION, "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';", "PASSED", eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); new TestCase( SECTION, "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';", "PASSED", eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); new TestCase( SECTION, "var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';", "PASSED", eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';") ); new TestCase( SECTION, "var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';", "PASSED", eval("var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.5-2.js0000644000175000017500000000663711545150464021566 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.5-2.js ECMA Section: The if statement Description: The production IfStatement : if ( Expression ) Statement else Statement is evaluated as follows: 1.Evaluate Expression. 2.Call GetValue(Result(1)). 3.Call ToBoolean(Result(2)). 4.If Result(3) is false, go to step 7. 5.Evaluate the first Statement. 6.Return Result(5). 7.Evaluate the second Statement. 8.Return Result(7). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The if statement" ; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR", "PASSED", eval("var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR") ); new TestCase( SECTION, "var MYVAR; if ( false ) MYVAR='FAILED'; MYVAR;", "PASSED", eval("var MYVAR=\"PASSED\"; if ( false ) MYVAR='FAILED'; MYVAR;") ); new TestCase( SECTION, "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR", "PASSED", eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR") ); new TestCase( SECTION, "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR", "PASSED", eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR") ); new TestCase( SECTION, "var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR", "PASSED", eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR") ); new TestCase( SECTION, "var MYVAR; if ( 0 ) MYVAR='FAILED'; MYVAR;", "PASSED", eval("var MYVAR=\"PASSED\"; if ( 0 ) MYVAR='FAILED'; MYVAR;") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.1-1.js0000644000175000017500000000546411545150464021722 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.1-1.js ECMA Section: The while statement Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.6.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The While statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR ", 1, eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR ")); new TestCase( SECTION, "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR ", 100, eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR ")); new TestCase( SECTION, "function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)", 2, eval("function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.2-1.js0000644000175000017500000000463311545150464021720 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.2-1.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is not present 3. third expression is not present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( "12.6.2-1", "for statement", 99, testprogram() ); test(); function testprogram() { myVar = 0; for ( ; ; ) { if ( ++myVar == 99 ) break; } return myVar; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.2-2.js0000644000175000017500000000467411545150464021726 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.2-2.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is not present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 99, testprogram() ); test(); function testprogram() { myVar = 0; for ( ; ; myVar++ ) { if ( myVar < 99 ) { continue; } else { break; } } return myVar; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.2-3.js0000644000175000017500000000461311545150464021720 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.2-3.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 100, testprogram() ); test(); function testprogram() { myVar = 0; for ( ; myVar < 100 ; myVar++ ) { continue; } return myVar; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.2-4.js0000644000175000017500000000457611545150464021731 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.2-4.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 100, testprogram() ); test(); function testprogram() { myVar = 0; for ( ; myVar < 100 ; myVar++ ) { } return myVar; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.2-5.js0000644000175000017500000000463611545150464021727 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.2-5.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 99, testprogram() ); test(); function testprogram() { myVar = 0; for ( ; myVar < 100 ; myVar++ ) { if (myVar == 99) break; } return myVar; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.2-6.js0000644000175000017500000000466311545150464021730 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.2-6.js ECMA Section: 12.6.2 The for Statement 1. first expression is present. 2. second expression is not present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( "12.6.2-6", "for statement", 256, testprogram() ); test(); function testprogram() { var myVar; for ( myVar=2; ; myVar *= myVar ) { if (myVar > 100) break; continue; } return myVar; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.2-7.js0000644000175000017500000000463211545150464021725 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.2-7.js ECMA Section: 12.6.2 The for Statement 1. first expression is present. 2. second expression is not present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-7"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 256, testprogram() ); test(); function testprogram() { var myVar; for ( myVar=2; myVar < 100 ; myVar *= myVar ) { continue; } return myVar; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.2-8.js0000644000175000017500000000460711545150464021730 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.2-8.js ECMA Section: 12.6.2 The for Statement 1. first expression is present. 2. second expression is present 3. third expression is present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-8"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "for statement", 256, testprogram() ); test(); function testprogram() { var myVar; for ( myVar=2; myVar < 256; myVar *= myVar ) { } return myVar; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.2-9-n.js0000644000175000017500000000460211545150464022157 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.2-9-n.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is not present 3. third expression is not present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "12.6.2-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for statement"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "for (i)"; EXPECTED = "error"; new TestCase( SECTION, "for (i)", "error", eval("for (i) { }") ); /* for (i) { } */ test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-1.js0000644000175000017500000000447211545150464021722 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var x; Number.prototype.foo = 34; for ( j in 7 ) x = j; x", "foo", eval("var x; Number.prototype.foo = 34; for ( j in 7 ){x = j;} x") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-10.js0000644000175000017500000001075011545150464021776 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-10.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-10"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression var count = 0; function f() { count++; return new Array("h","e","l","l","o"); } var result = ""; for ( p in f() ) { result += f()[p] }; new TestCase( SECTION, "count = 0; result = \"\"; "+ "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+ "for ( p in f() ) { result += f()[p] }; count", 6, count ); new TestCase( SECTION, "result", "hello", result ); // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ] // LeftHandSideExpression:NewExpression:MemberExpression . Identifier // LeftHandSideExpression:NewExpression:new MemberExpression Arguments // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression ) // LeftHandSideExpression:CallExpression:MemberExpression Arguments // LeftHandSideExpression:CallExpression Arguments // LeftHandSideExpression:CallExpression [ Expression ] // LeftHandSideExpression:CallExpression . Identifier test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-11.js0000644000175000017500000000741311545150464022001 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-11.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-11"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // 5. Get the name of the next property of Result(3) that doesn't have the // DontEnum attribute. If there is no such property, go to step 14. var result = ""; for ( p in Number ) { result += String(p) }; new TestCase( SECTION, "result = \"\"; for ( p in Number ) { result += String(p) };", "", result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-12.js0000644000175000017500000000740611545150464022004 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-12.js ECMA Section: 12.6.3 The for...in Statement Description: This is a regression test for http://bugzilla.mozilla.org/show_bug.cgi?id=9802. The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-12"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); var result = "PASSED"; for ( aVar in this ) { if (aVar == "aVar") { result = "FAILED" } }; new TestCase( SECTION, "var result=''; for ( aVar in this ) { " + "if (aVar == 'aVar') {return a failure}; result", "PASSED", result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-19.js0000644000175000017500000001075011545150464022007 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression var count = 0; function f() { count++; return new Array("h","e","l","l","o"); } var result = ""; for ( p in f() ) { result += f()[p] }; new TestCase( SECTION, "count = 0; result = \"\"; "+ "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+ "for ( p in f() ) { result += f()[p] }; count", 6, count ); new TestCase( SECTION, "result", "hello", result ); // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ] // LeftHandSideExpression:NewExpression:MemberExpression . Identifier // LeftHandSideExpression:NewExpression:new MemberExpression Arguments // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression ) // LeftHandSideExpression:CallExpression:MemberExpression Arguments // LeftHandSideExpression:CallExpression Arguments // LeftHandSideExpression:CallExpression [ Expression ] // LeftHandSideExpression:CallExpression . Identifier test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-2.js0000644000175000017500000000451611545150464021722 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-2.js ECMA Section: 12.6.3 The for...in Statement Description: Check the Boolean Object Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j]", 34, eval("Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j] ") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-3.js0000644000175000017500000000474411545150464021726 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-3.js ECMA Section: for..in loops Description: This verifies the fix to http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112156 for..in should take general lvalue for first argument Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.6.3-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); var o = {}; var result = ""; for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); } new TestCase( SECTION, "for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); } result", "123", result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-4.js0000644000175000017500000001367311545150464021730 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=344855"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression var o = new MyObject(); var result = 0; for ( MyObject in o ) { result += o[MyObject]; } new TestCase( SECTION, "for ( MyObject in o ) { result += o[MyObject] }", 6, result ); var result = 0; for ( value in o ) { result += o[value]; } new TestCase( SECTION, "for ( value in o ) { result += o[value]", 6, result ); var value = "value"; var result = 0; for ( value in o ) { result += o[value]; } new TestCase( SECTION, "value = \"value\"; for ( value in o ) { result += o[value]", 6, result ); var value = 0; var result = 0; for ( value in o ) { result += o[value]; } new TestCase( SECTION, "value = 0; for ( value in o ) { result += o[value]", 6, result ); // this causes a segv var ob = { 0:"hello" }; var result = 0; for ( ob[0] in o ) { result += o[ob[0]]; } new TestCase( SECTION, "ob = { 0:\"hello\" }; for ( ob[0] in o ) { result += o[ob[0]]", 6, result ); var result = 0; for ( ob["0"] in o ) { result += o[ob["0"]]; } new TestCase( SECTION, "value = 0; for ( ob[\"0\"] in o ) { result += o[o[\"0\"]]", 6, result ); var result = 0; var ob = { value:"hello" }; for ( ob[value] in o ) { result += o[ob[value]]; } new TestCase( SECTION, "ob = { 0:\"hello\" }; for ( ob[value] in o ) { result += o[ob[value]]", 6, result ); var result = 0; for ( ob["value"] in o ) { result += o[ob["value"]]; } new TestCase( SECTION, "value = 0; for ( ob[\"value\"] in o ) { result += o[ob[\"value\"]]", 6, result ); var result = 0; for ( ob.value in o ) { result += o[ob.value]; } new TestCase( SECTION, "value = 0; for ( ob.value in o ) { result += o[ob.value]", 6, result ); // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ] // LeftHandSideExpression:NewExpression:MemberExpression . Identifier // LeftHandSideExpression:NewExpression:new MemberExpression Arguments // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression ) // LeftHandSideExpression:CallExpression:MemberExpression Arguments // LeftHandSideExpression:CallExpression Arguments // LeftHandSideExpression:CallExpression [ Expression ] // LeftHandSideExpression:CallExpression . Identifier test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-5-n.js0000644000175000017500000000772211545150464022162 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression DESCRIPTION = "more than one member expression"; EXPECTED = "error"; new TestCase( SECTION, "more than one member expression", "error", eval("var o = new MyObject(); var result = 0; for ( var i, p in this) { result += this[p]; }") ); /* var o = new MyObject(); var result = 0; for ( var i, p in this) { result += this[p]; } */ test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-6-n.js0000644000175000017500000000767711545150464022174 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression DESCRIPTION = "bad left-hand side expression"; EXPECTED = "error"; new TestCase( SECTION, "bad left-hand side expression", "error", eval("var o = new MyObject(); var result = 0; for ( this in o) { result += this[p]; }") ); /* var o = new MyObject(); var result = 0; for ( this in o) { result += this[p]; } */ test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-7-n.js0000644000175000017500000000770111545150464022161 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression DESCRIPTION = "bad left-hand side expression"; EXPECTED = "error"; new TestCase( SECTION, "bad left-hand side expression", "error", eval("var o = new MyObject(); var result = 0; for ( \"a\" in o) { result += this[p]; } ") ); /* var o = new MyObject(); var result = 0; for ( "a" in o) { result += this[p]; } */ test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-8-n.js0000644000175000017500000000767511545150464022174 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-8-n.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression DESCRIPTION = "bad left-hand side expression"; EXPECTED = "error"; new TestCase( SECTION, "bad left-hand side expression", "error", eval("var o = new MyObject(); var result = 0; for ( 1 in o) { result += this[p]; } ") ); /* var o = new MyObject(); var result = 0; for ( 1 in o) { result += this[p]; } */ test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.6.3-9-n.js0000644000175000017500000000767211545150464022172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.6.3-9-n.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "12.6.3-9-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The for..in statement"; writeHeaderToLog( SECTION + " "+ TITLE); // for ( LeftHandSideExpression in Expression ) // LeftHandSideExpression:NewExpression:MemberExpression DESCRIPTION = "object is not defined"; EXPECTED = "error"; new TestCase( SECTION, "object is not defined", "error", eval("var o = new MyObject(); var result = 0; for ( var o in foo) { result += this[o]; } ") ); /* var o = new MyObject(); var result = 0; for ( var o in foo) { result += this[o]; } */ test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.7-1-n.js0000644000175000017500000000436711545150464022020 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.7-1-n.js ECMA Section: 12.7 The continue statement Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.7.1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The continue statement"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "continue"; EXPECTED = "error"; new TestCase( SECTION, "continue", "error", eval("continue") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.8-1-n.js0000644000175000017500000000435611545150464022017 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.8-1-n.js ECMA Section: 12.8 The break statement Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.8-1-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The break in statement"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "break"; EXPECTED = "error"; new TestCase( SECTION, "break", "error", eval("break") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/12.9-1-n.js0000644000175000017500000000432411545150464022013 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.9-1-n.js ECMA Section: 12.9 The return statement Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.9-1-n"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " The return statement"); DESCRIPTION = "return"; EXPECTED = "error"; new TestCase( SECTION, "return", "error", eval("return") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/browser.js0000644000175000017500000000000011545150464022477 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/jstests.list0000644000175000017500000000121111545150464023057 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/Statements/ script 12.10-1.js script 12.10.js script 12.2-1.js script 12.5-1.js script 12.5-2.js script 12.6.1-1.js script 12.6.2-1.js script 12.6.2-2.js script 12.6.2-3.js script 12.6.2-4.js script 12.6.2-5.js script 12.6.2-6.js script 12.6.2-7.js script 12.6.2-8.js script 12.6.2-9-n.js script 12.6.3-1.js script 12.6.3-10.js script 12.6.3-11.js script 12.6.3-12.js script 12.6.3-19.js script 12.6.3-2.js script 12.6.3-3.js script 12.6.3-4.js script 12.6.3-5-n.js script 12.6.3-6-n.js script 12.6.3-7-n.js script 12.6.3-8-n.js script 12.6.3-9-n.js script 12.7-1-n.js script 12.8-1-n.js script 12.9-1-n.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Statements/shell.js0000644000175000017500000000000011545150464022123 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.1.js0000644000175000017500000001752311545150464020704 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.1.js ECMA Section: 15.5.1 The String Constructor called as a Function 15.5.1.1 String(value) 15.5.1.2 String() Description: When String is called as a function rather than as a constructor, it performs a type conversion. - String(value) returns a string value (not a String object) computed by ToString(value) - String() returns the empty string "" Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The String Constructor Called as a Function"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String('string primitive')", "string primitive", String('string primitive') ); new TestCase( SECTION, "String(void 0)", "undefined", String( void 0) ); new TestCase( SECTION, "String(null)", "null", String( null ) ); new TestCase( SECTION, "String(true)", "true", String( true) ); new TestCase( SECTION, "String(false)", "false", String( false ) ); new TestCase( SECTION, "String(Boolean(true))", "true", String(Boolean(true)) ); new TestCase( SECTION, "String(Boolean(false))", "false", String(Boolean(false)) ); new TestCase( SECTION, "String(Boolean())", "false", String(Boolean(false)) ); new TestCase( SECTION, "String(new Array())", "", String( new Array()) ); new TestCase( SECTION, "String(new Array(1,2,3))", "1,2,3", String( new Array(1,2,3)) ); new TestCase( SECTION, "String( Number.NaN )", "NaN", String( Number.NaN ) ); new TestCase( SECTION, "String( 0 )", "0", String( 0 ) ); new TestCase( SECTION, "String( -0 )", "0", String( -0 ) ); new TestCase( SECTION, "String( Number.POSITIVE_INFINITY )", "Infinity", String( Number.POSITIVE_INFINITY ) ); new TestCase( SECTION, "String( Number.NEGATIVE_INFINITY )", "-Infinity", String( Number.NEGATIVE_INFINITY ) ); new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) ); // cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21 new TestCase( SECTION, "String( 1 )", "1", String( 1 ) ); new TestCase( SECTION, "String( 10 )", "10", String( 10 ) ); new TestCase( SECTION, "String( 100 )", "100", String( 100 ) ); new TestCase( SECTION, "String( 1000 )", "1000", String( 1000 ) ); new TestCase( SECTION, "String( 10000 )", "10000", String( 10000 ) ); new TestCase( SECTION, "String( 10000000000 )", "10000000000", String( 10000000000 ) ); new TestCase( SECTION, "String( 10000000000000000000 )", "10000000000000000000", String( 10000000000000000000 ) ); new TestCase( SECTION, "String( 100000000000000000000 )","100000000000000000000",String( 100000000000000000000 ) ); new TestCase( SECTION, "String( 12345 )", "12345", String( 12345 ) ); new TestCase( SECTION, "String( 1234567890 )", "1234567890", String( 1234567890 ) ); new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) ); new TestCase( SECTION, "String( -10 )", "-10", String( -10 ) ); new TestCase( SECTION, "String( -100 )", "-100", String( -100 ) ); new TestCase( SECTION, "String( -1000 )", "-1000", String( -1000 ) ); new TestCase( SECTION, "String( -1000000000 )", "-1000000000", String( -1000000000 ) ); new TestCase( SECTION, "String( -1000000000000000 )", "-1000000000000000", String( -1000000000000000 ) ); new TestCase( SECTION, "String( -100000000000000000000 )", "-100000000000000000000", String( -100000000000000000000 ) ); new TestCase( SECTION, "String( -1000000000000000000000 )", "-1e+21", String( -1000000000000000000000 ) ); new TestCase( SECTION, "String( -12345 )", "-12345", String( -12345 ) ); new TestCase( SECTION, "String( -1234567890 )", "-1234567890", String( -1234567890 ) ); // cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21, new TestCase( SECTION, "String( 1.0000001 )", "1.0000001", String( 1.0000001 ) ); // cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0 // cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6 new TestCase( SECTION, "String( 1000000000000000000000 )", "1e+21", String( 1000000000000000000000 ) ); new TestCase( SECTION, "String( 10000000000000000000000 )", "1e+22", String( 10000000000000000000000 ) ); // cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6 new TestCase( SECTION, "String( 1.2345 )", "1.2345", String( 1.2345)); new TestCase( SECTION, "String( 1.234567890 )", "1.23456789", String( 1.234567890 )); new TestCase( SECTION, "String( .12345 )", "0.12345", String(.12345 ) ); new TestCase( SECTION, "String( .012345 )", "0.012345", String(.012345) ); new TestCase( SECTION, "String( .0012345 )", "0.0012345", String(.0012345) ); new TestCase( SECTION, "String( .00012345 )", "0.00012345", String(.00012345) ); new TestCase( SECTION, "String( .000012345 )", "0.000012345", String(.000012345) ); new TestCase( SECTION, "String( .0000012345 )", "0.0000012345", String(.0000012345) ); new TestCase( SECTION, "String( .00000012345 )", "1.2345e-7", String(.00000012345)); new TestCase( "15.5.2", "String()", "", String() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.2.js0000644000175000017500000001705311545150464020703 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.2.js ECMA Section: 15.5.2 The String Constructor 15.5.2.1 new String(value) 15.5.2.2 new String() Description: When String is called as part of a new expression, it is a constructor; it initializes the newly constructed object. - The prototype property of the newly constructed object is set to the original String prototype object, the one that is the intial value of String.prototype - The internal [[Class]] property of the object is "String" - The value of the object is ToString(value). - If no value is specified, its value is the empty string. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The String Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "typeof new String('string primitive')", "object", typeof new String('string primitive') ); new TestCase( SECTION, "var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String('string primitive')).valueOf()", 'string primitive', (new String('string primitive')).valueOf() ); new TestCase( SECTION, "(new String('string primitive')).substring", String.prototype.substring, (new String('string primitive')).substring ); new TestCase( SECTION, "typeof new String(void 0)", "object", typeof new String(void 0) ); new TestCase( SECTION, "var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String(void 0)).valueOf()", "undefined", (new String(void 0)).valueOf() ); new TestCase( SECTION, "(new String(void 0)).toString", String.prototype.toString, (new String(void 0)).toString ); new TestCase( SECTION, "typeof new String(null)", "object", typeof new String(null) ); new TestCase( SECTION, "var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String(null)).valueOf()", "null", (new String(null)).valueOf() ); new TestCase( SECTION, "(new String(null)).valueOf", String.prototype.valueOf, (new String(null)).valueOf ); new TestCase( SECTION, "typeof new String(true)", "object", typeof new String(true) ); new TestCase( SECTION, "var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String(true)).valueOf()", "true", (new String(true)).valueOf() ); new TestCase( SECTION, "(new String(true)).charAt", String.prototype.charAt, (new String(true)).charAt ); new TestCase( SECTION, "typeof new String(false)", "object", typeof new String(false) ); new TestCase( SECTION, "var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String(false)).valueOf()", "false", (new String(false)).valueOf() ); new TestCase( SECTION, "(new String(false)).charCodeAt", String.prototype.charCodeAt, (new String(false)).charCodeAt ); new TestCase( SECTION, "typeof new String(new Boolean(true))", "object", typeof new String(new Boolean(true)) ); new TestCase( SECTION, "var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String(new Boolean(true))).valueOf()", "true", (new String(new Boolean(true))).valueOf() ); new TestCase( SECTION, "(new String(new Boolean(true))).indexOf", String.prototype.indexOf, (new String(new Boolean(true))).indexOf ); new TestCase( SECTION, "typeof new String()", "object", typeof new String() ); new TestCase( SECTION, "var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String()).valueOf()", '', (new String()).valueOf() ); new TestCase( SECTION, "(new String()).lastIndexOf", String.prototype.lastIndexOf, (new String()).lastIndexOf ); new TestCase( SECTION, "typeof new String('')", "object", typeof new String('') ); new TestCase( SECTION, "var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") ); new TestCase( SECTION, "(new String('')).valueOf()", '', (new String('')).valueOf() ); new TestCase( SECTION, "(new String('')).split", String.prototype.split, (new String('')).split ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.3.1-1.js0000644000175000017500000000521411545150464021175 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.3.1-1.js ECMA Section: 15.5.3.1 Properties of the String Constructor Description: The initial value of String.prototype is the built-in String prototype object. This property shall have the attributes [ DontEnum, DontDelete, ReadOnly] This tests the DontEnum attribute. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3.1-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the String Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length ); new TestCase( SECTION, "var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str", "", eval("var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.3.1-2.js0000644000175000017500000000501711545150464021177 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.3.1-2.js ECMA Section: 15.5.3.1 Properties of the String Constructor Description: The initial value of String.prototype is the built-in String prototype object. This property shall have the attributes [ DontEnum, DontDelete, ReadOnly] This tests the ReadOnly attribute. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the String Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype=null;String.prototype", String.prototype, eval("String.prototype=null;String.prototype") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.3.1-3.js0000644000175000017500000000473611545150464021207 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.3.1-3.js ECMA Section: 15.5.3.1 Properties of the String Constructor Description: The initial value of String.prototype is the built-in String prototype object. This property shall have the attributes [ DontEnum, DontDelete, ReadOnly] This tests the DontDelete attribute. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3.1-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the String Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( String.prototype )", false, eval("delete ( String.prototype )") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.3.1-4.js0000644000175000017500000000501311545150464021175 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.3.1-4.js ECMA Section: 15.5.3.1 Properties of the String Constructor Description: The initial value of String.prototype is the built-in String prototype object. This property shall have the attributes [ DontEnum, DontDelete, ReadOnly] This tests the DontDelete attribute. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3.1-4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the String Constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "delete( String.prototype );String.prototype", String.prototype, eval("delete ( String.prototype );String.prototype") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.3.2-1.js0000644000175000017500000003366711545150464021213 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.3.2-1.js ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) Description: Return a string value containing as many characters as the number of arguments. Each argument specifies one character of the resulting string, with the first argument specifying the first character, and so on, from left to right. An argument is converted to a character by applying the operation ToUint16 and regarding the resulting 16bit integeras the Unicode encoding of a character. If no arguments are supplied, the result is the empty string. This test covers Basic Latin (range U+0020 - U+007F) Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.3.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.fromCharCode()"; new TestCase( SECTION, "typeof String.fromCharCode", "function", typeof String.fromCharCode ); new TestCase( SECTION, "typeof String.prototype.fromCharCode", "undefined", typeof String.prototype.fromCharCode ); new TestCase( SECTION, "var x = new String(); typeof x.fromCharCode", "undefined", eval("var x = new String(); typeof x.fromCharCode") ); new TestCase( SECTION, "String.fromCharCode.length", 1, String.fromCharCode.length ); new TestCase( SECTION, "String.fromCharCode()", "", String.fromCharCode() ); new TestCase( SECTION, "String.fromCharCode(0x0020)", " ", String.fromCharCode(0x0020) ); new TestCase( SECTION, "String.fromCharCode(0x0021)", "!", String.fromCharCode(0x0021) ); new TestCase( SECTION, "String.fromCharCode(0x0022)", "\"", String.fromCharCode(0x0022) ); new TestCase( SECTION, "String.fromCharCode(0x0023)", "#", String.fromCharCode(0x0023) ); new TestCase( SECTION, "String.fromCharCode(0x0024)", "$", String.fromCharCode(0x0024) ); new TestCase( SECTION, "String.fromCharCode(0x0025)", "%", String.fromCharCode(0x0025) ); new TestCase( SECTION, "String.fromCharCode(0x0026)", "&", String.fromCharCode(0x0026) ); new TestCase( SECTION, "String.fromCharCode(0x0027)", "\'", String.fromCharCode(0x0027) ); new TestCase( SECTION, "String.fromCharCode(0x0028)", "(", String.fromCharCode(0x0028) ); new TestCase( SECTION, "String.fromCharCode(0x0029)", ")", String.fromCharCode(0x0029) ); new TestCase( SECTION, "String.fromCharCode(0x002A)", "*", String.fromCharCode(0x002A) ); new TestCase( SECTION, "String.fromCharCode(0x002B)", "+", String.fromCharCode(0x002B) ); new TestCase( SECTION, "String.fromCharCode(0x002C)", ",", String.fromCharCode(0x002C) ); new TestCase( SECTION, "String.fromCharCode(0x002D)", "-", String.fromCharCode(0x002D) ); new TestCase( SECTION, "String.fromCharCode(0x002E)", ".", String.fromCharCode(0x002E) ); new TestCase( SECTION, "String.fromCharCode(0x002F)", "/", String.fromCharCode(0x002F) ); new TestCase( SECTION, "String.fromCharCode(0x0030)", "0", String.fromCharCode(0x0030) ); new TestCase( SECTION, "String.fromCharCode(0x0031)", "1", String.fromCharCode(0x0031) ); new TestCase( SECTION, "String.fromCharCode(0x0032)", "2", String.fromCharCode(0x0032) ); new TestCase( SECTION, "String.fromCharCode(0x0033)", "3", String.fromCharCode(0x0033) ); new TestCase( SECTION, "String.fromCharCode(0x0034)", "4", String.fromCharCode(0x0034) ); new TestCase( SECTION, "String.fromCharCode(0x0035)", "5", String.fromCharCode(0x0035) ); new TestCase( SECTION, "String.fromCharCode(0x0036)", "6", String.fromCharCode(0x0036) ); new TestCase( SECTION, "String.fromCharCode(0x0037)", "7", String.fromCharCode(0x0037) ); new TestCase( SECTION, "String.fromCharCode(0x0038)", "8", String.fromCharCode(0x0038) ); new TestCase( SECTION, "String.fromCharCode(0x0039)", "9", String.fromCharCode(0x0039) ); new TestCase( SECTION, "String.fromCharCode(0x003A)", ":", String.fromCharCode(0x003A) ); new TestCase( SECTION, "String.fromCharCode(0x003B)", ";", String.fromCharCode(0x003B) ); new TestCase( SECTION, "String.fromCharCode(0x003C)", "<", String.fromCharCode(0x003C) ); new TestCase( SECTION, "String.fromCharCode(0x003D)", "=", String.fromCharCode(0x003D) ); new TestCase( SECTION, "String.fromCharCode(0x003E)", ">", String.fromCharCode(0x003E) ); new TestCase( SECTION, "String.fromCharCode(0x003F)", "?", String.fromCharCode(0x003F) ); new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) ); new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) ); new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) ); new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) ); new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) ); new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) ); new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) ); new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) ); new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) ); new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) ); new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) ); new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) ); new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) ); new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) ); new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) ); new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) ); new TestCase( SECTION, "String.fromCharCode(0x0050)", "P", String.fromCharCode(0x0050) ); new TestCase( SECTION, "String.fromCharCode(0x0051)", "Q", String.fromCharCode(0x0051) ); new TestCase( SECTION, "String.fromCharCode(0x0052)", "R", String.fromCharCode(0x0052) ); new TestCase( SECTION, "String.fromCharCode(0x0053)", "S", String.fromCharCode(0x0053) ); new TestCase( SECTION, "String.fromCharCode(0x0054)", "T", String.fromCharCode(0x0054) ); new TestCase( SECTION, "String.fromCharCode(0x0055)", "U", String.fromCharCode(0x0055) ); new TestCase( SECTION, "String.fromCharCode(0x0056)", "V", String.fromCharCode(0x0056) ); new TestCase( SECTION, "String.fromCharCode(0x0057)", "W", String.fromCharCode(0x0057) ); new TestCase( SECTION, "String.fromCharCode(0x0058)", "X", String.fromCharCode(0x0058) ); new TestCase( SECTION, "String.fromCharCode(0x0059)", "Y", String.fromCharCode(0x0059) ); new TestCase( SECTION, "String.fromCharCode(0x005A)", "Z", String.fromCharCode(0x005A) ); new TestCase( SECTION, "String.fromCharCode(0x005B)", "[", String.fromCharCode(0x005B) ); new TestCase( SECTION, "String.fromCharCode(0x005C)", "\\", String.fromCharCode(0x005C) ); new TestCase( SECTION, "String.fromCharCode(0x005D)", "]", String.fromCharCode(0x005D) ); new TestCase( SECTION, "String.fromCharCode(0x005E)", "^", String.fromCharCode(0x005E) ); new TestCase( SECTION, "String.fromCharCode(0x005F)", "_", String.fromCharCode(0x005F) ); new TestCase( SECTION, "String.fromCharCode(0x0060)", "`", String.fromCharCode(0x0060) ); new TestCase( SECTION, "String.fromCharCode(0x0061)", "a", String.fromCharCode(0x0061) ); new TestCase( SECTION, "String.fromCharCode(0x0062)", "b", String.fromCharCode(0x0062) ); new TestCase( SECTION, "String.fromCharCode(0x0063)", "c", String.fromCharCode(0x0063) ); new TestCase( SECTION, "String.fromCharCode(0x0064)", "d", String.fromCharCode(0x0064) ); new TestCase( SECTION, "String.fromCharCode(0x0065)", "e", String.fromCharCode(0x0065) ); new TestCase( SECTION, "String.fromCharCode(0x0066)", "f", String.fromCharCode(0x0066) ); new TestCase( SECTION, "String.fromCharCode(0x0067)", "g", String.fromCharCode(0x0067) ); new TestCase( SECTION, "String.fromCharCode(0x0068)", "h", String.fromCharCode(0x0068) ); new TestCase( SECTION, "String.fromCharCode(0x0069)", "i", String.fromCharCode(0x0069) ); new TestCase( SECTION, "String.fromCharCode(0x006A)", "j", String.fromCharCode(0x006A) ); new TestCase( SECTION, "String.fromCharCode(0x006B)", "k", String.fromCharCode(0x006B) ); new TestCase( SECTION, "String.fromCharCode(0x006C)", "l", String.fromCharCode(0x006C) ); new TestCase( SECTION, "String.fromCharCode(0x006D)", "m", String.fromCharCode(0x006D) ); new TestCase( SECTION, "String.fromCharCode(0x006E)", "n", String.fromCharCode(0x006E) ); new TestCase( SECTION, "String.fromCharCode(0x006F)", "o", String.fromCharCode(0x006F) ); new TestCase( SECTION, "String.fromCharCode(0x0070)", "p", String.fromCharCode(0x0070) ); new TestCase( SECTION, "String.fromCharCode(0x0071)", "q", String.fromCharCode(0x0071) ); new TestCase( SECTION, "String.fromCharCode(0x0072)", "r", String.fromCharCode(0x0072) ); new TestCase( SECTION, "String.fromCharCode(0x0073)", "s", String.fromCharCode(0x0073) ); new TestCase( SECTION, "String.fromCharCode(0x0074)", "t", String.fromCharCode(0x0074) ); new TestCase( SECTION, "String.fromCharCode(0x0075)", "u", String.fromCharCode(0x0075) ); new TestCase( SECTION, "String.fromCharCode(0x0076)", "v", String.fromCharCode(0x0076) ); new TestCase( SECTION, "String.fromCharCode(0x0077)", "w", String.fromCharCode(0x0077) ); new TestCase( SECTION, "String.fromCharCode(0x0078)", "x", String.fromCharCode(0x0078) ); new TestCase( SECTION, "String.fromCharCode(0x0079)", "y", String.fromCharCode(0x0079) ); new TestCase( SECTION, "String.fromCharCode(0x007A)", "z", String.fromCharCode(0x007A) ); new TestCase( SECTION, "String.fromCharCode(0x007B)", "{", String.fromCharCode(0x007B) ); new TestCase( SECTION, "String.fromCharCode(0x007C)", "|", String.fromCharCode(0x007C) ); new TestCase( SECTION, "String.fromCharCode(0x007D)", "}", String.fromCharCode(0x007D) ); new TestCase( SECTION, "String.fromCharCode(0x007E)", "~", String.fromCharCode(0x007E) ); // new TestCase( SECTION, "String.fromCharCode(0x0020, 0x007F)", "", String.fromCharCode(0x0040, 0x007F) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.3.2-2.js0000644000175000017500000000636611545150464021210 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.3.2-2.js ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) Description: Return a string value containing as many characters as the number of arguments. Each argument specifies one character of the resulting string, with the first argument specifying the first character, and so on, from left to right. An argument is converted to a character by applying the operation ToUint16 and regarding the resulting 16bit integeras the Unicode encoding of a character. If no arguments are supplied, the result is the empty string. This tests String.fromCharCode with multiple arguments. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.3.2-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.fromCharCode()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var MYSTRING = String.fromCharCode(eval(\"var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;\")); MYSTRING", " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~", eval( "var MYSTRING = String.fromCharCode(" + eval("var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;") +"); MYSTRING" )); new TestCase( SECTION, "MYSTRING.length", 0x007f - 0x0020, MYSTRING.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.3.2-3.js0000644000175000017500000001103011545150464021171 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.3.2-1.js ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... ) Description: Return a string value containing as many characters as the number of arguments. Each argument specifies one character of the resulting string, with the first argument specifying the first character, and so on, from left to right. An argument is converted to a character by applying the operation ToUint16 and regarding the resulting 16bit integeras the Unicode encoding of a character. If no arguments are supplied, the result is the empty string. This test covers Basic Latin (range U+0020 - U+007F) Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.3.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.fromCharCode()"; writeHeaderToLog( SECTION + " "+ TITLE); for ( CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) { new TestCase( SECTION, "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", ToUint16(CHARCODE), (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } for ( CHARCODE = 256; CHARCODE < 65536; CHARCODE+=333 ) { new TestCase( SECTION, "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", ToUint16(CHARCODE), (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } for ( CHARCODE = 65535; CHARCODE < 65538; CHARCODE++ ) { new TestCase( SECTION, "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", ToUint16(CHARCODE), (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } for ( CHARCODE = Math.pow(2,32)-1; CHARCODE < Math.pow(2,32)+1; CHARCODE++ ) { new TestCase( SECTION, "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", ToUint16(CHARCODE), (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } for ( CHARCODE = 0; CHARCODE > -65536; CHARCODE-=3333 ) { new TestCase( SECTION, "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)", ToUint16(CHARCODE), (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) ); new TestCase( SECTION, "(String.fromCharCode(65536)).charCodeAt(0)", 0, (String.fromCharCode(65536)).charCodeAt(0) ); new TestCase( SECTION, "(String.fromCharCode(65537)).charCodeAt(0)", 1, (String.fromCharCode(65537)).charCodeAt(0) ); test(); function ToUint16( num ) { num = Number( num ); if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) { return 0; } var sign = ( num < 0 ) ? -1 : 1; num = sign * Math.floor( Math.abs( num ) ); num = num % Math.pow(2,16); num = ( num > -65536 && num < 0) ? 65536 + num : num; return num; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.3.js0000644000175000017500000000505411545150464020702 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.3.1.js ECMA Section: 15.5.3 Properties of the String Constructor Description: The value of the internal [[Prototype]] property of the String constructor is the Function prototype object. In addition to the internal [[Call]] and [[Construct]] properties, the String constructor also has the length property, as well as properties described in 15.5.3.1 and 15.5.3.2. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.3"; var VERSION = "ECMA_2"; startTest(); var passed = true; writeHeaderToLog( SECTION + " Properties of the String Constructor" ); new TestCase( SECTION, "String.length", 1, String.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.1.js0000644000175000017500000000506111545150464021040 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.1.js ECMA Section: 15.5.4.1 String.prototype.constructor Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.5.4.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.constructor"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.constructor == String", true, String.prototype.constructor == String ); new TestCase( SECTION, "var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()", "[object String]", eval("var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.10-1.js0000644000175000017500000002157411545150464021265 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.10-1.js ECMA Section: 15.5.4.10 String.prototype.substring( start, end ) Description: 15.5.4.10 String.prototype.substring(start, end) Returns a substring of the result of converting this object to a string, starting from character position start and running to character position end of the string. The result is a string value, not a String object. If either argument is NaN or negative, it is replaced with zero; if either argument is larger than the length of the string, it is replaced with the length of the string. If start is larger than end, they are swapped. When the substring method is called with two arguments start and end, the following steps are taken: 1. Call ToString, giving it the this value as its argument. 2. Call ToInteger(start). 3. Call ToInteger (end). 4. Compute the number of characters in Result(1). 5. Compute min(max(Result(2), 0), Result(4)). 6. Compute min(max(Result(3), 0), Result(4)). 7. Compute min(Result(5), Result(6)). 8. Compute max(Result(5), Result(6)). 9. Return a string whose length is the difference between Result(8) and Result(7), containing characters from Result(1), namely the characters with indices Result(7) through Result(8)1, in ascending order. Note that the substring function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.10-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.substring( start, end )"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length ); new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length ); new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") ); // test cases for when substring is called with no arguments. // this is a string object new TestCase( SECTION, "var s = new String('this is a string object'); typeof s.substring()", "string", eval("var s = new String('this is a string object'); typeof s.substring()") ); new TestCase( SECTION, "var s = new String(''); s.substring(1,0)", "", eval("var s = new String(''); s.substring(1,0)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(true, false)", "t", eval("var s = new String('this is a string object'); s.substring(false, true)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(NaN, Infinity)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(NaN, Infinity)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(Infinity, NaN)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(Infinity, NaN)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(Infinity, Infinity)", "", eval("var s = new String('this is a string object'); s.substring(Infinity, Infinity)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(-0.01, 0)", "", eval("var s = new String('this is a string object'); s.substring(-0.01,0)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(s.length, s.length)", "", eval("var s = new String('this is a string object'); s.substring(s.length, s.length)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(s.length+1, 0)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(s.length+1, 0)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)", "", eval("var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)") ); // this is not a String object, start is not an integer new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)", "1,2,3,4,5", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)") ); new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)", "1", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)") ); new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')", "3", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')") ); // this is an object object new TestCase( SECTION, "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)", "[object ", eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)") ); new TestCase( SECTION, "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,obj.toString().length)", "Object]", eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8, obj.toString().length)") ); // this is a function object new TestCase( SECTION, "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8, Infinity)", "Function]", eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8,Infinity)") ); // this is a number object new TestCase( SECTION, "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)", "NaN", eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)") ); // this is the Math object new TestCase( SECTION, "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)", "[ob", eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)") ); // this is a Boolean object new TestCase( SECTION, "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))", "f", eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))") ); // this is a user defined object new TestCase( SECTION, "var obj = new MyObject( void 0 ); obj.substring(0, 100)", "undefined", eval( "var obj = new MyObject( void 0 ); obj.substring(0,100)") ); test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.11-1.js0000644000175000017500000002572111545150464021264 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.11-1.js ECMA Section: 15.5.4.11 String.prototype.toLowerCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toLowerCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.11-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toLowerCase()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length ); new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length ); new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") ); // Basic Latin, Latin-1 Supplement, Latin Extended A for ( var i = 0; i <= 0x017f; i++ ) { var U = new Unicode(i); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", String.fromCharCode(U.lower), eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", U.lower, eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.11-2.js0000644000175000017500000002500211545150464021255 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.11-2.js ECMA Section: 15.5.4.11 String.prototype.toLowerCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toLowerCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.11-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toLowerCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Georgian // Range: U+10A0 to U+10FF for ( var i = 0x10A0; i <= 0x10FF; i++ ) { var U = new Unicode( i ); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", String.fromCharCode(U.lower), eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", U.lower, eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.11-3.js0000644000175000017500000002502411545150464021262 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.11-2.js ECMA Section: 15.5.4.11 String.prototype.toLowerCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toLowerCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.11-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toLowerCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF for ( var i = 0xFF00; i <= 0xFFEF; i++ ) { var U = new Unicode(i); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", String.fromCharCode(U.lower), eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", U.lower, eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.11-4.js0000644000175000017500000002544111545150464021266 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.11-2.js ECMA Section: 15.5.4.11 String.prototype.toLowerCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toLowerCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.11-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toLowerCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Hiragana (no upper / lower case) // Range: U+3040 to U+309F for ( var i = 0x3040; i <= 0x309F; i++ ) { var U = new Unicode( i ); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", String.fromCharCode(U.lower), eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", U.lower, eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { this.upper = c; this.lower = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { this.upper = c; this.lower = c + 32; return this; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { this.upper = c - 32; this.lower = c; return this; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { this.upper = c; this.lower = c + 32; return this; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { this.upper = c - 32; this.lower = c; return this; } if ( c == 0x00FF ) { this.upper = 0x0178; this.lower = c; return this; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { this.upper = c; this.lower = 0x0069; return this; } if ( c == 0x0131 ) { this.upper = 0x0049; this.lower = c; return this; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 this.upper = c; this.lower = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 this.upper = c-1; this.lower = c; } return this; } if ( c == 0x0178 ) { this.upper = c; this.lower = 0x00FF; return this; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 this.upper = c; this.lower = c+1; } else { // if it's even, it's a lower case and upper case is c-1 this.upper = c-1; this.lower = c; } return this; } if ( c == 0x017F ) { this.upper = 0x0053; this.lower = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { this.upper = c; this.lower = c+1; } else { this.upper = c-1; this.lower = c; } return this; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { this.upper = c; this.lower = c + 80; return this; } if ( c >= 0x0410 && c <= 0x042F ) { this.upper = c; this.lower = c + 32; return this; } if ( c >= 0x0430 && c<= 0x044F ) { this.upper = c - 32; this.lower = c; return this; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { this.upper = c -80; this.lower = c; return this; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { this.upper = c; this.lower = c +1; } else { this.upper = c - 1; this.lower = c; } return this; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { this.upper = c; this.lower = c + 48; return this; } if ( c >= 0x0561 && c < 0x0587 ) { this.upper = c - 48; this.lower = c; return this; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { this.upper = c; this.lower = c + 48; return this; } if ( c >= 0x10D0 && c <= 0x10F5 ) { this.upper = c; this.lower = c; return this; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { this.upper = c; this.lower = c + 32; return this; } if ( c >= 0xFF41 && c <= 0xFF5A ) { this.upper = c - 32; this.lower = c; return this; } // Specials // Range: U+FFF0 to U+FFFF return this; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.11-5.js0000644000175000017500000002572211545150464021271 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.11-5.js ECMA Section: 15.5.4.11 String.prototype.toLowerCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toLowerCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.11-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toLowerCase()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length ); new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length ); new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") ); // Cyrillic (part) // Range: U+0400 to U+04FF for ( var i = 0x0400; i <= 0x047F; i++ ) { var U = new Unicode( i ); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", String.fromCharCode(U.lower), eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", U.lower, eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.11-6.js0000644000175000017500000002500311545150464021262 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.11-6.js ECMA Section: 15.5.4.11 String.prototype.toLowerCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toLowerCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.11-6"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toLowerCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Armenian // Range: U+0530 to U+058F for ( var i = 0x0530; i <= 0x058F; i++ ) { var U = new Unicode( i ); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()", String.fromCharCode(U.lower), eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)", U.lower, eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.12-1.js0000644000175000017500000002550311545150464021263 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.12-1.js ECMA Section: 15.5.4.12 String.prototype.toUpperCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toUpperCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.12-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toUpperCase()"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.toUpperCase.length", 0, String.prototype.toUpperCase.length ); new TestCase( SECTION, "delete String.prototype.toUpperCase.length", false, delete String.prototype.toUpperCase.length ); new TestCase( SECTION, "delete String.prototype.toupperCase.length; String.prototype.toupperCase.length", 0, eval("delete String.prototype.toUpperCase.length; String.prototype.toUpperCase.length") ); // Basic Latin, Latin-1 Supplement, Latin Extended A for ( var i = 0; i <= 0x017f; i++ ) { var U = new Unicode( i ); // XXX DF fails in java if ( i == 0x00DF ) { continue; } new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", U.upper, eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.12-2.js0000644000175000017500000002467711545150464021277 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.12-2.js ECMA Section: 15.5.4.12 String.prototype.toUpperCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toUpperCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.12-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toUpperCase()"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = ""; var EXPECT_STRING = ""; // basic latin test for ( var i = 0; i < 0x007A; i++ ) { var u = new Unicode(i); TEST_STRING += String.fromCharCode(i); EXPECT_STRING += String.fromCharCode( u.upper ); } // don't print out the value of the strings since they contain control // characters that break the driver var isEqual = EXPECT_STRING == (new String( TEST_STRING )).toUpperCase(); new TestCase( SECTION, "isEqual", true, isEqual); test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.12-3.js0000644000175000017500000002771211545150464021271 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.12-3.js ECMA Section: 15.5.4.12 String.prototype.toUpperCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toUpperCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.12-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toUpperCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Georgian // Range: U+10A0 to U+10FF for ( var i = 0x10A0; i <= 0x10FF; i++ ) { var U = new Unicode( i ); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", String.fromCharCode(U.upper), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", U.upper, eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") ); } // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF for ( var i = 0xFF00; i <= 0xFFEF; i++ ) { new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", eval( "var u = new Unicode( i ); u.upper" ), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") ); } // Hiragana (no upper / lower case) // Range: U+3040 to U+309F for ( var i = 0x3040; i <= 0x309F; i++ ) { new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", eval( "var u = new Unicode( i ); u.upper" ), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") ); } /* var TEST_STRING = ""; var EXPECT_STRING = ""; // basic latin test for ( var i = 0; i < 0x007A; i++ ) { var u = new Unicode(i); TEST_STRING += String.fromCharCode(i); EXPECT_STRING += String.fromCharCode( u.upper ); } */ test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.12-4.js0000644000175000017500000002476311545150464021275 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.12-1.js ECMA Section: 15.5.4.12 String.prototype.toUpperCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toUpperCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.12-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toUpperCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Cyrillic (part) // Range: U+0400 to U+04FF for ( var i = 0x0400; i <= 0x047F; i++ ) { var U =new Unicode( i ); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", U.upper, eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", U.upper, eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.12-5.js0000644000175000017500000002500211545150464021261 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.12-1.js ECMA Section: 15.5.4.12 String.prototype.toUpperCase() Description: Returns a string equal in length to the length of the result of converting this object to a string. The result is a string value, not a String object. Every character of the result is equal to the corresponding character of the string, unless that character has a Unicode 2.0 uppercase equivalent, in which case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case mapping shall be used, which does not depend on implementation or locale.) Note that the toUpperCase function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.12-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toUpperCase()"; writeHeaderToLog( SECTION + " "+ TITLE); // Armenian // Range: U+0530 to U+058F for ( var i = 0x0530; i <= 0x058F; i++ ) { var U = new Unicode( i ); /* new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()", String.fromCharCode(U.upper), eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") ); */ new TestCase( SECTION, "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)", U.upper, eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") ); } test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } function Unicode( c ) { u = GetUnicodeValues( c ); this.upper = u[0]; this.lower = u[1] return this; } function GetUnicodeValues( c ) { u = new Array(); u[0] = c; u[1] = c; // upper case Basic Latin if ( c >= 0x0041 && c <= 0x005A) { u[0] = c; u[1] = c + 32; return u; } // lower case Basic Latin if ( c >= 0x0061 && c <= 0x007a ) { u[0] = c - 32; u[1] = c; return u; } // upper case Latin-1 Supplement if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) { u[0] = c; u[1] = c + 32; return u; } // lower case Latin-1 Supplement if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) { u[0] = c - 32; u[1] = c; return u; } if ( c == 0x00FF ) { u[0] = 0x0178; u[1] = c; return u; } // Latin Extended A if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) { // special case for capital I if ( c == 0x0130 ) { u[0] = c; u[1] = 0x0069; return u; } if ( c == 0x0131 ) { u[0] = 0x0049; u[1] = c; return u; } if ( c % 2 == 0 ) { // if it's even, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's odd, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x0178 ) { u[0] = c; u[1] = 0x00FF; return u; } if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) { if ( c % 2 == 1 ) { // if it's odd, it's a capital and the lower case is c +1 u[0] = c; u[1] = c+1; } else { // if it's even, it's a lower case and upper case is c-1 u[0] = c-1; u[1] = c; } return u; } if ( c == 0x017F ) { u[0] = 0x0053; u[1] = c; } // Latin Extended B // need to improve this set if ( c >= 0x0200 && c <= 0x0217 ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c+1; } else { u[0] = c-1; u[1] = c; } return u; } // Latin Extended Additional // Range: U+1E00 to U+1EFF // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html // Spacing Modifier Leters // Range: U+02B0 to U+02FF // Combining Diacritical Marks // Range: U+0300 to U+036F // skip Greek for now // Greek // Range: U+0370 to U+03FF // Cyrillic // Range: U+0400 to U+04FF if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) { u[0] = c; u[1] = c + 80; return u; } if ( c >= 0x0410 && c <= 0x042F ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0x0430 && c<= 0x044F ) { u[0] = c - 32; u[1] = c; return u; } if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) { u[0] = c -80; u[1] = c; return u; } if ( c >= 0x0460 && c <= 0x047F ) { if ( c % 2 == 0 ) { u[0] = c; u[1] = c +1; } else { u[0] = c - 1; u[1] = c; } return u; } // Armenian // Range: U+0530 to U+058F if ( c >= 0x0531 && c <= 0x0556 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x0561 && c < 0x0587 ) { u[0] = c - 48; u[1] = c; return u; } // Hebrew // Range: U+0590 to U+05FF // Arabic // Range: U+0600 to U+06FF // Devanagari // Range: U+0900 to U+097F // Bengali // Range: U+0980 to U+09FF // Gurmukhi // Range: U+0A00 to U+0A7F // Gujarati // Range: U+0A80 to U+0AFF // Oriya // Range: U+0B00 to U+0B7F // no capital / lower case // Tamil // Range: U+0B80 to U+0BFF // no capital / lower case // Telugu // Range: U+0C00 to U+0C7F // no capital / lower case // Kannada // Range: U+0C80 to U+0CFF // no capital / lower case // Malayalam // Range: U+0D00 to U+0D7F // Thai // Range: U+0E00 to U+0E7F // Lao // Range: U+0E80 to U+0EFF // Tibetan // Range: U+0F00 to U+0FBF // Georgian // Range: U+10A0 to U+10F0 if ( c >= 0x10A0 && c <= 0x10C5 ) { u[0] = c; u[1] = c + 48; return u; } if ( c >= 0x10D0 && c <= 0x10F5 ) { u[0] = c; u[1] = c; return u; } // Hangul Jamo // Range: U+1100 to U+11FF // Greek Extended // Range: U+1F00 to U+1FFF // skip for now // General Punctuation // Range: U+2000 to U+206F // Superscripts and Subscripts // Range: U+2070 to U+209F // Currency Symbols // Range: U+20A0 to U+20CF // Combining Diacritical Marks for Symbols // Range: U+20D0 to U+20FF // skip for now // Number Forms // Range: U+2150 to U+218F // skip for now // Arrows // Range: U+2190 to U+21FF // Mathematical Operators // Range: U+2200 to U+22FF // Miscellaneous Technical // Range: U+2300 to U+23FF // Control Pictures // Range: U+2400 to U+243F // Optical Character Recognition // Range: U+2440 to U+245F // Enclosed Alphanumerics // Range: U+2460 to U+24FF // Box Drawing // Range: U+2500 to U+257F // Block Elements // Range: U+2580 to U+259F // Geometric Shapes // Range: U+25A0 to U+25FF // Miscellaneous Symbols // Range: U+2600 to U+26FF // Dingbats // Range: U+2700 to U+27BF // CJK Symbols and Punctuation // Range: U+3000 to U+303F // Hiragana // Range: U+3040 to U+309F // Katakana // Range: U+30A0 to U+30FF // Bopomofo // Range: U+3100 to U+312F // Hangul Compatibility Jamo // Range: U+3130 to U+318F // Kanbun // Range: U+3190 to U+319F // Enclosed CJK Letters and Months // Range: U+3200 to U+32FF // CJK Compatibility // Range: U+3300 to U+33FF // Hangul Syllables // Range: U+AC00 to U+D7A3 // High Surrogates // Range: U+D800 to U+DB7F // Private Use High Surrogates // Range: U+DB80 to U+DBFF // Low Surrogates // Range: U+DC00 to U+DFFF // Private Use Area // Range: U+E000 to U+F8FF // CJK Compatibility Ideographs // Range: U+F900 to U+FAFF // Alphabetic Presentation Forms // Range: U+FB00 to U+FB4F // Arabic Presentation Forms-A // Range: U+FB50 to U+FDFF // Combining Half Marks // Range: U+FE20 to U+FE2F // CJK Compatibility Forms // Range: U+FE30 to U+FE4F // Small Form Variants // Range: U+FE50 to U+FE6F // Arabic Presentation Forms-B // Range: U+FE70 to U+FEFF // Halfwidth and Fullwidth Forms // Range: U+FF00 to U+FFEF if ( c >= 0xFF21 && c <= 0xFF3A ) { u[0] = c; u[1] = c + 32; return u; } if ( c >= 0xFF41 && c <= 0xFF5A ) { u[0] = c - 32; u[1] = c; return u; } // Specials // Range: U+FFF0 to U+FFFF return u; } function DecimalToHexString( n ) { n = Number( n ); var h = "0x"; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.2-1.js0000644000175000017500000000617311545150464021204 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.2-1.js ECMA Section: 15.5.4.2 String.prototype.toString() Description: Returns this string value. Note that, for a String object, the toString() method happens to return the same thing as the valueOf() method. The toString function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.2-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() ); new TestCase( SECTION, "(new String()).toString()", "", (new String()).toString() ); new TestCase( SECTION, "(new String(\"\")).toString()", "", (new String("")).toString() ); new TestCase( SECTION, "(new String( String() )).toString()","", (new String(String())).toString() ); new TestCase( SECTION, "(new String( \"h e l l o\" )).toString()", "h e l l o", (new String("h e l l o")).toString() ); new TestCase( SECTION, "(new String( 0 )).toString()", "0", (new String(0)).toString() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.2-2-n.js0000644000175000017500000000563611545150464021443 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.2-2-n.js ECMA Section: 15.5.4.2 String.prototype.toString() Description: Returns this string value. Note that, for a String object, the toString() method happens to return the same thing as the valueOf() method. The toString function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.2-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()"; EXPECTED = "error"; new TestCase( SECTION, "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()", "error", eval("var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.2-3.js0000644000175000017500000000711411545150464021202 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.2-3.js ECMA Section: 15.5.4.2 String.prototype.toString() Description: Returns this string value. Note that, for a String object, the toString() method happens to return the same thing as the valueOf() method. The toString function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.2-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.toString"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()", "", eval("var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()") ); new TestCase( SECTION, "var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()", "0", eval("var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()") ); new TestCase( SECTION, "var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()", "hello", eval("var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()") ); new TestCase( SECTION, "var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()", "", eval("var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.2.js0000644000175000017500000000674611545150464021054 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.2.js ECMA Section: 15.5.4.2 String.prototype.toString Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.5.4.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.tostring"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.toString() == String.prototype.valueOf()", true, String.prototype.toString() == String.prototype.valueOf() ); new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() ); new TestCase( SECTION, "String.prototype.toString.length", 0, String.prototype.toString.length ); new TestCase( SECTION, "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()", true, eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") ); new TestCase( SECTION, "TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()", true, eval("TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()") ); new TestCase( SECTION, "TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()", true, eval("TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()") ); new TestCase( SECTION, "TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()", true, eval("TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()") ); new TestCase( SECTION, "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()", true, eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.3-1.js0000644000175000017500000000613611545150464021204 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.3-1.js ECMA Section: 15.5.4.3 String.prototype.valueOf() Description: Returns this string value. The valueOf function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.3-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.valueOf"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.valueOf.length", 0, String.prototype.valueOf.length ); new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() ); new TestCase( SECTION, "(new String()).valueOf()", "", (new String()).valueOf() ); new TestCase( SECTION, "(new String(\"\")).valueOf()", "", (new String("")).valueOf() ); new TestCase( SECTION, "(new String( String() )).valueOf()","", (new String(String())).valueOf() ); new TestCase( SECTION, "(new String( \"h e l l o\" )).valueOf()", "h e l l o", (new String("h e l l o")).valueOf() ); new TestCase( SECTION, "(new String( 0 )).valueOf()", "0", (new String(0)).valueOf() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.3-2.js0000644000175000017500000000727111545150464021206 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.3-2.js ECMA Section: 15.5.4.3 String.prototype.valueOf() Description: Returns this string value. The valueOf function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.3-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.valueOf"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valof()", "", eval("var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valueOf()") ); new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valof()", "0", eval("var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valueOf()") ); new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valof()", "hello", eval("var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valueOf()") ); new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valof()", "", eval("var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valueOf()") ); /* new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()", "error", eval("var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()") ); */ test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.3-3-n.js0000644000175000017500000000543011545150464021435 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.3-3-n.js ECMA Section: 15.5.4.3 String.prototype.valueOf() Description: Returns this string value. The valueOf function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "15.5.4.3-3-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.valueOf"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()"; EXPECTED = "error"; new TestCase( SECTION, "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()", "error", eval("var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.4-1.js0000644000175000017500000000662411545150464021207 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.4-1.js ECMA Section: 15.5.4.4 String.prototype.charAt(pos) Description: Returns a string containing the character at position pos in the string. If there is no character at that string, the result is the empty string. The result is a string value, not a String object. When the charAt method is called with one argument, pos, the following steps are taken: 1. Call ToString, with this value as its argument 2. Call ToInteger pos In this test, this is a String, pos is an integer, and all pos are in range. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charAt"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); var item = 0; var i; for ( i = 0x0020; i < 0x007e; i++, item++) { new TestCase( SECTION, "TEST_STRING.charAt("+item+")", String.fromCharCode( i ), TEST_STRING.charAt( item ) ); } for ( i = 0x0020; i < 0x007e; i++, item++) { new TestCase( SECTION, "TEST_STRING.charAt("+item+") == TEST_STRING.substring( "+item +", "+ (item+1) + ")", true, TEST_STRING.charAt( item ) == TEST_STRING.substring( item, item+1 ) ); } new TestCase( SECTION, "String.prototype.charAt.length", 1, String.prototype.charAt.length ); print( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.4-2.js0000644000175000017500000002374211545150464021210 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.4-1.js ECMA Section: 15.5.4.4 String.prototype.charAt(pos) Description: Returns a string containing the character at position pos in the string. If there is no character at that string, the result is the empty string. The result is a string value, not a String object. When the charAt method is called with one argument, pos, the following steps are taken: 1. Call ToString, with this value as its argument 2. Call ToInteger pos 3. Compute the number of characters in Result(1) 4. If Result(2) is less than 0 is or not less than Result(3), return the empty string 5. Return a string of length 1 containing one character from result (1), the character at position Result(2). Note that the charAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.4-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charAt"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)", "u", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)", "e", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)") ); new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)") ); new TestCase( SECTION, "x = new String(); x.charAt(0)", "", eval("x=new String();x.charAt(0)") ); new TestCase( SECTION, "x = new String(); x.charAt(1)", "", eval("x=new String();x.charAt(1)") ); new TestCase( SECTION, "x = new String(); x.charAt(-1)", "", eval("x=new String();x.charAt(-1)") ); new TestCase( SECTION, "x = new String(); x.charAt(NaN)", "", eval("x=new String();x.charAt(Number.NaN)") ); new TestCase( SECTION, "x = new String(); x.charAt(Number.POSITIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.POSITIVE_INFINITY)") ); new TestCase( SECTION, "x = new String(); x.charAt(Number.NEGATIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.NEGATIVE_INFINITY)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(0)", "1", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(0)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(1)", "2", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(1)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(2)", "3", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(2)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(3)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(3)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(4)", "5", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(4)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(5)", "6", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(5)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(6)", "7", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(6)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(7)", "8", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(7)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(8)", "9", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(8)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(9)", "0", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(9)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(10)", "", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(10)") ); new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)") ); // MyOtherObject.toString will return "[object Object] new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)", "[", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)", "o", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)", " ", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)", "O", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)") ); new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)", "]", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)") ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value;" ); this.toString = new Function( "return this.value +''" ); this.charAt = String.prototype.charAt; } function MyOtherObject(value) { this.value = value; this.valueOf = new Function( "return this.value;" ); this.charAt = String.prototype.charAt; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.4-3.js0000644000175000017500000001145411545150464021206 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.4-3.js ECMA Section: 15.5.4.4 String.prototype.charAt(pos) Description: Returns a string containing the character at position pos in the string. If there is no character at that string, the result is the empty string. The result is a string value, not a String object. When the charAt method is called with one argument, pos, the following steps are taken: 1. Call ToString, with this value as its argument 2. Call ToInteger pos 3. Compute the number of characters in Result(1) 4. If Result(2) is less than 0 is or not less than Result(3), return the empty string 5. Return a string of length 1 containing one character from result (1), the character at position Result(2). Note that the charAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. This tests assiging charAt to a user-defined function. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.4-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charAt"; writeHeaderToLog( SECTION + " "+ TITLE); var foo = new MyObject('hello'); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "h", foo.charAt(0) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "e", foo.charAt(1) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(2) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(3) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "o", foo.charAt(4) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(-1) ); new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(5) ); var boo = new MyObject(true); new TestCase( SECTION, "var boo = new MyObject(true); ", "t", boo.charAt(0) ); new TestCase( SECTION, "var boo = new MyObject(true); ", "r", boo.charAt(1) ); new TestCase( SECTION, "var boo = new MyObject(true); ", "u", boo.charAt(2) ); new TestCase( SECTION, "var boo = new MyObject(true); ", "e", boo.charAt(3) ); var noo = new MyObject( Math.PI ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "3", noo.charAt(0) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", ".", noo.charAt(1) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(2) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "4", noo.charAt(3) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(4) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "5", noo.charAt(5) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "9", noo.charAt(6) ); test(); function MyObject (v) { this.value = v; this.toString = new Function( "return this.value +'';" ); this.valueOf = new Function( "return this.value" ); this.charAt = String.prototype.charAt; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.4-4.js0000644000175000017500000003066511545150464021214 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.4-4.js ECMA Section: 15.5.4.4 String.prototype.charAt(pos) Description: Returns a string containing the character at position pos in the string. If there is no character at that string, the result is the empty string. The result is a string value, not a String object. When the charAt method is called with one argument, pos, the following steps are taken: 1. Call ToString, with this value as its argument 2. Call ToInteger pos 3. Compute the number of characters in Result(1) 4. If Result(2) is less than 0 is or not less than Result(3), return the empty string 5. Return a string of length 1 containing one character from result (1), the character at position Result(2). Note that the charAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. This tests assiging charAt to primitive types.. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.4-4"; var VERSION = "ECMA_2"; startTest(); var TITLE = "String.prototype.charAt"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)", "2", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)", "3", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)") ); new TestCase( SECTION, "x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)", "", eval("x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(4)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(5)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(6)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(7)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(8)", "O", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(8)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(9)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(9)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(10)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(10)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(11)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(11)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(12)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(12)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(13)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(13)") ); new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(14)", "]", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(14)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)", "F", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)", "u", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)", "i", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)", "]", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)") ); new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)", "", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.5-1.js0000644000175000017500000000677711545150464021221 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.5.1.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a number (a nonnegative integer less than 2^16) representing the Unicode encoding of the character at position pos in this string. If there is no character at that position, the number is NaN. When the charCodeAt method is called with one argument pos, the following steps are taken: 1. Call ToString, giving it the theis value as its argument 2. Call ToInteger(pos) 3. Compute the number of characters in result(1). 4. If Result(2) is less than 0 or is not less than Result(3), return NaN. 5. Return a value of Number type, of positive sign, whose magnitude is the Unicode encoding of one character from result 1, namely the characer at position Result (2), where the first character in Result(1) is considered to be at position 0. Note that the charCodeAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.5-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charCodeAt"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); for ( j = 0, i = 0x0020; i < 0x007e; i++, j++ ) { new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", i, TEST_STRING.charCodeAt( j ) ); } new TestCase( SECTION, 'TEST_STRING.charCodeAt('+i+')', NaN, TEST_STRING.charCodeAt( i ) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.5-2.js0000644000175000017500000002325311545150464021206 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.5.1.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a number (a nonnegative integer less than 2^16) representing the Unicode encoding of the character at position pos in this string. If there is no character at that position, the number is NaN. When the charCodeAt method is called with one argument pos, the following steps are taken: 1. Call ToString, giving it the theis value as its argument 2. Call ToInteger(pos) 3. Compute the number of characters in result(1). 4. If Result(2) is less than 0 or is not less than Result(3), return NaN. 5. Return a value of Number type, of positive sign, whose magnitude is the Unicode encoding of one character from result 1, namely the characer at position Result (2), where the first character in Result(1) is considered to be at position 0. Note that the charCodeAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.5-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charCodeAt"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); var x; new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)", 0x0031, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)", 0x0032, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)", 0x0033, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)") ); new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)", NaN, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)", 0x005B, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)", 0x006F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)", 0x0065, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)", 0x0063, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)", 0x0074, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)", 0x0020, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)", 0x004F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)") ); new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.5-3.js0000644000175000017500000001474511545150464021215 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.5-3.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a number (a nonnegative integer less than 2^16) representing the Unicode encoding of the character at position pos in this string. If there is no character at that position, the number is NaN. When the charCodeAt method is called with one argument pos, the following steps are taken: 1. Call ToString, giving it the theis value as its argument 2. Call ToInteger(pos) 3. Compute the number of characters in result(1). 4. If Result(2) is less than 0 or is not less than Result(3), return NaN. 5. Return a value of Number type, of positive sign, whose magnitude is the Unicode encoding of one character from result 1, namely the characer at position Result (2), where the first character in Result(1) is considered to be at position 0. Note that the charCodeAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.5-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charCodeAt"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); var foo = new MyObject('hello'); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(0)", 0x0068, foo.charCodeAt(0) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(1)", 0x0065, foo.charCodeAt(1) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(2)", 0x006c, foo.charCodeAt(2) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(3)", 0x006c, foo.charCodeAt(3) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(4)", 0x006f, foo.charCodeAt(4) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(-1)", Number.NaN, foo.charCodeAt(-1) ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(5)", Number.NaN, foo.charCodeAt(5) ); var boo = new MyObject(true); new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(0)", 0x0074, boo.charCodeAt(0) ); new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(1)", 0x0072, boo.charCodeAt(1) ); new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(2)", 0x0075, boo.charCodeAt(2) ); new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(3)", 0x0065, boo.charCodeAt(3) ); var noo = new MyObject( Math.PI ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(0)", 0x0033, noo.charCodeAt(0) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(1)", 0x002E, noo.charCodeAt(1) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(2)", 0x0031, noo.charCodeAt(2) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(3)", 0x0034, noo.charCodeAt(3) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(4)", 0x0031, noo.charCodeAt(4) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(5)", 0x0035, noo.charCodeAt(5) ); new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(6)", 0x0039, noo.charCodeAt(6) ); var noo = new MyObject( null ); new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(0)", 0x006E, noo.charCodeAt(0) ); new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(1)", 0x0075, noo.charCodeAt(1) ); new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(2)", 0x006C, noo.charCodeAt(2) ); new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(3)", 0x006C, noo.charCodeAt(3) ); new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(4)", NaN, noo.charCodeAt(4) ); var noo = new MyObject( void 0 ); new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(0)", 0x0075, noo.charCodeAt(0) ); new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(1)", 0x006E, noo.charCodeAt(1) ); new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(2)", 0x0064, noo.charCodeAt(2) ); new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(3)", 0x0065, noo.charCodeAt(3) ); new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(4)", 0x0066, noo.charCodeAt(4) ); test(); function MyObject (v) { this.value = v; this.toString = new Function ( "return this.value +\"\"" ); this.charCodeAt = String.prototype.charCodeAt; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.5-4.js0000644000175000017500000000537211545150464021212 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.5-4.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a nonnegative integer less than 2^16. Author: christine@netscape.com Date: 28 october 1997 */ var VERSION = "0697"; startTest(); var SECTION = "15.5.4.5-4"; writeHeaderToLog( SECTION + " String.prototype.charCodeAt(pos)" ); var MAXCHARCODE = Math.pow(2,16); var item=0, CHARCODE; for ( CHARCODE=0; CHARCODE <256; CHARCODE++ ) { new TestCase( SECTION, "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)", CHARCODE, (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } for ( CHARCODE=256; CHARCODE < 65536; CHARCODE+=999 ) { new TestCase( SECTION, "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)", CHARCODE, (String.fromCharCode(CHARCODE)).charCodeAt(0) ); } new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.5-5.js0000644000175000017500000001361211545150464021207 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.5.1.js ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos) Description: Returns a number (a nonnegative integer less than 2^16) representing the Unicode encoding of the character at position pos in this string. If there is no character at that position, the number is NaN. When the charCodeAt method is called with one argument pos, the following steps are taken: 1. Call ToString, giving it the theis value as its argument 2. Call ToInteger(pos) 3. Compute the number of characters in result(1). 4. If Result(2) is less than 0 or is not less than Result(3), return NaN. 5. Return a value of Number type, of positive sign, whose magnitude is the Unicode encoding of one character from result 1, namely the characer at position Result (2), where the first character in Result(1) is considered to be at position 0. Note that the charCodeAt function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.5-5"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.charCodeAt"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = ""; for ( var i = 0x0000; i < 255; i++ ) { TEST_STRING += String.fromCharCode( i ); } new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") ); new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") ); new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") ); for ( var j = 0; j < 255; j++ ) { new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", j, TEST_STRING.charCodeAt(j) ); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.6-1.js0000644000175000017500000001333311545150464021204 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.6-1.js ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos) Description: If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the right of the specified position, then the index of the leftmost such position is returned; otherwise -1 is returned. If positionis undefined or not supplied, 0 is assumed, so as to search all of the string. When the indexOf method is called with two arguments, searchString and pos, the following steps are taken: 1. Call ToString, giving it the this value as its argument. 2. Call ToString(searchString). 3. Call ToInteger(position). (If position is undefined or not supplied, this step produces the value 0). 4. Compute the number of characters in Result(1). 5. Compute min(max(Result(3), 0), Result(4)). 6. Compute the number of characters in the string that is Result(2). 7. Compute the smallest possible integer k not smaller than Result(5) such that k+Result(6) is not greater than Result(4), and for all nonnegative integers j less than Result(6), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then compute the value -1. 8. Return Result(7). Note that the indexOf function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.6-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.protoype.indexOf"; var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); writeHeaderToLog( SECTION + " "+ TITLE); var j = 0; for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf(" +String.fromCharCode(i)+ ", 0)", k, TEST_STRING.indexOf( String.fromCharCode(i), 0 ) ); } for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf("+String.fromCharCode(i)+ ", "+ k +")", k, TEST_STRING.indexOf( String.fromCharCode(i), k ) ); } for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf("+String.fromCharCode(i)+ ", "+k+1+")", -1, TEST_STRING.indexOf( String.fromCharCode(i), k+1 ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+0+")", k, TEST_STRING.indexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), 0 ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ k +")", k, TEST_STRING.indexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), k ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.indexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ k+1 +")", -1, TEST_STRING.indexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), k+1 ) ); } new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.indexOf( TEST_STRING, 0 ) ); new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 1 )", -1, TEST_STRING.indexOf( TEST_STRING, 1 )); print( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.6-2.js0000644000175000017500000002642611545150464021214 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.6-1.js ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos) Description: If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the right of the specified position, then the index of the leftmost such position is returned; otherwise -1 is returned. If positionis undefined or not supplied, 0 is assumed, so as to search all of the string. When the indexOf method is called with two arguments, searchString and pos, the following steps are taken: 1. Call ToString, giving it the this value as its argument. 2. Call ToString(searchString). 3. Call ToInteger(position). (If position is undefined or not supplied, this step produces the value 0). 4. Compute the number of characters in Result(1). 5. Compute min(max(Result(3), 0), Result(4)). 6. Compute the number of characters in the string that is Result(2). 7. Compute the smallest possible integer k not smaller than Result(5) such that k+Result(6) is not greater than Result(4), and for all nonnegative integers j less than Result(6), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then compute the value -1. 8. Return Result(7). Note that the indexOf function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com, pschwartau@netscape.com Date: 02 October 1997 Modified: 14 July 2002 Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289 ECMA-262 Ed.3 Section 15.5.4.7 The length property of the indexOf method is 1 * */ var SECTION = "15.5.4.6-2"; var VERSION = "ECMA_1"; var TITLE = "String.protoype.indexOf"; var BUGNUMBER="105721"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // the following test regresses http://scopus/bugsplat/show_bug.cgi?id=105721 // regress http://scopus/bugsplat/show_bug.cgi?id=105721 new TestCase( SECTION, "function f() { return this; }; function g() { var h = f; return h(); }; g().toString()", GLOBAL, g().toString() ); new TestCase( SECTION, "String.prototype.indexOf.length", 1, String.prototype.indexOf.length ); new TestCase( SECTION, "String.prototype.indexOf.length = null; String.prototype.indexOf.length", 1, eval("String.prototype.indexOf.length = null; String.prototype.indexOf.length") ); new TestCase( SECTION, "delete String.prototype.indexOf.length", false, delete String.prototype.indexOf.length ); new TestCase( SECTION, "delete String.prototype.indexOf.length; String.prototype.indexOf.length", 1, eval("delete String.prototype.indexOf.length; String.prototype.indexOf.length") ); new TestCase( SECTION, "var s = new String(); s.indexOf()", -1, eval("var s = new String(); s.indexOf()") ); // some Unicode tests. // generate a test string. var TEST_STRING = ""; for ( var u = 0x00A1; u <= 0x00FF; u++ ) { TEST_STRING += String.fromCharCode( u ); } for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) { new TestCase( SECTION, "TEST_STRING.indexOf( " + String.fromCharCode(u) + " )", i, TEST_STRING.indexOf( String.fromCharCode(u) ) ); } for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) { new TestCase( SECTION, "TEST_STRING.indexOf( " + String.fromCharCode(u) + ", void 0 )", i, TEST_STRING.indexOf( String.fromCharCode(u), void 0 ) ); } var foo = new MyObject('hello'); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('h')", 0, foo.indexOf("h") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('e')", 1, foo.indexOf("e") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('o')", 4, foo.indexOf("o") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('X')", -1, foo.indexOf("X") ); new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf(5) ", -1, foo.indexOf(5) ); var boo = new MyObject(true); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('t')", 0, boo.indexOf("t") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('r')", 1, boo.indexOf("r") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('u')", 2, boo.indexOf("u") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('e')", 3, boo.indexOf("e") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('true')", 0, boo.indexOf("true") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('rue')", 1, boo.indexOf("rue") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('ue')", 2, boo.indexOf("ue") ); new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('oy')", -1, boo.indexOf("oy") ); var noo = new MyObject( Math.PI ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('3') ", 0, noo.indexOf('3') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('.') ", 1, noo.indexOf('.') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('4') ", 3, noo.indexOf('4') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('5') ", 5, noo.indexOf('5') ); new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('9') ", 6, noo.indexOf('9') ); new TestCase( SECTION, "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')", 0, eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')") ); new TestCase( SECTION, "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')", 3, eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')") ); new TestCase( SECTION, "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')", 0, eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')") ); new TestCase( SECTION, "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')", 2, eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')") ); new TestCase( SECTION, "var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')", 0, eval("var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')") ); new TestCase( SECTION, "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')", -1, eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')") ); new TestCase( SECTION, "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)", -1, eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)") ); new TestCase( SECTION, "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)", 0, eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)") ); new TestCase( SECTION, "var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')", 1, eval("var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')") ); new TestCase( SECTION, "var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')", 0, eval("var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')") ); new TestCase( SECTION, "var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')", 1, eval("var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')") ); new TestCase( SECTION, "var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )", 8, eval("var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )") ); // new Date(0) has '31' or '01' at index 8 depending on whether tester is (GMT-) or (GMT+), respectively new TestCase( SECTION, "var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')", 8, eval("var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')") ); test(); function f() { return this; } function g() { var h = f; return h(); } function MyObject (v) { this.value = v; this.toString = new Function ( "return this.value +\"\""); this.indexOf = String.prototype.indexOf; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.7-1.js0000644000175000017500000001676511545150464021221 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.7-1.js ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos) Description: If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the left of the specified position, then the index of the rightmost such position is returned; otherwise -1 is returned. If position is undefined or not supplied, the length of this string value is assumed, so as to search all of the string. When the lastIndexOf method is called with two arguments searchString and position, the following steps are taken: 1.Call ToString, giving it the this value as its argument. 2.Call ToString(searchString). 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN). 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)). 5.Compute the number of characters in Result(1). 6.Compute min(max(Result(4), 0), Result(5)). 7.Compute the number of characters in the string that is Result(2). 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then compute the value -1. 1.Return Result(8). Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 2 october 1997 */ var SECTION = "15.5.4.7-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.protoype.lastIndexOf"; var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" ); writeHeaderToLog( SECTION + " "+ TITLE); var j = 0; for ( k = 0, i = 0x0021; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf(" +String.fromCharCode(i)+ ", 0)", -1, TEST_STRING.lastIndexOf( String.fromCharCode(i), 0 ) ); } for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+String.fromCharCode(i)+ ", "+ k +")", k, TEST_STRING.lastIndexOf( String.fromCharCode(i), k ) ); } for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+String.fromCharCode(i)+ ", "+k+1+")", k, TEST_STRING.lastIndexOf( String.fromCharCode(i), k+1 ) ); } for ( k = 9, i = 0x0021; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ 0 + ")", LastIndexOf( TEST_STRING, String.fromCharCode(i) + String.fromCharCode(i+1)+String.fromCharCode(i+2), 0), TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), 0 ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ k +")", k, TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), k ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+(String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ k+1 +")", k, TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), k+1 ) ); } for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) { new TestCase( SECTION, "String.lastIndexOf("+ (String.fromCharCode(i) + String.fromCharCode(i+1)+ String.fromCharCode(i+2)) +", "+ (k-1) +")", LastIndexOf( TEST_STRING, String.fromCharCode(i) + String.fromCharCode(i+1)+String.fromCharCode(i+2), k-1), TEST_STRING.lastIndexOf( (String.fromCharCode(i)+ String.fromCharCode(i+1)+ String.fromCharCode(i+2)), k-1 ) ); } new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 0 ) ); // new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 1 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 1 )); new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ")", 0, TEST_STRING.lastIndexOf( TEST_STRING )); print( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" ); test(); function LastIndexOf( string, search, position ) { string = String( string ); search = String( search ); position = Number( position ) if ( isNaN( position ) ) { position = Infinity; } else { position = ToInteger( position ); } result5= string.length; result6 = Math.min(Math.max(position, 0), result5); result7 = search.length; if (result7 == 0) { return Math.min(position, result5); } result8 = -1; for ( k = 0; k <= result6; k++ ) { if ( k+ result7 > result5 ) { break; } for ( j = 0; j < result7; j++ ) { if ( string.charAt(k+j) != search.charAt(j) ){ break; } else { if ( j == result7 -1 ) { result8 = k; } } } } return result8; } function ToInteger( n ) { n = Number( n ); if ( isNaN(n) ) { return 0; } if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) { return n; } var sign = ( n < 0 ) ? -1 : 1; return ( sign * Math.floor(Math.abs(n)) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.7-2.js0000644000175000017500000002605511545150464021213 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.7-2.js ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos) Description: If the given searchString appears as a substring of the result of converting this object to a string, at one or more positions that are at or to the left of the specified position, then the index of the rightmost such position is returned; otherwise -1 is returned. If position is undefined or not supplied, the length of this string value is assumed, so as to search all of the string. When the lastIndexOf method is called with two arguments searchString and position, the following steps are taken: 1.Call ToString, giving it the this value as its argument. 2.Call ToString(searchString). 3.Call ToNumber(position). (If position is undefined or not supplied, this step produces the value NaN). 4.If Result(3) is NaN, use +; otherwise, call ToInteger(Result(3)). 5.Compute the number of characters in Result(1). 6.Compute min(max(Result(4), 0), Result(5)). 7.Compute the number of characters in the string that is Result(2). 8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then compute the value -1. 1.Return Result(8). Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com, pschwartau@netscape.com Date: 02 October 1997 Modified: 14 July 2002 Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289 ECMA-262 Ed.3 Section 15.5.4.8 The length property of the lastIndexOf method is 1 * */ var SECTION = "15.5.4.7-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.protoype.lastIndexOf"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.lastIndexOf.length", 1, String.prototype.lastIndexOf.length ); new TestCase( SECTION, "delete String.prototype.lastIndexOf.length", false, delete String.prototype.lastIndexOf.length ); new TestCase( SECTION, "delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length", 1, eval("delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length" ) ); new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('', 0)", LastIndexOf("","",0), eval("var s = new String(''); s.lastIndexOf('', 0)") ); new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('')", LastIndexOf("",""), eval("var s = new String(''); s.lastIndexOf('')") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('', 0)", LastIndexOf("hello","",0), eval("var s = new String('hello'); s.lastIndexOf('',0)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('')", LastIndexOf("hello",""), eval("var s = new String('hello'); s.lastIndexOf('')") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll')", LastIndexOf("hello","ll"), eval("var s = new String('hello'); s.lastIndexOf('ll')") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 0)", LastIndexOf("hello","ll",0), eval("var s = new String('hello'); s.lastIndexOf('ll', 0)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1)", LastIndexOf("hello","ll",1), eval("var s = new String('hello'); s.lastIndexOf('ll', 1)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2)", LastIndexOf("hello","ll",2), eval("var s = new String('hello'); s.lastIndexOf('ll', 2)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 3)", LastIndexOf("hello","ll",3), eval("var s = new String('hello'); s.lastIndexOf('ll', 3)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 4)", LastIndexOf("hello","ll",4), eval("var s = new String('hello'); s.lastIndexOf('ll', 4)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 5)", LastIndexOf("hello","ll",5), eval("var s = new String('hello'); s.lastIndexOf('ll', 5)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 6)", LastIndexOf("hello","ll",6), eval("var s = new String('hello'); s.lastIndexOf('ll', 6)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1.5)", LastIndexOf('hello','ll', 1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 1.5)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2.5)", LastIndexOf('hello','ll', 2.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 2.5)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1)", LastIndexOf('hello','ll', -1), eval("var s = new String('hello'); s.lastIndexOf('ll', -1)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1.5)",LastIndexOf('hello','ll', -1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', -1.5)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -Infinity)", LastIndexOf("hello","ll",-Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', -Infinity)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', Infinity)", LastIndexOf("hello","ll",Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', Infinity)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', NaN)", LastIndexOf("hello","ll",NaN), eval("var s = new String('hello'); s.lastIndexOf('ll', NaN)") ); new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -0)", LastIndexOf("hello","ll",-0), eval("var s = new String('hello'); s.lastIndexOf('ll', -0)") ); for ( var i = 0; i < ( "[object Object]" ).length; i++ ) { new TestCase( SECTION, "var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")", ( i < 2 ? -1 : ( i < 9 ? 2 : 9 )) , eval("var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")") ); } for ( var i = 0; i < 5; i ++ ) { new TestCase( SECTION, "var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")", ( i < 2 ? -1 : 2 ), eval("var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")") ); } for ( var i = 0; i < 5; i ++ ) { new TestCase( SECTION, "var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")", ( i < 1 ? -1 : ( i < 9 ? 1 : ( i < 10 ? 9 : 10 ) ) ), eval("var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")") ); } for ( var i = 0; i < 9; i++ ) { new TestCase( SECTION, "var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )", ( i < 3 ? -1 : ( i < 5 ? 3 : 5 ) ), eval("var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )") ); } var a = new Array( "abc","def","ghi","jkl","mno","pqr","stu","vwx","yz" ); for ( var i = 0; i < (a.toString()).length; i++ ) { new TestCase( SECTION, "var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )", ( i < 15 ? -1 : 15 ), eval("var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )") ); } for ( var i = 0; i < 15; i ++ ) { new TestCase( SECTION, "var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")", ( i < 6 ? -1 : ( i < 10 ? 6 : 10 ) ), eval("var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")") ); } /* for ( var i = 0; i < 15; i++ ) { new TestCase( SECTION, "var d = new Date(); d.lastIndexOf = String.prototype.lastIndexOf; d.lastIndexOf( '0' )", ) } */ test(); function LastIndexOf( string, search, position ) { string = String( string ); search = String( search ); position = Number( position ) if ( isNaN( position ) ) { position = Infinity; } else { position = ToInteger( position ); } result5= string.length; result6 = Math.min(Math.max(position, 0), result5); result7 = search.length; if (result7 == 0) { return Math.min(position, result5); } result8 = -1; for ( k = 0; k <= result6; k++ ) { if ( k+ result7 > result5 ) { break; } for ( j = 0; j < result7; j++ ) { if ( string.charAt(k+j) != search.charAt(j) ){ break; } else { if ( j == result7 -1 ) { result8 = k; } } } } return result8; } function ToInteger( n ) { n = Number( n ); if ( isNaN(n) ) { return 0; } if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) { return n; } var sign = ( n < 0 ) ? -1 : 1; return ( sign * Math.floor(Math.abs(n)) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.8-1.js0000644000175000017500000002452611545150464021214 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.8-1.js ECMA Section: 15.5.4.8 String.prototype.split( separator ) Description: Returns an Array object into which substrings of the result of converting this object to a string have been stored. The substrings are determined by searching from left to right for occurrences of the given separator; these occurrences are not part of any substring in the returned array, but serve to divide up this string value. The separator may be a string of any length. As a special case, if the separator is the empty string, the string is split up into individual characters; the length of the result array equals the length of the string, and each substring contains one character. If the separator is not supplied, then the result array contains just one string, which is the string. Author: christine@netscape.com, pschwartau@netscape.com Date: 12 November 1997 Modified: 14 July 2002 Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289 ECMA-262 Ed.3 Section 15.5.4.14 The length property of the split method is 2 * */ var SECTION = "15.5.4.8-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.split"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.split.length", 2, String.prototype.split.length ); new TestCase( SECTION, "delete String.prototype.split.length", false, delete String.prototype.split.length ); new TestCase( SECTION, "delete String.prototype.split.length; String.prototype.split.length", 2, eval("delete String.prototype.split.length; String.prototype.split.length") ); // test cases for when split is called with no arguments. // this is a string object new TestCase( SECTION, "var s = new String('this is a string object'); typeof s.split()", "object", eval("var s = new String('this is a string object'); typeof s.split()") ); new TestCase( SECTION, "var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()", "[object Array]", eval("var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.split().length", 1, eval("var s = new String('this is a string object'); s.split().length") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.split()[0]", "this is a string object", eval("var s = new String('this is a string object'); s.split()[0]") ); // this is an object object new TestCase( SECTION, "var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = new Object(); obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = new Object(); obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]", "[object Object]", eval("var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]") ); // this is a function object new TestCase( SECTION, "var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = new Function(); obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = new Function(); obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]", "[object Function]", eval("var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]") ); // this is a number object new TestCase( SECTION, "var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]", "-1e+21", eval("var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]") ); // this is the Math object new TestCase( SECTION, "var obj = Math; obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = Math; obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = Math; obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = Math; obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = Math; obj.split = String.prototype.split; obj.split()[0]", "[object Math]", eval("var obj = Math; obj.split = String.prototype.split; obj.split()[0]") ); // this is an array object new TestCase( SECTION, "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]", "1,2,3,4,5", eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]") ); // this is a Boolean object new TestCase( SECTION, "var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()", "object", eval("var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()") ); new TestCase( SECTION, "var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()", "[object Array]", eval("var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") ); new TestCase( SECTION, "var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length", 1, eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length") ); new TestCase( SECTION, "var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]", "false", eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.8-2.js0000644000175000017500000002361711545150464021215 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.8-2.js ECMA Section: 15.5.4.8 String.prototype.split( separator ) Description: Returns an Array object into which substrings of the result of converting this object to a string have been stored. The substrings are determined by searching from left to right for occurrences of the given separator; these occurrences are not part of any substring in the returned array, but serve to divide up this string value. The separator may be a string of any length. As a special case, if the separator is the empty string, the string is split up into individual characters; the length of the result array equals the length of the string, and each substring contains one character. If the separator is not supplied, then the result array contains just one string, which is the string. When the split method is called with one argument separator, the following steps are taken: 1. Call ToString, giving it the this value as its argument. 2. Create a new Array object of length 0 and call it A. 3. If separator is not supplied, call the [[Put]] method of A with 0 and Result(1) as arguments, and then return A. 4. Call ToString(separator). 5. Compute the number of characters in Result(1). 6. Compute the number of characters in the string that is Result(4). 7. Let p be 0. 8. If Result(6) is zero (the separator string is empty), go to step 17. 9. Compute the smallest possible integer k not smaller than p such that k+Result(6) is not greater than Result(5), and for all nonnegative integers j less than Result(6), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then go to step 14. 10. Compute a string value equal to the substring of Result(1), consisting of the characters at positions p through k1, inclusive. 11. Call the [[Put]] method of A with A.length and Result(10) as arguments. 12. Let p be k+Result(6). 13. Go to step 9. 14. Compute a string value equal to the substring of Result(1), consisting of the characters from position p to the end of Result(1). 15. Call the [[Put]] method of A with A.length and Result(14) as arguments. 16. Return A. 17. If p equals Result(5), return A. 18. Compute a string value equal to the substring of Result(1), consisting of the single character at position p. 19. Call the [[Put]] method of A with A.length and Result(18) as arguments. 20. Increase p by 1. 21. Go to step 17. Note that the split function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.8-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.split"; writeHeaderToLog( SECTION + " "+ TITLE); // case where separator is the empty string. var TEST_STRING = "this is a string object"; new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split('').length", TEST_STRING.length, eval("var s = new String( TEST_STRING ); s.split('').length") ); for ( var i = 0; i < TEST_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split('')["+i+"]", TEST_STRING.charAt(i), eval("var s = new String( TEST_STRING ); s.split('')["+i+"]") ); } // case where the value of the separator is undefined. in this case. the value of the separator // should be ToString( separator ), or "undefined". var TEST_STRING = "thisundefinedisundefinedaundefinedstringundefinedobject"; var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split(void 0).length", EXPECT_STRING.length, eval("var s = new String( TEST_STRING ); s.split(void 0).length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split(void 0)["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split(void 0)["+i+"]") ); } // case where the value of the separator is null. in this case the value of the separator is "null". TEST_STRING = "thisnullisnullanullstringnullobject"; var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split(null).length", EXPECT_STRING.length, eval("var s = new String( TEST_STRING ); s.split(null).length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split(null)["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split(null)["+i+"]") ); } // case where the value of the separator is a boolean. TEST_STRING = "thistrueistrueatruestringtrueobject"; var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split(true).length", EXPECT_STRING.length, eval("var s = new String( TEST_STRING ); s.split(true).length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split(true)["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split(true)["+i+"]") ); } // case where the value of the separator is a number TEST_STRING = "this123is123a123string123object"; var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split(123).length", EXPECT_STRING.length, eval("var s = new String( TEST_STRING ); s.split(123).length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") ); } // case where the value of the separator is a number TEST_STRING = "this123is123a123string123object"; var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" ); new TestCase( SECTION, "var s = new String( "+ TEST_STRING +" ); s.split(123).length", EXPECT_STRING.length, eval("var s = new String( TEST_STRING ); s.split(123).length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") ); } // case where the separator is not in the string TEST_STRING = "this is a string"; EXPECT_STRING = new Array( "this is a string" ); new TestCase( SECTION, "var s = new String( " + TEST_STRING + " ); s.split(':').length", 1, eval("var s = new String( TEST_STRING ); s.split(':').length") ); new TestCase( SECTION, "var s = new String( " + TEST_STRING + " ); s.split(':')[0]", TEST_STRING, eval("var s = new String( TEST_STRING ); s.split(':')[0]") ); // case where part but not all of separator is in the string. TEST_STRING = "this is a string"; EXPECT_STRING = new Array( "this is a string" ); new TestCase( SECTION, "var s = new String( " + TEST_STRING + " ); s.split('strings').length", 1, eval("var s = new String( TEST_STRING ); s.split('strings').length") ); new TestCase( SECTION, "var s = new String( " + TEST_STRING + " ); s.split('strings')[0]", TEST_STRING, eval("var s = new String( TEST_STRING ); s.split('strings')[0]") ); // case where the separator is at the end of the string TEST_STRING = "this is a string"; EXPECT_STRING = new Array( "this is a " ); new TestCase( SECTION, "var s = new String( " + TEST_STRING + " ); s.split('string').length", 2, eval("var s = new String( TEST_STRING ); s.split('string').length") ); for ( var i = 0; i < EXPECT_STRING.length; i++ ) { new TestCase( SECTION, "var s = new String( "+TEST_STRING+" ); s.split('string')["+i+"]", EXPECT_STRING[i], eval("var s = new String( TEST_STRING ); s.split('string')["+i+"]") ); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.8-3.js0000644000175000017500000001564111545150464021214 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.8-3.js ECMA Section: 15.5.4.8 String.prototype.split( separator ) Description: Returns an Array object into which substrings of the result of converting this object to a string have been stored. The substrings are determined by searching from left to right for occurrences of the given separator; these occurrences are not part of any substring in the returned array, but serve to divide up this string value. The separator may be a string of any length. As a special case, if the separator is the empty string, the string is split up into individual characters; the length of the result array equals the length of the string, and each substring contains one character. If the separator is not supplied, then the result array contains just one string, which is the string. When the split method is called with one argument separator, the following steps are taken: 1. Call ToString, giving it the this value as its argument. 2. Create a new Array object of length 0 and call it A. 3. If separator is not supplied, call the [[Put]] method of A with 0 and Result(1) as arguments, and then return A. 4. Call ToString(separator). 5. Compute the number of characters in Result(1). 6. Compute the number of characters in the string that is Result(4). 7. Let p be 0. 8. If Result(6) is zero (the separator string is empty), go to step 17. 9. Compute the smallest possible integer k not smaller than p such that k+Result(6) is not greater than Result(5), and for all nonnegative integers j less than Result(6), the character at position k+j of Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then go to step 14. 10. Compute a string value equal to the substring of Result(1), consisting of the characters at positions p through k1, inclusive. 11. Call the [[Put]] method of A with A.length and Result(10) as arguments. 12. Let p be k+Result(6). 13. Go to step 9. 14. Compute a string value equal to the substring of Result(1), consisting of the characters from position p to the end of Result(1). 15. Call the [[Put]] method of A with A.length and Result(14) as arguments. 16. Return A. 17. If p equals Result(5), return A. 18. Compute a string value equal to the substring of Result(1), consisting of the single character at position p. 19. Call the [[Put]] method of A with A.length and Result(18) as arguments. 20. Increase p by 1. 21. Go to step 17. Note that the split function is intentionally generic; it does not require that its this value be a String object. Therefore it can be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.8-3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.split"; writeHeaderToLog( SECTION + " "+ TITLE); var TEST_STRING = ""; var EXPECT = new Array(); // this.toString is the empty string. new TestCase( SECTION, "var s = new String(); s.split().length", 1, eval("var s = new String(); s.split().length") ); new TestCase( SECTION, "var s = new String(); s.split()[0]", "", eval("var s = new String(); s.split()[0]") ); // this.toString() is the empty string, separator is specified. new TestCase( SECTION, "var s = new String(); s.split('').length", 0, eval("var s = new String(); s.split('').length") ); new TestCase( SECTION, "var s = new String(); s.split(' ').length", 1, eval("var s = new String(); s.split(' ').length") ); // this to string is " " new TestCase( SECTION, "var s = new String(' '); s.split().length", 1, eval("var s = new String(' '); s.split().length") ); new TestCase( SECTION, "var s = new String(' '); s.split()[0]", " ", eval("var s = new String(' '); s.split()[0]") ); new TestCase( SECTION, "var s = new String(' '); s.split('').length", 1, eval("var s = new String(' '); s.split('').length") ); new TestCase( SECTION, "var s = new String(' '); s.split('')[0]", " ", eval("var s = new String(' '); s.split('')[0]") ); new TestCase( SECTION, "var s = new String(' '); s.split(' ').length", 2, eval("var s = new String(' '); s.split(' ').length") ); new TestCase( SECTION, "var s = new String(' '); s.split(' ')[0]", "", eval("var s = new String(' '); s.split(' ')[0]") ); new TestCase( SECTION, "\"\".split(\"\").length", 0, ("".split("")).length ); new TestCase( SECTION, "\"\".split(\"x\").length", 1, ("".split("x")).length ); new TestCase( SECTION, "\"\".split(\"x\")[0]", "", ("".split("x"))[0] ); test(); function Split( string, separator ) { string = String( string ); var A = new Array(); if ( arguments.length < 2 ) { A[0] = string; return A; } separator = String( separator ); var str_len = String( string ).length; var sep_len = String( separator ).length; var p = 0; var k = 0; if ( sep_len == 0 ) { for ( ; p < str_len; p++ ) { A[A.length] = String( string.charAt(p) ); } } return A; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.9-1.js0000644000175000017500000001765211545150464021217 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.9-1.js ECMA Section: 15.5.4.9 String.prototype.substring( start ) Description: 15.5.4.9 String.prototype.substring(start) Returns a substring of the result of converting this object to a string, starting from character position start and running to the end of the string. The result is a string value, not a String object. If the argument is NaN or negative, it is replaced with zero; if the argument is larger than the length of the string, it is replaced with the length of the string. When the substring method is called with one argument start, the following steps are taken: 1.Call ToString, giving it the this value as its argument. 2.Call ToInteger(start). 3.Compute the number of characters in Result(1). 4.Compute min(max(Result(2), 0), Result(3)). 5.Return a string whose length is the difference between Result(3) and Result(4), containing characters from Result(1), namely the characters with indices Result(4) through Result(3)1, in ascending order. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.4.9-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.prototype.substring( start )"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length ); new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length ); new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") ); // test cases for when substring is called with no arguments. // this is a string object new TestCase( SECTION, "var s = new String('this is a string object'); typeof s.substring()", "string", eval("var s = new String('this is a string object'); typeof s.substring()") ); new TestCase( SECTION, "var s = new String(''); s.substring()", "", eval("var s = new String(''); s.substring()") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring()", "this is a string object", eval("var s = new String('this is a string object'); s.substring()") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(NaN)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(NaN)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(-0.01)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(-0.01)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(s.length)", "", eval("var s = new String('this is a string object'); s.substring(s.length)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(s.length+1)", "", eval("var s = new String('this is a string object'); s.substring(s.length+1)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(Infinity)", "", eval("var s = new String('this is a string object'); s.substring(Infinity)") ); new TestCase( SECTION, "var s = new String('this is a string object'); s.substring(-Infinity)", "this is a string object", eval("var s = new String('this is a string object'); s.substring(-Infinity)") ); // this is not a String object, start is not an integer new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()", "1,2,3,4,5", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()") ); new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)", ",2,3,4,5", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)") ); new TestCase( SECTION, "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')", "3,4,5", eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')") ); new TestCase( SECTION, "var s = new Array(); s.substring = String.prototype.substring; s.substring('4')", "", eval("var s = new Array(); s.substring = String.prototype.substring; s.substring('4')") ); // this is an object object new TestCase( SECTION, "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)", "Object]", eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)") ); // this is a function object new TestCase( SECTION, "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)", "Function]", eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)") ); // this is a number object new TestCase( SECTION, "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)", "NaN", eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)") ); // this is the Math object new TestCase( SECTION, "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)", "ject Math]", eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)") ); // this is a Boolean object new TestCase( SECTION, "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())", "false", eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())") ); // this is a user defined object new TestCase( SECTION, "var obj = new MyObject( null ); obj.substring(0)", "null", eval( "var obj = new MyObject( null ); obj.substring(0)") ); test(); function MyObject( value ) { this.value = value; this.substring = String.prototype.substring; this.toString = new Function ( "return this.value+''" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.4.js0000644000175000017500000000652611545150464020710 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.4.js ECMA Section: 15.5.4 Properties of the String prototype object Description: Author: christine@netscape.com Date: 28 october 1997 */ var SECTION = "15.5.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "Properties of the String Prototype objecta"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()", "[object String]", eval("String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()") ); delete String.prototype.getClass; new TestCase( SECTION, "typeof String.prototype", "object", typeof String.prototype ); new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() ); new TestCase( SECTION, "String.prototype +''", "", String.prototype + '' ); new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length ); var prop; var value; value = ''; for (prop in "") { value += prop; } new TestCase( SECTION, 'String "" has no enumerable properties', '', value ); value = ''; for (prop in String.prototype) { value += prop; } new TestCase( SECTION, 'String.prototype has no enumerable properties', '', value ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/15.5.5.1.js0000644000175000017500000000605611545150464021046 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.5.5.1 ECMA Section: String.length Description: The number of characters in the String value represented by this String object. Once a String object is created, this property is unchanging. It has the attributes { DontEnum, DontDelete, ReadOnly }. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "15.5.5.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "String.length"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var s = new String(); s.length", 0, eval("var s = new String(); s.length") ); new TestCase( SECTION, "var s = new String(); s.length = 10; s.length", 0, eval("var s = new String(); s.length = 10; s.length") ); new TestCase( SECTION, "var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props", "", eval("var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props") ); new TestCase( SECTION, "var s = new String(); delete s.length", false, eval("var s = new String(); delete s.length") ); new TestCase( SECTION, "var s = new String('hello'); delete s.length; s.length", 5, eval("var s = new String('hello'); delete s.length; s.length") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/browser.js0000644000175000017500000000000011545150464021616 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/jstests.list0000644000175000017500000000206111545150464022202 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/String/ script 15.5.1.js script 15.5.2.js script 15.5.3.1-1.js script 15.5.3.1-2.js script 15.5.3.1-3.js script 15.5.3.1-4.js script 15.5.3.2-1.js script 15.5.3.2-2.js script 15.5.3.2-3.js script 15.5.3.js script 15.5.4.1.js script 15.5.4.10-1.js script 15.5.4.11-1.js script 15.5.4.11-2.js script 15.5.4.11-3.js script 15.5.4.11-4.js script 15.5.4.11-5.js script 15.5.4.11-6.js script 15.5.4.12-1.js script 15.5.4.12-2.js script 15.5.4.12-3.js script 15.5.4.12-4.js script 15.5.4.12-5.js script 15.5.4.2-1.js script 15.5.4.2-2-n.js script 15.5.4.2-3.js script 15.5.4.2.js script 15.5.4.3-1.js script 15.5.4.3-2.js script 15.5.4.3-3-n.js script 15.5.4.4-1.js script 15.5.4.4-2.js script 15.5.4.4-3.js script 15.5.4.4-4.js script 15.5.4.5-1.js script 15.5.4.5-2.js script 15.5.4.5-3.js script 15.5.4.5-4.js script 15.5.4.5-5.js script 15.5.4.6-1.js script 15.5.4.6-2.js script 15.5.4.7-1.js script 15.5.4.7-2.js script 15.5.4.8-1.js script 15.5.4.8-2.js script 15.5.4.8-3.js script 15.5.4.9-1.js script 15.5.4.js script 15.5.5.1.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/String/shell.js0000644000175000017500000000000011545150464021242 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.2.js0000644000175000017500000001501111545150464022174 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): christine@netscape.com * Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.2.js ECMA Section: 9.2 Type Conversion: ToBoolean Description: rules for converting an argument to a boolean. undefined false Null false Boolean input argument( no conversion ) Number returns false for 0, -0, and NaN otherwise return true String return false if the string is empty (length is 0) otherwise the result is true Object all return true Author: christine@netscape.com Date: 14 july 1997 */ var SECTION = "9.2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "ToBoolean"; writeHeaderToLog( SECTION + " "+ TITLE); // special cases here new TestCase( SECTION, "Boolean()", false, Boolean() ); new TestCase( SECTION, "Boolean(var x)", false, Boolean(eval("var x")) ); new TestCase( SECTION, "Boolean(void 0)", false, Boolean(void 0) ); new TestCase( SECTION, "Boolean(null)", false, Boolean(null) ); new TestCase( SECTION, "Boolean(false)", false, Boolean(false) ); new TestCase( SECTION, "Boolean(true)", true, Boolean(true) ); new TestCase( SECTION, "Boolean(0)", false, Boolean(0) ); new TestCase( SECTION, "Boolean(-0)", false, Boolean(-0) ); new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) ); new TestCase( SECTION, "Boolean('')", false, Boolean("") ); // normal test cases here new TestCase( SECTION, "Boolean(Infinity)", true, Boolean(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Boolean(Math.PI)", true, Boolean(Math.PI) ); new TestCase( SECTION, "Boolean(1)", true, Boolean(1) ); new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) ); new TestCase( SECTION, "Boolean([tab])", true, Boolean("\t") ); new TestCase( SECTION, "Boolean('0')", true, Boolean("0") ); new TestCase( SECTION, "Boolean('string')", true, Boolean("string") ); // ToBoolean (object) should always return true. new TestCase( SECTION, "Boolean(new String() )", true, Boolean(new String()) ); new TestCase( SECTION, "Boolean(new String('') )", true, Boolean(new String("")) ); new TestCase( SECTION, "Boolean(new Boolean(true))", true, Boolean(new Boolean(true)) ); new TestCase( SECTION, "Boolean(new Boolean(false))", true, Boolean(new Boolean(false)) ); new TestCase( SECTION, "Boolean(new Boolean() )", true, Boolean(new Boolean()) ); new TestCase( SECTION, "Boolean(new Array())", true, Boolean(new Array()) ); new TestCase( SECTION, "Boolean(new Number())", true, Boolean(new Number()) ); new TestCase( SECTION, "Boolean(new Number(-0))", true, Boolean(new Number(-0)) ); new TestCase( SECTION, "Boolean(new Number(0))", true, Boolean(new Number(0)) ); new TestCase( SECTION, "Boolean(new Number(NaN))", true, Boolean(new Number(Number.NaN)) ); new TestCase( SECTION, "Boolean(new Number(-1))", true, Boolean(new Number(-1)) ); new TestCase( SECTION, "Boolean(new Number(Infinity))", true, Boolean(new Number(Number.POSITIVE_INFINITY)) ); new TestCase( SECTION, "Boolean(new Number(-Infinity))",true, Boolean(new Number(Number.NEGATIVE_INFINITY)) ); new TestCase( SECTION, "Boolean(new Object())", true, Boolean(new Object()) ); new TestCase( SECTION, "Boolean(new Function())", true, Boolean(new Function()) ); new TestCase( SECTION, "Boolean(new Date())", true, Boolean(new Date()) ); new TestCase( SECTION, "Boolean(new Date(0))", true, Boolean(new Date(0)) ); new TestCase( SECTION, "Boolean(Math)", true, Boolean(Math) ); // bug 375793 new TestCase( SECTION, "NaN ? true : false", false, (NaN ? true : false) ); new TestCase( SECTION, "1000 % 0 ? true : false", false, (1000 % 0 ? true : false) ); new TestCase( SECTION, "(function(a,b){ return a % b ? true : false })(1000, 0)", false, ((function(a,b){ return a % b ? true : false })(1000, 0)) ); new TestCase( SECTION, "(function(x) { return !(x) })(0/0)", true, ((function(x) { return !(x) })(0/0)) ); new TestCase( SECTION, "!(0/0)", true, (!(0/0)) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.3-1.js0000644000175000017500000001063011545150464022335 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.3-1.js ECMA Section: 9.3 Type Conversion: ToNumber Description: rules for converting an argument to a number. see 9.3.1 for cases for converting strings to numbers. special cases: undefined NaN Null NaN Boolean 1 if true; +0 if false Number the argument ( no conversion ) String see test 9.3.1 Object see test 9.3-1 This tests ToNumber applied to the object type, except if object is string. See 9.3-2 for ToNumber( String object). Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.3-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " ToNumber"); // object is Number new TestCase( SECTION, "Number(new Number())", 0, Number(new Number()) ); new TestCase( SECTION, "typeof Number(new Number())", "number", typeof Number(new Number()) ); new TestCase( SECTION, "Number(new Number(Number.NaN))", Number.NaN, Number(new Number(Number.NaN)) ); new TestCase( SECTION, "typeof Number(new Number(Number.NaN))","number", typeof Number(new Number(Number.NaN)) ); new TestCase( SECTION, "Number(new Number(0))", 0, Number(new Number(0)) ); new TestCase( SECTION, "typeof Number(new Number(0))", "number", typeof Number(new Number(0)) ); new TestCase( SECTION, "Number(new Number(null))", 0, Number(new Number(null)) ); new TestCase( SECTION, "typeof Number(new Number(null))", "number", typeof Number(new Number(null)) ); // new TestCase( SECTION, "Number(new Number(void 0))", Number.NaN, Number(new Number(void 0)) ); new TestCase( SECTION, "Number(new Number(true))", 1, Number(new Number(true)) ); new TestCase( SECTION, "typeof Number(new Number(true))", "number", typeof Number(new Number(true)) ); new TestCase( SECTION, "Number(new Number(false))", 0, Number(new Number(false)) ); new TestCase( SECTION, "typeof Number(new Number(false))", "number", typeof Number(new Number(false)) ); // object is boolean new TestCase( SECTION, "Number(new Boolean(true))", 1, Number(new Boolean(true)) ); new TestCase( SECTION, "typeof Number(new Boolean(true))", "number", typeof Number(new Boolean(true)) ); new TestCase( SECTION, "Number(new Boolean(false))", 0, Number(new Boolean(false)) ); new TestCase( SECTION, "typeof Number(new Boolean(false))", "number", typeof Number(new Boolean(false)) ); // object is array new TestCase( SECTION, "Number(new Array(2,4,8,16,32))", Number.NaN, Number(new Array(2,4,8,16,32)) ); new TestCase( SECTION, "typeof Number(new Array(2,4,8,16,32))", "number", typeof Number(new Array(2,4,8,16,32)) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.3.1-1.js0000644000175000017500000005225411545150464022504 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.3.1-1.js ECMA Section: 9.3 Type Conversion: ToNumber Description: rules for converting an argument to a number. see 9.3.1 for cases for converting strings to numbers. special cases: undefined NaN Null NaN Boolean 1 if true; +0 if false Number the argument ( no conversion ) String see test 9.3.1 Object see test 9.3-1 This tests ToNumber applied to the string type Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.3.1-1"; var VERSION = "ECMA_1"; var TITLE = "ToNumber applied to the String type"; var BUGNUMBER="77391"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // StringNumericLiteral:::StrWhiteSpace:::StrWhiteSpaceChar StrWhiteSpace::: // // Name Unicode Value Escape Sequence // 0X0009 \t // 0X0020 // 0X000C \f // 0X000B // 0X000D \r // 0X000A \n new TestCase( SECTION, "Number('')", 0, Number("") ); new TestCase( SECTION, "Number(' ')", 0, Number(" ") ); new TestCase( SECTION, "Number(\\t)", 0, Number("\t") ); new TestCase( SECTION, "Number(\\n)", 0, Number("\n") ); new TestCase( SECTION, "Number(\\r)", 0, Number("\r") ); new TestCase( SECTION, "Number(\\f)", 0, Number("\f") ); new TestCase( SECTION, "Number(String.fromCharCode(0x0009)", 0, Number(String.fromCharCode(0x0009)) ); new TestCase( SECTION, "Number(String.fromCharCode(0x0020)", 0, Number(String.fromCharCode(0x0020)) ); new TestCase( SECTION, "Number(String.fromCharCode(0x000C)", 0, Number(String.fromCharCode(0x000C)) ); new TestCase( SECTION, "Number(String.fromCharCode(0x000B)", 0, Number(String.fromCharCode(0x000B)) ); new TestCase( SECTION, "Number(String.fromCharCode(0x000D)", 0, Number(String.fromCharCode(0x000D)) ); new TestCase( SECTION, "Number(String.fromCharCode(0x000A)", 0, Number(String.fromCharCode(0x000A)) ); // a StringNumericLiteral may be preceeded or followed by whitespace and/or // line terminators new TestCase( SECTION, "Number( ' ' + 999 )", 999, Number( ' '+999) ); new TestCase( SECTION, "Number( '\\n' + 999 )", 999, Number( '\n' +999) ); new TestCase( SECTION, "Number( '\\r' + 999 )", 999, Number( '\r' +999) ); new TestCase( SECTION, "Number( '\\t' + 999 )", 999, Number( '\t' +999) ); new TestCase( SECTION, "Number( '\\f' + 999 )", 999, Number( '\f' +999) ); new TestCase( SECTION, "Number( 999 + ' ' )", 999, Number( 999+' ') ); new TestCase( SECTION, "Number( 999 + '\\n' )", 999, Number( 999+'\n' ) ); new TestCase( SECTION, "Number( 999 + '\\r' )", 999, Number( 999+'\r' ) ); new TestCase( SECTION, "Number( 999 + '\\t' )", 999, Number( 999+'\t' ) ); new TestCase( SECTION, "Number( 999 + '\\f' )", 999, Number( 999+'\f' ) ); new TestCase( SECTION, "Number( '\\n' + 999 + '\\n' )", 999, Number( '\n' +999+'\n' ) ); new TestCase( SECTION, "Number( '\\r' + 999 + '\\r' )", 999, Number( '\r' +999+'\r' ) ); new TestCase( SECTION, "Number( '\\t' + 999 + '\\t' )", 999, Number( '\t' +999+'\t' ) ); new TestCase( SECTION, "Number( '\\f' + 999 + '\\f' )", 999, Number( '\f' +999+'\f' ) ); new TestCase( SECTION, "Number( ' ' + '999' )", 999, Number( ' '+'999') ); new TestCase( SECTION, "Number( '\\n' + '999' )", 999, Number( '\n' +'999') ); new TestCase( SECTION, "Number( '\\r' + '999' )", 999, Number( '\r' +'999') ); new TestCase( SECTION, "Number( '\\t' + '999' )", 999, Number( '\t' +'999') ); new TestCase( SECTION, "Number( '\\f' + '999' )", 999, Number( '\f' +'999') ); new TestCase( SECTION, "Number( '999' + ' ' )", 999, Number( '999'+' ') ); new TestCase( SECTION, "Number( '999' + '\\n' )", 999, Number( '999'+'\n' ) ); new TestCase( SECTION, "Number( '999' + '\\r' )", 999, Number( '999'+'\r' ) ); new TestCase( SECTION, "Number( '999' + '\\t' )", 999, Number( '999'+'\t' ) ); new TestCase( SECTION, "Number( '999' + '\\f' )", 999, Number( '999'+'\f' ) ); new TestCase( SECTION, "Number( '\\n' + '999' + '\\n' )", 999, Number( '\n' +'999'+'\n' ) ); new TestCase( SECTION, "Number( '\\r' + '999' + '\\r' )", 999, Number( '\r' +'999'+'\r' ) ); new TestCase( SECTION, "Number( '\\t' + '999' + '\\t' )", 999, Number( '\t' +'999'+'\t' ) ); new TestCase( SECTION, "Number( '\\f' + '999' + '\\f' )", 999, Number( '\f' +'999'+'\f' ) ); var ws = ["", " ", " ", " "]; for (var i = 0, sz = ws.length; i < sz; i++) { var start = ws[i]; for (var j = 0; j < sz; j++) { var end = ws[j]; new TestCase( SECTION, "Number( '" + start + "' + '0xA' )", 10, Number( start+'0xA') ); new TestCase( SECTION, "Number( '0xA' + '" + end + "' )", 10, Number( '0xA'+end) ); new TestCase( SECTION, "Number( '" + start + "' + '0xA' + '" + end + "' )", 10, Number( start +'0xA'+end ) ); } } new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' )", 99, Number( String.fromCharCode(0x0009) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' )", 99, Number( String.fromCharCode(0x0020) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' )", 99, Number( String.fromCharCode(0x000C) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' )", 99, Number( String.fromCharCode(0x000B) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' )", 99, Number( String.fromCharCode(0x000D) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' )", 99, Number( String.fromCharCode(0x000A) + '99' ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0009)", 99, Number( '99' + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0020)", 99, Number( '99' + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000C)", 99, Number( '99' + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000D)", 99, Number( '99' + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000B)", 99, Number( '99' + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000A)", 99, Number( '99' + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 )", 99, Number( String.fromCharCode(0x0009) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 )", 99, Number( String.fromCharCode(0x0020) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 )", 99, Number( String.fromCharCode(0x000C) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 )", 99, Number( String.fromCharCode(0x000B) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 )", 99, Number( String.fromCharCode(0x000D) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 )", 99, Number( String.fromCharCode(0x000A) + 99 ) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0009)", 99, Number( 99 + String.fromCharCode(0x0009)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0020)", 99, Number( 99 + String.fromCharCode(0x0020)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000C)", 99, Number( 99 + String.fromCharCode(0x000C)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000D)", 99, Number( 99 + String.fromCharCode(0x000D)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000B)", 99, Number( 99 + String.fromCharCode(0x000B)) ); new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000A)", 99, Number( 99 + String.fromCharCode(0x000A)) ); // StrNumericLiteral:::StrDecimalLiteral:::Infinity new TestCase( SECTION, "Number('Infinity')", Math.pow(10,10000), Number("Infinity") ); new TestCase( SECTION, "Number('-Infinity')", -Math.pow(10,10000), Number("-Infinity") ); new TestCase( SECTION, "Number('+Infinity')", Math.pow(10,10000), Number("+Infinity") ); // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt new TestCase( SECTION, "Number('0')", 0, Number("0") ); new TestCase( SECTION, "Number('-0')", -0, Number("-0") ); new TestCase( SECTION, "Number('+0')", 0, Number("+0") ); new TestCase( SECTION, "Number('1')", 1, Number("1") ); new TestCase( SECTION, "Number('-1')", -1, Number("-1") ); new TestCase( SECTION, "Number('+1')", 1, Number("+1") ); new TestCase( SECTION, "Number('2')", 2, Number("2") ); new TestCase( SECTION, "Number('-2')", -2, Number("-2") ); new TestCase( SECTION, "Number('+2')", 2, Number("+2") ); new TestCase( SECTION, "Number('3')", 3, Number("3") ); new TestCase( SECTION, "Number('-3')", -3, Number("-3") ); new TestCase( SECTION, "Number('+3')", 3, Number("+3") ); new TestCase( SECTION, "Number('4')", 4, Number("4") ); new TestCase( SECTION, "Number('-4')", -4, Number("-4") ); new TestCase( SECTION, "Number('+4')", 4, Number("+4") ); new TestCase( SECTION, "Number('5')", 5, Number("5") ); new TestCase( SECTION, "Number('-5')", -5, Number("-5") ); new TestCase( SECTION, "Number('+5')", 5, Number("+5") ); new TestCase( SECTION, "Number('6')", 6, Number("6") ); new TestCase( SECTION, "Number('-6')", -6, Number("-6") ); new TestCase( SECTION, "Number('+6')", 6, Number("+6") ); new TestCase( SECTION, "Number('7')", 7, Number("7") ); new TestCase( SECTION, "Number('-7')", -7, Number("-7") ); new TestCase( SECTION, "Number('+7')", 7, Number("+7") ); new TestCase( SECTION, "Number('8')", 8, Number("8") ); new TestCase( SECTION, "Number('-8')", -8, Number("-8") ); new TestCase( SECTION, "Number('+8')", 8, Number("+8") ); new TestCase( SECTION, "Number('9')", 9, Number("9") ); new TestCase( SECTION, "Number('-9')", -9, Number("-9") ); new TestCase( SECTION, "Number('+9')", 9, Number("+9") ); new TestCase( SECTION, "Number('3.14159')", 3.14159, Number("3.14159") ); new TestCase( SECTION, "Number('-3.14159')", -3.14159, Number("-3.14159") ); new TestCase( SECTION, "Number('+3.14159')", 3.14159, Number("+3.14159") ); new TestCase( SECTION, "Number('3.')", 3, Number("3.") ); new TestCase( SECTION, "Number('-3.')", -3, Number("-3.") ); new TestCase( SECTION, "Number('+3.')", 3, Number("+3.") ); new TestCase( SECTION, "Number('3.e1')", 30, Number("3.e1") ); new TestCase( SECTION, "Number('-3.e1')", -30, Number("-3.e1") ); new TestCase( SECTION, "Number('+3.e1')", 30, Number("+3.e1") ); new TestCase( SECTION, "Number('3.e+1')", 30, Number("3.e+1") ); new TestCase( SECTION, "Number('-3.e+1')", -30, Number("-3.e+1") ); new TestCase( SECTION, "Number('+3.e+1')", 30, Number("+3.e+1") ); new TestCase( SECTION, "Number('3.e-1')", .30, Number("3.e-1") ); new TestCase( SECTION, "Number('-3.e-1')", -.30, Number("-3.e-1") ); new TestCase( SECTION, "Number('+3.e-1')", .30, Number("+3.e-1") ); // StrDecimalLiteral::: .DecimalDigits ExponentPart opt new TestCase( SECTION, "Number('.00001')", 0.00001, Number(".00001") ); new TestCase( SECTION, "Number('+.00001')", 0.00001, Number("+.00001") ); new TestCase( SECTION, "Number('-0.0001')", -0.00001, Number("-.00001") ); new TestCase( SECTION, "Number('.01e2')", 1, Number(".01e2") ); new TestCase( SECTION, "Number('+.01e2')", 1, Number("+.01e2") ); new TestCase( SECTION, "Number('-.01e2')", -1, Number("-.01e2") ); new TestCase( SECTION, "Number('.01e+2')", 1, Number(".01e+2") ); new TestCase( SECTION, "Number('+.01e+2')", 1, Number("+.01e+2") ); new TestCase( SECTION, "Number('-.01e+2')", -1, Number("-.01e+2") ); new TestCase( SECTION, "Number('.01e-2')", 0.0001, Number(".01e-2") ); new TestCase( SECTION, "Number('+.01e-2')", 0.0001, Number("+.01e-2") ); new TestCase( SECTION, "Number('-.01e-2')", -0.0001, Number("-.01e-2") ); // StrDecimalLiteral::: DecimalDigits ExponentPart opt new TestCase( SECTION, "Number('1234e5')", 123400000, Number("1234e5") ); new TestCase( SECTION, "Number('+1234e5')", 123400000, Number("+1234e5") ); new TestCase( SECTION, "Number('-1234e5')", -123400000, Number("-1234e5") ); new TestCase( SECTION, "Number('1234e+5')", 123400000, Number("1234e+5") ); new TestCase( SECTION, "Number('+1234e+5')", 123400000, Number("+1234e+5") ); new TestCase( SECTION, "Number('-1234e+5')", -123400000, Number("-1234e+5") ); new TestCase( SECTION, "Number('1234e-5')", 0.01234, Number("1234e-5") ); new TestCase( SECTION, "Number('+1234e-5')", 0.01234, Number("+1234e-5") ); new TestCase( SECTION, "Number('-1234e-5')", -0.01234, Number("-1234e-5") ); // StrNumericLiteral::: HexIntegerLiteral new TestCase( SECTION, "Number('0x0')", 0, Number("0x0")); new TestCase( SECTION, "Number('0x1')", 1, Number("0x1")); new TestCase( SECTION, "Number('0x2')", 2, Number("0x2")); new TestCase( SECTION, "Number('0x3')", 3, Number("0x3")); new TestCase( SECTION, "Number('0x4')", 4, Number("0x4")); new TestCase( SECTION, "Number('0x5')", 5, Number("0x5")); new TestCase( SECTION, "Number('0x6')", 6, Number("0x6")); new TestCase( SECTION, "Number('0x7')", 7, Number("0x7")); new TestCase( SECTION, "Number('0x8')", 8, Number("0x8")); new TestCase( SECTION, "Number('0x9')", 9, Number("0x9")); new TestCase( SECTION, "Number('0xa')", 10, Number("0xa")); new TestCase( SECTION, "Number('0xb')", 11, Number("0xb")); new TestCase( SECTION, "Number('0xc')", 12, Number("0xc")); new TestCase( SECTION, "Number('0xd')", 13, Number("0xd")); new TestCase( SECTION, "Number('0xe')", 14, Number("0xe")); new TestCase( SECTION, "Number('0xf')", 15, Number("0xf")); new TestCase( SECTION, "Number('0xA')", 10, Number("0xA")); new TestCase( SECTION, "Number('0xB')", 11, Number("0xB")); new TestCase( SECTION, "Number('0xC')", 12, Number("0xC")); new TestCase( SECTION, "Number('0xD')", 13, Number("0xD")); new TestCase( SECTION, "Number('0xE')", 14, Number("0xE")); new TestCase( SECTION, "Number('0xF')", 15, Number("0xF")); new TestCase( SECTION, "Number('0X0')", 0, Number("0X0")); new TestCase( SECTION, "Number('0X1')", 1, Number("0X1")); new TestCase( SECTION, "Number('0X2')", 2, Number("0X2")); new TestCase( SECTION, "Number('0X3')", 3, Number("0X3")); new TestCase( SECTION, "Number('0X4')", 4, Number("0X4")); new TestCase( SECTION, "Number('0X5')", 5, Number("0X5")); new TestCase( SECTION, "Number('0X6')", 6, Number("0X6")); new TestCase( SECTION, "Number('0X7')", 7, Number("0X7")); new TestCase( SECTION, "Number('0X8')", 8, Number("0X8")); new TestCase( SECTION, "Number('0X9')", 9, Number("0X9")); new TestCase( SECTION, "Number('0Xa')", 10, Number("0Xa")); new TestCase( SECTION, "Number('0Xb')", 11, Number("0Xb")); new TestCase( SECTION, "Number('0Xc')", 12, Number("0Xc")); new TestCase( SECTION, "Number('0Xd')", 13, Number("0Xd")); new TestCase( SECTION, "Number('0Xe')", 14, Number("0Xe")); new TestCase( SECTION, "Number('0Xf')", 15, Number("0Xf")); new TestCase( SECTION, "Number('0XA')", 10, Number("0XA")); new TestCase( SECTION, "Number('0XB')", 11, Number("0XB")); new TestCase( SECTION, "Number('0XC')", 12, Number("0XC")); new TestCase( SECTION, "Number('0XD')", 13, Number("0XD")); new TestCase( SECTION, "Number('0XE')", 14, Number("0XE")); new TestCase( SECTION, "Number('0XF')", 15, Number("0XF")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.3.1-2.js0000644000175000017500000000704111545150464022477 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.3.1-2.js ECMA Section: 9.3 Type Conversion: ToNumber Description: rules for converting an argument to a number. see 9.3.1 for cases for converting strings to numbers. special cases: undefined NaN Null NaN Boolean 1 if true; +0 if false Number the argument ( no conversion ) String see test 9.3.1 Object see test 9.3-1 This tests special cases of ToNumber(string) that are not covered in 9.3.1-1.js. Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.3.1-2"; var VERSION = "ECMA_1"; startTest(); var TITLE = "ToNumber applied to the String type"; writeHeaderToLog( SECTION + " "+ TITLE); // A StringNumericLiteral may not use octal notation new TestCase( SECTION, "Number(00)", 0, Number("00")); new TestCase( SECTION, "Number(01)", 1, Number("01")); new TestCase( SECTION, "Number(02)", 2, Number("02")); new TestCase( SECTION, "Number(03)", 3, Number("03")); new TestCase( SECTION, "Number(04)", 4, Number("04")); new TestCase( SECTION, "Number(05)", 5, Number("05")); new TestCase( SECTION, "Number(06)", 6, Number("06")); new TestCase( SECTION, "Number(07)", 7, Number("07")); new TestCase( SECTION, "Number(010)", 10, Number("010")); new TestCase( SECTION, "Number(011)", 11, Number("011")); // A StringNumericLIteral may have any number of leading 0 digits new TestCase( SECTION, "Number(001)", 1, Number("001")); new TestCase( SECTION, "Number(0001)", 1, Number("0001")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.3.1-3.js0000644000175000017500000005354411545150464022511 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.3.1-3.js ECMA Section: 9.3 Type Conversion: ToNumber Description: rules for converting an argument to a number. see 9.3.1 for cases for converting strings to numbers. special cases: undefined NaN Null NaN Boolean 1 if true; +0 if false Number the argument ( no conversion ) String see test 9.3.1 Object see test 9.3-1 Test cases provided by waldemar. Author: christine@netscape.com Date: 10 june 1998 */ var SECTION = "9.3.1-3"; var VERSION = "ECMA_1"; var BUGNUMBER="129087"; var TITLE = "Number To String, String To Number"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // test case from http://scopus.mcom.com/bugsplat/show_bug.cgi?id=312954 var z = 0; new TestCase( SECTION, "var z = 0; print(1/-z)", -Infinity, 1/-z ); // test cases from bug http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122882 new TestCase( SECTION, '- -"0x80000000"', 2147483648, - -"0x80000000" ); new TestCase( SECTION, '- -"0x100000000"', 4294967296, - -"0x100000000" ); new TestCase( SECTION, '- "-0x123456789abcde8"', NaN, - "-0x123456789abcde8" ); new TestCase( SECTION, '- "+0x123456789abcde8"', NaN, - "+0x123456789abcde8" ); // Convert some large numbers to string new TestCase( SECTION, "1e2000 +''", "Infinity", 1e2000 +"" ); new TestCase( SECTION, "1e2000", Infinity, 1e2000 ); new TestCase( SECTION, "-1e2000 +''", "-Infinity", -1e2000 +"" ); new TestCase( SECTION, "-\"1e2000\"", -Infinity, -"1e2000" ); new TestCase( SECTION, "-\"-1e2000\" +''", "Infinity", -"-1e2000" +"" ); new TestCase( SECTION, "1e-2000", 0, 1e-2000 ); new TestCase( SECTION, "1/1e-2000", Infinity, 1/1e-2000 ); // convert some strings to large numbers new TestCase( SECTION, "1/-1e-2000", -Infinity, 1/-1e-2000 ); new TestCase( SECTION, "1/\"1e-2000\"", Infinity, 1/"1e-2000" ); new TestCase( SECTION, "1/\"-1e-2000\"", -Infinity, 1/"-1e-2000" ); new TestCase( SECTION, "parseFloat(\"1e2000\")", Infinity, parseFloat("1e2000") ); new TestCase( SECTION, "parseFloat(\"1e-2000\")", 0, parseFloat("1e-2000") ); new TestCase( SECTION, "1.7976931348623157E+308", 1.7976931348623157e+308, 1.7976931348623157E+308 ); new TestCase( SECTION, "1.7976931348623158e+308", 1.7976931348623157e+308, 1.7976931348623158e+308 ); new TestCase( SECTION, "1.7976931348623159e+308", Infinity, 1.7976931348623159e+308 ); s = "17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068"; print("s = " + s); print("-s = " + (-s)); new TestCase( SECTION, "s = " + s +"; s +="+ "\"190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779\""+ +"; s", "17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779", s += "190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779" ); s1 = s+1; print("s1 = " + s1); print("-s1 = " + (-s1)); new TestCase( SECTION, "s1 = s+1; s1", "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497791", s1 ); /***** This answer is preferred but -Infinity is also acceptable here *****/ new TestCase( SECTION, "-s1 == Infinity || s1 == 1.7976931348623157e+308", true, -s1 == Infinity || s1 == 1.7976931348623157e+308 ); s2 = s + 2; print("s2 = " + s2); print("-s2 = " + (-s2)); new TestCase( SECTION, "s2 = s+2; s2", "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792", s2 ); // ***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here ***** new TestCase( SECTION, "-s2 == -Infinity || -s2 == -1.7976931348623157e+308 ", true, -s2 == -Infinity || -s2 == -1.7976931348623157e+308 ); s3 = s+3; print("s3 = " + s3); print("-s3 = " + (-s3)); new TestCase( SECTION, "s3 = s+3; s3", "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497793", s3 ); //***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here ***** new TestCase( SECTION, "-s3 == -Infinity || -s3 == -1.7976931348623157e+308", true, -s3 == -Infinity || -s3 == -1.7976931348623157e+308 ); //***** This answer is preferred but Infinity is also acceptable here ***** new TestCase( SECTION, "parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity", true, parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity ); //***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here ***** new TestCase( SECTION, "parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308", true , parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 ); //***** This answer is preferred but Infinity is also acceptable here ***** new TestCase( SECTION, "parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity", true, parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity); //***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here ***** new TestCase( SECTION, "parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308", true, parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 ); new TestCase( SECTION, "0x12345678", 305419896, 0x12345678 ); new TestCase( SECTION, "0x80000000", 2147483648, 0x80000000 ); new TestCase( SECTION, "0xffffffff", 4294967295, 0xffffffff ); new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 ); new TestCase( SECTION, "077777777777777777", 2251799813685247, 077777777777777777 ); new TestCase( SECTION, "077777777777777776", 2251799813685246, 077777777777777776 ); new TestCase( SECTION, "0x1fffffffffffff", 9007199254740991, 0x1fffffffffffff ); new TestCase( SECTION, "0x20000000000000", 9007199254740992, 0x20000000000000 ); new TestCase( SECTION, "0x20123456789abc", 9027215253084860, 0x20123456789abc ); new TestCase( SECTION, "0x20123456789abd", 9027215253084860, 0x20123456789abd ); new TestCase( SECTION, "0x20123456789abe", 9027215253084862, 0x20123456789abe ); new TestCase( SECTION, "0x20123456789abf", 9027215253084864, 0x20123456789abf ); /***** These test the round-to-nearest-or-even-if-equally-close rule *****/ new TestCase( SECTION, "0x1000000000000080", 1152921504606847000, 0x1000000000000080 ); new TestCase( SECTION, "0x1000000000000081", 1152921504606847200, 0x1000000000000081 ); new TestCase( SECTION, "0x1000000000000100", 1152921504606847200, 0x1000000000000100 ); new TestCase( SECTION, "0x100000000000017f", 1152921504606847200, 0x100000000000017f ); new TestCase( SECTION, "0x1000000000000180", 1152921504606847500, 0x1000000000000180 ); new TestCase( SECTION, "0x1000000000000181", 1152921504606847500, 0x1000000000000181 ); new TestCase( SECTION, "0x10000000000001f0", 1152921504606847500, 0x10000000000001f0 ); new TestCase( SECTION, "0x1000000000000200", 1152921504606847500, 0x1000000000000200 ); new TestCase( SECTION, "0x100000000000027f", 1152921504606847500, 0x100000000000027f ); new TestCase( SECTION, "0x1000000000000280", 1152921504606847500, 0x1000000000000280 ); new TestCase( SECTION, "0x1000000000000281", 1152921504606847700, 0x1000000000000281 ); new TestCase( SECTION, "0x10000000000002ff", 1152921504606847700, 0x10000000000002ff ); new TestCase( SECTION, "0x1000000000000300", 1152921504606847700, 0x1000000000000300 ); new TestCase( SECTION, "0x10000000000000000", 18446744073709552000, 0x10000000000000000 ); new TestCase( SECTION, "parseInt(\"000000100000000100100011010001010110011110001001101010111100\",2)", 9027215253084860, parseInt("000000100000000100100011010001010110011110001001101010111100",2) ); new TestCase( SECTION, "parseInt(\"000000100000000100100011010001010110011110001001101010111101\",2)", 9027215253084860, parseInt("000000100000000100100011010001010110011110001001101010111101",2) ); new TestCase( SECTION, "parseInt(\"000000100000000100100011010001010110011110001001101010111111\",2)", 9027215253084864, parseInt("000000100000000100100011010001010110011110001001101010111111",2) ); new TestCase( SECTION, "parseInt(\"0000001000000001001000110100010101100111100010011010101111010\",2)", 18054430506169720, parseInt("0000001000000001001000110100010101100111100010011010101111010",2)); new TestCase( SECTION, "parseInt(\"0000001000000001001000110100010101100111100010011010101111011\",2)", 18054430506169724, parseInt("0000001000000001001000110100010101100111100010011010101111011",2) ); new TestCase( SECTION, "parseInt(\"0000001000000001001000110100010101100111100010011010101111100\",2)", 18054430506169724, parseInt("0000001000000001001000110100010101100111100010011010101111100",2)); new TestCase( SECTION, "parseInt(\"0000001000000001001000110100010101100111100010011010101111110\",2)", 18054430506169728, parseInt("0000001000000001001000110100010101100111100010011010101111110",2)); new TestCase( SECTION, "parseInt(\"yz\",35)", 34, parseInt("yz",35) ); new TestCase( SECTION, "parseInt(\"yz\",36)", 1259, parseInt("yz",36) ); new TestCase( SECTION, "parseInt(\"yz\",37)", NaN, parseInt("yz",37) ); new TestCase( SECTION, "parseInt(\"+77\")", 77, parseInt("+77") ); new TestCase( SECTION, "parseInt(\"-77\",9)", -70, parseInt("-77",9) ); new TestCase( SECTION, "parseInt(\"\\u20001234\\u2000\")", 1234, parseInt("\u20001234\u2000") ); new TestCase( SECTION, "parseInt(\"123456789012345678\")", 123456789012345680, parseInt("123456789012345678") ); new TestCase( SECTION, "parseInt(\"9\",8)", NaN, parseInt("9",8) ); new TestCase( SECTION, "parseInt(\"1e2\")", 1, parseInt("1e2") ); new TestCase( SECTION, "parseInt(\"1.9999999999999999999\")", 1, parseInt("1.9999999999999999999") ); new TestCase( SECTION, "parseInt(\"0x10\")", 16, parseInt("0x10") ); new TestCase( SECTION, "parseInt(\"0x10\",10)", 0, parseInt("0x10",10) ); new TestCase( SECTION, "parseInt(\"0022\")", 18, parseInt("0022") ); new TestCase( SECTION, "parseInt(\"0022\",10)", 22, parseInt("0022",10) ); new TestCase( SECTION, "parseInt(\"0x1000000000000080\")", 1152921504606847000, parseInt("0x1000000000000080") ); new TestCase( SECTION, "parseInt(\"0x1000000000000081\")", 1152921504606847200, parseInt("0x1000000000000081") ); s = "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; new TestCase( SECTION, "s = "+ "\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+ "s", "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s ); new TestCase( SECTION, "s +="+ "\"0000000000000000000000000000000000000\"; s", "0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s += "0000000000000000000000000000000000000" ); new TestCase( SECTION, "-s", -1.7976931348623157e+308, -s ); s = "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; new TestCase( SECTION, "s ="+ "\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+ "s", "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s ); new TestCase( SECTION, "s += \"0000000000000000000000000000000000001\"", "0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", s += "0000000000000000000000000000000000001" ); new TestCase( SECTION, "-s", -1.7976931348623157e+308, -s ); s = "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; new TestCase( SECTION, "s ="+ "\"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+ "s", "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s ); new TestCase( SECTION, "s += \"0000000000000000000000000000000000000\"", "0xFFFFFFFFFFFFFC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s += "0000000000000000000000000000000000000"); new TestCase( SECTION, "-s", -Infinity, -s ); s = "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; new TestCase( SECTION, "s = "+ "\"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";s", "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", s); new TestCase( SECTION, "s += \"0000000000000000000000000000000000001\"", "0xFFFFFFFFFFFFFB00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", s += "0000000000000000000000000000000000001" ); new TestCase( SECTION, "-s", -1.7976931348623157e+308, -s ); new TestCase( SECTION, "s += \"0\"", "0xFFFFFFFFFFFFFB000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010", s += "0" ); new TestCase( SECTION, "-s", -Infinity, -s ); new TestCase( SECTION, "parseInt(s)", Infinity, parseInt(s) ); new TestCase( SECTION, "parseInt(s,32)", 0, parseInt(s,32) ); new TestCase( SECTION, "parseInt(s,36)", Infinity, parseInt(s,36) ); new TestCase( SECTION, "-\"\"", 0, -"" ); new TestCase( SECTION, "-\" \"", 0, -" " ); new TestCase( SECTION, "-\"999\"", -999, -"999" ); new TestCase( SECTION, "-\" 999\"", -999, -" 999" ); new TestCase( SECTION, "-\"\\t999\"", -999, -"\t999" ); new TestCase( SECTION, "-\"013 \"", -13, -"013 " ); new TestCase( SECTION, "-\"999\\t\"", -999, -"999\t" ); new TestCase( SECTION, "-\"-Infinity\"", Infinity, -"-Infinity" ); new TestCase( SECTION, "-\"+Infinity\"", -Infinity, -"+Infinity" ); new TestCase( SECTION, "-\"+Infiniti\"", NaN, -"+Infiniti" ); new TestCase( SECTION, "- -\"0x80000000\"", 2147483648, - -"0x80000000" ); new TestCase( SECTION, "- -\"0x100000000\"", 4294967296, - -"0x100000000" ); new TestCase( SECTION, "- \"-0x123456789abcde8\"", NaN, - "-0x123456789abcde8" ); new TestCase( SECTION, "- \"+0x123456789abcde8\"", NaN, - "+0x123456789abcde8" ); // the following two tests are not strictly ECMA 1.0 new TestCase( SECTION, "-\"\\u20001234\\u2001\"", -1234, -"\u20001234\u2001" ); new TestCase( SECTION, "-\"\\u20001234\\0\"", NaN, -"\u20001234\0" ); new TestCase( SECTION, "-\"0x10\"", -16, -"0x10" ); new TestCase( SECTION, "-\"+\"", NaN, -"+" ); new TestCase( SECTION, "-\"-\"", NaN, -"-" ); new TestCase( SECTION, "-\"-0-\"", NaN, -"-0-" ); new TestCase( SECTION, "-\"1e-\"", NaN, -"1e-" ); new TestCase( SECTION, "-\"1e-1\"", -0.1, -"1e-1" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.3.js0000644000175000017500000001004311545150464022175 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.3.js ECMA Section: 9.3 Type Conversion: ToNumber Description: rules for converting an argument to a number. see 9.3.1 for cases for converting strings to numbers. special cases: undefined NaN Null NaN Boolean 1 if true; +0 if false Number the argument ( no conversion ) String see test 9.3.1 Object see test 9.3-1 For ToNumber applied to the String type, see test 9.3.1. For ToNumber applied to the object type, see test 9.3-1. Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.3"; var VERSION = "ECMA_1"; startTest(); var TITLE = "ToNumber"; writeHeaderToLog( SECTION + " "+ TITLE); // special cases here new TestCase( SECTION, "Number()", 0, Number() ); new TestCase( SECTION, "Number(eval('var x'))", Number.NaN, Number(eval("var x")) ); new TestCase( SECTION, "Number(void 0)", Number.NaN, Number(void 0) ); new TestCase( SECTION, "Number(null)", 0, Number(null) ); new TestCase( SECTION, "Number(true)", 1, Number(true) ); new TestCase( SECTION, "Number(false)", 0, Number(false) ); new TestCase( SECTION, "Number(0)", 0, Number(0) ); new TestCase( SECTION, "Number(-0)", -0, Number(-0) ); new TestCase( SECTION, "Number(1)", 1, Number(1) ); new TestCase( SECTION, "Number(-1)", -1, Number(-1) ); new TestCase( SECTION, "Number(Number.MAX_VALUE)", 1.7976931348623157e308, Number(Number.MAX_VALUE) ); new TestCase( SECTION, "Number(Number.MIN_VALUE)", 5e-324, Number(Number.MIN_VALUE) ); new TestCase( SECTION, "Number(Number.NaN)", Number.NaN, Number(Number.NaN) ); new TestCase( SECTION, "Number(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, Number(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Number(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, Number(Number.NEGATIVE_INFINITY) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.4-1.js0000644000175000017500000001277511545150464022352 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.4-1.js ECMA Section: 9.4 ToInteger Description: 1. Call ToNumber on the input argument 2. If Result(1) is NaN, return +0 3. If Result(1) is +0, -0, Infinity, or -Infinity, return Result(1). 4. Compute sign(Result(1)) * floor(abs(Result(1))). 5. Return Result(4). To test ToInteger, this test uses new Date(value), 15.9.3.7. The Date constructor sets the [[Value]] property of the new object to TimeClip(value), which uses the rules: TimeClip(time) 1. If time is not finite, return NaN 2. If abs(Result(1)) > 8.64e15, return NaN 3. Return an implementation dependent choice of either ToInteger(Result(2)) or ToInteger(Result(2)) + (+0) (Adding a positive 0 converts -0 to +0). This tests ToInteger for values -8.64e15 > value > 8.64e15, not including -0 and +0. For additional special cases (0, +0, Infinity, -Infinity, and NaN, see 9.4-2.js). For value is String, see 9.4-3.js. Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "ToInteger"; writeHeaderToLog( SECTION + " "+ TITLE); // some special cases new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") ); new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) ); new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") ); // value is not an integer new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") ); new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") ); new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") ); new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") ); new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") ); // value is not a number new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) ); new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") ); new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); // edge cases new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.4-2.js0000644000175000017500000001277511545150464022353 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.4-1.js ECMA Section: 9.4 ToInteger Description: 1. Call ToNumber on the input argument 2. If Result(1) is NaN, return +0 3. If Result(1) is +0, -0, Infinity, or -Infinity, return Result(1). 4. Compute sign(Result(1)) * floor(abs(Result(1))). 5. Return Result(4). To test ToInteger, this test uses new Date(value), 15.9.3.7. The Date constructor sets the [[Value]] property of the new object to TimeClip(value), which uses the rules: TimeClip(time) 1. If time is not finite, return NaN 2. If abs(Result(1)) > 8.64e15, return NaN 3. Return an implementation dependent choice of either ToInteger(Result(2)) or ToInteger(Result(2)) + (+0) (Adding a positive 0 converts -0 to +0). This tests ToInteger for values -8.64e15 > value > 8.64e15, not including -0 and +0. For additional special cases (0, +0, Infinity, -Infinity, and NaN, see 9.4-2.js). For value is String, see 9.4-3.js. Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.4-1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "ToInteger"; writeHeaderToLog( SECTION + " "+ TITLE); // some special cases new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") ); new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) ); new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") ); // value is not an integer new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") ); new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") ); new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") ); new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") ); new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") ); // value is not a number new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) ); new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") ); new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") ); // edge cases new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") ); new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.5-2.js0000644000175000017500000002136111545150464022343 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.5-2.js ECMA Section: 9.5 Type Conversion: ToInt32 Description: rules for converting an argument to a signed 32 bit integer this test uses << 0 to convert the argument to a 32bit integer. The operator ToInt32 converts its argument to one of 2^32 integer values in the range -2^31 through 2^31 inclusive. This operator functions as follows: 1 call ToNumber on argument 2 if result is NaN, 0, -0, return 0 3 compute (sign (result(1)) * floor(abs(result 1))) 4 compute result(3) modulo 2^32: 5 if result(4) is greater than or equal to 2^31, return result(5)-2^32. otherwise, return result(5) special cases: -0 returns 0 Infinity returns 0 -Infinity returns 0 ToInt32(ToUint32(x)) == ToInt32(x) for all values of x Numbers greater than 2^31 (see step 5 above) (note http://bugzilla.mozilla.org/show_bug.cgi?id=120083) Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "9.5-2"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " ToInt32"); new TestCase( SECTION, "0 << 0", 0, 0 << 0 ); new TestCase( SECTION, "-0 << 0", 0, -0 << 0 ); new TestCase( SECTION, "Infinity << 0", 0, "Infinity" << 0 ); new TestCase( SECTION, "-Infinity << 0", 0, "-Infinity" << 0 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY << 0", 0, Number.POSITIVE_INFINITY << 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY << 0", 0, Number.NEGATIVE_INFINITY << 0 ); new TestCase( SECTION, "Number.NaN << 0", 0, Number.NaN << 0 ); new TestCase( SECTION, "Number.MIN_VALUE << 0", 0, Number.MIN_VALUE << 0 ); new TestCase( SECTION, "-Number.MIN_VALUE << 0", 0, -Number.MIN_VALUE << 0 ); new TestCase( SECTION, "0.1 << 0", 0, 0.1 << 0 ); new TestCase( SECTION, "-0.1 << 0", 0, -0.1 << 0 ); new TestCase( SECTION, "1 << 0", 1, 1 << 0 ); new TestCase( SECTION, "1.1 << 0", 1, 1.1 << 0 ); new TestCase( SECTION, "-1 << 0", ToInt32(-1), -1 << 0 ); new TestCase( SECTION, "2147483647 << 0", ToInt32(2147483647), 2147483647 << 0 ); new TestCase( SECTION, "2147483648 << 0", ToInt32(2147483648), 2147483648 << 0 ); new TestCase( SECTION, "2147483649 << 0", ToInt32(2147483649), 2147483649 << 0 ); new TestCase( SECTION, "(Math.pow(2,31)-1) << 0", ToInt32(2147483647), (Math.pow(2,31)-1) << 0 ); new TestCase( SECTION, "Math.pow(2,31) << 0", ToInt32(2147483648), Math.pow(2,31) << 0 ); new TestCase( SECTION, "(Math.pow(2,31)+1) << 0", ToInt32(2147483649), (Math.pow(2,31)+1) << 0 ); new TestCase( SECTION, "(Math.pow(2,32)-1) << 0", ToInt32(4294967295), (Math.pow(2,32)-1) << 0 ); new TestCase( SECTION, "(Math.pow(2,32)) << 0", ToInt32(4294967296), (Math.pow(2,32)) << 0 ); new TestCase( SECTION, "(Math.pow(2,32)+1) << 0", ToInt32(4294967297), (Math.pow(2,32)+1) << 0 ); new TestCase( SECTION, "4294967295 << 0", ToInt32(4294967295), 4294967295 << 0 ); new TestCase( SECTION, "4294967296 << 0", ToInt32(4294967296), 4294967296 << 0 ); new TestCase( SECTION, "4294967297 << 0", ToInt32(4294967297), 4294967297 << 0 ); new TestCase( SECTION, "'2147483647' << 0", ToInt32(2147483647), '2147483647' << 0 ); new TestCase( SECTION, "'2147483648' << 0", ToInt32(2147483648), '2147483648' << 0 ); new TestCase( SECTION, "'2147483649' << 0", ToInt32(2147483649), '2147483649' << 0 ); new TestCase( SECTION, "'4294967295' << 0", ToInt32(4294967295), '4294967295' << 0 ); new TestCase( SECTION, "'4294967296' << 0", ToInt32(4294967296), '4294967296' << 0 ); new TestCase( SECTION, "'4294967297' << 0", ToInt32(4294967297), '4294967297' << 0 ); new TestCase( SECTION, "-2147483647 << 0", ToInt32(-2147483647), -2147483647 << 0 ); new TestCase( SECTION, "-2147483648 << 0", ToInt32(-2147483648), -2147483648 << 0 ); new TestCase( SECTION, "-2147483649 << 0", ToInt32(-2147483649), -2147483649 << 0 ); new TestCase( SECTION, "-4294967295 << 0", ToInt32(-4294967295), -4294967295 << 0 ); new TestCase( SECTION, "-4294967296 << 0", ToInt32(-4294967296), -4294967296 << 0 ); new TestCase( SECTION, "-4294967297 << 0", ToInt32(-4294967297), -4294967297 << 0 ); /* * Numbers between 2^31 and 2^32 will have a negative ToInt32 per ECMA (see step 5 of introduction) * (These are by stevechapel@earthlink.net; cf. http://bugzilla.mozilla.org/show_bug.cgi?id=120083) */ new TestCase( SECTION, "2147483648.25 << 0", ToInt32(2147483648.25), 2147483648.25 << 0 ); new TestCase( SECTION, "2147483648.5 << 0", ToInt32(2147483648.5), 2147483648.5 << 0 ); new TestCase( SECTION, "2147483648.75 << 0", ToInt32(2147483648.75), 2147483648.75 << 0 ); new TestCase( SECTION, "4294967295.25 << 0", ToInt32(4294967295.25), 4294967295.25 << 0 ); new TestCase( SECTION, "4294967295.5 << 0", ToInt32(4294967295.5), 4294967295.5 << 0 ); new TestCase( SECTION, "4294967295.75 << 0", ToInt32(4294967295.75), 4294967295.75 << 0 ); new TestCase( SECTION, "3000000000.25 << 0", ToInt32(3000000000.25), 3000000000.25 << 0 ); new TestCase( SECTION, "3000000000.5 << 0", ToInt32(3000000000.5), 3000000000.5 << 0 ); new TestCase( SECTION, "3000000000.75 << 0", ToInt32(3000000000.75), 3000000000.75 << 0 ); /* * Numbers between - 2^31 and - 2^32 */ new TestCase( SECTION, "-2147483648.25 << 0", ToInt32(-2147483648.25), -2147483648.25 << 0 ); new TestCase( SECTION, "-2147483648.5 << 0", ToInt32(-2147483648.5), -2147483648.5 << 0 ); new TestCase( SECTION, "-2147483648.75 << 0", ToInt32(-2147483648.75), -2147483648.75 << 0 ); new TestCase( SECTION, "-4294967295.25 << 0", ToInt32(-4294967295.25), -4294967295.25 << 0 ); new TestCase( SECTION, "-4294967295.5 << 0", ToInt32(-4294967295.5), -4294967295.5 << 0 ); new TestCase( SECTION, "-4294967295.75 << 0", ToInt32(-4294967295.75), -4294967295.75 << 0 ); new TestCase( SECTION, "-3000000000.25 << 0", ToInt32(-3000000000.25), -3000000000.25 << 0 ); new TestCase( SECTION, "-3000000000.5 << 0", ToInt32(-3000000000.5), -3000000000.5 << 0 ); new TestCase( SECTION, "-3000000000.75 << 0", ToInt32(-3000000000.75), -3000000000.75 << 0 ); test(); function ToInt32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32); if ( sign == -1 ) { n = ( n < -Math.pow(2,31) ) ? n + Math.pow(2,32) : n; } else{ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n; } return ( n ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.6.js0000644000175000017500000001450411545150464022206 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.6.js ECMA Section: 9.6 Type Conversion: ToUint32 Description: rules for converting an argument to an unsigned 32 bit integer this test uses >>> 0 to convert the argument to an unsigned 32bit integer. 1 call ToNumber on argument 2 if result is NaN, 0, -0, Infinity, -Infinity return 0 3 compute (sign (result(1)) * floor(abs(result 1))) 4 compute result(3) modulo 2^32: 5 return result(4) special cases: -0 returns 0 Infinity returns 0 -Infinity returns 0 0 returns 0 ToInt32(ToUint32(x)) == ToInt32(x) for all values of x ** NEED TO DO THIS PART IN A SEPARATE TEST FILE ** Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "9.6"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Type Conversion: ToUint32"); new TestCase( SECTION, "0 >>> 0", 0, 0 >>> 0 ); // new TestCase( SECTION, "+0 >>> 0", 0, +0 >>> 0); new TestCase( SECTION, "-0 >>> 0", 0, -0 >>> 0 ); new TestCase( SECTION, "'Infinity' >>> 0", 0, "Infinity" >>> 0 ); new TestCase( SECTION, "'-Infinity' >>> 0", 0, "-Infinity" >>> 0); new TestCase( SECTION, "'+Infinity' >>> 0", 0, "+Infinity" >>> 0 ); new TestCase( SECTION, "Number.POSITIVE_INFINITY >>> 0", 0, Number.POSITIVE_INFINITY >>> 0 ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY >>> 0", 0, Number.NEGATIVE_INFINITY >>> 0 ); new TestCase( SECTION, "Number.NaN >>> 0", 0, Number.NaN >>> 0 ); new TestCase( SECTION, "Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 ); new TestCase( SECTION, "-Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 ); new TestCase( SECTION, "0.1 >>> 0", 0, 0.1 >>> 0 ); new TestCase( SECTION, "-0.1 >>> 0", 0, -0.1 >>> 0 ); new TestCase( SECTION, "1 >>> 0", 1, 1 >>> 0 ); new TestCase( SECTION, "1.1 >>> 0", 1, 1.1 >>> 0 ); new TestCase( SECTION, "-1.1 >>> 0", ToUint32(-1.1), -1.1 >>> 0 ); new TestCase( SECTION, "-1 >>> 0", ToUint32(-1), -1 >>> 0 ); new TestCase( SECTION, "2147483647 >>> 0", ToUint32(2147483647), 2147483647 >>> 0 ); new TestCase( SECTION, "2147483648 >>> 0", ToUint32(2147483648), 2147483648 >>> 0 ); new TestCase( SECTION, "2147483649 >>> 0", ToUint32(2147483649), 2147483649 >>> 0 ); new TestCase( SECTION, "4294967295 >>> 0", ToUint32(4294967295), 4294967295 >>> 0 ); new TestCase( SECTION, "4294967296 >>> 0", ToUint32(4294967296), 4294967296 >>> 0 ); new TestCase( SECTION, "4294967297 >>> 0", ToUint32(4294967297), 4294967297 >>> 0 ); new TestCase( SECTION, "-2147483647 >>> 0", ToUint32(-2147483647), -2147483647 >>> 0 ); new TestCase( SECTION, "-2147483648 >>> 0", ToUint32(-2147483648), -2147483648 >>> 0 ); new TestCase( SECTION, "-2147483649 >>> 0", ToUint32(-2147483649), -2147483649 >>> 0 ); new TestCase( SECTION, "-4294967295 >>> 0", ToUint32(-4294967295), -4294967295 >>> 0 ); new TestCase( SECTION, "-4294967296 >>> 0", ToUint32(-4294967296), -4294967296 >>> 0 ); new TestCase( SECTION, "-4294967297 >>> 0", ToUint32(-4294967297), -4294967297 >>> 0 ); new TestCase( SECTION, "'2147483647' >>> 0", ToUint32(2147483647), '2147483647' >>> 0 ); new TestCase( SECTION, "'2147483648' >>> 0", ToUint32(2147483648), '2147483648' >>> 0 ); new TestCase( SECTION, "'2147483649' >>> 0", ToUint32(2147483649), '2147483649' >>> 0 ); new TestCase( SECTION, "'4294967295' >>> 0", ToUint32(4294967295), '4294967295' >>> 0 ); new TestCase( SECTION, "'4294967296' >>> 0", ToUint32(4294967296), '4294967296' >>> 0 ); new TestCase( SECTION, "'4294967297' >>> 0", ToUint32(4294967297), '4294967297' >>> 0 ); test(); function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.7.js0000644000175000017500000002446711545150464022220 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.7.js ECMA Section: 9.7 Type Conversion: ToInt16 Description: rules for converting an argument to an unsigned 16 bit integer in the range 0 to 2^16-1. this test uses String.prototype.fromCharCode() and String.prototype.charCodeAt() to test ToInt16. special cases: -0 returns 0 Infinity returns 0 -Infinity returns 0 0 returns 0 Author: christine@netscape.com Date: 17 july 1997 */ var SECTION = "9.7"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " Type Conversion: ToInt16"); /* new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", 0, String.fromCharCode(0).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", 0, String.fromCharCode(-0).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", 1, String.fromCharCode(1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", 64, String.fromCharCode(64).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", 126, String.fromCharCode(126).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", 127, String.fromCharCode(127).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", 128, String.fromCharCode(128).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", 130, String.fromCharCode(130).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", 255, String.fromCharCode(255).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", 256, String.fromCharCode(256).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) ); */ new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", ToInt16(0), String.fromCharCode(0).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", ToInt16(0), String.fromCharCode(-0).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", ToInt16(1), String.fromCharCode(1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", ToInt16(64), String.fromCharCode(64).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", ToInt16(126), String.fromCharCode(126).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", ToInt16(127), String.fromCharCode(127).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", ToInt16(128), String.fromCharCode(128).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", ToInt16(130), String.fromCharCode(130).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", ToInt16(255), String.fromCharCode(255).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", ToInt16(256), String.fromCharCode(256).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(65535).charCodeAt(0)", ToInt16(65535), String.fromCharCode(65535).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(65536).charCodeAt(0)", ToInt16(65536), String.fromCharCode(65536).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(65537).charCodeAt(0)", ToInt16(65537), String.fromCharCode(65537).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(131071).charCodeAt(0)", ToInt16(131071), String.fromCharCode(131071).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(131072).charCodeAt(0)", ToInt16(131072), String.fromCharCode(131072).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(131073).charCodeAt(0)", ToInt16(131073), String.fromCharCode(131073).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode('65535').charCodeAt(0)", 65535, String.fromCharCode("65535").charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode('65536').charCodeAt(0)", 0, String.fromCharCode("65536").charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-1).charCodeAt(0)", ToInt16(-1), String.fromCharCode(-1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-64).charCodeAt(0)", ToInt16(-64), String.fromCharCode(-64).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-126).charCodeAt(0)", ToInt16(-126), String.fromCharCode(-126).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-127).charCodeAt(0)", ToInt16(-127), String.fromCharCode(-127).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-128).charCodeAt(0)", ToInt16(-128), String.fromCharCode(-128).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-130).charCodeAt(0)", ToInt16(-130), String.fromCharCode(-130).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-255).charCodeAt(0)", ToInt16(-255), String.fromCharCode(-255).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-256).charCodeAt(0)", ToInt16(-256), String.fromCharCode(-256).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(-Math.pow(2,16)).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-65535).charCodeAt(0)", ToInt16(-65535), String.fromCharCode(-65535).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-65536).charCodeAt(0)", ToInt16(-65536), String.fromCharCode(-65536).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-65537).charCodeAt(0)", ToInt16(-65537), String.fromCharCode(-65537).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-131071).charCodeAt(0)", ToInt16(-131071), String.fromCharCode(-131071).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-131072).charCodeAt(0)", ToInt16(-131072), String.fromCharCode(-131072).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode(-131073).charCodeAt(0)", ToInt16(-131073), String.fromCharCode(-131073).charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode('-65535').charCodeAt(0)", ToInt16(-65535), String.fromCharCode("-65535").charCodeAt(0) ); new TestCase( "9.7", "String.fromCharCode('-65536').charCodeAt(0)", ToInt16(-65536), String.fromCharCode("-65536").charCodeAt(0) ); // new TestCase( "9.7", "String.fromCharCode(2147483648).charCodeAt(0)", ToInt16(2147483648), String.fromCharCode(2147483648).charCodeAt(0) ); // the following test cases cause a runtime error. see: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=78878 // new TestCase( "9.7", "String.fromCharCode(Infinity).charCodeAt(0)", 0, String.fromCharCode("Infinity").charCodeAt(0) ); // new TestCase( "9.7", "String.fromCharCode(-Infinity).charCodeAt(0)", 0, String.fromCharCode("-Infinity").charCodeAt(0) ); // new TestCase( "9.7", "String.fromCharCode(NaN).charCodeAt(0)", 0, String.fromCharCode(Number.NaN).charCodeAt(0) ); // new TestCase( "9.7", "String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) ); // new TestCase( "9.7", "String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) ); test(); function ToInt16( num ) { num = Number( num ); if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) { return 0; } var sign = ( num < 0 ) ? -1 : 1; num = sign * Math.floor( Math.abs( num ) ); num = num % Math.pow(2,16); num = ( num > -65536 && num < 0) ? 65536 + num : num; return num; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.8.1.js0000644000175000017500000002116111545150464022344 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.8.1.js ECMA Section: 9.8.1 ToString Applied to the Number Type Description: The operator ToString convers a number m to string as follows: 1. if m is NaN, return the string "NaN" 2. if m is +0 or -0, return the string "0" 3. if m is less than zero, return the string concatenation of the string "-" and ToString(-m). 4. If m is Infinity, return the string "Infinity". 5. Otherwise, let n, k, and s be integers such that k >= 1, 10k1 <= s < 10k, the number value for s10nk is m, and k is as small as possible. Note that k is the number of digits in the decimal representation of s, that s is not divisible by 10, and that the least significant digit of s is not necessarily uniquely determined by these criteria. 6. If k <= n <= 21, return the string consisting of the k digits of the decimal representation of s (in order, with no leading zeroes), followed by n-k occurences of the character '0'. 7. If 0 < n <= 21, return the string consisting of the most significant n digits of the decimal representation of s, followed by a decimal point '.', followed by the remaining kn digits of the decimal representation of s. 8. If 6 < n <= 0, return the string consisting of the character '0', followed by a decimal point '.', followed by n occurences of the character '0', followed by the k digits of the decimal representation of s. 9. Otherwise, if k = 1, return the string consisting of the single digit of s, followed by lowercase character 'e', followed by a plus sign '+' or minus sign '' according to whether n1 is positive or negative, followed by the decimal representation of the integer abs(n1) (with no leading zeros). 10. Return the string consisting of the most significant digit of the decimal representation of s, followed by a decimal point '.', followed by the remaining k1 digits of the decimal representation of s, followed by the lowercase character 'e', followed by a plus sign '+' or minus sign '' according to whether n1 is positive or negative, followed by the decimal representation of the integer abs(n1) (with no leading zeros). Note that if x is any number value other than 0, then ToNumber(ToString(x)) is exactly the same number value as x. As noted, the least significant digit of s is not always uniquely determined by the requirements listed in step 5. The following specification for step 5 was considered, but not adopted: Author: christine@netscape.com Date: 10 july 1997 */ var SECTION = "9.8.1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " ToString applied to the Number type"); new TestCase( SECTION, "Number.NaN", "NaN", Number.NaN + "" ); new TestCase( SECTION, "0", "0", 0 + "" ); new TestCase( SECTION, "-0", "0", -0 + "" ); new TestCase( SECTION, "Number.POSITIVE_INFINITY", "Infinity", Number.POSITIVE_INFINITY + "" ); new TestCase( SECTION, "Number.NEGATIVE_INFINITY", "-Infinity", Number.NEGATIVE_INFINITY + "" ); new TestCase( SECTION, "-1", "-1", -1 + "" ); // cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21 new TestCase( SECTION, "1", "1", 1 + "" ); new TestCase( SECTION, "10", "10", 10 + "" ); new TestCase( SECTION, "100", "100", 100 + "" ); new TestCase( SECTION, "1000", "1000", 1000 + "" ); new TestCase( SECTION, "10000", "10000", 10000 + "" ); new TestCase( SECTION, "10000000000", "10000000000", 10000000000 + "" ); new TestCase( SECTION, "10000000000000000000", "10000000000000000000", 10000000000000000000 + "" ); new TestCase( SECTION, "100000000000000000000","100000000000000000000",100000000000000000000 + "" ); new TestCase( SECTION, "12345", "12345", 12345 + "" ); new TestCase( SECTION, "1234567890", "1234567890", 1234567890 + "" ); new TestCase( SECTION, "-1", "-1", -1 + "" ); new TestCase( SECTION, "-10", "-10", -10 + "" ); new TestCase( SECTION, "-100", "-100", -100 + "" ); new TestCase( SECTION, "-1000", "-1000", -1000 + "" ); new TestCase( SECTION, "-1000000000", "-1000000000", -1000000000 + "" ); new TestCase( SECTION, "-1000000000000000", "-1000000000000000", -1000000000000000 + "" ); new TestCase( SECTION, "-100000000000000000000", "-100000000000000000000", -100000000000000000000 + "" ); new TestCase( SECTION, "-1000000000000000000000", "-1e+21", -1000000000000000000000 + "" ); new TestCase( SECTION, "-12345", "-12345", -12345 + "" ); new TestCase( SECTION, "-1234567890", "-1234567890", -1234567890 + "" ); // cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21, new TestCase( SECTION, "1.0000001", "1.0000001", 1.0000001 + "" ); // cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0 // cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6 new TestCase( SECTION, "1000000000000000000000", "1e+21", 1000000000000000000000 + "" ); new TestCase( SECTION, "10000000000000000000000", "1e+22", 10000000000000000000000 + "" ); // cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6 new TestCase( SECTION, "1.2345", "1.2345", String( 1.2345)); new TestCase( SECTION, "1.234567890", "1.23456789", String( 1.234567890 )); new TestCase( SECTION, ".12345", "0.12345", String(.12345 ) ); new TestCase( SECTION, ".012345", "0.012345", String(.012345) ); new TestCase( SECTION, ".0012345", "0.0012345", String(.0012345) ); new TestCase( SECTION, ".00012345", "0.00012345", String(.00012345) ); new TestCase( SECTION, ".000012345", "0.000012345", String(.000012345) ); new TestCase( SECTION, ".0000012345", "0.0000012345", String(.0000012345) ); new TestCase( SECTION, ".00000012345", "1.2345e-7", String(.00000012345)); new TestCase( SECTION, "-1e21", "-1e+21", String(-1e21) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/9.9-1.js0000644000175000017500000001462511545150464022353 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 9.9-1.js ECMA Section: 9.9 Type Conversion: ToObject Description: undefined generate a runtime error null generate a runtime error boolean create a new Boolean object whose default value is the value of the boolean. number Create a new Number object whose default value is the value of the number. string Create a new String object whose default value is the value of the string. object Return the input argument (no conversion). Author: christine@netscape.com Date: 17 july 1997 */ var VERSION = "ECMA_1"; startTest(); var SECTION = "9.9-1"; writeHeaderToLog( SECTION + " Type Conversion: ToObject" ); new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() ); new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) ); new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() ); new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) ); new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() ); new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) ); new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() ); new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) ); new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() ); new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) ); new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() ); new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) ); new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) ); new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) ); new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) ); new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) ); new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() ); new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) ); new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() ); new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) ); new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() ); new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) ); new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() ); new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) ); new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() ); new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") ); new TestCase( SECTION, "Object( new MyObject(true) ).valueOf()", true, eval("Object( new MyObject(true) ).valueOf()") ); new TestCase( SECTION, "typeof Object( new MyObject(true) )", "object", eval("typeof Object( new MyObject(true) )") ); new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function ( "return this.value" ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/browser.js0000644000175000017500000000000011545150464023337 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/jstests.list0000644000175000017500000000041011545150464023717 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/TypeConversion/ script 9.2.js script 9.3-1.js script 9.3.1-1.js script 9.3.1-2.js script 9.3.1-3.js script 9.3.js script 9.4-1.js script 9.4-2.js script 9.5-2.js script 9.6.js script 9.7.js script 9.8.1.js script 9.9-1.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/TypeConversion/shell.js0000644000175000017500000000000011545150464022763 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Types/8.1.js0000644000175000017500000000507711545150464020322 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 8.1.js ECMA Section: The undefined type Description: The Undefined type has exactly one value, called undefined. Any variable that has not been assigned a value is of type Undefined. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "8.1"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The undefined type"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var x; typeof x", "undefined", eval("var x; typeof x") ); new TestCase( SECTION, "var x; typeof x == 'undefined", true, eval("var x; typeof x == 'undefined'") ); new TestCase( SECTION, "var x; x == void 0", true, eval("var x; x == void 0") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Types/8.4.js0000644000175000017500000000743011545150464020320 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 8.4.js ECMA Section: The String type Description: The String type is the set of all finite ordered sequences of zero or more Unicode characters. Each character is regarded as occupying a position within the sequence. These positions are identified by nonnegative integers. The leftmost character (if any) is at position 0, the next character (if any) at position 1, and so on. The length of a string is the number of distinct positions within it. The empty string has length zero and therefore contains no characters. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "8.4"; var VERSION = "ECMA_1"; startTest(); var TITLE = "The String type"; writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "var s = ''; s.length", 0, eval("var s = ''; s.length") ); new TestCase( SECTION, "var s = ''; s.charAt(0)", "", eval("var s = ''; s.charAt(0)") ); for ( var i = 0x0041, TEST_STRING = "", EXPECT_STRING = ""; i < 0x007B; i++ ) { TEST_STRING += ("\\u"+ DecimalToHexString( i ) ); EXPECT_STRING += String.fromCharCode(i); } new TestCase( SECTION, "var s = '" + TEST_STRING+ "'; s", EXPECT_STRING, eval("var s = '" + TEST_STRING+ "'; s") ); new TestCase( SECTION, "var s = '" + TEST_STRING+ "'; s.length", 0x007B-0x0041, eval("var s = '" + TEST_STRING+ "'; s.length") ); test(); function DecimalToHexString( n ) { n = Number( n ); var h = ""; for ( var i = 3; i >= 0; i-- ) { if ( n >= Math.pow(16, i) ){ var t = Math.floor( n / Math.pow(16, i)); n -= t * Math.pow(16, i); if ( t >= 10 ) { if ( t == 10 ) { h += "A"; } if ( t == 11 ) { h += "B"; } if ( t == 12 ) { h += "C"; } if ( t == 13 ) { h += "D"; } if ( t == 14 ) { h += "E"; } if ( t == 15 ) { h += "F"; } } else { h += String( t ); } } else { h += "0"; } } return h; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Types/8.6.2.1-1.js0000644000175000017500000000617611545150464020765 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 8.6.2.1-1.js ECMA Section: 8.6.2.1 Get (Value) Description: When the [[Get]] method of O is called with property name P, the following steps are taken: 1. If O doesn't have a property with name P, go to step 4. 2. Get the value of the property. 3. Return Result(2). 4. If the [[Prototype]] of O is null, return undefined. 5. Call the [[Get]] method of [[Prototype]] with property name P. 6. Return Result(5). This tests [[Get]] (Value). Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "8.6.2.1-1"; var VERSION = "ECMA_1"; startTest(); writeHeaderToLog( SECTION + " [[Get]] (Value)"); new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") ); new TestCase( SECTION, "var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") ); new TestCase( SECTION, "var OBJ = new MyObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyObject('string'); OBJ.valueOf()") ); test(); function MyObject( value ) { this.valueOf = new Function( "return this.value" ); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Types/browser.js0000644000175000017500000000000011545150464021454 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Types/jstests.list0000644000175000017500000000014111545150464022035 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma/Types/ script 8.1.js script 8.4.js script 8.6.2.1-1.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma/Types/shell.js0000644000175000017500000000000011545150464021100 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/boolean-001.js0000644000175000017500000000532411545150464023162 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: boolean-001.js Description: Corresponds to ecma/Boolean/15.6.4.2-4-n.js The toString function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: june 27, 1997 */ var SECTION = "boolean-001.js"; var VERSION = "JS1_4"; var TITLE = "Boolean.prototype.toString()"; startTest(); writeHeaderToLog( SECTION +" "+ TITLE ); var exception = "No exception thrown"; var result = "Failed"; var TO_STRING = Boolean.prototype.toString; try { var s = new String("Not a Boolean"); s.toString = TO_STRING; s.toString(); } catch ( e ) { result = "Passed!"; exception = e.toString(); } new TestCase( SECTION, "Assigning Boolean.prototype.toString to a String object "+ "(threw " +exception +")", "Passed!", result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/boolean-002.js0000644000175000017500000000543111545150464023162 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: boolean-001.js Description: Corresponds to ecma/Boolean/15.6.4.3-4-n.js 15.6.4.3 Boolean.prototype.valueOf() Returns this boolean value. The valueOf function is not generic; it generates a runtime error if its this value is not a Boolean object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 09 september 1998 */ var SECTION = "boolean-002.js"; var VERSION = "JS1_4"; var TITLE = "Boolean.prototype.valueOf()"; startTest(); writeHeaderToLog( SECTION +" "+ TITLE ); var exception = "No exception thrown"; var result = "Failed"; var VALUE_OF = Boolean.prototype.valueOf; try { var s = new String("Not a Boolean"); s.valueOf = VALUE_0F; s.valueOf(); } catch ( e ) { result = "Passed!"; exception = e.toString(); } new TestCase( SECTION, "Assigning Boolean.prototype.valueOf to a String object "+ "(threw " +exception +")", "Passed!", result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/browser.js0000644000175000017500000000000011545150464022712 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/date-001.js0000644000175000017500000000625011545150464022457 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: date-001.js Corresponds To: 15.9.5.2-2.js ECMA Section: 15.9.5.2 Date.prototype.toString Description: This function returns a string value. The contents of the string are implementation dependent, but are intended to represent the Date in a convenient, human-readable form in the current time zone. The toString function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. This verifies that calling toString on an object that is not a string generates a runtime error. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "date-001"; var VERSION = "JS1_4"; var TITLE = "Date.prototype.toString"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var OBJ = new MyObject( new Date(0) ); result = OBJ.toString(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "OBJECT = new MyObject( new Date(0)) ; result = OBJ.toString()" + " (threw " + exception +")", expect, result ); test(); function MyObject( value ) { this.value = value; this.valueOf = new Function( "return this.value" ); this.toString = Date.prototype.toString; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/date-002.js0000644000175000017500000000555111545150464022463 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: date-002.js Corresponds To: 15.9.5.23-3-n.js ECMA Section: 15.9.5.23 Description: Date.prototype.setTime 1. If the this value is not a Date object, generate a runtime error. 2. Call ToNumber(time). 3. Call TimeClip(Result(1)). 4. Set the [[Value]] property of the this value to Result(2). 5. Return the value of the [[Value]] property of the this value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "date-002"; var VERSION = "JS1_4"; var TITLE = "Date.prototype.setTime()"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var MYDATE = new MyDate(); result = MYDATE.setTime(0); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "MYDATE = new MyDate(); MYDATE.setTime(0)" + " (threw " + exception +")", expect, result ); test(); function MyDate(value) { this.value = value; this.setTime = Date.prototype.setTime; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/date-003.js0000644000175000017500000000572711545150464022471 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: date-003.js Corresponds To 15.9.5.3-1.js ECMA Section: 15.9.5.3-1 Date.prototype.valueOf Description: The valueOf function returns a number, which is this time value. The valueOf function is not generic; it generates a runtime error if its this value is not a Date object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "date-003"; var VERSION = "JS1_4"; var TITLE = "Date.prototype.valueOf"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var OBJ = new MyObject( new Date(0) ); result = OBJ.valueOf(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "OBJ = new MyObject( new Date(0)); OBJ.valueOf()" + " (threw " + exception +")", expect, result ); test(); function MyObject( value ) { this.value = value; this.valueOf = Date.prototype.valueOf; // The following line causes an infinte loop // this.toString = new Function( "return this+\"\";"); return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/date-004.js0000644000175000017500000000531511545150464022463 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: date-004.js Corresponds To: 15.9.5.4-2-n.js ECMA Section: 15.9.5.4-1 Date.prototype.getTime Description: 1. If the this value is not an object whose [[Class]] property is "Date", generate a runtime error. 2. Return this time value. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "date-004"; var VERSION = "JS1_4"; var TITLE = "Date.prototype.getTime"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var MYDATE = new MyDate(); result = MYDATE.getTime(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "MYDATE = new MyDate(); MYDATE.getTime()" + " (threw " + exception +")", expect, result ); test(); function MyDate( value ) { this.value = value; this.getTime = Date.prototype.getTime; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/exception-001.js0000644000175000017500000000503011545150464023533 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: exception-001 * ECMA Section: * Description: Tests for JavaScript Standard Exceptions * * Call error. * * Author: christine@netscape.com * Date: 31 August 1998 */ var SECTION = "exception-001"; var VERSION = "js1_4"; var TITLE = "Tests for JavaScript Standard Exceptions: CallError"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); Call_1(); test(); function Call_1() { result = "failed: no exception thrown"; exception = null; try { Math(); } catch ( e ) { result = "passed: threw exception", exception = e.toString(); } finally { new TestCase( SECTION, "Math() [ exception is " + exception +" ]", "passed: threw exception", result ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/exception-002.js0000644000175000017500000000507411545150464023544 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: exception-002 * ECMA Section: * Description: Tests for JavaScript Standard Exceptions * * Construct error. * * Author: christine@netscape.com * Date: 31 August 1998 */ var SECTION = "exception-002"; var VERSION = "js1_4"; var TITLE = "Tests for JavaScript Standard Exceptions: ConstructError"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); Construct_1(); test(); function Construct_1() { result = "failed: no exception thrown"; exception = null; try { result = new Math(); } catch ( e ) { result = "passed: threw exception", exception = e.toString(); } finally { new TestCase( SECTION, "new Math() [ exception is " + exception +" ]", "passed: threw exception", result ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/exception-003.js0000644000175000017500000000534311545150464023544 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: exception-003 * ECMA Section: * Description: Tests for JavaScript Standard Exceptions * * Target error. * * Author: christine@netscape.com * Date: 31 August 1998 */ var SECTION = "exception-003"; var VERSION = "js1_4"; var TITLE = "Tests for JavaScript Standard Exceptions: TargetError"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); Target_1(); test(); function Target_1() { result = "failed: no exception thrown"; exception = null; try { string = new String("hi"); string.toString = Boolean.prototype.toString; string.toString(); } catch ( e ) { result = "passed: threw exception", exception = e.toString(); } finally { new TestCase( SECTION, "string = new String(\"hi\");"+ "string.toString = Boolean.prototype.toString" + "string.toString() [ exception is " + exception +" ]", "passed: threw exception", result ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/exception-004.js0000644000175000017500000000507211545150464023544 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: exception-004 * ECMA Section: * Description: Tests for JavaScript Standard Exceptions * * ToObject error. * * Author: christine@netscape.com * Date: 31 August 1998 */ var SECTION = "exception-004"; var VERSION = "js1_4"; var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); ToObject_1(); test(); function ToObject_1() { result = "failed: no exception thrown"; exception = null; try { result = foo["bar"]; } catch ( e ) { result = "passed: threw exception", exception = e.toString(); } finally { new TestCase( SECTION, "foo[\"bar\"] [ exception is " + exception +" ]", "passed: threw exception", result ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/exception-005.js0000644000175000017500000000507211545150464023545 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: exception-005 * ECMA Section: * Description: Tests for JavaScript Standard Exceptions * * ToObject error. * * Author: christine@netscape.com * Date: 31 August 1998 */ var SECTION = "exception-005"; var VERSION = "js1_4"; var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); ToObject_1(); test(); function ToObject_1() { result = "failed: no exception thrown"; exception = null; try { result = foo["bar"]; } catch ( e ) { result = "passed: threw exception", exception = e.toString(); } finally { new TestCase( SECTION, "foo[\"bar\"] [ exception is " + exception +" ]", "passed: threw exception", result ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/exception-006.js0000644000175000017500000000545611545150464023554 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: exception-006 * ECMA Section: * Description: Tests for JavaScript Standard Exceptions * * ToPrimitive error. * * Author: christine@netscape.com * Date: 31 August 1998 */ var SECTION = "exception-006"; var VERSION = "js1_4"; var TITLE = "Tests for JavaScript Standard Exceptions: TypeError"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); ToPrimitive_1(); test(); /** * Getting the [[DefaultValue]] of any instances of MyObject * should result in a runtime error in ToPrimitive. */ function MyObject() { this.toString = void 0; this.valueOf = void 0; } function ToPrimitive_1() { result = "failed: no exception thrown"; exception = null; try { result = new MyObject() + new MyObject(); } catch ( e ) { result = "passed: threw exception", exception = e.toString(); } finally { new TestCase( SECTION, "new MyObject() + new MyObject() [ exception is " + exception +" ]", "passed: threw exception", result ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/exception-007.js0000644000175000017500000000552011545150464023545 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: exception-007 * ECMA Section: * Description: Tests for JavaScript Standard Exceptions * * DefaultValue error. * * Author: christine@netscape.com * Date: 31 August 1998 */ var SECTION = "exception-007"; var VERSION = "js1_4"; var TITLE = "Tests for JavaScript Standard Exceptions: TypeError"; var BUGNUMBER="318250"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); DefaultValue_1(); test(); /** * Getting the [[DefaultValue]] of any instances of MyObject * should result in a runtime error in ToPrimitive. */ function MyObject() { this.toString = void 0; this.valueOf = new Object(); } function DefaultValue_1() { result = "failed: no exception thrown"; exception = null; try { result = new MyObject() + new MyObject(); } catch ( e ) { result = "passed: threw exception", exception = e.toString(); } finally { new TestCase( SECTION, "new MyObject() + new MyObject() [ exception is " + exception +" ]", "passed: threw exception", result ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/exception-008.js0000644000175000017500000000507511545150464023553 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: exception-008 * ECMA Section: * Description: Tests for JavaScript Standard Exceptions * * SyntaxError. * * Author: christine@netscape.com * Date: 31 August 1998 */ var SECTION = "exception-008"; var VERSION = "js1_4"; var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); Syntax_1(); test(); function Syntax_1() { result = "failed: no exception thrown"; exception = null; try { result = eval("continue;"); } catch ( e ) { result = "passed: threw exception", exception = e.toString(); } finally { new TestCase( SECTION, "eval(\"continue\") [ exception is " + exception +" ]", "passed: threw exception", result ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/exception-009.js0000644000175000017500000000516411545150464023553 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: exception-009 * ECMA Section: * Description: Tests for JavaScript Standard Exceptions * * Regression test for nested try blocks. * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=312964 * * Author: christine@netscape.com * Date: 31 August 1998 */ var SECTION = "exception-009"; var VERSION = "JS1_4"; var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError"; var BUGNUMBER= "312964"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); try { expect = "passed: no exception thrown"; result = expect; Nested_1(); } catch ( e ) { result = "failed: threw " + e; } finally { new TestCase( SECTION, "nested try", expect, result ); } test(); function Nested_1() { try { try { } catch (a) { } finally { } } catch (b) { } finally { } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/exception-010-n.js0000644000175000017500000000433411545150464023774 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Ginda rginda@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var SECTION = "exception-010"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Don't Crash throwing null"; writeHeaderToLog( SECTION + " "+ TITLE); print("Null throw test."); print("BUGNUMBER: 21799"); DESCRIPTION = "throw null"; EXPECTED = "error"; new TestCase( SECTION, "throw null", "error", eval("throw null" )); test(); print("FAILED!: Should have exited with uncaught exception."); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/exception-011-n.js0000644000175000017500000000432511545150464023775 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Ginda rginda@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var SECTION = "exception-011"; var VERSION = "ECMA_2"; startTest(); var TITLE = "Don't Crash throwing undefined"; writeHeaderToLog( SECTION + " "+ TITLE); print("Undefined throw test."); DESCRIPTION = "throw undefined"; EXPECTED = "error"; new TestCase( SECTION, "throw undefined", "error", eval("throw (void 0)") ); test(); print("FAILED!: Should have exited with uncaught exception."); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-001.js0000644000175000017500000000601111545150464023734 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-001.js Corresponds to: ecma/Expressions/11.12-2-n.js ECMA Section: 11.12 Description: The grammar for a ConditionalExpression in ECMAScript is a little bit different from that in C and Java, which each allow the second subexpression to be an Expression but restrict the third expression to be a ConditionalExpression. The motivation for this difference in ECMAScript is to allow an assignment expression to be governed by either arm of a conditional and to eliminate the confusing and fairly useless case of a comma expression as the center expression. Author: christine@netscape.com Date: 09 september 1998 */ var SECTION = "expression-001"; var VERSION = "JS1_4"; var TITLE = "Conditional operator ( ? : )" startTest(); writeHeaderToLog( SECTION + " " + TITLE ); // the following expression should be an error in JS. var result = "Failed" var exception = "No exception was thrown"; try { eval("var MY_VAR = true ? \"EXPR1\", \"EXPR2\" : \"EXPR3\""); } catch ( e ) { result = "Passed"; exception = e.toString(); } new TestCase( SECTION, "comma expression in a conditional statement "+ "(threw "+ exception +")", "Passed", result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-002.js0000644000175000017500000000572511545150464023750 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expressions-002.js Corresponds to: ecma/Expressions/11.2.1-3-n.js ECMA Section: 11.2.1 Property Accessors Description: Try to access properties of an object whose value is undefined. Author: christine@netscape.com Date: 09 september 1998 */ var SECTION = "expressions-002.js"; var VERSION = "JS1_4"; var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); startTest(); // go through all Native Function objects, methods, and properties and get their typeof. var PROPERTY = new Array(); var p = 0; // try to access properties of primitive types OBJECT = new Property( "undefined", void 0, "undefined", NaN ); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = OBJECT.value.valueOf(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "Get the value of an object whose value is undefined "+ "(threw " + exception +")", expect, result ); test(); function Property( object, value, string, number ) { this.object = object; this.string = String(value); this.number = Number(value); this.valueOf = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-003.js0000644000175000017500000000554111545150464023745 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expressions-003.js Corresponds to: ecma/Expressions/11.2.1-3-n.js ECMA Section: 11.2.1 Property Accessors Description: Try to access properties of an object whose value is undefined. Author: christine@netscape.com Date: 09 september 1998 */ var SECTION = "expressions-003.js"; var VERSION = "JS1_4"; var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); startTest(); // try to access properties of primitive types OBJECT = new Property( "undefined", void 0, "undefined", NaN ); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = OBJECT.value.toString(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "Get the toString value of an object whose value is undefined "+ "(threw " + exception +")", expect, result ); test(); function Property( object, value, string, number ) { this.object = object; this.string = String(value); this.number = Number(value); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-004.js0000644000175000017500000000527611545150464023753 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-004.js Corresponds To: 11.2.1-4-n.js ECMA Section: 11.2.1 Property Accessors Description: Author: christine@netscape.com Date: 09 september 1998 */ var SECTION = "expression-004"; var VERSION = "JS1_4"; var TITLE = "Property Accessors"; writeHeaderToLog( SECTION + " "+TITLE ); startTest(); var OBJECT = new Property( "null", null, "null", 0 ); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = OBJECT.value.toString(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "Get the toString value of an object whose value is null "+ "(threw " + exception +")", expect, result ); test(); function Property( object, value, string, number ) { this.object = object; this.string = String(value); this.number = Number(value); this.value = value; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-005.js0000644000175000017500000000464511545150464023753 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-005.js Corresponds To: 11.2.2-10-n.js ECMA Section: 11.2.2. The new operator Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-005"; var VERSION = "JS1_4"; var TITLE = "The new operator"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var expect = "Passed"; var exception = "No exception thrown"; try { result = new Math(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "result= new Math() (threw " + exception + ")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-006.js0000644000175000017500000000505611545150464023751 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-006.js Corresponds to: 11.2.2-1-n.js ECMA Section: 11.2.2. The new operator Description: http://scopus/bugsplat/show_bug.cgi?id=327765 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-006.js"; var VERSION = "JS1_4"; var TITLE = "The new operator"; var BUGNUMBER="327765"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var OBJECT = new Object(); result = new OBJECT(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "OBJECT = new Object; result = new OBJECT()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-007.js0000644000175000017500000000474011545150464023751 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-007.js Corresponds To: 11.2.2-2-n.js ECMA Section: 11.2.2. The new operator Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-007"; var VERSION = "JS1_4"; var TITLE = "The new operator"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { UNDEFINED = void 0; result = new UNDEFINED(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "UNDEFINED = void 0; result = new UNDEFINED()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-008.js0000644000175000017500000000470411545150464023752 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-008 Corresponds To: 11.2.2-3-n.js ECMA Section: 11.2.2. The new operator Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-008"; var VERSION = "JS1_4"; var TITLE = "The new operator"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var NULL = null; var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = new NULL(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "NULL = null; result = new NULL()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-009.js0000644000175000017500000000473211545150464023754 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-009 Corresponds to: ecma/Expressions/11.2.2-4-n.js ECMA Section: 11.2.2. The new operator Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-009"; var VERSION = "JS1_4"; var TITLE = "The new operator"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var STRING = ""; var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = new STRING(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "STRING = ''; result = new STRING()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-010.js0000644000175000017500000000471111545150464023741 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-010.js Corresponds To: 11.2.2-5-n.js ECMA Section: 11.2.2. The new operator Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-010"; var VERSION = "JS1_4"; var TITLE = "The new operator"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var NUMBER = 0; var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = new NUMBER(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "NUMBER=0, result = new NUMBER()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-011.js0000644000175000017500000000475311545150464023750 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-011.js Corresponds To: ecma/Expressions/11.2.2-6-n.js ECMA Section: 11.2.2. The new operator Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-011"; var VERSION = "JS1_4"; var TITLE = "The new operator"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var BOOLEAN = true; var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var OBJECT = new BOOLEAN(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "BOOLEAN = true; result = new BOOLEAN()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-012.js0000644000175000017500000000510511545150464023741 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-012.js Corresponds To: ecma/Expressions/11.2.2-6-n.js ECMA Section: 11.2.2. The new operator Description: http://scopus/bugsplat/show_bug.cgi?id=327765 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-012"; var VERSION = "JS1_4"; var TITLE = "The new operator"; var BUGNUMBER= "327765"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var STRING = new String("hi"); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = new STRING(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "STRING = new String(\"hi\"); result = new STRING()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-013.js0000644000175000017500000000501511545150464023742 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-013.js Corresponds To: ecma/Expressions/11.2.2-8-n.js ECMA Section: 11.2.2. The new operator Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-013"; var VERSION = "JS1_4"; var TITLE = "The new operator"; var BUGNUMBER= "327765"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var NUMBER = new Number(1); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = new NUMBER(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "NUMBER = new Number(1); result = new NUMBER()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-014.js0000644000175000017500000000502711545150464023746 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-014.js Corresponds To: ecma/Expressions/11.2.2-9-n.js ECMA Section: 11.2.2. The new operator Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-014.js"; var VERSION = "ECMA_1"; var TITLE = "The new operator"; var BUGNUMBER= "327765"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var BOOLEAN = new Boolean(); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = new BOOLEAN(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "BOOLEAN = new Boolean(); result = new BOOLEAN()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-015.js0000644000175000017500000000467011545150464023752 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-015.js Corresponds To: ecma/Expressions/11.2.3-2-n.js ECMA Section: 11.2.3. Function Calls Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-015"; var VERSION = "JS1_4"; var TITLE = "Function Calls"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("result = 3.valueOf();"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "3.valueOf()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-016.js0000644000175000017500000000467511545150464023760 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-016.js Corresponds To: ecma/Expressions/11.2.3-3-n.js ECMA Section: 11.2.3. Function Calls Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-016"; var VERSION = "JS1_4"; var TITLE = "Function Calls"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = (void 0).valueOf(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "(void 0).valueOf()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-017.js0000644000175000017500000000466311545150464023756 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-07.js Corresponds To: ecma/Expressions/11.2.3-4-n.js ECMA Section: 11.2.3. Function Calls Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-017"; var VERSION = "JS1_4"; var TITLE = "Function Calls"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = nullvalueOf(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "null.valueOf()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/expression-019.js0000644000175000017500000000501411545150464023747 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: expression-019.js Corresponds To: 11.2.2-7-n.js ECMA Section: 11.2.2. The new operator Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "expression-019"; var VERSION = "JS1_4"; var TITLE = "The new operator"; var BUGNUMBER= "327765"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var STRING = new String("hi"); result = new STRING(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var STRING = new String(\"hi\"); result = new STRING();" + " (threw " + exception + ")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/function-001.js0000644000175000017500000000555711545150464023400 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: boolean-001.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 * * eval("function f(){}function g(){}") at top level is an error for JS1.2 * and above (missing ; between named function expressions), but declares f * and g as functions below 1.2. * * Fails to produce error regardless of version: * js> version(100) * 120 * js> eval("function f(){}function g(){}") * js> version(120); * 100 * js> eval("function f(){}function g(){}") * js> * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "function-001.js"; var VERSION = "JS_12"; var TITLE = "functions not separated by semicolons are errors in version 120 and higher"; var BUGNUMBER="10278"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "pass"; var exception = "no exception thrown"; try { eval("function f(){}function g(){}"); } catch ( e ) { result = "fail"; exception = e.toString(); } new TestCase( SECTION, "eval(\"function f(){}function g(){}\") (threw "+exception, "pass", result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/global-001.js0000644000175000017500000000510011545150464022773 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: global-001 Corresponds To: ecma/GlobalObject/15.1-1-n.js ECMA Section: The global object Description: The global object does not have a [[Construct]] property; it is not possible to use the global object as a constructor with the new operator. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "global-001"; var VERSION = "ECMA_1"; var TITLE = "The Global Object"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = new this(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "result = new this()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/global-002.js0000644000175000017500000000506711545150464023010 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: global-002 Corresponds To: ecma/GlobalObject/15.1-2-n.js ECMA Section: The global object Description: The global object does not have a [[Construct]] property; it is not possible to use the global object as a constructor with the new operator. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "global-002"; var VERSION = "JS1_4"; var TITLE = "The Global Object"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = this(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "result = this()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/jstests.list0000644000175000017500000000456611545150464023312 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_2/Exceptions/ script boolean-001.js script boolean-002.js script date-001.js script date-002.js script date-003.js script date-004.js script exception-001.js script exception-002.js script exception-003.js script exception-004.js script exception-005.js script exception-006.js script exception-007.js script exception-008.js script exception-009.js script exception-010-n.js script exception-011-n.js script expression-001.js script expression-002.js script expression-003.js script expression-004.js script expression-005.js script expression-006.js script expression-007.js script expression-008.js script expression-009.js script expression-010.js script expression-011.js script expression-012.js script expression-013.js script expression-014.js script expression-015.js script expression-016.js script expression-017.js script expression-019.js script function-001.js script global-001.js script global-002.js script lexical-001.js script lexical-002.js script lexical-003.js script lexical-004.js script lexical-005.js script lexical-006.js script lexical-007.js script lexical-008.js script lexical-009.js skip script lexical-010.js # obsolete test script lexical-011.js script lexical-012.js script lexical-013.js script lexical-014.js script lexical-015.js script lexical-016.js script lexical-017.js script lexical-018.js script lexical-019.js script lexical-020.js script lexical-021.js skip script lexical-022.js # obsolete test script lexical-023.js script lexical-024.js script lexical-025.js script lexical-026.js script lexical-027.js script lexical-028.js script lexical-029.js script lexical-030.js script lexical-031.js script lexical-032.js script lexical-033.js script lexical-034.js script lexical-035.js script lexical-036.js script lexical-037.js script lexical-038.js script lexical-039.js script lexical-040.js script lexical-041.js script lexical-042.js script lexical-047.js script lexical-048.js script lexical-049.js script lexical-050.js script lexical-051.js script lexical-052.js script lexical-053.js script lexical-054.js script number-001.js script number-002.js script number-003.js script statement-001.js script statement-002.js script statement-003.js script statement-004.js script statement-005.js script statement-006.js script statement-007.js script statement-008.js script statement-009.js script string-001.js script string-002.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-001.js0000644000175000017500000000570211545150464023164 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-001.js CorrespondsTo: ecma/LexicalConventions/7.2.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r this test uses onerror to capture line numbers. because we use on error, we can only have one test case per file. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "lexical-001"; var VERSION = "JS1_4"; var TITLE = "Line Terminators"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = eval("\r\n\expect"); } catch ( e ) { exception = e.toString(); } new TestCase( SECTION, "OBJECT = new Object; result = new OBJECT()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-002.js0000644000175000017500000000566711545150464023177 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-002.js Corresponds To: ecma/LexicalConventions/7.2-3-n.js ECMA Section: 7.2 Line Terminators Description: - readability - separate tokens - may occur between any two tokens - cannot occur within any token, not even a string - affect the process of automatic semicolon insertion. white space characters are: unicode name formal name string representation \u000A line feed \n \u000D carriage return \r this test uses onerror to capture line numbers. because we use on error, we can only have one test case per file. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "lexical-002"; var VERSION = "JS1_4"; var TITLE = "Line Terminators"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { result = eval("\r\n\expect"); } catch ( e ) { exception = e.toString(); } new TestCase( SECTION, "result=eval(\"\r\nexpect\")" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-003.js0000644000175000017500000000465211545150464023171 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-003.js Corresponds To: 7.3-13-n.js ECMA Section: 7.3 Comments Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-003.js"; var VERSION = "JS1_4"; var TITLE = "Comments"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("/*\n/* nested comment */\n*/\n"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "/*/*nested comment*/ */" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-004.js0000644000175000017500000000505411545150464023167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-004.js Corresponds To: ecma/LexicalExpressions/7.4.1-1-n.js ECMA Section: 7.4.1 Description: Reserved words cannot be used as identifiers. ReservedWord :: Keyword FutureReservedWord NullLiteral BooleanLiteral Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-004"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var null = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var null = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-005.js0000644000175000017500000000501411545150464023164 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-005.js Corresponds To: 7.4.1-2.js ECMA Section: 7.4.1 Description: Reserved words cannot be used as identifiers. ReservedWord :: Keyword FutureReservedWord NullLiteral BooleanLiteral Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-005"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("true = false;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "true = false" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-006.js0000644000175000017500000000563111545150464023172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-006.js Corresponds To: 7.4.2-1.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-006"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("break = new Object();"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "break = new Object()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-007.js0000644000175000017500000000501511545150464023167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-005.js Corresponds To: 7.4.1-3-n.js ECMA Section: 7.4.1 Description: Reserved words cannot be used as identifiers. ReservedWord :: Keyword FutureReservedWord NullLiteral BooleanLiteral Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-005"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("false = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "false = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-008.js0000644000175000017500000000540111545150464023167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-008.js Corresponds To: 7.4.3-1-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-008.js"; var VERSION = "JS1_4"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("case = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "case = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-009.js0000644000175000017500000000540411545150464023173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-009 Corresponds To: 7.4.3-2-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-009"; var VERSION = "ECMA_1"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("debugger = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "debugger = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-010.js0000644000175000017500000000540111545150464023160 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-010.js Corresponds To: 7.4.3-3-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-010"; var VERSION = "ECMA_1"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("export = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "export = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-011.js0000644000175000017500000000567011545150464023171 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-011.js Corresponds To: 7.4.3-4-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-011"; var VERSION = "JS1_4"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("super = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "super = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-012.js0000644000175000017500000000540011545150464023161 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-012.js Corresponds To: 7.4.3-5-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-012"; var VERSION = "JS1_4"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("catch = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "catch = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-013.js0000644000175000017500000000540411545150464023166 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-013.js Corresponds To: 7.4.3-6-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-013"; var VERSION = "JS1_4"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("default = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "default = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-014.js0000644000175000017500000000567711545150464023203 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-014.js Corresponds To: 7.4.3-7-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-014.js"; var VERSION = "JS1_4"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("extends = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "extends = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-015.js0000644000175000017500000000540211545150464023166 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-015.js Corresponds To: 7.4.3-8-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-015"; var VERSION = "JS1_4"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("switch = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "switch = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-016.js0000644000175000017500000000566511545150464023202 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-016 Corresponds To: 7.4.3-9-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-016"; var VERSION = "JS1_4"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("class = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "class = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-017.js0000644000175000017500000000537411545150464023200 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-017.js Corresponds To: 7.4.3-10-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-017"; var VERSION = "JS1_4"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("do = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "do = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-018.js0000644000175000017500000000540211545150464023171 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-018 Corresponds To: 7.4.3-11-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-018"; var VERSION = "JS1_4"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("finally = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "finally = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-019.js0000644000175000017500000000540111545150464023171 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-019.js Corresponds To: 7.4.3-12-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-019"; var VERSION = "JS1_4"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("throw = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "throw = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-020.js0000644000175000017500000000540111545150464023161 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-020.js Corresponds To 7.4.3-13-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-020"; var VERSION = "JS1_4"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("const = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "const = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-021.js0000644000175000017500000000567311545150464023175 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-021.js Corresponds To: 7.4.3-14-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-021.js"; var VERSION = "ECMA_1"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("enum = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "enum = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-022.js0000644000175000017500000000540411545150464023166 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-022 Corresponds To 7.4.3-15-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-022.js"; var VERSION = "ECMA_1"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("import = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "import = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-023.js0000644000175000017500000000540011545150464023163 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-023.js Corresponds To: 7.4.3-16-n.js ECMA Section: 7.4.3 Description: The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions. FutureReservedWord :: one of case debugger export super catch default extends switch class do finally throw const enum import try Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-023.js"; var VERSION = "ECMA_1"; var TITLE = "Future Reserved Words"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("try = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "try = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-024.js0000644000175000017500000000560311545150464023171 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-024 Corresponds To: 7.4.2-1-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-024"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var break;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var break" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-025.js0000644000175000017500000000560211545150464023171 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-025.js Corresponds To 7.4.2-2-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-025"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var for;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var for" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-026.js0000644000175000017500000000560211545150464023172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-026.js Corresponds To: 7.4.2-3-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-026"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var new;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var new" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-027.js0000644000175000017500000000561211545150464023174 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-027.js Corresponds To: 7.4.2-4-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax var Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-027"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var var;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var var" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-028.js0000644000175000017500000000562611545150464023202 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-028.js Corresponds To: 7.4.2-5-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-028"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var continue=true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var continue=true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-029.js0000644000175000017500000000563011545150464023176 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-029.js Corresponds To: 7.4.2-6.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-029"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var function = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var function = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-030.js0000644000175000017500000000562611545150464023173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-030.js Corresponds To: 7.4.2-7-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-030"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var return = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var return = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-031.js0000644000175000017500000000561011545150464023165 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-031.js Corresponds To: 7.4.2-8-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-031"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var return;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var return" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-032.js0000644000175000017500000000561611545150464023174 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-032.js Corresponds To: 7.4.2-9-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-032"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("delete = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "delete = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-033.js0000644000175000017500000000560511545150464023173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-033.js Corresponds To: 7.4.2-10.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-033"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("if = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "if = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-034.js0000644000175000017500000000554411545150464023176 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 7.4.2-11-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-034"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("this = true"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "this = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-035.js0000644000175000017500000000560611545150464023176 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-035.js Correpsonds To: 7.4.2-12-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-035"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var while"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var while" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-036.js0000644000175000017500000000561311545150464023175 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-036.js Corresponds To: 7.4.2-13-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-036"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("else = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "else = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-037.js0000644000175000017500000000560111545150464023173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-037.js Corresponds To: 7.4.2-14-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-028"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var in;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var in" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-038.js0000644000175000017500000000561711545150464023203 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-038.js Corresponds To: 7.4.2-15-n.js ECMA Section: 7.4.2 Description: The following tokens are ECMAScript keywords and may not be used as identifiers in ECMAScript programs. Syntax Keyword :: one of break for new var continue function return void delete if this while else in typeof with This test verifies that the keyword cannot be used as an identifier. Functioinal tests of the keyword may be found in the section corresponding to the function of the keyword. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "lexical-038"; var VERSION = "JS1_4"; var TITLE = "Keywords"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("typeof = true;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "typeof = true" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-039.js0000644000175000017500000000507311545150464023200 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-039 Corresponds To: 7.5-2-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "lexical-039"; var VERSION = "JS1_4"; var TITLE = "Identifiers"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var 0abc;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var 0abc" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-040.js0000644000175000017500000000507411545150464023171 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-040.js Corresponds To: 7.5-2.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "lexical-040"; var VERSION = "JS1_4"; var TITLE = "Identifiers"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var 1abc;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var 1abc" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-041.js0000644000175000017500000000516511545150464023173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-041.js Corresponds To: 7.5-8-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "lexical-041"; var VERSION = "ECMA_1"; var TITLE = "Identifiers"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var @abc;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var @abc" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-042.js0000644000175000017500000000516311545150464023172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-042.js Corresponds To: 7.5-9-n.js ECMA Section: 7.5 Identifiers Description: Identifiers are of unlimited length - can contain letters, a decimal digit, _, or $ - the first character cannot be a decimal digit - identifiers are case sensitive Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "lexical-042"; var VERSION = "JS1_4"; var TITLE = "Identifiers"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("var 123;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "var 123" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-047.js0000644000175000017500000000507211545150464023176 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-047.js Corresponds To: 7.8.1-7-n.js ECMA Section: 7.8.1 Description: Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "lexical-047"; var VERSION = "JS1_4"; var TITLE = "for loops"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var counter = 0; eval("for ( counter = 0\n" + "counter <= 1\n" + "counter++ )\n" + "{\n" + "result += \": got to inner loop\";\n" + "}\n"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "line breaks within a for expression" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-048.js0000644000175000017500000000510011545150464023167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-048.js Corresponds To: 7.8.1-1.js ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertion Description: Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "lexical-048"; var VERSION = "JS1_4"; var TITLE = "The Rules of Automatic Semicolon Insertion"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var counter = 0; eval( "for ( counter = 0;\ncounter <= 1\ncounter++ ) {\nresult += \": got inside for loop\")"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "line breaks within a for expression" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-049.js0000644000175000017500000000517711545150464023206 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-049 Corresponds To: 7.8.1-1.js ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertioin Description: Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "lexical-049"; var VERSION = "JS1_4"; var TITLE = "The Rules of Automatic Semicolon Insertion"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var counter = 0; eval("for ( counter = 0\n" + "counter <= 1;\n" + "counter++ )\n" + "{\n" + "result += \": got inside for loop\";\n" + "}\n"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "line breaks within a for expression" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-050.js0000644000175000017500000000506011545150464023165 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-050.js Corresponds to: 7.8.2-1-n.js ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion Description: compare some specific examples of the automatic insertion rules in the EMCA specification. Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "lexical-050"; var VERSION = "JS1_4"; var TITLE = "Examples of Automatic Semicolon Insertion"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("{ 1 2 } 3"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "{ 1 2 } 3" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-051.js0000644000175000017500000000513411545150464023170 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-051.js Corresponds to: 7.8.2-3-n.js ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion Description: compare some specific examples of the automatic insertion rules in the EMCA specification. Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "lexical-051"; var VERSION = "JS1_4"; var TITLE = "Examples of Automatic Semicolon Insertion"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("for (a; b\n) result += \": got to inner loop\";") } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "for (a; b\n)" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-052.js0000644000175000017500000000516211545150464023172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-052.js Corresponds to: 7.8.2-4-n.js ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion Description: compare some specific examples of the automatic insertion rules in the EMCA specification. Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "lexical-052"; var VERSION = "JS1_4"; var TITLE = "Examples of Automatic Semicolon Insertion"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { MyFunction(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "calling return indirectly" + " (threw " + exception +")", expect, result ); test(); function MyFunction() { var s = "return"; eval(s); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-053.js0000644000175000017500000000520411545150464023170 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-053.js Corresponds to: 7.8.2-7-n.js ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion Description: compare some specific examples of the automatic insertion rules in the EMCA specification. Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "lexical-053"; var VERSION = "JS1_4"; var TITLE = "Examples of Automatic Semicolon Insertion"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { a = true b = false eval('if (a > b)\nelse result += ": got to else statement"'); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "calling return indirectly" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/lexical-054.js0000644000175000017500000000514311545150464023173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: lexical-054.js Corresponds to: 7.8.2-7-n.js ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion Description: compare some specific examples of the automatic insertion rules in the EMCA specification. Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "lexical-054"; var VERSION = "JS1_4"; var TITLE = "Examples of Automatic Semicolon Insertion"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { a=0; b=1; c=2; d=3; eval("if (a > b)\nelse c = d"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "if (a > b)\nelse c = d" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/number-001.js0000644000175000017500000000615311545150464023034 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: number-001 Corresponds To: 15.7.4.2-2-n.js ECMA Section: 15.7.4.2.2 Number.prototype.toString() Description: If the radix is the number 10 or not supplied, then this number value is given as an argument to the ToString operator; the resulting string value is returned. If the radix is supplied and is an integer from 2 to 36, but not 10, the result is a string, the choice of which is implementation dependent. The toString function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "number-001"; var VERSION = "JS1_4"; var TITLE = "Exceptions for Number.toString()"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.toString()"); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { object= new Object(); object.toString = Number.prototype.toString; result = object.toString(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "object = new Object(); object.toString = Number.prototype.toString; object.toString()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/number-002.js0000644000175000017500000000552211545150464023034 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: number-002.js Corresponds To: ecma/Number/15.7.4.3-2-n.js ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() Description: Returns this number value. The valueOf function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "number-002"; var VERSION = "JS1_4"; var TITLE = "Exceptions for Number.valueOf()"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { object= new Object(); object.toString = Number.prototype.valueOf; result = object.toString(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "object = new Object(); object.valueOf = Number.prototype.valueOf; object.valueOf()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/number-003.js0000644000175000017500000000553011545150464023034 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: number-003.js Corresponds To: 15.7.4.3-3.js ECMA Section: 15.7.4.3.1 Number.prototype.valueOf() Description: Returns this number value. The valueOf function is not generic; it generates a runtime error if its this value is not a Number object. Therefore it cannot be transferred to other kinds of objects for use as a method. Author: christine@netscape.com Date: 16 september 1997 */ var SECTION = "number-003"; var VERSION = "JS1_4"; var TITLE = "Exceptions for Number.valueOf()"; startTest(); writeHeaderToLog( SECTION + " Number.prototype.valueOf()"); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { VALUE_OF = Number.prototype.valueOf; OBJECT = new String("Infinity"); OBJECT.valueOf = VALUE_OF; result = OBJECT.valueOf(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "Assigning Number.prototype.valueOf as the valueOf of a String object " + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/shell.js0000644000175000017500000000000011545150464022336 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/statement-001.js0000644000175000017500000000505711545150464023552 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: statement-001.js Corresponds To: 12.6.2-9-n.js ECMA Section: 12.6.2 The for Statement 1. first expression is not present. 2. second expression is not present 3. third expression is not present Author: christine@netscape.com Date: 15 september 1997 */ var SECTION = "statement-001.js"; // var SECTION = "12.6.2-9-n"; var VERSION = "ECMA_1"; var TITLE = "The for statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("for (i) {\n}"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "for(i) {}" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/statement-002.js0000644000175000017500000000742311545150464023552 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: statement-002.js Corresponds To: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "statement-002"; var VERSION = "JS1_4"; var TITLE = "The for..in statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval(" for ( var i, p in this) { result += this[p]; }"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "more than one member expression" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/statement-003.js0000644000175000017500000000763211545150464023555 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: statement-003 Corresponds To: 12.6.3-7-n.js ECMA Section: 12.6.3 The for...in Statement Description: The production IterationStatement : for ( LeftHandSideExpression in Expression ) Statement is evaluated as follows: 1. Evaluate the Expression. 2. Call GetValue(Result(1)). 3. Call ToObject(Result(2)). 4. Let C be "normal completion". 5. Get the name of the next property of Result(3) that doesn't have the DontEnum attribute. If there is no such property, go to step 14. 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly). 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ): 1. If Type(V) is not Reference, generate a runtime error. 2. Call GetBase(V). 3. If Result(2) is null, go to step 6. 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V) for the property name and W for the value. 5. Return. 6. Call the [[Put]] method for the global object, passing GetPropertyName(V) for the property name and W for the value. 7. Return. 8. Evaluate Statement. 9. If Result(8) is a value completion, change C to be "normal completion after value V" where V is the value carried by Result(8). 10. If Result(8) is a break completion, go to step 14. 11. If Result(8) is a continue completion, go to step 5. 12. If Result(8) is a return completion, return Result(8). 13. Go to step 5. 14. Return C. Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "statement-003"; var VERSION = "JS1_4"; var TITLE = "The for..in statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var o = new MyObject(); var result = 0; eval("for ( this in o) {\n" + "result += this[p];\n" + "}\n"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "bad left-hand side expression" + " (threw " + exception +")", expect, result ); test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/statement-004.js0000644000175000017500000000512711545150464023553 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: statement-004.js Corresponds To: 12.6.3-1.js ECMA Section: 12.6.3 The for...in Statement Description: Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "statement-004"; var VERSION = "JS1_4"; var TITLE = "The for..in statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var o = new MyObject(); eval("for ( \"a\" in o) {\n" + "result += this[p];\n" + "}"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "bad left-hand side expression" + " (threw " + exception +")", expect, result ); test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/statement-005.js0000644000175000017500000000514011545150464023547 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: statement-005.js Corresponds To: 12.6.3-8-n.js ECMA Section: 12.6.3 The for...in Statement Description: Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "statement-005"; var VERSION = "JS1_4"; var TITLE = "The for..in statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var o = new MyObject(); result = 0; eval("for (1 in o) {\n" + "result += this[p];" + "}\n"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "bad left-hand side expression" + " (threw " + exception +")", expect, result ); test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/statement-006.js0000644000175000017500000000510611545150464023552 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: statement-006.js Corresponds To: 12.6.3-9-n.js ECMA Section: 12.6.3 The for...in Statement Description: Author: christine@netscape.com Date: 11 september 1997 */ var SECTION = "statement-006"; var VERSION = "JS1_4"; var TITLE = "The for..in statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var o = new MyObject(); var result = 0; for ( var o in foo) { result += this[o]; } } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "object is not defined" + " (threw " + exception +")", expect, result ); test(); function MyObject() { this.value = 2; this[0] = 4; return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/statement-007.js0000644000175000017500000000470511545150464023557 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: statement-007.js Corresponds To: 12.7-1-n.js ECMA Section: 12.7 The continue statement Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "statement-007"; var VERSION = "JS1_4"; var TITLE = "The continue statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("continue;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "continue outside of an iteration statement" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/statement-008.js0000644000175000017500000000467411545150464023565 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: statement-008.js Corresponds To: 12.8-1-n.js ECMA Section: 12.8 The break statement Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "statement-008"; var VERSION = "JS1_4"; var TITLE = "The break in statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("break;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "break outside of an iteration statement" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/statement-009.js0000644000175000017500000000462211545150464023557 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 12.9-1-n.js ECMA Section: 12.9 The return statement Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "12.9-1-n"; var VERSION = "ECMA_1"; var TITLE = "The return statement"; startTest(); writeHeaderToLog( SECTION + " The return statement"); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { eval("return;"); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "return outside of a function" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/string-001.js0000644000175000017500000000567211545150464023057 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: string-001.js Corresponds To: 15.5.4.2-2-n.js ECMA Section: 15.5.4.2 String.prototype.toString() Description: Returns this string value. Note that, for a String object, the toString() method happens to return the same thing as the valueOf() method. The toString function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "string-001"; var VERSION = "JS1_4"; var TITLE = "String.prototype.toString"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { OBJECT = new Object(); OBJECT.toString = String.prototype.toString(); result = OBJECT.toString(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "OBJECT = new Object; "+ " OBJECT.toString = String.prototype.toString; OBJECT.toString()" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Exceptions/string-002.js0000644000175000017500000000550411545150464023052 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: string-002.js Corresponds To: 15.5.4.3-3-n.js ECMA Section: 15.5.4.3 String.prototype.valueOf() Description: Returns this string value. The valueOf function is not generic; it generates a runtime error if its this value is not a String object. Therefore it connot be transferred to the other kinds of objects for use as a method. Author: christine@netscape.com Date: 1 october 1997 */ var SECTION = "string-002"; var VERSION = "JS1_4"; var TITLE = "String.prototype.valueOf"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var result = "Failed"; var exception = "No exception thrown"; var expect = "Passed"; try { var OBJECT =new Object(); OBJECT.valueOf = String.prototype.valueOf; result = OBJECT.valueOf(); } catch ( e ) { result = expect; exception = e.toString(); } new TestCase( SECTION, "OBJECT = new Object; OBJECT.valueOf = String.prototype.valueOf;"+ "result = OBJECT.valueOf();" + " (threw " + exception +")", expect, result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Expressions/browser.js0000644000175000017500000000000011545150464023113 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Expressions/jstests.list0000644000175000017500000000012611545150464023477 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_2/Expressions/ script StrictEquality-001.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Expressions/shell.js0000644000175000017500000000000011545150464022537 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Expressions/StrictEquality-001.js0000644000175000017500000000646311545150464024737 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: StrictEquality-001.js * ECMA Section: 11.9.6.js * Description: * * Author: christine@netscape.com * Date: 4 september 1998 */ var SECTION = "StrictEquality-001 - 11.9.6"; var VERSION = "ECMA_2"; var TITLE = "The strict equality operator ( === )"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // 1. If Type(x) is different from Type(y) return false StrictEquality( true, new Boolean(true), false ); StrictEquality( new Boolean(), false, false ); StrictEquality( "", new String(), false ); StrictEquality( new String("hi"), "hi", false ); // 2. If Type(x) is not Number go to step 9. // 3. If x is NaN, return false StrictEquality( NaN, NaN, false ); StrictEquality( NaN, 0, false ); // 4. If y is NaN, return false. StrictEquality( 0, NaN, false ); // 5. if x is the same number value as y, return true // 6. If x is +0 and y is -0, return true // 7. If x is -0 and y is +0, return true // 8. Return false. // 9. If Type(x) is String, then return true if x and y are exactly // the same sequence of characters ( same length and same characters // in corresponding positions.) Otherwise return false. // 10. If Type(x) is Boolean, return true if x and y are both true or // both false. otherwise return false. // Return true if x and y refer to the same object. Otherwise return // false. // Return false. test(); function StrictEquality( x, y, expect ) { result = ( x === y ); new TestCase( SECTION, x +" === " + y, expect, result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/extensions/browser.js0000644000175000017500000000000011545150464022770 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/extensions/constructor-001.js0000644000175000017500000000515011545150464024203 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/constructor-001.js * ECMA Section: 15.7.3.3 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/constructor-001"; var VERSION = "ECMA_2"; var TITLE = "new RegExp()"; startTest(); /* * for each test case, verify: * - verify that [[Class]] property is RegExp * - prototype property should be set to RegExp.prototype * - source is set to the empty string * - global property is set to false * - ignoreCase property is set to false * - multiline property is set to false * - lastIndex property is set to 0 */ RegExp.prototype.getClassProperty = Object.prototype.toString; var re = new RegExp(); AddTestCase( "new RegExp().__proto__", RegExp.prototype, re.__proto__ ); test() mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/extensions/function-001.js0000644000175000017500000000515611545150464023451 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/function-001.js * ECMA Section: 15.7.2.1 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/function-001"; var VERSION = "ECMA_2"; var TITLE = "RegExp( pattern, flags )"; startTest(); /* * for each test case, verify: * - verify that [[Class]] property is RegExp * - prototype property should be set to RegExp.prototype * - source is set to the empty string * - global property is set to false * - ignoreCase property is set to false * - multiline property is set to false * - lastIndex property is set to 0 */ RegExp.prototype.getClassProperty = Object.prototype.toString; var re = new RegExp(); AddTestCase( "new RegExp().__proto__", RegExp.prototype, re.__proto__ ); test() mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/extensions/instanceof-001.js0000644000175000017500000001026411545150464023751 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: instanceof-001.js * ECMA Section: 11.8.6 * Description: * * RelationalExpression instanceof Identifier * * Author: christine@netscape.com * Date: 2 September 1998 */ var SECTION = "instanceof-001"; var VERSION = "ECMA_2"; var TITLE = "instanceof" startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function InstanceOf( object_1, object_2, expect ) { result = object_1 instanceof object_2; new TestCase( SECTION, "(" + object_1 + ") instanceof " + object_2, expect, result ); } function Gen3(value) { this.value = value; this.generation = 3; this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" ); } Gen3.name = 3; Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\""); function Gen2(value) { this.value = value; this.generation = 2; } Gen2.name = 2; Gen2.prototype = new Gen3(); function Gen1(value) { this.value = value; this.generation = 1; } Gen1.name = 1; Gen1.prototype = new Gen2(); function Gen0(value) { this.value = value; this.generation = 0; } Gen0.name = 0; Gen0.prototype = new Gen1(); function GenA(value) { this.value = value; this.generation = "A"; this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); } GenA.prototype = new Gen0(); GenA.name = "A"; function GenB(value) { this.value = value; this.generation = "B"; this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); } GenB.name = "B" GenB.prototype = void 0; // RelationalExpression is not an object. InstanceOf( true, Boolean, false ); InstanceOf( new Boolean(false), Boolean, true ); // __proto__ of RelationalExpression is null. should return false genA = new GenA(); genA.__proto__ = null; InstanceOf( genA, GenA, false ); // RelationalExpression.__proto__ == (but not ===) Identifier.prototype InstanceOf( new Gen2(), Gen0, false ); InstanceOf( new Gen2(), Gen1, false ); InstanceOf( new Gen2(), Gen2, true ); InstanceOf( new Gen2(), Gen3, true ); // RelationalExpression.__proto__.__proto__ === Identifier.prototype InstanceOf( new Gen0(), Gen0, true ); InstanceOf( new Gen0(), Gen1, true ); InstanceOf( new Gen0(), Gen2, true ); InstanceOf( new Gen0(), Gen3, true ); InstanceOf( new Gen0(), Object, true ); InstanceOf( new Gen0(), Function, false ); InstanceOf( Gen0, Function, true ); InstanceOf( Gen0, Object, true ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/extensions/instanceof-002.js0000644000175000017500000001163311545150464023753 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: instanceof-002.js Section: Description: Determining Instance Relationships This test is the same as js1_3/inherit/proto-002, except that it uses the builtin instanceof operator rather than a user-defined function called InstanceOf. This tests Object Hierarchy and Inheritance, as described in the document Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 15:19:34 on http://devedge.netscape.com/. Current URL: http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm This tests the syntax ObjectName.prototype = new PrototypeObject using the Employee example in the document referenced above. Author: christine@netscape.com Date: 12 november 1997 */ // onerror = err; var SECTION = "instanceof-002"; var VERSION = "ECMA_2"; var TITLE = "Determining Instance Relationships"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function InstanceOf( object, constructor ) { while ( object != null ) { if ( object == constructor.prototype ) { return true; } object = object.__proto__; } return false; } function Employee ( name, dept ) { this.name = name || ""; this.dept = dept || "general"; } function Manager () { this.reports = []; } Manager.prototype = new Employee(); function WorkerBee ( name, dept, projs ) { this.base = Employee; this.base( name, dept) this.projects = projs || new Array(); } WorkerBee.prototype = new Employee(); function SalesPerson () { this.dept = "sales"; this.quota = 100; } SalesPerson.prototype = new WorkerBee(); function Engineer ( name, projs, machine ) { this.base = WorkerBee; this.base( name, "engineering", projs ) this.machine = machine || ""; } Engineer.prototype = new WorkerBee(); var pat = new Engineer(); new TestCase( SECTION, "pat.__proto__ == Engineer.prototype", true, pat.__proto__ == Engineer.prototype ); new TestCase( SECTION, "pat.__proto__.__proto__ == WorkerBee.prototype", true, pat.__proto__.__proto__ == WorkerBee.prototype ); new TestCase( SECTION, "pat.__proto__.__proto__.__proto__ == Employee.prototype", true, pat.__proto__.__proto__.__proto__ == Employee.prototype ); new TestCase( SECTION, "pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype", true, pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype ); new TestCase( SECTION, "pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null", true, pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null ); new TestCase( SECTION, "pat instanceof Engineer", true, pat instanceof Engineer ); new TestCase( SECTION, "pat instanceof WorkerBee )", true, pat instanceof WorkerBee ); new TestCase( SECTION, "pat instanceof Employee )", true, pat instanceof Employee ); new TestCase( SECTION, "pat instanceof Object )", true, pat instanceof Object ); new TestCase( SECTION, "pat instanceof SalesPerson )", false, pat instanceof SalesPerson ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/extensions/instanceof-003-n.js0000644000175000017500000000671711545150464024216 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: instanceof-001.js * ECMA Section: 11.8.6 * Description: * * RelationalExpression instanceof Identifier * * Author: christine@netscape.com * Date: 2 September 1998 */ var SECTION = "instanceof-003-n"; var VERSION = "ECMA_2"; var TITLE = "instanceof" startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function InstanceOf( object_1, object_2, expect ) { result = object_1 instanceof object_2; new TestCase( SECTION, "(" + object_1 + ") instanceof " + object_2, expect, result ); } function Gen3(value) { this.value = value; this.generation = 3; this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" ); } Gen3.name = 3; Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\""); function Gen2(value) { this.value = value; this.generation = 2; } Gen2.name = 2; Gen2.prototype = new Gen3(); function Gen1(value) { this.value = value; this.generation = 1; } Gen1.name = 1; Gen1.prototype = new Gen2(); function Gen0(value) { this.value = value; this.generation = 0; } Gen0.name = 0; Gen0.prototype = new Gen1(); function GenA(value) { this.value = value; this.generation = "A"; this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); } GenA.prototype = new Gen0(); GenA.name = "A"; function GenB(value) { this.value = value; this.generation = "B"; this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); } GenB.name = "B" GenB.prototype = void 0; // Identifier is not a function DESCRIPTION = "Identifier is not a function"; EXPECTED = "error"; InstanceOf( true, true, "error" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/extensions/instanceof-004-n.js0000644000175000017500000000673511545150464024217 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: instanceof-001.js * ECMA Section: 11.8.6 * Description: * * RelationalExpression instanceof Identifier * * Author: christine@netscape.com * Date: 2 September 1998 */ var SECTION = "instanceof-004-n"; var VERSION = "ECMA_2"; var TITLE = "instanceof" startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function InstanceOf( object_1, object_2, expect ) { result = object_1 instanceof object_2; new TestCase( SECTION, "(" + object_1 + ") instanceof " + object_2, expect, result ); } function Gen3(value) { this.value = value; this.generation = 3; this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" ); } Gen3.name = 3; Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\""); function Gen2(value) { this.value = value; this.generation = 2; } Gen2.name = 2; Gen2.prototype = new Gen3(); function Gen1(value) { this.value = value; this.generation = 1; } Gen1.name = 1; Gen1.prototype = new Gen2(); function Gen0(value) { this.value = value; this.generation = 0; } Gen0.name = 0; Gen0.prototype = new Gen1(); function GenA(value) { this.value = value; this.generation = "A"; this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); } GenA.prototype = new Gen0(); GenA.name = "A"; function GenB(value) { this.value = value; this.generation = "B"; this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); } GenB.name = "B" GenB.prototype = void 0; // Identifier is not a function DESCRIPTION = "Identifier is not a function"; EXPECTED = "error"; InstanceOf( new Boolean(true), false, "error" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/extensions/instanceof-005-n.js0000644000175000017500000000704211545150464024210 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: instanceof-001.js * ECMA Section: 11.8.6 * Description: * * RelationalExpression instanceof Identifier * * Author: christine@netscape.com * Date: 2 September 1998 */ var SECTION = "instanceof-005-n"; var VERSION = "ECMA_2"; var TITLE = "instanceof" startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function InstanceOf( object_1, object_2, expect ) { result = object_1 instanceof object_2; new TestCase( SECTION, "(" + object_1 + ") instanceof " + object_2, expect, result ); } function Gen3(value) { this.value = value; this.generation = 3; this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" ); } Gen3.name = 3; Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\""); function Gen2(value) { this.value = value; this.generation = 2; } Gen2.name = 2; Gen2.prototype = new Gen3(); function Gen1(value) { this.value = value; this.generation = 1; } Gen1.name = 1; Gen1.prototype = new Gen2(); function Gen0(value) { this.value = value; this.generation = 0; } Gen0.name = 0; Gen0.prototype = new Gen1(); function GenA(value) { this.value = value; this.generation = "A"; this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); } GenA.prototype = new Gen0(); GenA.name = "A"; function GenB(value) { this.value = value; this.generation = "B"; this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); } GenB.name = "B" GenB.prototype = void 0; // Identifier is a function, prototype of Identifier is not an object DESCRIPTION = "Identifier is a function, prototype of Identifier is not an object"; EXPECTED = "error"; InstanceOf( new GenB(), GenB, "error" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/extensions/instanceof-006.js0000644000175000017500000000671411545150464023763 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: instanceof-001.js * ECMA Section: 11.8.6 * Description: * * RelationalExpression instanceof Identifier * * Author: christine@netscape.com * Date: 2 September 1998 */ var SECTION = "instanceof-001"; var VERSION = "ECMA_2"; var TITLE = "instanceof" startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function InstanceOf( object_1, object_2, expect ) { result = object_1 instanceof object_2; new TestCase( SECTION, "(" + object_1 + ") instanceof " + object_2, expect, result ); } function Gen3(value) { this.value = value; this.generation = 3; this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" ); } Gen3.name = 3; Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\""); function Gen2(value) { this.value = value; this.generation = 2; } Gen2.name = 2; Gen2.prototype = new Gen3(); function Gen1(value) { this.value = value; this.generation = 1; } Gen1.name = 1; Gen1.prototype = new Gen2(); function Gen0(value) { this.value = value; this.generation = 0; } Gen0.name = 0; Gen0.prototype = new Gen1(); function GenA(value) { this.value = value; this.generation = "A"; this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); } GenA.prototype = new Gen0(); GenA.name = "A"; function GenB(value) { this.value = value; this.generation = "B"; this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" ); } GenB.name = "B" GenB.prototype = void 0; // RelationalExpression is not an object. // InstanceOf( true, Boolean, false ); InstanceOf( new Boolean(false), Boolean, true ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/extensions/jstests.list0000644000175000017500000000040511545150464023354 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_2/extensions/ script constructor-001.js script function-001.js script instanceof-001.js script instanceof-002.js script instanceof-003-n.js script instanceof-004-n.js script instanceof-005-n.js script instanceof-006.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/extensions/shell.js0000644000175000017500000000000011545150464022414 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/FunctionObjects/apply-001-n.js0000644000175000017500000000433511545150464024102 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Ginda rginda@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ print("STATUS: f.apply crash test."); print("BUGNUMBER: 21836"); function f () { } var SECTION = "apply-001-n"; var VERSION = "ECMA_1"; startTest(); var TITLE = "f.apply(2,2) doesn't crash"; writeHeaderToLog( SECTION + " "+ TITLE); DESCRIPTION = "f.apply(2,2) doesn't crash"; EXPECTED = "error"; new TestCase( SECTION, "f.apply(2,2) doesn't crash", "error", eval("f.apply(2,2)") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/FunctionObjects/browser.js0000644000175000017500000000000011545150464023670 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/FunctionObjects/call-1.js0000644000175000017500000000513611545150464023275 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: call-1.js Section: Function.prototype.call Description: Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "call-1"; var VERSION = "ECMA_2"; var TITLE = "Function.prototype.call"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "ConvertToString.call(this, this)", GLOBAL, ConvertToString.call(this, this)); new TestCase( SECTION, "ConvertToString.call(Boolean, Boolean.prototype)", "false", ConvertToString.call(Boolean, Boolean.prototype)); new TestCase( SECTION, "ConvertToString.call(Boolean, Boolean.prototype.valueOf())", "false", ConvertToString.call(Boolean, Boolean.prototype.valueOf())); test(); function ConvertToString(obj) { return obj +""; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/FunctionObjects/jstests.list0000644000175000017500000000014411545150464024254 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_2/FunctionObjects/ script apply-001-n.js script call-1.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/FunctionObjects/shell.js0000644000175000017500000000000011545150464023314 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/instanceof/browser.js0000644000175000017500000000000011545150464022722 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/instanceof/instanceof-001.js0000644000175000017500000000456411545150464023711 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: instanceof-1.js ECMA Section: Description: instanceof operator Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = ""; var VERSION = "ECMA_2"; var TITLE = "instanceof operator"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var b = new Boolean(); new TestCase( SECTION, "var b = new Boolean(); b instanceof Boolean", true, b instanceof Boolean ); new TestCase( SECTION, "b instanceof Object", true, b instanceof Object ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/instanceof/instanceof-002.js0000644000175000017500000000514411545150464023705 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: ECMA Section: Description: Call Objects Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = ""; var VERSION = "ECMA_2"; var TITLE = "The Call Constructor"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var b = new Boolean(); new TestCase( SECTION, "var b = new Boolean(); b instanceof Boolean", true, b instanceof Boolean ); new TestCase( SECTION, "b instanceof Object", true, b instanceof Object ); new TestCase( SECTION, "b instanceof Array", false, b instanceof Array ); new TestCase( SECTION, "true instanceof Boolean", false, true instanceof Boolean ); new TestCase( SECTION, "Boolean instanceof Object", true, Boolean instanceof Object ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/instanceof/instanceof-003.js0000644000175000017500000000552211545150464023706 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: instanceof-003.js ECMA Section: Description: http://bugzilla.mozilla.org/show_bug.cgi?id=7635 js> function Foo() {} js> theproto = {}; [object Object] js> Foo.prototype = theproto [object Object] js> theproto instanceof Foo true I think this should be 'false' Author: christine@netscape.com Date: 12 november 1997 Modified to conform to ECMA3 https://bugzilla.mozilla.org/show_bug.cgi?id=281606 */ var SECTION = "instanceof-003"; var VERSION = "ECMA_2"; var TITLE = "instanceof operator"; var BUGNUMBER ="7635"; startTest(); function Foo() {}; theproto = {}; Foo.prototype = theproto; AddTestCase( "function Foo() = {}; theproto = {}; Foo.prototype = theproto; " + "theproto instanceof Foo", false, theproto instanceof Foo ); var o = {}; // https://bugzilla.mozilla.org/show_bug.cgi?id=281606 try { AddTestCase( "o = {}; o instanceof o", "error", o instanceof o ); } catch(e) { AddTestCase( "o = {}; o instanceof o", "error", "error" ); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/instanceof/jstests.list0000644000175000017500000000023211545150464023304 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_2/instanceof/ script instanceof-001.js script instanceof-002.js script instanceof-003.js script regress-7635.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/instanceof/regress-7635.js0000644000175000017500000000645411545150464023336 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: regress-7635.js * Reference: http://bugzilla.mozilla.org/show_bug.cgi?id=7635 * Description: instanceof tweaks * Author: */ var SECTION = "instanceof"; // provide a document reference (ie, ECMA section) var VERSION = "ECMA_2"; // Version of JavaScript or ECMA var TITLE = "Regression test for Bugzilla #7635"; // Provide ECMA section title or a description var BUGNUMBER = "7635"; // Provide URL to bugsplat or bugzilla report startTest(); // leave this alone /* * Calls to AddTestCase here. AddTestCase is a function that is defined * in shell.js and takes three arguments: * - a string representation of what is being tested * - the expected result * - the actual result * * For example, a test might look like this: * * var zip = /[\d]{5}$/; * * AddTestCase( * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test * "02134", // expected result * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result * */ function Foo() {} theproto = {}; Foo.prototype = theproto theproto instanceof Foo AddTestCase( "function Foo() {}; theproto = {}; Foo.prototype = theproto; theproto instanceof Foo", false, theproto instanceof Foo ); var f = new Function(); AddTestCase( "var f = new Function(); f instanceof f", false, f instanceof f ); test(); // leave this alone. this executes the test cases and // displays results. mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/instanceof/shell.js0000644000175000017500000000000011545150464022346 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/LexicalConventions/browser.js0000644000175000017500000000000011545150464024400 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/LexicalConventions/jstests.list0000644000175000017500000000022311545150464024762 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_2/LexicalConventions/ script keywords-001.js script regexp-literals-001.js script regexp-literals-002.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/LexicalConventions/keywords-001.js0000644000175000017500000000462311545150464025101 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: * ECMA Section: * Description: * * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = ""; var VERSION = "ECMA_2"; var TITLE = "Keywords"; startTest(); print("This test requires option javascript.options.strict enabled"); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } var result = "failed"; try { eval("super;"); } catch (x) { if (x instanceof SyntaxError) result = x.name; } AddTestCase( "using the expression \"super\" shouldn't cause js to crash", "SyntaxError", result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/LexicalConventions/regexp-literals-001.js0000644000175000017500000000516711545150464026345 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: LexicalConventions/regexp-literals-001.js * ECMA Section: 7.8.5 * Description: * * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "LexicalConventions/regexp-literals-001.js"; var VERSION = "ECMA_2"; var TITLE = "Regular Expression Literals"; startTest(); // Regular Expression Literals may not be empty; // should be regarded // as a comment, not a RegExp literal. s = //; "passed"; AddTestCase( "// should be a comment, not a regular expression literal", "passed", String(s)); AddTestCase( "// typeof object should be type of object declared on following line", "passed", (typeof s) == "string" ? "passed" : "failed" ); AddTestCase( "// should not return an object of the type RegExp", "passed", (typeof s == "object") ? "failed" : "passed" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/LexicalConventions/regexp-literals-002.js0000644000175000017500000000455711545150464026350 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: LexicalConventions/regexp-literals-002.js * ECMA Section: 7.8.5 * Description: Based on ECMA 2 Draft 8 October 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "LexicalConventions/regexp-literals-002.js"; var VERSION = "ECMA_2"; var TITLE = "Regular Expression Literals"; startTest(); // A regular expression literal represents an object of type RegExp. AddTestCase( "// A regular expression literal represents an object of type RegExp.", "true", (/x*/ instanceof RegExp).toString() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/LexicalConventions/shell.js0000644000175000017500000000000011545150464024024 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/browser.js0000644000175000017500000000000011545150464021763 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/constructor-001.js0000644000175000017500000000602311545150464023176 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/constructor-001.js * ECMA Section: 15.7.3.3 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/constructor-001"; var VERSION = "ECMA_2"; var TITLE = "new RegExp()"; startTest(); /* * for each test case, verify: * - verify that [[Class]] property is RegExp * - prototype property should be set to RegExp.prototype * - source is set to the empty string * - global property is set to false * - ignoreCase property is set to false * - multiline property is set to false * - lastIndex property is set to 0 */ RegExp.prototype.getClassProperty = Object.prototype.toString; var re = new RegExp(); AddTestCase( "RegExp.prototype.getClassProperty = Object.prototype.toString; " + "(new RegExp()).getClassProperty()", "[object RegExp]", re.getClassProperty() ); AddTestCase( "(new RegExp()).source", "", re.source ); AddTestCase( "(new RegExp()).global", false, re.global ); AddTestCase( "(new RegExp()).ignoreCase", false, re.ignoreCase ); AddTestCase( "(new RegExp()).multiline", false, re.multiline ); AddTestCase( "(new RegExp()).lastIndex", 0, re.lastIndex ); test() mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/exec-001.js0000644000175000017500000000504211545150464021535 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/exec-001.js * ECMA Section: 15.7.5.3 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/exec-001"; var VERSION = "ECMA_2"; var TITLE = "RegExp.prototype.exec(string)"; startTest(); /* * for each test case, verify: * - type of object returned * - length of the returned array * - value of lastIndex * - value of index * - value of input * - value of the array indices */ // test cases without subpatterns // test cases with subpatterns // global property is true // global property is false // test cases in which the exec returns null AddTestCase("NO TESTS EXIST", "PASSED", "Test not implemented"); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/exec-002.js0000644000175000017500000001144211545150464021537 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/exec-002.js * ECMA Section: 15.7.5.3 * Description: Based on ECMA 2 Draft 7 February 1999 * * Test cases provided by rogerl@netscape.com * * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/exec-002"; var VERSION = "ECMA_2"; var TITLE = "RegExp.prototype.exec(string)"; startTest(); /* * for each test case, verify: * - type of object returned * - length of the returned array * - value of lastIndex * - value of index * - value of input * - value of the array indices */ AddRegExpCases( /(a|d|q|)x/i, "bcaDxqy", 3, ["Dx", "D"] ); AddRegExpCases( /(a|(e|q))(x|y)/, "bcaddxqy", 6, ["qy","q","q","y"] ); AddRegExpCases( /a+b+d/, "aabbeeaabbs", 0, null ); AddRegExpCases( /a*b/, "aaadaabaaa", 4, ["aab"] ); AddRegExpCases( /a*b/, "dddb", 3, ["b"] ); AddRegExpCases( /a*b/, "xxx", 0, null ); AddRegExpCases( /x\d\dy/, "abcx45ysss235", 3, ["x45y"] ); AddRegExpCases( /[^abc]def[abc]+/, "abxdefbb", 2, ["xdefbb"] ); AddRegExpCases( /(a*)baa/, "ccdaaabaxaabaa", 9, ["aabaa", "aa"] ); AddRegExpCases( /(a*)baa/, "aabaa", 0, ["aabaa", "aa"] ); AddRegExpCases( /q(a|b)*q/, "xxqababqyy", 2, ["qababq", "b"] ); AddRegExpCases( /(a(.|[^d])c)*/, "adcaxc", 0, ["adcaxc", "axc", "x"] ); AddRegExpCases( /(a*)b\1/, "abaaaxaabaayy", 0, ["aba", "a"] ); AddRegExpCases( /(a*)b\1/, "abaaaxaabaayy", 0, ["aba", "a"] ); AddRegExpCases( /(a*)b\1/, "cccdaaabaxaabaayy", 6, ["aba", "a"] ); AddRegExpCases( /(a*)b\1/, "cccdaaabqxaabaayy", 7, ["b", ""] ); AddRegExpCases( /"(.|[^"\\\\])*"/, 'xx\"makudonarudo\"yy', 2, ["\"makudonarudo\"", "o"] ); AddRegExpCases( /"(.|[^"\\\\])*"/, "xx\"ma\"yy", 2, ["\"ma\"", "a"] ); test(); function AddRegExpCases( regexp, pattern, index, matches_array ) { // prevent a runtime error if ( regexp.exec(pattern) == null || matches_array == null ) { AddTestCase( regexp + ".exec(" + pattern +")", matches_array, regexp.exec(pattern) ); return; } AddTestCase( regexp + ".exec(" + pattern +").length", matches_array.length, regexp.exec(pattern).length ); AddTestCase( regexp + ".exec(" + pattern +").index", index, regexp.exec(pattern).index ); AddTestCase( regexp + ".exec(" + pattern +").input", pattern, regexp.exec(pattern).input ); AddTestCase( regexp + ".exec(" + pattern +").toString()", matches_array.toString(), regexp.exec(pattern).toString() ); /* var limit = matches_array.length > regexp.exec(pattern).length ? matches_array.length : regexp.exec(pattern).length; for ( var matches = 0; matches < limit; matches++ ) { AddTestCase( regexp + ".exec(" + pattern +")[" + matches +"]", matches_array[matches], regexp.exec(pattern)[matches] ); } */ } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/function-001.js0000644000175000017500000000603111545150464022435 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/function-001.js * ECMA Section: 15.7.2.1 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/function-001"; var VERSION = "ECMA_2"; var TITLE = "RegExp( pattern, flags )"; startTest(); /* * for each test case, verify: * - verify that [[Class]] property is RegExp * - prototype property should be set to RegExp.prototype * - source is set to the empty string * - global property is set to false * - ignoreCase property is set to false * - multiline property is set to false * - lastIndex property is set to 0 */ RegExp.prototype.getClassProperty = Object.prototype.toString; var re = new RegExp(); AddTestCase( "RegExp.prototype.getClassProperty = Object.prototype.toString; " + "(new RegExp()).getClassProperty()", "[object RegExp]", re.getClassProperty() ); AddTestCase( "(new RegExp()).source", "", re.source ); AddTestCase( "(new RegExp()).global", false, re.global ); AddTestCase( "(new RegExp()).ignoreCase", false, re.ignoreCase ); AddTestCase( "(new RegExp()).multiline", false, re.multiline ); AddTestCase( "(new RegExp()).lastIndex", 0, re.lastIndex ); test() mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/hex-001.js0000644000175000017500000000735711545150464021410 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/hex-001.js * ECMA Section: 15.7.3.1 * Description: Based on ECMA 2 Draft 7 February 1999 * Positive test cases for constructing a RegExp object * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/hex-001"; var VERSION = "ECMA_2"; var TITLE = "RegExp patterns that contain HexicdecimalEscapeSequences"; startTest(); // These examples come from 15.7.1, HexidecimalEscapeSequence AddRegExpCases( new RegExp("\x41"), "new RegExp('\\x41')", "A", "A", 1, 0, ["A"] ); AddRegExpCases( new RegExp("\x412"),"new RegExp('\\x412')", "A2", "A2", 1, 0, ["A2"] ); AddRegExpCases( new RegExp("\x1g"), "new RegExp('\\x1g')", "x1g","x1g", 1, 0, ["x1g"] ); AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x41", "\\x41", 1, 0, ["A"] ); AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x412", "\\x412", 1, 0, ["A"] ); AddRegExpCases( new RegExp("^x"), "new RegExp('^x')", "x412", "x412", 1, 0, ["x"]); AddRegExpCases( new RegExp("A"), "new RegExp('A')", "A2", "A2", 1, 0, ["A"] ); test(); function AddRegExpCases( regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) { // prevent a runtime error if ( regexp.exec(pattern) == null || matches_array == null ) { AddTestCase( str_regexp + ".exec(" + pattern +")", matches_array, regexp.exec(pattern) ); return; } AddTestCase( str_regexp + ".exec(" + str_pattern +").length", length, regexp.exec(pattern).length ); AddTestCase( str_regexp + ".exec(" + str_pattern +").index", index, regexp.exec(pattern).index ); AddTestCase( str_regexp + ".exec(" + str_pattern +").input", pattern, regexp.exec(pattern).input ); for ( var matches = 0; matches < matches_array.length; matches++ ) { AddTestCase( str_regexp + ".exec(" + str_pattern +")[" + matches +"]", matches_array[matches], regexp.exec(pattern)[matches] ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/jstests.list0000644000175000017500000000060311545150464022347 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_2/RegExp/ script constructor-001.js skip script exec-001.js # obsolete test script exec-002.js script function-001.js script hex-001.js script multiline-001.js script octal-001.js script octal-002.js script octal-003.js script properties-001.js script properties-002.js script regexp-enumerate-001.js script regress-001.js script unicode-001.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/multiline-001.js0000644000175000017500000000634211545150464022617 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/multiline-001.js * ECMA Section: * Description: Based on ECMA 2 Draft 7 February 1999 * * Date: 19 February 1999 */ var SECTION = "RegExp/multiline-001"; var VERSION = "ECMA_2"; var TITLE = "RegExp: multiline flag"; var BUGNUMBER="343901"; startTest(); var woodpeckers = "ivory-billed\ndowny\nhairy\nacorn\nyellow-bellied sapsucker\n" + "northern flicker\npileated\n"; AddRegExpCases( /.*[y]$/m, woodpeckers, woodpeckers.indexOf("downy"), ["downy"] ); AddRegExpCases( /.*[d]$/m, woodpeckers, woodpeckers.indexOf("ivory-billed"), ["ivory-billed"] ); test(); function AddRegExpCases ( regexp, pattern, index, matches_array ) { // prevent a runtime error if ( regexp.exec(pattern) == null || matches_array == null ) { AddTestCase( regexp + ".exec(" + pattern +")", matches_array, regexp.exec(pattern) ); return; } AddTestCase( regexp.toString() + ".exec(" + pattern +").length", matches_array.length, regexp.exec(pattern).length ); AddTestCase( regexp.toString() + ".exec(" + pattern +").index", index, regexp.exec(pattern).index ); AddTestCase( regexp + ".exec(" + pattern +").input", pattern, regexp.exec(pattern).input ); for ( var matches = 0; matches < matches_array.length; matches++ ) { AddTestCase( regexp + ".exec(" + pattern +")[" + matches +"]", matches_array[matches], regexp.exec(pattern)[matches] ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/octal-001.js0000644000175000017500000000673711545150464021727 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/octal-001.js * ECMA Section: 15.7.1 * Description: Based on ECMA 2 Draft 7 February 1999 * Simple test cases for matching OctalEscapeSequences. * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/octal-001.js"; var VERSION = "ECMA_2"; var TITLE = "RegExp patterns that contain OctalEscapeSequences"; var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346196"; startTest(); // backreference AddRegExpCases( /(.)\1/, "/(.)\\1/", "HI!!", "HI!", 2, ["!!", "!"] ); test(); function AddRegExpCases( regexp, str_regexp, pattern, str_pattern, index, matches_array ) { // prevent a runtime error if ( regexp.exec(pattern) == null || matches_array == null ) { AddTestCase( regexp + ".exec(" + str_pattern +")", matches_array, regexp.exec(pattern) ); return; } AddTestCase( str_regexp + ".exec(" + str_pattern +").length", matches_array.length, regexp.exec(pattern).length ); AddTestCase( str_regexp + ".exec(" + str_pattern +").index", index, regexp.exec(pattern).index ); AddTestCase( str_regexp + ".exec(" + str_pattern +").input", pattern, regexp.exec(pattern).input ); AddTestCase( str_regexp + ".exec(" + str_pattern +").toString()", matches_array.toString(), regexp.exec(pattern).toString() ); /* var limit = matches_array.length > regexp.exec(pattern).length ? matches_array.length : regexp.exec(pattern).length; for ( var matches = 0; matches < limit; matches++ ) { AddTestCase( str_regexp + ".exec(" + str_pattern +")[" + matches +"]", matches_array[matches], regexp.exec(pattern)[matches] ); } */ } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/octal-002.js0000644000175000017500000000771511545150464021725 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/octal-002.js * ECMA Section: 15.7.1 * Description: Based on ECMA 2 Draft 7 February 1999 * Simple test cases for matching OctalEscapeSequences. * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/octal-002.js"; var VERSION = "ECMA_2"; var TITLE = "RegExp patterns that contain OctalEscapeSequences"; var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346189"; startTest(); // backreference AddRegExpCases( /(.)(.)(.)(.)(.)(.)(.)(.)\8/, "/(.)(.)(.)(.)(.)(.)(.)(.)\\8", "aabbccaaabbbccc", "aabbccaaabbbccc", 0, ["aabbccaaa", "a", "a", "b", "b", "c", "c", "a", "a"] ); AddRegExpCases( /(.)(.)(.)(.)(.)(.)(.)(.)(.)\9/, "/(.)(.)(.)(.)(.)(.)(.)(.)\\9", "aabbccaabbcc", "aabbccaabbcc", 0, ["aabbccaabb", "a", "a", "b", "b", "c", "c", "a", "a", "b"] ); AddRegExpCases( /(.)(.)(.)(.)(.)(.)(.)(.)(.)\8/, "/(.)(.)(.)(.)(.)(.)(.)(.)(.)\\8", "aabbccaababcc", "aabbccaababcc", 0, ["aabbccaaba", "a", "a", "b", "b", "c", "c", "a", "a", "b"] ); test(); function AddRegExpCases( regexp, str_regexp, pattern, str_pattern, index, matches_array ) { // prevent a runtime error if ( regexp.exec(pattern) == null || matches_array == null ) { AddTestCase( regexp + ".exec(" + str_pattern +")", matches_array, regexp.exec(pattern) ); return; } AddTestCase( str_regexp + ".exec(" + str_pattern +").length", matches_array.length, regexp.exec(pattern).length ); AddTestCase( str_regexp + ".exec(" + str_pattern +").index", index, regexp.exec(pattern).index ); AddTestCase( str_regexp + ".exec(" + str_pattern +").input", pattern, regexp.exec(pattern).input ); AddTestCase( str_regexp + ".exec(" + str_pattern +").toString()", matches_array.toString(), regexp.exec(pattern).toString() ); /* var limit = matches_array.length > regexp.exec(pattern).length ? matches_array.length : regexp.exec(pattern).length; for ( var matches = 0; matches < limit; matches++ ) { AddTestCase( str_regexp + ".exec(" + str_pattern +")[" + matches +"]", matches_array[matches], regexp.exec(pattern)[matches] ); } */ } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/octal-003.js0000644000175000017500000001032211545150464021712 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/octal-003.js * ECMA Section: 15.7.1 * Description: Based on ECMA 2 Draft 7 February 1999 * Simple test cases for matching OctalEscapeSequences. * Author: christine@netscape.com * Date: 19 February 1999 * * Revised: 02 August 2002 * Author: pschwartau@netscape.com * * WHY: the original test expected the regexp /.\011/ * to match 'a' + String.fromCharCode(0) + '11' * * This is incorrect: the string is a 4-character string consisting of * the characters <'a'>, , <'1'>, <'1'>. By contrast, the \011 in the * regexp should be parsed as a single token: it is the octal escape sequence * for the horizontal tab character '\t' === '\u0009' === '\x09' === '\011'. * * So the regexp consists of 2 characters: , <'\t'>. * There is no match between the regexp and the string. * * See the testcase ecma_3/RegExp/octal-002.js for an elaboration. * */ var SECTION = "RegExp/octal-003.js"; var VERSION = "ECMA_2"; var TITLE = "RegExp patterns that contain OctalEscapeSequences"; var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346132"; startTest(); AddRegExpCases( /.\011/, "/\\011/", "a" + String.fromCharCode(0) + "11", "a\\011", 0, null ); test(); function AddRegExpCases( regexp, str_regexp, pattern, str_pattern, index, matches_array ) { // prevent a runtime error if ( regexp.exec(pattern) == null || matches_array == null ) { AddTestCase( regexp + ".exec(" + str_pattern +")", matches_array, regexp.exec(pattern) ); return; } AddTestCase( str_regexp + ".exec(" + str_pattern +").length", matches_array.length, regexp.exec(pattern).length ); AddTestCase( str_regexp + ".exec(" + str_pattern +").index", index, regexp.exec(pattern).index ); AddTestCase( str_regexp + ".exec(" + str_pattern +").input", escape(pattern), escape(regexp.exec(pattern).input) ); AddTestCase( str_regexp + ".exec(" + str_pattern +").toString()", matches_array.toString(), escape(regexp.exec(pattern).toString()) ); var limit = matches_array.length > regexp.exec(pattern).length ? matches_array.length : regexp.exec(pattern).length; for ( var matches = 0; matches < limit; matches++ ) { AddTestCase( str_regexp + ".exec(" + str_pattern +")[" + matches +"]", matches_array[matches], escape(regexp.exec(pattern)[matches]) ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/properties-001.js0000644000175000017500000001032511545150464023005 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/properties-001.js * ECMA Section: 15.7.6.js * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/properties-001.js"; var VERSION = "ECMA_2"; var TITLE = "Properties of RegExp Instances"; var BUGNUMBER =""; startTest(); AddRegExpCases( new RegExp, "", false, false, false, 0 ); AddRegExpCases( /.*/, ".*", false, false, false, 0 ); AddRegExpCases( /[\d]{5}/g, "[\\d]{5}", true, false, false, 0 ); AddRegExpCases( /[\S]?$/i, "[\\S]?$", false, true, false, 0 ); AddRegExpCases( /^([a-z]*)[^\w\s\f\n\r]+/m, "^([a-z]*)[^\\w\\s\\f\\n\\r]+", false, false, true, 0 ); AddRegExpCases( /[\D]{1,5}[\ -][\d]/gi, "[\\D]{1,5}[\\ -][\\d]", true, true, false, 0 ); AddRegExpCases( /[a-zA-Z0-9]*/gm, "[a-zA-Z0-9]*", true, false, true, 0 ); AddRegExpCases( /x|y|z/gim, "x|y|z", true, true, true, 0 ); AddRegExpCases( /\u0051/im, "\\u0051", false, true, true, 0 ); AddRegExpCases( /\x45/gm, "\\x45", true, false, true, 0 ); AddRegExpCases( /\097/gi, "\\097", true, true, false, 0 ); test(); function AddRegExpCases( re, s, g, i, m, l ) { AddTestCase( re + ".test == RegExp.prototype.test", true, re.test == RegExp.prototype.test ); AddTestCase( re + ".toString == RegExp.prototype.toString", true, re.toString == RegExp.prototype.toString ); AddTestCase( re + ".contructor == RegExp.prototype.constructor", true, re.constructor == RegExp.prototype.constructor ); AddTestCase( re + ".compile == RegExp.prototype.compile", true, re.compile == RegExp.prototype.compile ); AddTestCase( re + ".exec == RegExp.prototype.exec", true, re.exec == RegExp.prototype.exec ); // properties AddTestCase( re + ".source", s, re.source ); /* * http://bugzilla.mozilla.org/show_bug.cgi?id=225550 changed * the behavior of toString() and toSource() on empty regexps. * So branch if |s| is the empty string - */ var S = s? s : '(?:)'; AddTestCase( re + ".toString()", "/" + S +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""), re.toString() ); AddTestCase( re + ".global", g, re.global ); AddTestCase( re + ".ignoreCase", i, re.ignoreCase ); AddTestCase( re + ".multiline", m, re.multiline); AddTestCase( re + ".lastIndex", l, re.lastIndex ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/properties-002.js0000644000175000017500000001217511545150464023013 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/properties-002.js * ECMA Section: 15.7.6.js * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ //----------------------------------------------------------------------------- var SECTION = "RegExp/properties-002.js"; var VERSION = "ECMA_2"; var TITLE = "Properties of RegExp Instances"; var BUGNUMBER ="124339"; startTest(); re_1 = /\cA?/g; re_1.lastIndex = Math.pow(2,31); AddRegExpCases( re_1, "\\cA?", true, false, false, Math.pow(2,31) ); re_2 = /\w*/i; re_2.lastIndex = Math.pow(2,32) -1; AddRegExpCases( re_2, "\\w*", false, true, false, Math.pow(2,32)-1 ); re_3 = /\*{0,80}/m; re_3.lastIndex = Math.pow(2,31) -1; AddRegExpCases( re_3, "\\*{0,80}", false, false, true, Math.pow(2,31) -1 ); re_4 = /^./gim; re_4.lastIndex = Math.pow(2,30) -1; AddRegExpCases( re_4, "^.", true, true, true, Math.pow(2,30) -1 ); re_5 = /\B/; re_5.lastIndex = Math.pow(2,30); AddRegExpCases( re_5, "\\B", false, false, false, Math.pow(2,30) ); /* * Brendan: "need to test cases Math.pow(2,32) and greater to see * whether they round-trip." Reason: thanks to the work done in * http://bugzilla.mozilla.org/show_bug.cgi?id=124339, lastIndex * is now stored as a double instead of a uint32 (unsigned integer). * * Note 2^32 -1 is the upper bound for uint32's, but doubles can go * all the way up to Number.MAX_VALUE. So that's why we need cases * between those two numbers. * */ re_6 = /\B/; re_6.lastIndex = Math.pow(2,32); AddRegExpCases( re_6, "\\B", false, false, false, Math.pow(2,32) ); re_7 = /\B/; re_7.lastIndex = Math.pow(2,32) + 1; AddRegExpCases( re_7, "\\B", false, false, false, Math.pow(2,32) + 1 ); re_8 = /\B/; re_8.lastIndex = Math.pow(2,32) * 2; AddRegExpCases( re_8, "\\B", false, false, false, Math.pow(2,32) * 2 ); re_9 = /\B/; re_9.lastIndex = Math.pow(2,40); AddRegExpCases( re_9, "\\B", false, false, false, Math.pow(2,40) ); re_10 = /\B/; re_10.lastIndex = Number.MAX_VALUE; AddRegExpCases( re_10, "\\B", false, false, false, Number.MAX_VALUE ); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function AddRegExpCases( re, s, g, i, m, l ){ AddTestCase( re + ".test == RegExp.prototype.test", true, re.test == RegExp.prototype.test ); AddTestCase( re + ".toString == RegExp.prototype.toString", true, re.toString == RegExp.prototype.toString ); AddTestCase( re + ".contructor == RegExp.prototype.constructor", true, re.constructor == RegExp.prototype.constructor ); AddTestCase( re + ".compile == RegExp.prototype.compile", true, re.compile == RegExp.prototype.compile ); AddTestCase( re + ".exec == RegExp.prototype.exec", true, re.exec == RegExp.prototype.exec ); // properties AddTestCase( re + ".source", s, re.source ); AddTestCase( re + ".toString()", "/" + s +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""), re.toString() ); AddTestCase( re + ".global", g, re.global ); AddTestCase( re + ".ignoreCase", i, re.ignoreCase ); AddTestCase( re + ".multiline", m, re.multiline); AddTestCase( re + ".lastIndex", l, re.lastIndex ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/regexp-enumerate-001.js0000644000175000017500000000755311545150464024077 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: regexp-enumerate-001.js ECMA V2 Section: Description: Regression Test. If instance Native Object have properties that are enumerable, JavaScript enumerated through the properties twice. This only happened if objects had been instantiated, but their properties had not been enumerated. ie, the object inherited properties from its prototype that are enumerated. In the core JavaScript, this is only a problem with RegExp objects, since the inherited properties of most core JavaScript objects are not enumerated. Author: christine@netscape.com, pschwartau@netscape.com Date: 12 November 1997 Modified: 14 July 2002 Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155291 ECMA-262 Ed.3 Sections 15.10.7.1 through 15.10.7.5 RegExp properties should be DontEnum * */ // onerror = err; var SECTION = "regexp-enumerate-001"; var VERSION = "ECMA_2"; var TITLE = "Regression Test for Enumerating Properties"; var BUGNUMBER="339403"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); /* * This test expects RegExp instances to have four enumerated properties: * source, global, ignoreCase, and lastIndex * * 99.01.25: now they also have a multiLine instance property. * */ var r = new RegExp(); var e = new Array(); var t = new TestRegExp(); for ( p in r ) { e[e.length] = { property:p, value:r[p] }; t.addProperty( p, r[p]) }; new TestCase( SECTION, "r = new RegExp(); e = new Array(); "+ "for ( p in r ) { e[e.length] = { property:p, value:r[p] }; e.length", 0, e.length ); test(); function TestRegExp() { this.addProperty = addProperty; } function addProperty(name, value) { var pass = false; if ( eval("this."+name) != void 0 ) { pass = true; } else { eval( "this."+ name+" = "+ false ); } new TestCase( SECTION, "Property: " + name +" already enumerated?", false, pass ); if ( gTestcases[ gTestcases.length-1].passed == false ) { gTestcases[gTestcases.length-1].reason = "property already enumerated"; } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/regress-001.js0000644000175000017500000000521511545150464022265 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/regress-001.js * ECMA Section: N/A * Description: Regression test case: * JS regexp anchoring on empty match bug * http://bugzilla.mozilla.org/show_bug.cgi?id=2157 * * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/hex-001.js"; var VERSION = "ECMA_2"; var TITLE = "JS regexp anchoring on empty match bug"; var BUGNUMBER = "2157"; startTest(); AddRegExpCases( /a||b/(''), "//a||b/('')", 1, [''] ); test(); function AddRegExpCases( regexp, str_regexp, length, matches_array ) { AddTestCase( "( " + str_regexp + " ).length", regexp.length, regexp.length ); for ( var matches = 0; matches < matches_array.length; matches++ ) { AddTestCase( "( " + str_regexp + " )[" + matches +"]", matches_array[matches], regexp[matches] ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/shell.js0000644000175000017500000000000011545150464021407 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/RegExp/unicode-001.js0000644000175000017500000000667511545150464022254 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: RegExp/unicode-001.js * ECMA Section: 15.7.3.1 * Description: Based on ECMA 2 Draft 7 February 1999 * Positive test cases for constructing a RegExp object * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "RegExp/unicode-001.js"; var VERSION = "ECMA_2"; var TITLE = "new RegExp( pattern, flags )"; startTest(); // These examples come from 15.7.1, UnicodeEscapeSequence AddRegExpCases( /\u0041/, "/\\u0041/", "A", "A", 1, 0, ["A"] ); AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] ); AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] ); AddRegExpCases( /\u001g/, "/\\u001g/", "u001g", "u001g", 1, 0, ["u001g"] ); AddRegExpCases( /A/, "/A/", "\u0041", "\\u0041", 1, 0, ["A"] ); AddRegExpCases( /A/, "/A/", "\u00412", "\\u00412", 1, 0, ["A"] ); AddRegExpCases( /A2/, "/A2/", "\u00412", "\\u00412", 1, 0, ["A2"]); AddRegExpCases( /A/, "/A/", "A2", "A2", 1, 0, ["A"] ); test(); function AddRegExpCases( regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) { AddTestCase( str_regexp + " .exec(" + str_pattern +").length", length, regexp.exec(pattern).length ); AddTestCase( str_regexp + " .exec(" + str_pattern +").index", index, regexp.exec(pattern).index ); AddTestCase( str_regexp + " .exec(" + str_pattern +").input", pattern, regexp.exec(pattern).input ); for ( var matches = 0; matches < matches_array.length; matches++ ) { AddTestCase( str_regexp + " .exec(" + str_pattern +")[" + matches +"]", matches_array[matches], regexp.exec(pattern)[matches] ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/browser.js0000644000175000017500000000000011545150464022720 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/dowhile-001.js0000644000175000017500000000471011545150464023202 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: dowhile-001 * ECMA Section: * Description: do...while statements * * * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "dowhile-002"; var VERSION = "ECMA_2"; var TITLE = "do...while with a labeled continue statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); LabeledContinue( 0, 1 ); LabeledContinue( 1, 1 ); LabeledContinue( -1, 1 ); LabeledContinue( 5, 5 ); test(); function LabeledContinue( limit, expect ) { i = 0; woohoo: do { i++; continue woohoo; } while ( i < limit ); new TestCase( SECTION, "do while ( " + i +" < " + limit +" )", expect, i ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/dowhile-002.js0000644000175000017500000000625411545150464023210 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: dowhile-002 * ECMA Section: * Description: do...while statements * * Verify that code after a labeled break is not executed. Verify that * a labeled break breaks you out of the whole labeled block, and not * just the current iteration statement. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "dowhile-002"; var VERSION = "ECMA_2"; var TITLE = "do...while with a labeled continue statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); LabeledContinue( 0, 1 ); LabeledContinue( 1, 1 ); LabeledContinue( -1, 1 ); LabeledContinue( 5, 5 ); test(); // The labeled statement contains statements after the labeled break. // Verify that the statements after the break are not executed. function LabeledContinue( limit, expect ) { i = 0; result1 = "pass"; result2 = "pass"; woohoo: { do { i++; if ( ! (i < limit) ) { break woohoo; result1 = "fail: evaluated statement after a labeled break"; } } while ( true ); result2 = "failed: broke out of loop, but not out of labeled block"; } new TestCase( SECTION, "do while ( " + i +" < " + limit +" )", expect, i ); new TestCase( SECTION, "breaking out of a do... while loop", "pass", result1 ); new TestCase( SECTION, "breaking out of a labeled do...while loop", "pass", result2 ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/dowhile-003.js0000644000175000017500000000564211545150464023211 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: dowhile-003 * ECMA Section: * Description: do...while statements * * Test do while, when the while expression is a JavaScript Number object. * * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "dowhile-003"; var VERSION = "ECMA_2"; var TITLE = "do...while with a labeled continue statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); DoWhile( new DoWhileObject( 1, 1, 0 )); DoWhile( new DoWhileObject( 1000, 1000, 0 )); DoWhile( new DoWhileObject( 1001, 1001, 0 )); DoWhile( new DoWhileObject( 1002, 1001, 1 )); DoWhile( new DoWhileObject( -1, 1001, -1002 )); test(); function DoWhileObject( value, iterations, endvalue ) { this.value = value; this.iterations = iterations; this.endvalue = endvalue; } function DoWhile( object ) { var i = 0; do { object.value = --object.value; i++; if ( i > 1000 ) break; } while( object.value ); new TestCase( SECTION, "loop iterations", object.iterations, i ); new TestCase( SECTION, "object.value", object.endvalue, Number( object.value ) ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/dowhile-004.js0000644000175000017500000000566411545150464023216 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: dowhile-004 * ECMA Section: * Description: do...while statements * * Test a labeled do...while. Break out of the loop with no label * should break out of the loop, but not out of the label. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "dowhile-004"; var VERSION = "ECMA_2"; var TITLE = "do...while with a labeled continue statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); DoWhile( 0, 1 ); DoWhile( 1, 1 ); DoWhile( -1, 1 ); DoWhile( 5, 5 ); test(); function DoWhile( limit, expect ) { i = 0; result1 = "pass"; result2 = "failed: broke out of labeled statement unexpectedly"; foo: { do { i++; if ( ! (i < limit) ) { break; result1 = "fail: evaluated statement after a labeled break"; } } while ( true ); result2 = "pass"; } new TestCase( SECTION, "do while ( " + i +" < " + limit +" )", expect, i ); new TestCase( SECTION, "breaking out of a do... while loop", "pass", result1 ); new TestCase( SECTION, "breaking out of a labeled do...while loop", "pass", result2 ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/dowhile-005.js0000644000175000017500000000607511545150464023214 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: dowhile-005 * ECMA Section: * Description: do...while statements * * Test a labeled do...while. Break out of the loop with no label * should break out of the loop, but not out of the label. * * Currently causes an infinite loop in the monkey. Uncomment the * print statement below and it works OK. * * Author: christine@netscape.com * Date: 26 August 1998 */ var SECTION = "dowhile-005"; var VERSION = "ECMA_2"; var TITLE = "do...while with a labeled continue statement"; var BUGNUMBER = "316293"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); NestedLabel(); test(); function NestedLabel() { i = 0; result1 = "pass"; result2 = "fail: did not hit code after inner loop"; result3 = "pass"; outer: { do { inner: { // print( i ); break inner; result1 = "fail: did break out of inner label"; } result2 = "pass"; break outer; print(i); } while ( i++ < 100 ); } result3 = "fail: did not break out of outer label"; new TestCase( SECTION, "number of loop iterations", 0, i ); new TestCase( SECTION, "break out of inner loop", "pass", result1 ); new TestCase( SECTION, "break out of outer loop", "pass", result2 ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/dowhile-006.js0000644000175000017500000000674311545150464023217 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: dowhile-006 * ECMA Section: * Description: do...while statements * * A general do...while test. * * Author: christine@netscape.com * Date: 26 August 1998 */ var SECTION = "dowhile-006"; var VERSION = "ECMA_2"; var TITLE = "do...while"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); DoWhile( new DoWhileObject( false, false, 10 ) ); DoWhile( new DoWhileObject( true, false, 2 ) ); DoWhile( new DoWhileObject( false, true, 3 ) ); DoWhile( new DoWhileObject( true, true, 4 ) ); test(); function looping( object ) { object.iterations--; if ( object.iterations <= 0 ) { return false; } else { return true; } } function DoWhileObject( breakOut, breakIn, iterations, loops ) { this.iterations = iterations; this.loops = loops; this.breakOut = breakOut; this.breakIn = breakIn; this.looping = looping; } function DoWhile( object ) { var result1 = false; var result2 = false; outie: { innie: { do { if ( object.breakOut ) break outie; if ( object.breakIn ) break innie; } while ( looping(object) ); // statements should be executed if: // do...while exits normally // do...while exits abruptly with no label result1 = true; } // statements should be executed if: // do...while breaks out with label "innie" // do...while exits normally // do...while does not break out with "outie" result2 = true; } new TestCase( SECTION, "hit code after loop in inner loop", ( object.breakIn || object.breakOut ) ? false : true , result1 ); new TestCase( SECTION, "hit code after loop in outer loop", ( object.breakOut ) ? false : true, result2 ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/dowhile-007.js0000644000175000017500000000742711545150464023220 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: dowhile-007 * ECMA Section: * Description: do...while statements * * A general do...while test. * * Author: christine@netscape.com * Date: 26 August 1998 */ var SECTION = "dowhile-007"; var VERSION = "ECMA_2"; var TITLE = "do...while"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); DoWhile( new DoWhileObject( false, false, false, false )); DoWhile( new DoWhileObject( true, false, false, false )); DoWhile( new DoWhileObject( true, true, false, false )); DoWhile( new DoWhileObject( true, true, true, false )); DoWhile( new DoWhileObject( true, true, true, true )); DoWhile( new DoWhileObject( false, false, false, true )); DoWhile( new DoWhileObject( false, false, true, true )); DoWhile( new DoWhileObject( false, true, true, true )); DoWhile( new DoWhileObject( false, false, true, false )); test(); function DoWhileObject( out1, out2, out3, in1 ) { this.breakOutOne = out1; this.breakOutTwo = out2; this.breakOutThree = out3; this.breakIn = in1; } function DoWhile( object ) { result1 = false; result2 = false; result3 = false; result4 = false; outie: do { if ( object.breakOutOne ) { break outie; } result1 = true; innie: do { if ( object.breakOutTwo ) { break outie; } result2 = true; if ( object.breakIn ) { break innie; } result3 = true; } while ( false ); if ( object.breakOutThree ) { break outie; } result4 = true; } while ( false ); new TestCase( SECTION, "break one: ", (object.breakOutOne) ? false : true, result1 ); new TestCase( SECTION, "break two: ", (object.breakOutOne||object.breakOutTwo) ? false : true, result2 ); new TestCase( SECTION, "break three: ", (object.breakOutOne||object.breakOutTwo||object.breakIn) ? false : true, result3 ); new TestCase( SECTION, "break four: ", (object.breakOutOne||object.breakOutTwo||object.breakOutThree) ? false: true, result4 ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/forin-001.js0000644000175000017500000001663711545150464022677 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: forin-001.js * ECMA Section: * Description: The forin-001 statement * * Verify that the property name is assigned to the property on the left * hand side of the for...in expression. * * Author: christine@netscape.com * Date: 28 August 1998 */ var SECTION = "forin-001"; var VERSION = "ECMA_2"; var TITLE = "The for...in statement"; var BUGNUMBER="330890"; var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=344855"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); ForIn_1( { length:4, company:"netscape", year:2000, 0:"zero" } ); ForIn_2( { length:4, company:"netscape", year:2000, 0:"zero" } ); ForIn_3( { length:4, company:"netscape", year:2000, 0:"zero" } ); // ForIn_6({ length:4, company:"netscape", year:2000, 0:"zero" }); // ForIn_7({ length:4, company:"netscape", year:2000, 0:"zero" }); ForIn_8({ length:4, company:"netscape", year:2000, 0:"zero" }); test(); /** * Verify that the left side argument is evaluated with every iteration. * Verify that the name of each property of the object is assigned to a * a property. * */ function ForIn_1( object ) { PropertyArray = new Array(); ValueArray = new Array(); for ( PropertyArray[PropertyArray.length] in object ) { ValueArray[ValueArray.length] = object[PropertyArray[PropertyArray.length-1]]; } for ( var i = 0; i < PropertyArray.length; i++ ) { new TestCase( SECTION, "object[" + PropertyArray[i] +"]", object[PropertyArray[i]], ValueArray[i] ); } new TestCase( SECTION, "object.length", PropertyArray.length, object.length ); } /** * Similar to ForIn_1, except it should increment the counter variable * every time the left hand expression is evaluated. */ function ForIn_2( object ) { PropertyArray = new Array(); ValueArray = new Array(); var i = 0; for ( PropertyArray[i++] in object ) { ValueArray[ValueArray.length] = object[PropertyArray[PropertyArray.length-1]]; } for ( i = 0; i < PropertyArray.length; i++ ) { new TestCase( SECTION, "object[" + PropertyArray[i] +"]", object[PropertyArray[i]], ValueArray[i] ); } new TestCase( SECTION, "object.length", PropertyArray.length, object.length ); } /** * Break out of a for...in loop * * */ function ForIn_3( object ) { var checkBreak = "pass"; var properties = new Array(); var values = new Array(); for ( properties[properties.length] in object ) { values[values.length] = object[properties[properties.length-1]]; break; checkBreak = "fail"; } new TestCase( SECTION, "check break out of for...in", "pass", checkBreak ); new TestCase( SECTION, "properties.length", 1, properties.length ); new TestCase( SECTION, "object["+properties[0]+"]", values[0], object[properties[0]] ); } /** * Break out of a labeled for...in loop. */ function ForIn_4( object ) { var result1 = 0; var result2 = 0; var result3 = 0; var result4 = 0; var i = 0; var property = new Array(); butterbean: { result1++; for ( property[i++] in object ) { result2++; break; result4++; } result3++; } new TestCase( SECTION, "verify labeled statement is only executed once", true, result1 == 1 ); new TestCase( SECTION, "verify statements in for loop are evaluated", true, result2 == i ); new TestCase( SECTION, "verify break out of labeled for...in loop", true, result4 == 0 ); new TestCase( SECTION, "verify break out of labeled block", true, result3 == 0 ); } /** * Labeled break out of a labeled for...in loop. */ function ForIn_5 (object) { var result1 = 0; var result2 = 0; var result3 = 0; var result4 = 0; var i = 0; var property = new Array(); bigredbird: { result1++; for ( property[i++] in object ) { result2++; break bigredbird; result4++; } result3++; } new TestCase( SECTION, "verify labeled statement is only executed once", true, result1 == 1 ); new TestCase( SECTION, "verify statements in for loop are evaluated", true, result2 == i ); new TestCase( SECTION, "verify break out of labeled for...in loop", true, result4 == 0 ); new TestCase( SECTION, "verify break out of labeled block", true, result3 == 0 ); } /** * Labeled continue from a labeled for...in loop */ function ForIn_7( object ) { var result1 = 0; var result2 = 0; var result3 = 0; var result4 = 0; var i = 0; var property = new Array(); bigredbird: for ( property[i++] in object ) { result2++; continue bigredbird; result4++; } new TestCase( SECTION, "verify statements in for loop are evaluated", true, result2 == i ); new TestCase( SECTION, "verify break out of labeled for...in loop", true, result4 == 0 ); new TestCase( SECTION, "verify break out of labeled block", true, result3 == 1 ); } /** * continue in a for...in loop * */ function ForIn_8( object ) { var checkBreak = "pass"; var properties = new Array(); var values = new Array(); for ( properties[properties.length] in object ) { values[values.length] = object[properties[properties.length-1]]; break; checkBreak = "fail"; } new TestCase( SECTION, "check break out of for...in", "pass", checkBreak ); new TestCase( SECTION, "properties.length", 1, properties.length ); new TestCase( SECTION, "object["+properties[0]+"]", values[0], object[properties[0]] ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/forin-002.js0000644000175000017500000000635511545150464022674 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: forin-002.js * ECMA Section: * Description: The forin-001 statement * * Verify that the property name is assigned to the property on the left * hand side of the for...in expression. * * Author: christine@netscape.com * Date: 28 August 1998 */ var SECTION = "forin-002"; var VERSION = "ECMA_2"; var TITLE = "The for...in statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function MyObject( value ) { this.value = value; this.valueOf = new Function ( "return this.value" ); this.toString = new Function ( "return this.value + \"\"" ); this.toNumber = new Function ( "return this.value + 0" ); this.toBoolean = new Function ( "return Boolean( this.value )" ); } ForIn_1(this); ForIn_2(this); ForIn_1(new MyObject(true)); ForIn_2(new MyObject(new Boolean(true))); ForIn_2(3); test(); /** * For ... In in a With Block * */ function ForIn_1( object) { with ( object ) { for ( property in object ) { new TestCase( SECTION, "with loop in a for...in loop. ("+object+")["+property +"] == "+ "eval ( " + property +" )", true, object[property] == eval(property) ); } } } /** * With block in a For...In loop * */ function ForIn_2(object) { for ( property in object ) { with ( object ) { new TestCase( SECTION, "with loop in a for...in loop. ("+object+")["+property +"] == "+ "eval ( " + property +" )", true, object[property] == eval(property) ); } } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/if-001.js0000644000175000017500000000473611545150464022155 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: if-001.js * ECMA Section: * Description: The if statement * * Verify that assignment in the if expression is evaluated correctly. * Verifies the fix for bug http://scopus/bugsplat/show_bug.cgi?id=148822. * * Author: christine@netscape.com * Date: 28 August 1998 */ var SECTION = "for-001"; var VERSION = "ECMA_2"; var TITLE = "The if statement"; var BUGNUMBER="148822"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var a = 0; var b = 0; var result = "passed"; if ( a = b ) { result = "failed: a = b should return 0"; } new TestCase( SECTION, "if ( a = b ), where a and b are both equal to 0", "passed", result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/jstests.list0000644000175000017500000000132711545150464023310 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_2/Statements/ script dowhile-001.js script dowhile-002.js script dowhile-003.js script dowhile-004.js script dowhile-005.js script dowhile-006.js script dowhile-007.js script forin-001.js fails-if(!xulRuntime.shell) script forin-002.js # bug - NS_ERROR_DOM_NOT_SUPPORTED_ERR line 112 script if-001.js script label-001.js script label-002.js script switch-001.js script switch-002.js script switch-003.js script switch-004.js script try-001.js script try-003.js script try-004.js script try-005.js script try-006.js script try-007.js script try-008.js script try-009.js script try-010.js script try-012.js script while-001.js script while-002.js script while-003.js script while-004.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/label-001.js0000644000175000017500000000500211545150464022621 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: label-001.js * ECMA Section: * Description: Labeled statements * * Labeled break and continue within a for loop. * * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "label-003"; var VERSION = "ECMA_2"; var TITLE = "Labeled statements"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); LabelTest(0, 0); LabelTest(1, 1) LabelTest(-1, 1000); LabelTest(false, 0); LabelTest(true, 1); test(); function LabelTest( limit, expect) { woo: for ( var result = 0; result < 1000; result++ ) { if (result == limit) { break woo; } else { continue woo; } }; new TestCase( SECTION, "break out of a labeled for loop: "+ limit, expect, result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/label-002.js0000644000175000017500000000604311545150464022630 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: label-002.js * ECMA Section: * Description: Labeled statements * * Labeled break and continue within a for-in loop. * * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "label-002"; var VERSION = "ECMA_2"; var TITLE = "Labeled statements"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); LabelTest( { p1:"hi,", p2:" norris" }, "hi, norris", " norrishi," ); LabelTest( { 0:"zero", 1:"one" }, "zeroone", "onezero" ); LabelTest2( { p1:"hi,", p2:" norris" }, "hi,", " norris" ); LabelTest2( { 0:"zero", 1:"one" }, "zero", "one" ); test(); function LabelTest( object, expect1, expect2 ) { result = ""; yoohoo: { for ( property in object ) { result += object[property]; }; break yoohoo }; new TestCase( SECTION, "yoohoo: for ( property in object ) { result += object[property]; } break yoohoo }", true, result == expect1 || result == expect2 ); } function LabelTest2( object, expect1, expect2 ) { result = ""; yoohoo: { for ( property in object ) { result += object[property]; break yoohoo } }; ; new TestCase( SECTION, "yoohoo: for ( property in object ) { result += object[property]; break yoohoo }}", true, result == expect1 || result == expect2 ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/shell.js0000644000175000017500000000000011545150464022344 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/switch-001.js0000644000175000017500000000547511545150464023061 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: switch-001.js * ECMA Section: * Description: The switch Statement * * A simple switch test with no abrupt completions. * * Author: christine@netscape.com * Date: 11 August 1998 * */ var SECTION = "switch-001"; var VERSION = "ECMA_2"; var TITLE = "The switch statement"; var BUGNUMBER="315767"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); SwitchTest( 0, 126 ); SwitchTest( 1, 124 ); SwitchTest( 2, 120 ); SwitchTest( 3, 112 ); SwitchTest( 4, 64 ); SwitchTest( 5, 96 ); SwitchTest( true, 96 ); SwitchTest( false, 96 ); SwitchTest( null, 96 ); SwitchTest( void 0, 96 ); SwitchTest( "0", 96 ); test(); function SwitchTest( input, expect ) { var result = 0; switch ( input ) { case 0: result += 2; case 1: result += 4; case 2: result += 8; case 3: result += 16; default: result += 32; case 4: result +=64; } new TestCase( SECTION, "switch with no breaks, case expressions are numbers. input is "+ input, expect, result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/switch-002.js0000644000175000017500000000537711545150464023063 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: switch-002.js * ECMA Section: * Description: The switch Statement * * A simple switch test with no abrupt completions. * * Author: christine@netscape.com * Date: 11 August 1998 * */ var SECTION = "switch-002"; var VERSION = "ECMA_2"; var TITLE = "The switch statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); SwitchTest( 0, 6 ); SwitchTest( 1, 4 ); SwitchTest( 2, 56 ); SwitchTest( 3, 48 ); SwitchTest( 4, 64 ); SwitchTest( true, 32 ); SwitchTest( false, 32 ); SwitchTest( null, 32 ); SwitchTest( void 0, 32 ); SwitchTest( "0", 32 ); test(); function SwitchTest( input, expect ) { var result = 0; switch ( input ) { case 0: result += 2; case 1: result += 4; break; case 2: result += 8; case 3: result += 16; default: result += 32; break; case 4: result += 64; } new TestCase( SECTION, "switch with no breaks: input is " + input, expect, result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/switch-003.js0000644000175000017500000000557411545150464023063 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: switch-003.js * ECMA Section: * Description: The switch Statement * * Attempt to verify that case statements are evaluated in source order * * Author: christine@netscape.com * Date: 11 August 1998 * */ var SECTION = "switch-003"; var VERSION = "ECMA_2"; var TITLE = "The switch statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); SwitchTest( "a", "abc" ); SwitchTest( "b", "bc" ); SwitchTest( "c", "c" ); SwitchTest( "d", "*abc" ); SwitchTest( "v", "*abc" ); SwitchTest( "w", "w*abc" ); SwitchTest( "x", "xw*abc" ); SwitchTest( "y", "yxw*abc" ); SwitchTest( "z", "zyxw*abc" ); // SwitchTest( new java.lang.String("z"), "*abc" ); test(); function SwitchTest( input, expect ) { var result = ""; switch ( input ) { case "z": result += "z"; case "y": result += "y"; case "x": result += "x"; case "w": result += "w"; default: result += "*"; case "a": result += "a"; case "b": result += "b"; case "c": result += "c"; } new TestCase( SECTION, "switch with no breaks: input is " + input, expect, result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/switch-004.js0000644000175000017500000001026511545150464023055 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: switch-003.js * ECMA Section: * Description: The switch Statement * * This uses variables and objects as case expressions in switch statements. * This verifies a bunch of bugs: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315988 * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315975 * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315954 * * Author: christine@netscape.com * Date: 11 August 1998 * */ var SECTION = "switch-003"; var VERSION = "ECMA_2"; var TITLE = "The switch statement"; var BUGNUMBER= "315988"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); ONE = new Number(1); ZERO = new Number(0); var A = new String("A"); var B = new String("B"); TRUE = new Boolean( true ); FALSE = new Boolean( false ); UNDEFINED = void 0; NULL = null; SwitchTest( ZERO, "ZERO" ); SwitchTest( NULL, "NULL" ); SwitchTest( UNDEFINED, "UNDEFINED" ); SwitchTest( FALSE, "FALSE" ); SwitchTest( false, "false" ); SwitchTest( 0, "0" ); SwitchTest ( TRUE, "TRUE" ); SwitchTest( 1, "1" ); SwitchTest( ONE, "ONE" ); SwitchTest( true, "true" ); SwitchTest( "a", "a" ); SwitchTest( A, "A" ); SwitchTest( "b", "b" ); SwitchTest( B, "B" ); SwitchTest( new Boolean( true ), "default" ); SwitchTest( new Boolean(false ), "default" ); SwitchTest( new String( "A" ), "default" ); SwitchTest( new Number( 0 ), "default" ); test(); function SwitchTest( input, expect ) { var result = ""; switch ( input ) { default: result += "default"; break; case "a": result += "a"; break; case "b": result += "b"; break; case A: result += "A"; break; case B: result += "B"; break; case new Boolean(true): result += "new TRUE"; break; case new Boolean(false): result += "new FALSE"; break; case NULL: result += "NULL"; break; case UNDEFINED: result += "UNDEFINED"; break; case true: result += "true"; break; case false: result += "false"; break; case TRUE: result += "TRUE"; break; case FALSE: result += "FALSE"; break; case 0: result += "0"; break; case 1: result += "1"; break; case new Number(0) : result += "new ZERO"; break; case new Number(1) : result += "new ONE"; break; case ONE: result += "ONE"; break; case ZERO: result += "ZERO"; break; } new TestCase( SECTION, "switch with no breaks: input is " + input, expect, result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/try-001.js0000644000175000017500000000714311545150464022370 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: try-001.js * ECMA Section: * Description: The try statement * * This test contains try, catch, and finally blocks. An exception is * sometimes thrown by a function called from within the try block. * * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = ""; var VERSION = "ECMA_2"; var TITLE = "The try statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var INVALID_JAVA_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor"; TryNewJavaInteger( "3.14159", INVALID_JAVA_INTEGER_VALUE ); TryNewJavaInteger( NaN, INVALID_JAVA_INTEGER_VALUE ); TryNewJavaInteger( 0, 0 ); TryNewJavaInteger( -1, -1 ); TryNewJavaInteger( 1, 1 ); TryNewJavaInteger( Infinity, Infinity ); test(); /** * Check to see if the input is valid for java.lang.Integer. If it is * not valid, throw INVALID_JAVA_INTEGER_VALUE. If input is valid, * return Number( v ) * */ function newJavaInteger( v ) { value = Number( v ); if ( Math.floor(value) != value || isNaN(value) ) { throw ( INVALID_JAVA_INTEGER_VALUE ); } else { return value; } } /** * Call newJavaInteger( value ) from within a try block. Catch any * exception, and store it in result. Verify that we got the right * return value from newJavaInteger in cases in which we do not expect * exceptions, and that we got the exception in cases where an exception * was expected. */ function TryNewJavaInteger( value, expect ) { var finalTest = false; try { result = newJavaInteger( value ); } catch ( e ) { result = String( e ); } finally { finalTest = true; } new TestCase( SECTION, "newJavaValue( " + value +" )", expect, result); new TestCase( SECTION, "newJavaValue( " + value +" ) hit finally block", true, finalTest); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/try-003.js0000644000175000017500000000652211545150464022372 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: try-003.js * ECMA Section: * Description: The try statement * * This test has a try with no catch, and a finally. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "try-003"; var VERSION = "ECMA_2"; var TITLE = "The try statement"; var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=313585"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // Tests start here. TrySomething( "x = \"hi\"", false ); TrySomething( "throw \"boo\"", true ); TrySomething( "throw 3", true ); test(); /** * This function contains a try block with no catch block, * but it does have a finally block. Try to evaluate expressions * that do and do not throw exceptions. */ function TrySomething( expression, throwing ) { innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK"; if (throwing) { outerCatch = "FAILED: NO EXCEPTION CAUGHT"; } else { outerCatch = "PASS"; } outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK"; try { try { eval( expression ); } finally { innerFinally = "PASS"; } } catch ( e ) { if (throwing) { outerCatch = "PASS"; } else { outerCatch = "FAIL: HIT OUTER CATCH BLOCK"; } } finally { outerFinally = "PASS"; } new TestCase( SECTION, "eval( " + expression +" )", "PASS", innerFinally ); new TestCase( SECTION, "eval( " + expression +" )", "PASS", outerCatch ); new TestCase( SECTION, "eval( " + expression +" )", "PASS", outerFinally ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/try-004.js0000644000175000017500000000540711545150464022374 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: try-004.js * ECMA Section: * Description: The try statement * * This test has a try with one catch block but no finally. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "try-004"; var VERSION = "ECMA_2"; var TITLE = "The try statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); TryToCatch( "Math.PI", Math.PI ); TryToCatch( "Thrower(5)", "Caught 5" ); TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" ); test(); function Thrower( v ) { throw "Caught " + v; } /** * Evaluate a string. Catch any exceptions thrown. If no exception is * expected, verify the result of the evaluation. If an exception is * expected, verify that we got the right exception. */ function TryToCatch( value, expect ) { try { result = eval( value ); } catch ( e ) { result = e; } new TestCase( SECTION, "eval( " + value +" )", expect, result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/try-005.js0000644000175000017500000000564411545150464022400 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: try-005.js * ECMA Section: * Description: The try statement * * This test has a try with one catch block but no finally. Same * as try-004, but the eval statement is called from a function, not * directly from within the try block. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "try-005"; var VERSION = "ECMA_2"; var TITLE = "The try statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); TryToCatch( "Math.PI", Math.PI ); TryToCatch( "Thrower(5)", "Caught 5" ); TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" ); test(); function Thrower( v ) { throw "Caught " + v; } function Eval( v ) { return eval( v ); } /** * Evaluate a string. Catch any exceptions thrown. If no exception is * expected, verify the result of the evaluation. If an exception is * expected, verify that we got the right exception. */ function TryToCatch( value, expect ) { try { result = Eval( value ); } catch ( e ) { result = e; } new TestCase( SECTION, "eval( " + value +" )", expect, result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/try-006.js0000644000175000017500000000721211545150464022372 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: try-006.js * ECMA Section: * Description: The try statement * * Throw an exception from within a With block in a try block. Verify * that any expected exceptions are caught. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "try-006"; var VERSION = "ECMA_2"; var TITLE = "The try statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); /** * This is the "check" function for test objects that will * throw an exception. */ function throwException() { throw EXCEPTION_STRING +": " + this.valueOf(); } var EXCEPTION_STRING = "Exception thrown:"; /** * This is the "check" function for test objects that do not * throw an exception */ function noException() { return this.valueOf(); } /** * Add test cases here */ TryWith( new TryObject( "hello", throwException, true )); TryWith( new TryObject( "hola", noException, false )); /** * Run the test. */ test(); /** * This is the object that will be the "this" in a with block. */ function TryObject( value, fun, exception ) { this.value = value; this.exception = exception; this.valueOf = new Function ( "return this.value" ); this.check = fun; } /** * This function has the try block that has a with block within it. * Test cases are added in this function. Within the with block, the * object's "check" function is called. If the test object's exception * property is true, we expect the result to be the exception value. * If exception is false, then we expect the result to be the value of * the object. */ function TryWith( object ) { try { with ( object ) { result = check(); } } catch ( e ) { result = e; } new TestCase( SECTION, "TryWith( " + object.value +" )", (object.exception ? EXCEPTION_STRING +": " + object.valueOf() : object.valueOf()), result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/try-007.js0000644000175000017500000000715111545150464022375 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: try-007.js * ECMA Section: * Description: The try statement * * This test has a for-in statement within a try block. * * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "try-007"; var VERSION = "ECMA_2"; var TITLE = "The try statement: for-in"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); /** * This is the "check" function for test objects that will * throw an exception. */ function throwException() { throw EXCEPTION_STRING +": " + this.valueOf(); } var EXCEPTION_STRING = "Exception thrown:"; /** * This is the "check" function for test objects that do not * throw an exception */ function noException() { return this.valueOf(); } /** * Add test cases here */ TryForIn( new TryObject( "hello", throwException, true )); TryForIn( new TryObject( "hola", noException, false )); /** * Run the test. */ test(); /** * This is the object that will be the "this" in a with block. * The check function is either throwException() or noException(). * See above. * */ function TryObject( value, fun, exception ) { this.value = value; this.exception = exception; this.check = fun; this.valueOf = function () { return this.value; } } /** * This function has a for-in statement within a try block. Test cases * are added after the try-catch-finally statement. Within the for-in * block, call a function that can throw an exception. Verify that any * exceptions are properly caught. */ function TryForIn( object ) { try { for ( p in object ) { if ( typeof object[p] == "function" ) { result = object[p](); } } } catch ( e ) { result = e; } new TestCase( SECTION, "TryForIn( " + object+ " )", (object.exception ? EXCEPTION_STRING +": " + object.value : object.value), result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/try-008.js0000644000175000017500000000557711545150464022410 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: try-008.js * ECMA Section: * Description: The try statement * * This test has a try block in a constructor. * * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "try-008"; var VERSION = "ECMA_2"; var TITLE = "The try statement: try in a constructor"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function Integer( value, exception ) { try { this.value = checkValue( value ); } catch ( e ) { this.value = e.toString(); } new TestCase( SECTION, "Integer( " + value +" )", (exception ? INVALID_INTEGER_VALUE +": " + value : this.value), this.value ); } var INVALID_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor"; function checkValue( value ) { if ( Math.floor(value) != value || isNaN(value) ) { throw ( INVALID_INTEGER_VALUE +": " + value ); } else { return value; } } // add test cases new Integer( 3, false ); new Integer( NaN, true ); new Integer( 0, false ); new Integer( Infinity, false ); new Integer( -2.12, true ); new Integer( Math.LN2, true ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/try-009.js0000644000175000017500000000632611545150464022402 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: try-009.js * ECMA Section: * Description: The try statement * * This test has a try block within a while block. Verify that an exception * breaks out of the while. I don't really know why this is an interesting * test case but Mike Shaver had two of these so what the hey. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "try-009"; var VERSION = "ECMA_2"; var TITLE = "The try statement: try in a while block"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var EXCEPTION_STRING = "Exception thrown: "; var NO_EXCEPTION_STRING = "No exception thrown: "; TryInWhile( new TryObject( "hello", ThrowException, true ) ); TryInWhile( new TryObject( "aloha", NoException, false )); test(); function TryObject( value, throwFunction, result ) { this.value = value; this.thrower = throwFunction; this.result = result; } function ThrowException() { throw EXCEPTION_STRING + this.value; } function NoException() { return NO_EXCEPTION_STRING + this.value; } function TryInWhile( object ) { result = null; while ( true ) { try { object.thrower(); result = NO_EXCEPTION_STRING + object.value; break; } catch ( e ) { result = e; break; } } new TestCase( SECTION, "( "+ object +".thrower() )", (object.result ? EXCEPTION_STRING + object.value : NO_EXCEPTION_STRING + object.value), result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/try-010.js0000644000175000017500000000662611545150464022375 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: try-010.js * ECMA Section: * Description: The try statement * * This has a try block nested in the try block. Verify that the * exception is caught by the right try block, and all finally blocks * are executed. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "try-010"; var VERSION = "ECMA_2"; var TITLE = "The try statement: try in a tryblock"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var EXCEPTION_STRING = "Exception thrown: "; var NO_EXCEPTION_STRING = "No exception thrown: "; NestedTry( new TryObject( "No Exceptions Thrown", NoException, NoException, 43 ) ); NestedTry( new TryObject( "Throw Exception in Outer Try", ThrowException, NoException, 48 )); NestedTry( new TryObject( "Throw Exception in Inner Try", NoException, ThrowException, 45 )); NestedTry( new TryObject( "Throw Exception in Both Trys", ThrowException, ThrowException, 48 )); test(); function TryObject( description, tryOne, tryTwo, result ) { this.description = description; this.tryOne = tryOne; this.tryTwo = tryTwo; this.result = result; } function ThrowException() { throw EXCEPTION_STRING + this.value; } function NoException() { return NO_EXCEPTION_STRING + this.value; } function NestedTry( object ) { result = 0; try { object.tryOne(); result += 1; try { object.tryTwo(); result += 2; } catch ( e ) { result +=4; } finally { result += 8; } } catch ( e ) { result += 16; } finally { result += 32; } new TestCase( SECTION, object.description, object.result, result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/try-012.js0000644000175000017500000000767211545150464022401 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: try-012.js * ECMA Section: * Description: The try statement * * This test has a try with no catch, and a finally. This is like try-003, * but throws from a finally block, not the try block. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "try-012"; var VERSION = "ECMA_2"; var TITLE = "The try statement"; var BUGNUMBER="336872"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // Tests start here. TrySomething( "x = \"hi\"", true ); TrySomething( "throw \"boo\"", true ); TrySomething( "throw 3", true ); test(); /** * This function contains a try block with no catch block, * but it does have a finally block. Try to evaluate expressions * that do and do not throw exceptions. * * The productioni TryStatement Block Finally is evaluated as follows: * 1. Evaluate Block * 2. Evaluate Finally * 3. If Result(2).type is normal return result 1 (in the test case, result 1 has * the completion type throw) * 4. return result 2 (does not get hit in this case) * */ function TrySomething( expression, throwing ) { innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK"; if (throwing) { outerCatch = "FAILED: NO EXCEPTION CAUGHT"; } else { outerCatch = "PASS"; } outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK"; // If the inner finally does not throw an exception, the result // of the try block should be returned. (Type of inner return // value should be throw if finally executes correctly try { try { throw 0; } finally { innerFinally = "PASS"; eval( expression ); } } catch ( e ) { if (throwing) { outerCatch = "PASS"; } else { outerCatch = "FAIL: HIT OUTER CATCH BLOCK"; } } finally { outerFinally = "PASS"; } new TestCase( SECTION, "eval( " + expression +" ): evaluated inner finally block", "PASS", innerFinally ); new TestCase( SECTION, "eval( " + expression +" ): evaluated outer catch block ", "PASS", outerCatch ); new TestCase( SECTION, "eval( " + expression +" ): evaluated outer finally block", "PASS", outerFinally ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/while-001.js0000644000175000017500000000464211545150464022663 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: while-001 * ECMA Section: * Description: while statement * * Verify that the while statement is not executed if the while expression is * false * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "while-001"; var VERSION = "ECMA_2"; var TITLE = "while statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); DoWhile(); test(); function DoWhile() { result = "pass"; while (false) { result = "fail"; break; } new TestCase( SECTION, "while statement: don't evaluate statement is expression is false", "pass", result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/while-002.js0000644000175000017500000000716211545150464022664 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: while-002 * ECMA Section: * Description: while statement * * Verify that the while statement is not executed if the while expression is * false * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "while-002"; var VERSION = "ECMA_2"; var TITLE = "while statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); DoWhile( new DoWhileObject( "while expression is null", null, "result = \"fail: should not have evaluated statements in while block;break" ) ); DoWhile( new DoWhileObject( "while expression is undefined", void 0, "result = \"fail: should not have evaluated statements in while block; break" )); DoWhile( new DoWhileObject( "while expression is 0", 0, "result = \"fail: should not have evaluated statements in while block; break;" )); DoWhile( new DoWhileObject( "while expression is eval(\"\")", eval(""), "result = \"fail: should not have evaluated statements in while block; break" )); DoWhile( new DoWhileObject( "while expression is NaN", NaN, "result = \"fail: should not have evaluated statements in while block; break" )); test(); function DoWhileObject( d, e, s ) { this.description = d; this.whileExpression = e; this.statements = s; } function DoWhile( object ) { result = "pass"; while ( expression = object.whileExpression ) { eval( object.statements ); } // verify that the while expression was evaluated new TestCase( SECTION, "verify that while expression was evaluated (should be "+ object.whileExpression +")", "pass", (object.whileExpression == expression || ( isNaN(object.whileExpression) && isNaN(expression) ) ) ? "pass" : "fail" ); new TestCase( SECTION, object.description, "pass", result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/while-003.js0000644000175000017500000000713111545150464022661 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: while-003 * ECMA Section: * Description: while statement * * The while expression evaluates to true, Statement returns abrupt completion. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "while-003"; var VERSION = "ECMA_2"; var TITLE = "while statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); DoWhile( new DoWhileObject( "while expression is true", true, "result = \"pass\";" )); DoWhile( new DoWhileObject( "while expression is 1", 1, "result = \"pass\";" )); DoWhile( new DoWhileObject( "while expression is new Boolean(false)", new Boolean(false), "result = \"pass\";" )); DoWhile( new DoWhileObject( "while expression is new Object()", new Object(), "result = \"pass\";" )); DoWhile( new DoWhileObject( "while expression is \"hi\"", "hi", "result = \"pass\";" )); /* DoWhile( new DoWhileObject( "while expression has a continue in it", "true", "if ( i == void 0 ) i = 0; result=\"pass\"; if ( ++i == 1 ) {continue;} else {break;} result=\"fail\";" )); */ test(); function DoWhileObject( d, e, s ) { this.description = d; this.whileExpression = e; this.statements = s; } function DoWhile( object ) { result = "fail: statements in while block were not evaluated"; while ( expression = object.whileExpression ) { eval( object.statements ); break; } // verify that the while expression was evaluated new TestCase( SECTION, "verify that while expression was evaluated (should be "+ object.whileExpression +")", "pass", (object.whileExpression == expression || ( isNaN(object.whileExpression) && isNaN(expression) ) ) ? "pass" : "fail" ); new TestCase( SECTION, object.description, "pass", result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/Statements/while-004.js0000644000175000017500000001401511545150464022661 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: while-004 * ECMA Section: * Description: while statement * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "while-004"; var VERSION = "ECMA_2"; var TITLE = "while statement"; var BUGNUMBER="316725"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); DoWhile_1(); DoWhile_2(); DoWhile_3(); DoWhile_4(); DoWhile_5(); test(); /** * Break out of a while by calling return. * * Tests: 12.6.2 step 6. */ function dowhile() { result = "pass"; while (true) { return result; result = "fail: hit code after return statement"; break; } } function DoWhile_1() { description = "return statement in a while block"; result = dowhile(); new TestCase( SECTION, "DoWhile_1" + description, "pass", result ); } /** * While with a labeled continue statement. Verify that statements * after the continue statement are not evaluated. * * Tests: 12.6.2 step 8. * */ function DoWhile_2() { var description = "while with a labeled continue statement"; var result1 = "pass"; var result2 = "fail: did not execute code after loop, but inside label"; var i = 0; var j = 0; theloop: while( i++ < 10 ) { j++; continue theloop; result1 = "failed: hit code after continue statement"; } result2 = "pass"; new TestCase( SECTION, "DoWhile_2: " +description + " - code inside the loop, before the continue should be executed ("+j+")", true, j == 10 ); new TestCase( SECTION, "DoWhile_2: " +description +" - code after labeled continue should not be executed", "pass", result1 ); new TestCase( SECTION, "DoWhile_2: " +description +" - code after loop but inside label should be executed", "pass", result2 ); } /** * While with a labeled break. * */ function DoWhile_3() { var description = "while with a labeled break statement"; var result1 = "pass"; var result2 = "pass"; var result3 = "fail: did not get to code after label"; woohoo: { while( true ) { break woohoo; result1 = "fail: got to code after a break"; } result2 = "fail: got to code outside of loop but inside label"; } result3 = "pass"; new TestCase( SECTION, "DoWhile_3: " +description +" - verify break out of loop", "pass", result1 ); new TestCase( SECTION, "DoWhile_3: " +description +" - verify break out of label", "pass", result2 ); new TestCase( SECTION, "DoWhile_3: " +description + " - verify correct exit from label", "pass", result3 ); } /** * Labled while with an unlabeled break * */ function DoWhile_4() { var description = "labeled while with an unlabeled break"; var result1 = "pass"; var result2 = "pass"; var result3 = "fail: did not evaluate statement after label"; woohooboy: { while( true ) { break woohooboy; result1 = "fail: got to code after the break"; } result2 = "fail: broke out of while, but not out of label"; } result3 = "pass"; new TestCase( SECTION, "DoWhile_4: " +description +" - verify break out of while loop", "pass", result1 ); new TestCase( SECTION, "DoWhile_4: " +description + " - verify break out of label", "pass", result2 ); new TestCase( SECTION, "DoWhile_4: " +description +" - verify that statements after label are evaluated", "pass", result3 ); } /** * in this case, should behave the same way as * * */ function DoWhile_5() { var description = "while with a labeled continue statement"; var result1 = "pass"; var result2 = "fail: did not execute code after loop, but inside label"; var i = 0; var j = 0; theloop: { j++; while( i++ < 10 ) { continue; result1 = "failed: hit code after continue statement"; } result2 = "pass"; } new TestCase( SECTION, "DoWhile_5: " +description + " - continue should not execute statements above the loop", true, ( j == 1 ) ); new TestCase( SECTION, "DoWhile_5: " +description +" - code after labeled continue should not be executed", "pass", result1 ); new TestCase( SECTION, "DoWhile_5: " +description +" - code after loop but inside label should be executed", "pass", result2 ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/String/browser.js0000644000175000017500000000000011545150464022037 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/String/jstests.list0000644000175000017500000000035311545150464022425 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_2/String/ script match-001.js script match-002.js script match-003.js script match-004.js skip script replace-001.js # obsolete test script split-001.js script split-002.js script split-003.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/String/match-001.js0000644000175000017500000001162611545150464021766 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: String/match-001.js * ECMA Section: 15.6.4.9 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ /* * String.match( regexp ) * * If regexp is not an object of type RegExp, it is replaced with result * of the expression new RegExp(regexp). Let string denote the result of * converting the this value to a string. If regexp.global is false, * return the result obtained by invoking RegExp.prototype.exec (see * section 15.7.5.3) on regexp with string as parameter. * * Otherwise, set the regexp.lastIndex property to 0 and invoke * RegExp.prototype.exec repeatedly until there is no match. If there is a * match with an empty string (in other words, if the value of * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1. * The value returned is an array with the properties 0 through n-1 * corresponding to the first element of the result of each matching * invocation of RegExp.prototype.exec. * * Note that the match function is intentionally generic; it does not * require that its this value be a string object. Therefore, it can be * transferred to other kinds of objects for use as a method. */ var SECTION = "String/match-001.js"; var VERSION = "ECMA_2"; var TITLE = "String.prototype.match( regexp )"; startTest(); // the regexp argument is not a RegExp object // this is not a string object // cases in which the regexp global property is false AddRegExpCases( 3, "3", "1234567890", 1, 2, ["3"] ); // cases in which the regexp object global property is true AddGlobalRegExpCases( /34/g, "/34/g", "343443444", 3, ["34", "34", "34"] ); AddGlobalRegExpCases( /\d{1}/g, "/d{1}/g", "123456abcde7890", 10, ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] ); AddGlobalRegExpCases( /\d{2}/g, "/d{2}/g", "123456abcde7890", 5, ["12", "34", "56", "78", "90"] ); AddGlobalRegExpCases( /\D{2}/g, "/d{2}/g", "123456abcde7890", 2, ["ab", "cd"] ); test(); function AddRegExpCases( regexp, str_regexp, string, length, index, matches_array ) { AddTestCase( "( " + string + " ).match(" + str_regexp +").length", length, string.match(regexp).length ); AddTestCase( "( " + string + " ).match(" + str_regexp +").index", index, string.match(regexp).index ); AddTestCase( "( " + string + " ).match(" + str_regexp +").input", string, string.match(regexp).input ); for ( var matches = 0; matches < matches_array.length; matches++ ) { AddTestCase( "( " + string + " ).match(" + str_regexp +")[" + matches +"]", matches_array[matches], string.match(regexp)[matches] ); } } function AddGlobalRegExpCases( regexp, str_regexp, string, length, matches_array ) { AddTestCase( "( " + string + " ).match(" + str_regexp +").length", length, string.match(regexp).length ); for ( var matches = 0; matches < matches_array.length; matches++ ) { AddTestCase( "( " + string + " ).match(" + str_regexp +")[" + matches +"]", matches_array[matches], string.match(regexp)[matches] ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/String/match-002.js0000644000175000017500000001435311545150464021767 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: String/match-002.js * ECMA Section: 15.6.4.9 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ /* * String.match( regexp ) * * If regexp is not an object of type RegExp, it is replaced with result * of the expression new RegExp(regexp). Let string denote the result of * converting the this value to a string. If regexp.global is false, * return the result obtained by invoking RegExp.prototype.exec (see * section 15.7.5.3) on regexp with string as parameter. * * Otherwise, set the regexp.lastIndex property to 0 and invoke * RegExp.prototype.exec repeatedly until there is no match. If there is a * match with an empty string (in other words, if the value of * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1. * The value returned is an array with the properties 0 through n-1 * corresponding to the first element of the result of each matching * invocation of RegExp.prototype.exec. * * Note that the match function is intentionally generic; it does not * require that its this value be a string object. Therefore, it can be * transferred to other kinds of objects for use as a method. * * This file tests cases in which regexp.global is false. Therefore, * results should behave as regexp.exec with string passed as a parameter. * */ var SECTION = "String/match-002.js"; var VERSION = "ECMA_2"; var TITLE = "String.prototype.match( regexp )"; startTest(); // the regexp argument is not a RegExp object // this is not a string object AddRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/, "/([\d]{5})([-\ ]?[\d]{4})?$/", "Boston, Mass. 02134", 14, ["02134", "02134", undefined]); AddGlobalRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/g, "/([\d]{5})([-\ ]?[\d]{4})?$/g", "Boston, Mass. 02134", ["02134"]); // set the value of lastIndex re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = 0; s = "Boston, MA 02134"; AddRegExpCases( re, "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex =0", s, s.lastIndexOf("0"), ["02134", "02134", undefined]); re.lastIndex = s.length; AddRegExpCases( re, "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + s.length, s, s.lastIndexOf("0"), ["02134", "02134", undefined] ); re.lastIndex = s.lastIndexOf("0"); AddRegExpCases( re, "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + s.lastIndexOf("0"), s, s.lastIndexOf("0"), ["02134", "02134", undefined]); re.lastIndex = s.lastIndexOf("0") + 1; AddRegExpCases( re, "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + s.lastIndexOf("0") +1, s, s.lastIndexOf("0"), ["02134", "02134", undefined]); test(); function AddRegExpCases( regexp, str_regexp, string, index, matches_array ) { // prevent a runtime error if ( regexp.exec(string) == null || matches_array == null ) { AddTestCase( string + ".match(" + regexp +")", matches_array, string.match(regexp) ); return; } AddTestCase( "( " + string + " ).match(" + str_regexp +").length", matches_array.length, string.match(regexp).length ); AddTestCase( "( " + string + " ).match(" + str_regexp +").index", index, string.match(regexp).index ); AddTestCase( "( " + string + " ).match(" + str_regexp +").input", string, string.match(regexp).input ); var limit = matches_array.length > string.match(regexp).length ? matches_array.length : string.match(regexp).length; for ( var matches = 0; matches < limit; matches++ ) { AddTestCase( "( " + string + " ).match(" + str_regexp +")[" + matches +"]", matches_array[matches], string.match(regexp)[matches] ); } } function AddGlobalRegExpCases( regexp, str_regexp, string, matches_array ) { // prevent a runtime error if ( regexp.exec(string) == null || matches_array == null ) { AddTestCase( regexp + ".exec(" + string +")", matches_array, regexp.exec(string) ); return; } AddTestCase( "( " + string + " ).match(" + str_regexp +").length", matches_array.length, string.match(regexp).length ); var limit = matches_array.length > string.match(regexp).length ? matches_array.length : string.match(regexp).length; for ( var matches = 0; matches < limit; matches++ ) { AddTestCase( "( " + string + " ).match(" + str_regexp +")[" + matches +"]", matches_array[matches], string.match(regexp)[matches] ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/String/match-003.js0000644000175000017500000001222411545150464021763 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: String/match-003.js * ECMA Section: 15.6.4.9 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ /* * String.match( regexp ) * * If regexp is not an object of type RegExp, it is replaced with result * of the expression new RegExp(regexp). Let string denote the result of * converting the this value to a string. If regexp.global is false, * return the result obtained by invoking RegExp.prototype.exec (see * section 15.7.5.3) on regexp with string as parameter. * * Otherwise, set the regexp.lastIndex property to 0 and invoke * RegExp.prototype.exec repeatedly until there is no match. If there is a * match with an empty string (in other words, if the value of * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1. * The value returned is an array with the properties 0 through n-1 * corresponding to the first element of the result of each matching * invocation of RegExp.prototype.exec. * * Note that the match function is intentionally generic; it does not * require that its this value be a string object. Therefore, it can be * transferred to other kinds of objects for use as a method. */ var SECTION = "String/match-003.js"; var VERSION = "ECMA_2"; var TITLE = "String.prototype.match( regexp )"; startTest(); // the regexp argument is not a RegExp object // this is not a string object // [if regexp.global is true] set the regexp.lastIndex property to 0 and // invoke RegExp.prototype.exec repeatedly until there is no match. If // there is a match with an empty string (in other words, if the value of // regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1. // The value returned is an array with the properties 0 through n-1 // corresponding to the first element of the result of each matching invocation // of RegExp.prototype.exec. // set the value of lastIndex re = /([\d]{5})([-\ ]?[\d]{4})?$/g; s = "Boston, MA 02134"; AddGlobalRegExpCases( re, "re = " + re, s, ["02134" ]); re.lastIndex = 0; AddGlobalRegExpCases( re, "re = " + re + "; re.lastIndex = 0 ", s, ["02134"]); re.lastIndex = s.length; AddGlobalRegExpCases( re, "re = " + re + "; re.lastIndex = " + s.length, s, ["02134"] ); re.lastIndex = s.lastIndexOf("0"); AddGlobalRegExpCases( re, "re = "+ re +"; re.lastIndex = " + s.lastIndexOf("0"), s, ["02134"]); re.lastIndex = s.lastIndexOf("0") + 1; AddGlobalRegExpCases( re, "re = " +re+ "; re.lastIndex = " + (s.lastIndexOf("0") +1), s, ["02134"]); test(); function AddGlobalRegExpCases( regexp, str_regexp, string, matches_array ) { // prevent a runtime error if ( string.match(regexp) == null || matches_array == null ) { AddTestCase( string + ".match(" + str_regexp +")", matches_array, string.match(regexp) ); return; } AddTestCase( "( " + string + " ).match(" + str_regexp +").length", matches_array.length, string.match(regexp).length ); var limit = matches_array.length > string.match(regexp).length ? matches_array.length : string.match(regexp).length; for ( var matches = 0; matches < limit; matches++ ) { AddTestCase( "( " + string + " ).match(" + str_regexp +")[" + matches +"]", matches_array[matches], string.match(regexp)[matches] ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/String/match-004.js0000644000175000017500000001357411545150464021775 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: String/match-004.js * ECMA Section: 15.6.4.9 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ /* * String.match( regexp ) * * If regexp is not an object of type RegExp, it is replaced with result * of the expression new RegExp(regexp). Let string denote the result of * converting the this value to a string. If regexp.global is false, * return the result obtained by invoking RegExp.prototype.exec (see * section 15.7.5.3) on regexp with string as parameter. * * Otherwise, set the regexp.lastIndex property to 0 and invoke * RegExp.prototype.exec repeatedly until there is no match. If there is a * match with an empty string (in other words, if the value of * regexp.lastIndex is left unchanged) increment regexp.lastIndex by 1. * The value returned is an array with the properties 0 through n-1 * corresponding to the first element of the result of each matching * invocation of RegExp.prototype.exec. * * Note that the match function is intentionally generic; it does not * require that its this value be a string object. Therefore, it can be * transferred to other kinds of objects for use as a method. * * * The match function should be intentionally generic, and not require * this to be a string. * */ var SECTION = "String/match-004.js"; var VERSION = "ECMA_2"; var TITLE = "String.prototype.match( regexp )"; var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=345818"; startTest(); // set the value of lastIndex re = /0./; s = 10203040506070809000; Number.prototype.match = String.prototype.match; AddRegExpCases( re, "re = " + re , s, String(s), 1, ["02"]); re.lastIndex = 0; AddRegExpCases( re, "re = " + re +" [lastIndex is " + re.lastIndex+"]", s, String(s), 1, ["02"]); /* re.lastIndex = s.length; AddRegExpCases( re, "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + s.length, s, s.lastIndexOf("0"), null ); re.lastIndex = s.lastIndexOf("0"); AddRegExpCases( re, "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + s.lastIndexOf("0"), s, s.lastIndexOf("0"), ["02134"]); re.lastIndex = s.lastIndexOf("0") + 1; AddRegExpCases( re, "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " + s.lastIndexOf("0") +1, s, 0, null); */ test(); function AddRegExpCases( regexp, str_regexp, string, str_string, index, matches_array ) { // prevent a runtime error if ( regexp.exec(string) == null || matches_array == null ) { AddTestCase( string + ".match(" + regexp +")", matches_array, string.match(regexp) ); return; } AddTestCase( "( " + string + " ).match(" + str_regexp +").length", matches_array.length, string.match(regexp).length ); AddTestCase( "( " + string + " ).match(" + str_regexp +").index", index, string.match(regexp).index ); AddTestCase( "( " + string + " ).match(" + str_regexp +").input", str_string, string.match(regexp).input ); var limit = matches_array.length > string.match(regexp).length ? matches_array.length : string.match(regexp).length; for ( var matches = 0; matches < limit; matches++ ) { AddTestCase( "( " + string + " ).match(" + str_regexp +")[" + matches +"]", matches_array[matches], string.match(regexp)[matches] ); } } function AddGlobalRegExpCases( regexp, str_regexp, string, matches_array ) { // prevent a runtime error if ( regexp.exec(string) == null || matches_array == null ) { AddTestCase( regexp + ".exec(" + string +")", matches_array, regexp.exec(string) ); return; } AddTestCase( "( " + string + " ).match(" + str_regexp +").length", matches_array.length, string.match(regexp).length ); var limit = matches_array.length > string.match(regexp).length ? matches_array.length : string.match(regexp).length; for ( var matches = 0; matches < limit; matches++ ) { AddTestCase( "( " + string + " ).match(" + str_regexp +")[" + matches +"]", matches_array[matches], string.match(regexp)[matches] ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/String/replace-001.js0000644000175000017500000001034211545150464022277 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: String/replace-001.js * ECMA Section: 15.6.4.10 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ var SECTION = "String/replace-001.js"; var VERSION = "ECMA_2"; var TITLE = "String.prototype.replace( regexp, replaceValue )"; startTest(); /* * If regexp is not an object of type RegExp, it is replaced with the * result of the expression new RegExp(regexp). Let string denote the * result of converting the this value to a string. String is searched * for the first occurrence of the regular expression pattern regexp if * regexp.global is false, or all occurrences if regexp.global is true. * * The match is performed as in String.prototype.match, including the * update of regexp.lastIndex. Let m be the number of matched * parenthesized subexpressions as specified in section 15.7.5.3. * * If replaceValue is a function, then for each matched substring, call * the function with the following m + 3 arguments. Argument 1 is the * substring that matched. The next m arguments are all of the matched * subexpressions. Argument m + 2 is the length of the left context, and * argument m + 3 is string. * * The result is a string value derived from the original input by * replacing each matched substring with the corresponding return value * of the function call, converted to a string if need be. * * Otherwise, let newstring denote the result of converting replaceValue * to a string. The result is a string value derived from the original * input string by replacing each matched substring with a string derived * from newstring by replacing characters in newstring by replacement text * as specified in the following table: * * $& The matched substring. * $‘ The portion of string that precedes the matched substring. * $’ The portion of string that follows the matched substring. * $+ The substring matched by the last parenthesized subexpressions in * the regular expression. * $n The corresponding matched parenthesized subexpression n, where n * is a single digit 0-9. If there are fewer than n subexpressions, “$n * is left unchanged. * * Note that the replace function is intentionally generic; it does not * require that its this value be a string object. Therefore, it can be * transferred to other kinds of objects for use as a method. */ AddTestCase( "NO TESTS EXIST", "PASSED", "Test not implemented"); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/String/shell.js0000644000175000017500000000000011545150464021463 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/String/split-001.js0000644000175000017500000001165311545150464022025 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: String/split-001.js * ECMA Section: 15.6.4.9 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ /* * Since regular expressions have been part of JavaScript since 1.2, there * are already tests for regular expressions in the js1_2/regexp folder. * * These new tests try to supplement the existing tests, and verify that * our implementation of RegExp conforms to the ECMA specification, but * does not try to be as exhaustive as in previous tests. * * The [,limit] argument to String.split is new, and not covered in any * existing tests. * * String.split cases are covered in ecma/String/15.5.4.8-*.js. * String.split where separator is a RegExp are in * js1_2/regexp/string_split.js * */ var SECTION = "ecma_2/String/split-001.js"; var VERSION = "ECMA_2"; var TITLE = "String.prototype.split( regexp, [,limit] )"; startTest(); // the separator is not supplied // separator is undefined // separator is an empty string AddSplitCases( "splitme", "", "''", ["s", "p", "l", "i", "t", "m", "e"] ); AddSplitCases( "splitme", new RegExp(), "new RegExp()", ["s", "p", "l", "i", "t", "m", "e"] ); // separartor is a regexp // separator regexp value global setting is set // string is an empty string // if separator is an empty string, split each by character // this is not a String object // limit is not a number // limit is undefined // limit is larger than 2^32-1 // limit is a negative number test(); function AddSplitCases( string, separator, str_sep, split_array ) { // verify that the result of split is an object of type Array AddTestCase( "( " + string + " ).split(" + str_sep +").constructor == Array", true, string.split(separator).constructor == Array ); // check the number of items in the array AddTestCase( "( " + string + " ).split(" + str_sep +").length", split_array.length, string.split(separator).length ); // check the value of each array item var limit = (split_array.length > string.split(separator).length ) ? split_array.length : string.split(separator).length; for ( var matches = 0; matches < split_array.length; matches++ ) { AddTestCase( "( " + string + " ).split(" + str_sep +")[" + matches +"]", split_array[matches], string.split( separator )[matches] ); } } function AddLimitedSplitCases( string, separator, str_sep, limit, str_limit, split_array ) { // verify that the result of split is an object of type Array AddTestCase( "( " + string + " ).split(" + str_sep +", " + str_limit + " ).constructor == Array", true, string.split(separator, limit).constructor == Array ); // check the length of the array AddTestCase( "( " + string + " ).split(" + str_sep +", " + str_limit + " ).length", length, string.split(separator).length ); // check the value of each array item for ( var matches = 0; matches < split_array.length; matches++ ) { AddTestCase( "( " + string + " ).split(" + str_sep +", " + str_limit + " )[" + matches +"]", split_array[matches], string.split( separator )[matches] ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/String/split-002.js0000644000175000017500000002125411545150464022024 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: String/split-002.js * ECMA Section: 15.6.4.9 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ /* * Since regular expressions have been part of JavaScript since 1.2, there * are already tests for regular expressions in the js1_2/regexp folder. * * These new tests try to supplement the existing tests, and verify that * our implementation of RegExp conforms to the ECMA specification, but * does not try to be as exhaustive as in previous tests. * * The [,limit] argument to String.split is new, and not covered in any * existing tests. * * String.split cases are covered in ecma/String/15.5.4.8-*.js. * String.split where separator is a RegExp are in * js1_2/regexp/string_split.js * */ var SECTION = "ecma_2/String/split-002.js"; var VERSION = "ECMA_2"; var TITLE = "String.prototype.split( regexp, [,limit] )"; startTest(); // the separator is not supplied // separator is undefined // separator is an empty string // AddSplitCases( "splitme", "", "''", ["s", "p", "l", "i", "t", "m", "e"] ); // AddSplitCases( "splitme", new RegExp(), "new RegExp()", ["s", "p", "l", "i", "t", "m", "e"] ); // separator is an empty regexp // separator is not supplied CompareSplit( "hello", "ll" ); CompareSplit( "hello", "l" ); CompareSplit( "hello", "x" ); CompareSplit( "hello", "h" ); CompareSplit( "hello", "o" ); CompareSplit( "hello", "hello" ); CompareSplit( "hello", undefined ); CompareSplit( "hello", ""); CompareSplit( "hello", "hellothere" ); CompareSplit( new String("hello" ) ); Number.prototype.split = String.prototype.split; CompareSplit( new Number(100111122133144155), 1 ); CompareSplitWithLimit(new Number(100111122133144155), 1, 1 ); CompareSplitWithLimit(new Number(100111122133144155), 1, 2 ); CompareSplitWithLimit(new Number(100111122133144155), 1, 0 ); CompareSplitWithLimit(new Number(100111122133144155), 1, 100 ); CompareSplitWithLimit(new Number(100111122133144155), 1, void 0 ); CompareSplitWithLimit(new Number(100111122133144155), 1, Math.pow(2,32)-1 ); CompareSplitWithLimit(new Number(100111122133144155), 1, "boo" ); CompareSplitWithLimit(new Number(100111122133144155), 1, -(Math.pow(2,32)-1) ); CompareSplitWithLimit( "hello", "l", NaN ); CompareSplitWithLimit( "hello", "l", 0 ); CompareSplitWithLimit( "hello", "l", 1 ); CompareSplitWithLimit( "hello", "l", 2 ); CompareSplitWithLimit( "hello", "l", 3 ); CompareSplitWithLimit( "hello", "l", 4 ); /* CompareSplitWithLimit( "hello", "ll", 0 ); CompareSplitWithLimit( "hello", "ll", 1 ); CompareSplitWithLimit( "hello", "ll", 2 ); CompareSplit( "", " " ); CompareSplit( "" ); */ // separartor is a regexp // separator regexp value global setting is set // string is an empty string // if separator is an empty string, split each by character // this is not a String object // limit is not a number // limit is undefined // limit is larger than 2^32-1 // limit is a negative number test(); function CompareSplit( string, separator ) { split_1 = string.split( separator ); split_2 = string_split( string, separator ); AddTestCase( "( " + string +".split(" + separator + ") ).length" , split_2.length, split_1.length ); var limit = split_1.length > split_2.length ? split_1.length : split_2.length; for ( var split_item = 0; split_item < limit; split_item++ ) { AddTestCase( string + ".split(" + separator + ")["+split_item+"]", split_2[split_item], split_1[split_item] ); } } function CompareSplitWithLimit( string, separator, splitlimit ) { split_1 = string.split( separator, splitlimit ); split_2 = string_split( string, separator, splitlimit ); AddTestCase( "( " + string +".split(" + separator + ", " + splitlimit+") ).length" , split_2.length, split_1.length ); var limit = split_1.length > split_2.length ? split_1.length : split_2.length; for ( var split_item = 0; split_item < limit; split_item++ ) { AddTestCase( string + ".split(" + separator + ", " + splitlimit+")["+split_item+"]", split_2[split_item], split_1[split_item] ); } } function string_split ( __this, separator, limit ) { var S = String(__this ); // 1 var A = new Array(); // 2 if ( limit == undefined ) { // 3 lim = Math.pow(2, 31 ) -1; } else { lim = ToUint32( limit ); } var s = S.length; // 4 var p = 0; // 5 if ( separator == undefined ) { // 8 A[0] = S; return A; } if ( separator.constructor == RegExp ) // 6 R = separator; else R = separator.toString(); if (lim == 0) return A; // 7 if ( separator == undefined ) { // 8 A[0] = S; return A; } if (s == 0) { // 9 z = SplitMatch(R, S, 0); if (z != false) return A; A[0] = S; return A; } var q = p; // 10 loop: while (true ) { if ( q == s ) break; // 11 z = SplitMatch(R, S, q); // 12 //print("Returned ", z); if (z != false) { // 13 e = z.endIndex; // 14 cap = z.captures; // 14 if (e != p) { // 15 //print("S = ", S, ", p = ", p, ", q = ", q); T = S.slice(p, q); // 16 //print("T = ", T); A[A.length] = T; // 17 if (A.length == lim) return A; // 18 p = e; // 19 i = 0; // 20 while (true) { // 25 if (i == cap.length) { // 21 q = p; // 10 continue loop; } i = i + 1; // 22 A[A.length] = cap[i] // 23 if (A.length == lim) return A; // 24 } } } q = q + 1; // 26 } T = S.slice(p, q); A[A.length] = T; return A; } function SplitMatch(R, S, q) { if (R.constructor == RegExp) { // 1 var reResult = R.match(S, q); // 8 if (reResult == undefined) return false; else { a = new Array(reResult.length - 1); for (var i = 1; i < reResult.length; i++) a[a.length] = reResult[i]; return { endIndex : reResult.index + reResult[0].length, captures : cap }; } } else { var r = R.length; // 2 s = S.length; // 3 if ((q + r) > s) return false; // 4 for (var i = 0; i < r; i++) { //print("S.charAt(", q + i, ") = ", S.charAt(q + i), ", R.charAt(", i, ") = ", R.charAt(i)); if (S.charAt(q + i) != R.charAt(i)) // 5 return false; } cap = new Array(); // 6 return { endIndex : q + r, captures : cap }; // 7 } } function ToUint32( n ) { n = Number( n ); var sign = ( n < 0 ) ? -1 : 1; if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY || n != n) { return 0; } n = sign * Math.floor( Math.abs(n) ) n = n % Math.pow(2,32); if ( n < 0 ){ n += Math.pow(2,32); } return ( n ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_2/String/split-003.js0000644000175000017500000001367011545150464022030 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communication Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: String/split-003.js * ECMA Section: 15.6.4.9 * Description: Based on ECMA 2 Draft 7 February 1999 * * Author: christine@netscape.com * Date: 19 February 1999 */ /* * Since regular expressions have been part of JavaScript since 1.2, there * are already tests for regular expressions in the js1_2/regexp folder. * * These new tests try to supplement the existing tests, and verify that * our implementation of RegExp conforms to the ECMA specification, but * does not try to be as exhaustive as in previous tests. * * The [,limit] argument to String.split is new, and not covered in any * existing tests. * * String.split cases are covered in ecma/String/15.5.4.8-*.js. * String.split where separator is a RegExp are in * js1_2/regexp/string_split.js * */ var SECTION = "ecma_2/String/split-003.js"; var VERSION = "ECMA_2"; var TITLE = "String.prototype.split( regexp, [,limit] )"; startTest(); // separator is a regexp // separator regexp value global setting is set // string is an empty string // if separator is an empty string, split each by character AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] ); AddSplitCases( "hello", /l/, "/l/", ["he","","o"] ); AddLimitedSplitCases( "hello", /l/, "/l/", 0, [] ); AddLimitedSplitCases( "hello", /l/, "/l/", 1, ["he"] ); AddLimitedSplitCases( "hello", /l/, "/l/", 2, ["he",""] ); AddLimitedSplitCases( "hello", /l/, "/l/", 3, ["he","","o"] ); AddLimitedSplitCases( "hello", /l/, "/l/", 4, ["he","","o"] ); AddLimitedSplitCases( "hello", /l/, "/l/", void 0, ["he","","o"] ); AddLimitedSplitCases( "hello", /l/, "/l/", "hi", [] ); AddLimitedSplitCases( "hello", /l/, "/l/", undefined, ["he","","o"] ); AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] ); AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 0, [] ); AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 1, ["h"] ); AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 2, ["h","e"] ); AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 3, ["h","e","l"] ); AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 4, ["h","e","l","l"] ); AddLimitedSplitCases( "hello", new RegExp, "new RegExp", void 0, ["h","e","l","l","o"] ); AddLimitedSplitCases( "hello", new RegExp, "new RegExp", "hi", [] ); AddLimitedSplitCases( "hello", new RegExp, "new RegExp", undefined, ["h","e","l","l","o"] ); test(); function AddSplitCases( string, separator, str_sep, split_array ) { // verify that the result of split is an object of type Array AddTestCase( "( " + string + " ).split(" + str_sep +").constructor == Array", true, string.split(separator).constructor == Array ); // check the number of items in the array AddTestCase( "( " + string + " ).split(" + str_sep +").length", split_array.length, string.split(separator).length ); // check the value of each array item var limit = (split_array.length > string.split(separator).length ) ? split_array.length : string.split(separator).length; for ( var matches = 0; matches < split_array.length; matches++ ) { AddTestCase( "( " + string + " ).split(" + str_sep +")[" + matches +"]", split_array[matches], string.split( separator )[matches] ); } } function AddLimitedSplitCases( string, separator, str_sep, limit, split_array ) { // verify that the result of split is an object of type Array AddTestCase( "( " + string + " ).split(" + str_sep +", " + limit + " ).constructor == Array", true, string.split(separator, limit).constructor == Array ); // check the length of the array AddTestCase( "( " + string + " ).split(" + str_sep +", " + limit + " ).length", split_array.length, string.split(separator, limit).length ); // check the value of each array item var slimit = (split_array.length > string.split(separator).length ) ? split_array.length : string.split(separator, limit).length; for ( var matches = 0; matches < slimit; matches++ ) { AddTestCase( "( " + string + " ).split(" + str_sep +", " + limit + " )[" + matches +"]", split_array[matches], string.split( separator, limit )[matches] ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Array/15.4.4.11-01.js0000644000175000017500000000430211545150464021365 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 312138; var summary = 'Array.sort should not eat exceptions'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); expect = "e=1 N=1"; var N = 0; var array = [4,3,2,1]; try { array.sort(function() { throw ++N; }); } catch (e) { actual = ("e="+e+" N="+N); } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Array/15.4.4.3-1.js0000644000175000017500000000631711545150464021236 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 12 Mar 2001 * * * SUMMARY: Testing Array.prototype.toLocaleString() * See http://bugzilla.mozilla.org/show_bug.cgi?id=56883 * See http://bugzilla.mozilla.org/show_bug.cgi?id=58031 * * By ECMA3 15.4.4.3, myArray.toLocaleString() means that toLocaleString() * should be applied to each element of the array, and the results should be * concatenated with an implementation-specific delimiter. For example: * * myArray[0].toLocaleString() + ',' + myArray[1].toLocaleString() + etc. * * In this testcase toLocaleString is a user-defined property of each * array element; therefore it is the function that should be * invoked. This function increments a global variable. Therefore the * end value of this variable should be myArray.length. */ //----------------------------------------------------------------------------- var BUGNUMBER = 56883; var summary = 'Testing Array.prototype.toLocaleString() -'; var actual = ''; var expect = ''; var n = 0; var obj = {toLocaleString: function() {n++}}; var myArray = [obj, obj, obj]; myArray.toLocaleString(); actual = n; expect = 3; // (see explanation above) //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Array/15.4.4.4-001.js0000644000175000017500000000777411545150464021407 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * george@vanous.com, igor@icesoft.no, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 19 September 2002 * SUMMARY: Testing Array.prototype.concat() * See http://bugzilla.mozilla.org/show_bug.cgi?id=169795 * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 169795; var summary = 'Testing Array.prototype.concat()'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var x; status = inSection(1); x = "Hello"; actual = [].concat(x).toString(); expect = x.toString(); addThis(); status = inSection(2); x = 999; actual = [].concat(x).toString(); expect = x.toString(); addThis(); status = inSection(3); x = /Hello/g; actual = [].concat(x).toString(); expect = x.toString(); addThis(); status = inSection(4); x = new Error("Hello"); actual = [].concat(x).toString(); expect = x.toString(); addThis(); status = inSection(5); x = function() {return "Hello";}; actual = [].concat(x).toString(); expect = x.toString(); addThis(); status = inSection(6); x = [function() {return "Hello";}]; actual = [].concat(x).toString(); expect = x.toString(); addThis(); status = inSection(7); x = [1,2,3].concat([4,5,6]); actual = [].concat(x).toString(); expect = x.toString(); addThis(); status = inSection(8); x = eval('this'); actual = [].concat(x).toString(); expect = x.toString(); addThis(); /* * The next two sections are by igor@icesoft.no; see * http://bugzilla.mozilla.org/show_bug.cgi?id=169795#c3 */ status = inSection(9); x={length:0}; actual = [].concat(x).toString(); expect = x.toString(); addThis(); status = inSection(10); x={length:2, 0:0, 1:1}; actual = [].concat(x).toString(); expect = x.toString(); addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i * See http://bugzilla.mozilla.org/show_bug.cgi?id=101488 * * Without the "new" keyword, assigning arr.length = Number(n) worked. * But with it, Rhino was giving an error "Inappropriate array length" * and SpiderMonkey was exiting without giving any error or return value - * * Comments on the Rhino code by igor@icesoft.no: * * jsSet_length requires that the new length value should be an instance * of Number. But according to Ecma 15.4.5.1, item 12-13, an error should * be thrown only if ToUint32(length_value) != ToNumber(length_value) */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 101488; var summary = 'Try assigning arr.length = new Number(n)'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var arr = []; status = inSection(1); arr = Array(); tryThis('arr.length = new Number(1);'); actual = arr.length; expect = 1; addThis(); status = inSection(2); arr = Array(5); tryThis('arr.length = new Number(1);'); actual = arr.length; expect = 1; addThis(); status = inSection(3); arr = Array(); tryThis('arr.length = new Number(17);'); actual = arr.length; expect = 17; addThis(); status = inSection(4); arr = Array(5); tryThis('arr.length = new Number(17);'); actual = arr.length; expect = 17; addThis(); /* * Also try the above with the "new" keyword before Array(). * Array() and new Array() should be equivalent, by ECMA 15.4.1.1 */ status = inSection(5); arr = new Array(); tryThis('arr.length = new Number(1);'); actual = arr.length; expect = 1; addThis(); status = inSection(6); arr = new Array(5); tryThis('arr.length = new Number(1);'); actual = arr.length; expect = 1; addThis(); arr = new Array(); tryThis('arr.length = new Number(17);'); actual = arr.length; expect = 17; addThis(); status = inSection(7); arr = new Array(5); tryThis('arr.length = new Number(17);'); actual = arr.length; expect = 17; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function tryThis(s) { try { eval(s); } catch(e) { // keep going } } function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i=0; i= dst_start && t < dst_end ) return msPerHour; return 0; } function GetFirstSundayInMonth( t, m ) { var year = YearFromTime(t); var leap = InLeapYear(t); // month m 0..11 // april == 3 // march == 2 // set time to first day of month m var time = TimeFromYear(year); for (var i = 0; i < m; ++i) { time += TimeInMonth(i, leap); } for ( var first_sunday = time; WeekDay(first_sunday) > 0; first_sunday += msPerDay ) { ; } return first_sunday; } function GetLastSundayInMonth( t, m ) { var year = YearFromTime(t); var leap = InLeapYear(t); // month m 0..11 // april == 3 // march == 2 // first day of following month var time = TimeFromYear(year); for (var i = 0; i <= m; ++i) { time += TimeInMonth(i, leap); } // prev day == last day of month time -= msPerDay; for ( var last_sunday = time; WeekDay(last_sunday) > 0; last_sunday -= msPerDay ) { ; } return last_sunday; } /* 15.9.1.9 Daylight Saving Time Adjustment The implementation of ECMAScript should not try to determine whether the exact time was subject to daylight saving time, but just whether daylight saving time would have been in effect if the current daylight saving time algorithm had been used at the time. This avoids complications such as taking into account the years that the locale observed daylight saving time year round. */ /* US DST algorithm Before 2007, DST starts first Sunday in April at 2 AM and ends last Sunday in October at 2 AM Starting in 2007, DST starts second Sunday in March at 2 AM and ends first Sunday in November at 2 AM Note that different operating systems behave differently. Fully patched Windows XP uses the 2007 algorithm for all dates while fully patched Fedora Core 6 and RHEL 4 Linux use the algorithm in effect at the time. Since pre-2007 DST is a subset of 2007 DST rules, this only affects tests that occur in the period Mar-Apr and Oct-Nov where the two algorithms do not agree. */ function GetDSTStart( t ) { return (GetFirstSundayInMonth(t, 2) + 7*msPerDay + 2*msPerHour - LocalTZA()); } function GetDSTEnd( t ) { return (GetFirstSundayInMonth(t, 10) + 2*msPerHour - LocalTZA()); } function GetOldDSTStart( t ) { return (GetFirstSundayInMonth(t, 3) + 2*msPerHour - LocalTZA()); } function GetOldDSTEnd( t ) { return (GetLastSundayInMonth(t, 9) + 2*msPerHour - LocalTZA()); } function LocalTime( t ) { return ( t + LocalTZA() + DaylightSavingTA(t) ); } function MakeTime( hour, min, sec, ms ) { if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) { return Number.NaN; } hour = ToInteger(hour); min = ToInteger( min); sec = ToInteger( sec); ms = ToInteger( ms ); return( (hour*msPerHour) + (min*msPerMinute) + (sec*msPerSecond) + ms ); } function MakeDay( year, month, date ) { if ( isNaN(year) || isNaN(month) || isNaN(date) ) { return Number.NaN; } year = ToInteger(year); month = ToInteger(month); date = ToInteger(date ); var sign = ( year < 1970 ) ? -1 : 1; var t = ( year < 1970 ) ? 1 : 0; var y = ( year < 1970 ) ? 1969 : 1970; var result5 = year + Math.floor( month/12 ); var result6 = month % 12; if ( year < 1970 ) { for ( y = 1969; y >= year; y += sign ) { t += sign * TimeInYear(y); } } else { for ( y = 1970 ; y < year; y += sign ) { t += sign * TimeInYear(y); } } var leap = InLeapYear( t ); for ( var m = 0; m < month; m++ ) { t += TimeInMonth( m, leap ); } if ( YearFromTime(t) != result5 ) { return Number.NaN; } if ( MonthFromTime(t) != result6 ) { return Number.NaN; } if ( DateFromTime(t) != 1 ) { return Number.NaN; } return ( (Day(t)) + date - 1 ); } function TimeInMonth( month, leap ) { // september april june november // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6 // aug 7 sep 8 oct 9 nov 10 dec 11 if ( month == 3 || month == 5 || month == 8 || month == 10 ) { return ( 30*msPerDay ); } // all the rest if ( month == 0 || month == 2 || month == 4 || month == 6 || month == 7 || month == 9 || month == 11 ) { return ( 31*msPerDay ); } // save february return ( (leap == 0) ? 28*msPerDay : 29*msPerDay ); } function MakeDate( day, time ) { if ( day == Number.POSITIVE_INFINITY || day == Number.NEGATIVE_INFINITY ) { return Number.NaN; } if ( time == Number.POSITIVE_INFINITY || time == Number.NEGATIVE_INFINITY ) { return Number.NaN; } return ( day * msPerDay ) + time; } function TimeClip( t ) { if ( isNaN( t ) ) { return ( Number.NaN ); } if ( Math.abs( t ) > 8.64e15 ) { return ( Number.NaN ); } return ( ToInteger( t ) ); } function ToInteger( t ) { t = Number( t ); if ( isNaN( t ) ){ return ( Number.NaN ); } if ( t == 0 || t == -0 || t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) { return 0; } var sign = ( t < 0 ) ? -1 : 1; return ( sign * Math.floor( Math.abs( t ) ) ); } function Enumerate ( o ) { var p; for ( p in o ) { print( p +": " + o[p] ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Exceptions/15.11.1.1.js0000644000175000017500000000770011545150464022211 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * joerg.schaible@gmx.de * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 27 Nov 2002 * SUMMARY: Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1). */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = ''; var summary = 'Ensuring normal function call of Error (ECMA-262 Ed.3 15.11.1.1)'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var EMPTY_STRING = ''; var EXPECTED_FORMAT = 0; function otherScope(msg) { return Error(msg); } status = inSection(1); var err1 = Error('msg1'); actual = examineThis(err1, 'msg1'); expect = EXPECTED_FORMAT; addThis(); status = inSection(2); var err2 = otherScope('msg2'); actual = examineThis(err2, 'msg2'); expect = EXPECTED_FORMAT; addThis(); status = inSection(3); var err3 = otherScope(); actual = examineThis(err3, EMPTY_STRING); expect = EXPECTED_FORMAT; addThis(); status = inSection(4); var err4 = eval("Error('msg4')"); actual = examineThis(err4, 'msg4'); expect = EXPECTED_FORMAT; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- /* * Searches err.toString() for err.name + ':' + err.message, * with possible whitespace on each side of the colon sign. * * We allow for no colon in case err.message was not provided by the user. * In such a case, SpiderMonkey and Rhino currently set err.message = '', * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. * * If this is ever changed to a non-empty string, e.g. 'undefined', * you may have to modify |pattern| to take that into account - * */ function examineThis(err, msg) { var pattern = err.name + '\\s*:?\\s*' + msg; return err.toString().search(RegExp(pattern)); } function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i = 0; i < UBound; i++) { reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); } exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Exceptions/15.11.4.4-1.js0000644000175000017500000001173111545150464022354 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2001 * the Initial Developer. All Rights Reserved. * * Contributor(s): * d-russo@ti.com, pschwartau@netscape.com, joerg.schaible@gmx.de * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 22 Jan 2002 * SUMMARY: Testing Error.prototype.toString() * * Revised: 25 Nov 2002 * See http://bugzilla.mozilla.org/show_bug.cgi?id=181909 * * Note that ECMA-262 3rd Edition Final, Section 15.11.4.4 states that * Error.prototype.toString() returns an implementation-dependent string. * Therefore any testcase on this property is somewhat arbitrary. * * However, d-russo@ti.com pointed out that Rhino was returning this: * * js> err = new Error() * undefined: undefined * * js> err = new Error("msg") * undefined: msg * * * We expect Rhino to return what SpiderMonkey currently does: * * js> err = new Error() * Error * * js> err = new Error("msg") * Error: msg * * * i.e. we expect err.toString() === err.name if err.message is not defined; * otherwise, we expect err.toString() === err.name + ': ' + err.message. * * See also ECMA 15.11.4.2, 15.11.4.3 */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = '(none)'; var summary = 'Testing Error.prototype.toString()'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var EMPTY_STRING = ''; var EXPECTED_FORMAT = 0; status = inSection(1); var err1 = new Error('msg1'); actual = examineThis(err1, 'msg1'); expect = EXPECTED_FORMAT; addThis(); status = inSection(2); var err2 = new Error(err1); actual = examineThis(err2, err1); expect = EXPECTED_FORMAT; addThis(); status = inSection(3); var err3 = new Error(); actual = examineThis(err3, EMPTY_STRING); expect = EXPECTED_FORMAT; addThis(); status = inSection(4); var err4 = new Error(EMPTY_STRING); actual = examineThis(err4, EMPTY_STRING); expect = EXPECTED_FORMAT; addThis(); // now generate a run-time error - status = inSection(5); try { eval('1=2'); } catch(err5) { actual = examineThis(err5, '.*'); } expect = EXPECTED_FORMAT; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- /* * Searches err.toString() for err.name + ':' + err.message, * with possible whitespace on each side of the colon sign. * * We allow for no colon in case err.message was not provided by the user. * In such a case, SpiderMonkey and Rhino currently set err.message = '', * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. * * If this is ever changed to a non-empty string, e.g. 'undefined', * you may have to modify |pattern| to take that into account - * */ function examineThis(err, msg) { var pattern = err.name + '\\s*:?\\s*' + msg; return err.toString().search(RegExp(pattern)); } function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i = 0; i < UBound; i++) { reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); } exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Exceptions/15.11.5.js0000644000175000017500000000502711545150464022056 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Corporation * Portions created by the Initial Developer are Copyright (C) 2010 * the Initial Developer. All Rights Reserved. * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 4 Oct 2010 * SUMMARY: Error instances have no special properties beyond those inherited * from the Error prototype object */ //----------------------------------------------------------------------------- var summary = 'Error instances have no special properties beyond those inherited the Error prototype object'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printStatus (summary); var actual = ''; var expect = 'TypeError: Error.prototype is not a constructor'; try { new Error.prototype; } catch (e) { actual = '' + e; } reportCompare(actual, expect, "not a constructor"); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Exceptions/15.11.7.6-001.js0000644000175000017500000000664611545150464022532 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2003 * the Initial Developer. All Rights Reserved. * * Contributor(s): * igor@fastmail.fm, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 14 April 2003 * SUMMARY: Prototype of predefined error objects should be DontEnum * See http://bugzilla.mozilla.org/show_bug.cgi?id=201989 * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 201989; var summary = 'Prototype of predefined error objects should be DontEnum'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; /* * Tests that |F.prototype| is not enumerable in |F| */ function testDontEnum(F) { var proto = F.prototype; for (var prop in F) { if (F[prop] === proto) return false; } return true; } var list = [ "Error", "ConversionError", "EvalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError" ]; for (i in list) { var F = this[list[i]]; // Test for |F|; e.g. Rhino defines |ConversionError| while SM does not. if (F) { status = 'Testing DontEnum attribute of |' + list[i] + '.prototype|'; actual = testDontEnum(F); expect = true; addThis(); } } //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i -1); expect = true; addThis(); } //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = isReferenceError(actual); expectedvalues[UBound] = isReferenceError(expect); UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i = 0; i < UBound; i++) { reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); } exitFunc ('test'); } // converts a Boolean result into a textual result - function isReferenceError(bResult) { return bResult? ERR_REF_YES : ERR_REF_NO; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Exceptions/browser.js0000644000175000017500000000000011545150464022713 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Exceptions/jstests.list0000644000175000017500000000046411545150464023304 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_3/Exceptions/ script 15.11.1.1.js script 15.11.4.4-1.js script 15.11.5.js script 15.11.7.6-001.js script 15.11.7.6-002.js script 15.11.7.6-003.js script binding-001.js script regress-181654.js script regress-181914.js script regress-58946.js script regress-95101.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Exceptions/regress-181654.js0000644000175000017500000001054411545150464023466 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * joerg.schaible@gmx.de * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 23 Nov 2002 * SUMMARY: Calling toString for an object derived from the Error class * results in an TypeError (Rhino only) * See http://bugzilla.mozilla.org/show_bug.cgi?id=181654 */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = '181654'; var summary = 'Calling toString for an object derived from the Error class should be possible.'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var EMPTY_STRING = ''; var EXPECTED_FORMAT = 0; // derive MyError from Error function MyError( msg ) { this.message = msg; } MyError.prototype = new Error(); MyError.prototype.name = "MyError"; status = inSection(1); var err1 = new MyError('msg1'); actual = examineThis(err1, 'msg1'); expect = EXPECTED_FORMAT; addThis(); status = inSection(2); var err2 = new MyError(String(err1)); actual = examineThis(err2, err1); expect = EXPECTED_FORMAT; addThis(); status = inSection(3); var err3 = new MyError(); actual = examineThis(err3, EMPTY_STRING); expect = EXPECTED_FORMAT; addThis(); status = inSection(4); var err4 = new MyError(EMPTY_STRING); actual = examineThis(err4, EMPTY_STRING); expect = EXPECTED_FORMAT; addThis(); // now generate an error - status = inSection(5); try { throw new MyError("thrown"); } catch(err5) { actual = examineThis(err5, "thrown"); } expect = EXPECTED_FORMAT; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- /* * Searches err.toString() for err.name + ':' + err.message, * with possible whitespace on each side of the colon sign. * * We allow for no colon in case err.message was not provided by the user. * In such a case, SpiderMonkey and Rhino currently set err.message = '', * as allowed for by ECMA 15.11.4.3. This makes |pattern| work in this case. * * If this is ever changed to a non-empty string, e.g. 'undefined', * you may have to modify |pattern| to take that into account - * */ function examineThis(err, msg) { var pattern = err.name + '\\s*:?\\s*' + msg; return err.toString().search(RegExp(pattern)); } function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i = 0; i < UBound; i++) { reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); } exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Exceptions/regress-181914.js0000644000175000017500000001153711545150464023470 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * joerg.schaible@gmx.de, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 25 Nov 2002 * SUMMARY: Calling a user-defined superconstructor * See http://bugzilla.mozilla.org/show_bug.cgi?id=181914, esp. Comment 10. * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = '181914'; var summary = 'Calling a user-defined superconstructor'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var EMPTY_STRING = ''; var EXPECTED_FORMAT = 0; // make a user-defined version of the Error constructor function _Error(msg) { this.message = msg; } _Error.prototype = new Error(); _Error.prototype.name = '_Error'; // derive MyApplyError from _Error function MyApplyError(msg) { if(this instanceof MyApplyError) _Error.apply(this, arguments); else return new MyApplyError(msg); } MyApplyError.prototype = new _Error(); MyApplyError.prototype.name = "MyApplyError"; // derive MyCallError from _Error function MyCallError(msg) { if(this instanceof MyCallError) _Error.call(this, msg); else return new MyCallError(msg); } MyCallError.prototype = new _Error(); MyCallError.prototype.name = "MyCallError"; function otherScope(msg) { return MyApplyError(msg); } status = inSection(1); var err1 = new MyApplyError('msg1'); actual = examineThis(err1, 'msg1'); expect = EXPECTED_FORMAT; addThis(); status = inSection(2); var err2 = new MyCallError('msg2'); actual = examineThis(err2, 'msg2'); expect = EXPECTED_FORMAT; addThis(); status = inSection(3); var err3 = MyApplyError('msg3'); actual = examineThis(err3, 'msg3'); expect = EXPECTED_FORMAT; addThis(); status = inSection(4); var err4 = MyCallError('msg4'); actual = examineThis(err4, 'msg4'); expect = EXPECTED_FORMAT; addThis(); status = inSection(5); var err5 = otherScope('msg5'); actual = examineThis(err5, 'msg5'); expect = EXPECTED_FORMAT; addThis(); status = inSection(6); var err6 = otherScope(); actual = examineThis(err6, EMPTY_STRING); expect = EXPECTED_FORMAT; addThis(); status = inSection(7); var err7 = eval("MyApplyError('msg7')"); actual = examineThis(err7, 'msg7'); expect = EXPECTED_FORMAT; addThis(); status = inSection(8); var err8; try { throw MyApplyError('msg8'); } catch(e) { if(e instanceof Error) err8 = e; } actual = examineThis(err8, 'msg8'); expect = EXPECTED_FORMAT; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- // Searches |err.toString()| for |err.name + ':' + err.message| function examineThis(err, msg) { var pattern = err.name + '\\s*:?\\s*' + msg; return err.toString().search(RegExp(pattern)); } function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i = 0; i < UBound; i++) { reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); } exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Exceptions/regress-58946.js0000644000175000017500000000442611545150464023417 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //------------------------------------------------------------------------------------------------- var BUGNUMBER = '58946'; var stat = 'Testing a return statement inside a catch statement inside a function'; test(); function test() { enterFunc ("test"); printBugNumber(BUGNUMBER); printStatus (stat); expect = 'PASS'; function f() { try { throw 'PASS'; } catch(e) { return e; } } actual = f(); reportCompare(expect, actual, stat); exitFunc ("test"); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Exceptions/regress-95101.js0000644000175000017500000000671611545150464023403 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 13 August 2001 * * SUMMARY: Invoking an undefined function should produce a ReferenceError * See http://bugzilla.mozilla.org/show_bug.cgi?id=95101 */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 95101; var summary = 'Invoking an undefined function should produce a ReferenceError'; var msgERR_REF_YES = 'ReferenceError'; var msgERR_REF_NO = 'did NOT generate a ReferenceError'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; try { xxxyyyzzz(); } catch (e) { status = 'Section 1 of test'; actual = e instanceof ReferenceError; expect = true; addThis(); /* * This test is more literal, and may one day be invalid. * Searching for literal string "ReferenceError" in e.toString() */ status = 'Section 2 of test'; var match = e.toString().search(/ReferenceError/); actual = (match > -1); expect = true; addThis(); } //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = isReferenceError(actual); expectedvalues[UBound] = isReferenceError(expect); UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i = 0; i < UBound; i++) { reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); } exitFunc ('test'); } // converts a Boolean result into a textual result - function isReferenceError(bResult) { return bResult? msgERR_REF_YES : msgERR_REF_NO; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Exceptions/shell.js0000644000175000017500000000000011545150464022337 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/ExecutionContexts/10.1.3-1.js0000644000175000017500000001121711545150464023474 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 11 Feb 2002 * SUMMARY: Testing functions having duplicate formal parameter names * * Note: given function f(x,x,x,x) {return x;}; f(1,2,3,4) should return 4. * See ECMA-262 3rd Edition Final Section 10.1.3: Variable Instantiation * * Also see http://bugzilla.mozilla.org/show_bug.cgi?id=124900 */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 124900; var summary = 'Testing functions having duplicate formal parameter names'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; function f1(x,x) { return x; } status = inSection(1); actual = f1(1,2); expect = 2; addThis(); function f2(x,x,x) { return x*x*x; } status = inSection(2); actual = f2(1,2,3); expect = 27; addThis(); function f3(x,x,x,x) { return 'a' + x + 'b' + x + 'c' + x ; } status = inSection(3); actual = f3(1,2,3,4); expect = 'a4b4c4'; addThis(); /* * If the value of the last duplicate parameter is not provided by * the function caller, the value of this parameter is undefined */ function f4(x,a,b,x,z) { return x; } status = inSection(4); actual = f4(1,2); expect = undefined; addThis(); /* * f.toString() should preserve any duplicate formal parameter names that exist */ function f5(x,x,x,x) { } status = inSection(5); actual = f5.toString().match(/\((.*)\)/)[1]; actual = actual.replace(/\s/g, ''); // for definiteness, remove any white space expect = 'x,x,x,x'; addThis(); function f6(x,x,x,x) { var ret = []; for (var i=0; i> p); reportCompare(expectval, actualval, summary + ': value'); reportCompare(expect, actual, summary + ': order'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Expressions/11.7.3-01.js0000644000175000017500000000522511545150464022414 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 396969; var summary = '11.7.3 - >>> should evaluate operands in order'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'o.valueOf, p.valueOf'; var actualval; var expectval = 10; var o = { valueOf: (function (){ actual += 'o.valueOf'; return this.value}), value:42 }; var p = { valueOf: (function (){ actual += ', p.valueOf'; return this.value}), value:2 }; actualval = (o >>> p); reportCompare(expectval, actualval, summary + ': value'); reportCompare(expect, actual, summary + ': order'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Expressions/11.9.6-1.js0000644000175000017500000001056511545150464022344 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 20 Feb 2002 * SUMMARY: Testing the comparison |undefined === null| * See http://bugzilla.mozilla.org/show_bug.cgi?id=126722 * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 126722; var summary = 'Testing the comparison |undefined === null|'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; status = inSection(1); if (undefined === null) actual = true; else actual = false; expect = false; addThis(); status = inSection(2); switch(true) { case (undefined === null) : actual = true; break; default: actual = false; } expect = false; addThis(); status = inSection(3); function f3(x) { var res = false; switch(true) { case (x === null) : res = true; break; default: // do nothing } return res; } actual = f3(undefined); expect = false; addThis(); status = inSection(4); function f4(arr) { var elt = ''; var res = false; for (i=0; i?"; var UntilRSBs = "[^]]*]([^]]+])*]+"; var CDATA_CE = UntilRSBs + "([^]>]" + UntilRSBs + ")*>"; var S = "[ \\n\\t\\r]+"; var QuoteSE = '"[^"]' + "*" + '"' + "|'[^']*'"; var DT_IdentSE = S + Name + "(" + S + "(" + Name + "|" + QuoteSE + "))*"; var MarkupDeclCE = "([^]\"'><]+|" + QuoteSE + ")*>"; var S1 = "[\\n\\r\\t ]"; var UntilQMs = "[^?]*\\?+"; var PI_Tail = "\\?>|" + S1 + UntilQMs + "([^>?]" + UntilQMs + ")*>"; var DT_ItemSE = "<(!(--" + Until2Hyphens + ">|[^-]" + MarkupDeclCE + ")|\\?" + Name + "(" + PI_Tail + "))|%" + Name + ";|" + S; var DocTypeCE = DT_IdentSE + "(" + S + ")?(\\[(" + DT_ItemSE + ")*](" + S + ")?)?>?"; var DeclCE = "--(" + CommentCE + ")?|\\[CDATA\\[(" + CDATA_CE + ")?|DOCTYPE(" + DocTypeCE + ")?"; var PI_CE = Name + "(" + PI_Tail + ")?"; var EndTagCE = Name + "(" + S + ")?>?"; var AttValSE = '"[^<"]' + "*" + '"' + "|'[^<']*'"; var ElemTagCE = Name + "(" + S + Name + "(" + S + ")?=(" + S + ")?(" + AttValSE + "))*(" + S + ")?/?>?"; var MarkupSPE = "<(!(" + DeclCE + ")?|\\?(" + PI_CE + ")?|/(" + EndTagCE + ")?|(" + ElemTagCE + ")?)"; var XML_SPE = TextSE + "|" + MarkupSPE; var CommentRE = "'; s += ''; s += ''; s += ''; s += ''; s += ' '; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += 'Click here to skip to main content.'; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ''; s += ''; s += '
        '; s += '
        CNN.com'; s += ' '; s += ''; s += ' '; s += ''; s += ''; s += ''; s += ''; s += '
        '; s += '
        '; s += ''; s += ''; s += ' '; s += ''; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        SEARCH
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
          The Web  CNN.com   
        enhanced by Google
        '; s += '
        '; s += ''; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ''; s += ' '; s += ' '; s += ''; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
         
         
         
         
         
         
         
         
         
         
         
         
         
         
         
        '; s += '
        SERVICES
         
         
         
        SEARCH
        '; s += ''; s += '
        '; s += ' '; s += ' '; s += ' '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        WebCNN.com
        enhanced by Google
        '; s += ''; s += ''; s += ''; s += '
        '; s += ''; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        Updated: 05:53 p.m. EDT (2153 GMT) June 12, 2003
        '; s += '
        '; s += ''; s += ''; s += ' '; s += ' Oscar-winner Peck dies'; s += ''; s += '
        '; s += '

        Oscar-winner Peck dies

        '; s += '

        '; s += 'Actor Gregory Peck, who won an Oscar for his portrayal of upstanding lawyer Atticus Finch in 1962s "To Kill a Mockingbird," has died at age 87. Peck was best known for roles of dignified statesmen and people who followed a strong code of ethics. But he also could play against type. All told, Peck was nominated for five Academy Awards.'; s += '

        '; s += '

        '; s += ' FULL STORY'; s += '

        '; s += ''; s += ''; s += ''; s += '• Video: premium content A leading mans leading man
        '; s += ''; s += ''; s += ''; s += ' '; s += '• Interactive: Gregory Peck through the years
        '; s += ''; s += ' '; s += '• Gregory Peck filmographyexternal link
        '; s += ''; s += ' '; s += '• Pecks Finch chararcter AFIs top heroexternal link
        '; s += '
        '; s += ''; s += ''; s += '
        '; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += '
        '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        MORE TOP STORIES Hot Stories
        '; s += '
        '; s += ''; s += ' '; s += ''; s += ''; s += ' '; s += ''; s += ''; s += ' '; s += ''; s += ''; s += ' '; s += ''; s += ''; s += ' '; s += ''; s += ''; s += ' '; s += ''; s += ''; s += ' '; s += ''; s += '
        '; s += ''; s += ''; s += '
        '; s += ''; s += ''; s += ''; s += ' '; s += '
        '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ''; s += ' '; s += ' '; s += '
        '; s += ' CNNRADIO'; s += '
        Listen to latest updates'; s += '
        '; s += ''; s += '
        '; s += ' '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        VIDEOMORE VIDEO
        '; s += ' Soldier broke dozens of hearts over e-mail
        '; s += ' premium content PLAY VIDEO
        '; s += '
        '; s += ' '; s += '
        '; s += ' '; s += '
        '; s += ''; s += ''; s += '
        '; s += ''; s += ''; s += ''; s += '
        '; s += '
        '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        ON THE SCENEmore reports
        '; s += ''; s += ''; s += ' '; s += ' '; s += ''; s += ''; s += ' '; s += '
        Jeffrey Toobin: "It takes guts" for Peterson defense to subpoena judge over wiretap issue.'; s += 'Full Storyimage
        '; s += '
        '; s += '
        '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        BUSINESS'; s += '  at CNN/Money  Business News
        '; s += ''; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        STOCK/FUND QUOTES:
        enter symbol
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        sponsored by:Click Here
        '; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ''; s += ' '; s += '
        MARKETS: '; s += ''; s += '4:30pm ET, 6/12
        DJIA+13.309196.50+ 0.14%
        NAS+ 7.601653.62+ 0.46%
        S&P+ 1.03998.51+ 0.10%
        '; s += '
        '; s += ''; s += '
        '; s += ''; s += ''; s += '
        '; s += ''; s += ''; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += '
        '; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        MORE REAL TVMore Entertainment
        '; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += ' '; s += ' Go ahead, follow me
        '; s += 'New reality series and the movie debut of "Idol" finalists'; s += '
        Go ahead, follow me
        '; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ' '; s += '
        '; s += ''; s += '
        '; s += '
        '; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        GIFT IDEASBusiness News
        '; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += ''; s += ''; s += 'CNN/Money: Fathers Day
        '; s += 'Smaller is better --from digital cameras to iPod'; s += '
        Fathers Day
        '; s += '
        '; s += '
        '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '

        U.S. News:
        '; s += ''; s += ' '; s += '• Miami police link 4 rapes to serial rapist
        '; s += ''; s += ' '; s += '• Woman mistaken for fugitive jailed
        '; s += ''; s += ' '; s += '• Pregnant woman impaled on mic stand
        '; s += '
        World News:
        '; s += ''; s += ' '; s += '• NATO reshapes for new era
        '; s += ''; s += ' '; s += '• U.N. reviews Bunia peace force
        '; s += ''; s += ''; s += ''; s += '• TIME.com: Saddams curtain trailexternal link
        '; s += '
        Sci-Tech News:
        '; s += ''; s += ' '; s += '• Another reason to throw out your VCR
        '; s += ''; s += ' '; s += '• Flat screen TV prices dropping
        '; s += '
        Entertainment News:
        '; s += ''; s += ' '; s += '• CNN hires Soledad OBrien for "AM"
        '; s += ''; s += ' '; s += '• Dating show star let go by law firm
        '; s += '
        Politics News:
        '; s += ''; s += ' '; s += '• Schwarzenegger on California politics
        '; s += ''; s += ' '; s += '• House approves extension on child tax credit
        '; s += '
        Law News:
        '; s += ''; s += ' '; s += '• Court bars cash advances to plaintiffs
        '; s += ''; s += ' '; s += '• Lawsuit against Jackson settled
        '; s += '
        Health News:
        '; s += ''; s += ' '; s += '• Monkeypox spreading person-to-person?
        '; s += ''; s += ' '; s += '• A full body X-ray in 13 seconds
        '; s += '
        Space News:
        '; s += ''; s += ' '; s += '• Hydrogen fuel may disturb ozone layer
        '; s += ''; s += ' '; s += '• New threat found for shuttle launches
        '; s += '
        Travel News:
        '; s += ''; s += ' '; s += '• Walking America from coast to coast
        '; s += ''; s += ' '; s += '• Airline execs not seeing sunny skies yet
        '; s += '
        Education News:
        '; s += ''; s += ' '; s += '• Arab students seek prom balance
        '; s += ''; s += ' '; s += '• Public schools turn to upscale fundraising
        '; s += '
        Sports News:
        Business News:
        '; s += '• Here come the "Duppies"
        '; s += '• Oracle beats estimates
        '; s += '
        '; s += '
        '; s += '
        '; s += ' '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        WATCH CNN TV
        On CNN TV
        '; s += ''; s += ' '; s += ' '; s += ' '; s += '
        American Morning, 7 a.m. ETAmerican Morning (7 a.m. ET): Tomorrow, singer Carnie Wilson talks about her new book, "Im Still Hungry."'; s += '
        '; s += ''; s += ''; s += ''; s += '
        '; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        ANALYSIS
        U.S. News
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += 'Fight It, Martha'; s += ''; s += ''; s += 'NYTimes: Fight It, Martha
        '; s += 'William Safire: I hope Martha Stewart beats this bum rap'; s += ''; s += ''; s += ''; s += ''; s += '
        '; s += '
        '; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        OFFBEAT
        more offbeat
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += 'Waiting list'; s += ' '; s += ' Waiting list
        '; s += 'Chinas "smart sperm" bank needs donors'; s += '
        '; s += '
        '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ' '; s += ' '; s += ' '; s += ''; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
         WEATHER
        Get your hometown weather on the home page! Enter city name or U.S. Zip Code:
        Or select location from a list
        '; s += ''; s += ''; s += ''; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        Quick Vote'; s += ''; s += 'Click Here'; s += '
        '; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += '
        Should an international peacekeeping force be sent to the Mideast?
        Yes'; s += '
        No'; s += '
        '; s += ''; s += '
        VIEW RESULTS
        '; s += ''; s += '
        '; s += ''; s += '
        '; s += '
        '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ''; s += '
        From our Partners'; s += '  External site icon
        '; s += 'Time:
          Subscribe to TIME  

        '; s += 'CNNsi.com:
        '; s += '• Marty Burns: Nets pull out all stops
        '; s += '• Michael Farber: Sens look good for "04
        '; s += '• Tim Layden: NFL or bust for Neuheisel
        '; s += '
        '; s += '
          Subscribe to Sports Illustrated  
        '; s += '

        '; s += 'New York Times:
          Get 50% OFF the NY Times  
        '; s += '
        '; s += ''; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += ''; s += ''; s += '
        '; s += ''; s += '
        '; s += ''; s += ''; s += ' '; s += ' '; s += ' '; s += ''; s += ' '; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        International Edition
        CNN TVCNN InternationalHeadline NewsTranscriptsPreferencesAbout CNN.com
        '; s += ''; s += '
        '; s += ''; s += ''; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        '; s += '© 2003 Cable News Network LP, LLLP.
        '; s += 'An AOL Time Warner Company. All Rights Reserved.
        '; s += 'Terms under which this service is provided to you.
        '; s += 'Read our privacy guidelines. Contact us.'; s += '
        '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += ' '; s += '
        external link
        All external sites will open in a new browser.
        '; s += ' CNN.com does not endorse external sites.
        '; s += ''; s += '
         Premium content icon Denotes premium content.
        '; s += ''; s += '
        '; s += ''; s += ''; s += ''; s += ''; s += ''; s += ' '; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; s += ''; return s; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-209919.js0000644000175000017500000001216011545150464022540 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2003 * the Initial Developer. All Rights Reserved. * * Contributor(s): * sagdjb@softwareag.com, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 19 June 2003 * SUMMARY: Testing regexp submatches with quantifiers * * See http://bugzilla.mozilla.org/show_bug.cgi?id=209919 * */ //----------------------------------------------------------------------------- var i = 0; var BUGNUMBER = 209919; var summary = 'Testing regexp submatches with quantifiers'; var status = ''; var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; var strings = new Array(); var actualmatch = ''; var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); /* * Waldemar: "ECMA-262 15.10.2.5, third algorithm, step 2.1 states that * once the minimum repeat count (which is 0 for *, 1 for +, etc.) has * been satisfied, an atom being repeated must not match the empty string." * * In this example, the minimum repeat count is 0, so the last thing the * capturing parens is permitted to contain is the 'a'. It may NOT go on * to capture the '' at the $ position of 'a', even though '' satifies * the condition b* * */ status = inSection(1); string = 'a'; pattern = /(a|b*)*/; actualmatch = string.match(pattern); expectedmatch = Array(string, 'a'); addThis(); /* * In this example, the minimum repeat count is 5, so the capturing parens * captures the 'a', then goes on to capture the '' at the $ position of 'a' * 4 times before it has to stop. Therefore the last thing it contains is ''. */ status = inSection(2); string = 'a'; pattern = /(a|b*){5,}/; actualmatch = string.match(pattern); expectedmatch = Array(string, ''); addThis(); /* * Reduction of the above examples to contain only the condition b* * inside the capturing parens. This can be even harder to grasp! * * The global match is the '' at the ^ position of 'a', but the parens * is NOT permitted to capture it since the minimum repeat count is 0! */ status = inSection(3); string = 'a'; pattern = /(b*)*/; actualmatch = string.match(pattern); expectedmatch = Array('', undefined); addThis(); /* * Here we have used the + quantifier (repeat count 1) outside the parens. * Therefore the parens must capture at least once before stopping, so it * does capture the '' this time - */ status = inSection(4); string = 'a'; pattern = /(b*)+/; actualmatch = string.match(pattern); expectedmatch = Array('', ''); addThis(); /* * More complex examples - */ pattern = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/; status = inSection(5); string = '100.00'; actualmatch = string.match(pattern); expectedmatch = Array(string, '00', undefined); addThis(); status = inSection(6); string = '100,00'; actualmatch = string.match(pattern); expectedmatch = Array(string, '100', ',00'); addThis(); status = inSection(7); string = '1.000,00'; actualmatch = string.match(pattern); expectedmatch = Array(string, '000', ',00'); addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; expectedmatches[i] = expectedmatch; i++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-216591.js0000644000175000017500000000747011545150464022542 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2003 * the Initial Developer. All Rights Reserved. * * Contributor(s): * okin7@yahoo.fr, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 19 August 2003 * SUMMARY: Regexp conformance test * * See http://bugzilla.mozilla.org/show_bug.cgi?id=216591 * */ //----------------------------------------------------------------------------- var i = 0; var BUGNUMBER = 216591; var summary = 'Regexp conformance test'; var status = ''; var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; var strings = new Array(); var actualmatch = ''; var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); status = inSection(1); string = 'a {result.data.DATA} b'; pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i; actualmatch = string.match(pattern); expectedmatch = Array('{result.data.DATA}', 'result.data.', 'data.', 'DATA'); addThis(); /* * Add a global flag to the regexp. In Perl 5, this gives the same results as above. Compare: * * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/i; print("$&, $1, $2, $3");' * {result.data.DATA}, result.data., data., DATA * * [ ] perl -e '"a {result.data.DATA} b" =~ /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi; print("$&, $1, $2, $3");' * {result.data.DATA}, result.data., data., DATA * * * But in JavaScript, there will no longer be any sub-captures: */ status = inSection(2); string = 'a {result.data.DATA} b'; pattern = /\{(([a-z0-9\-_]+?\.)+?)([a-z0-9\-_]+?)\}/gi; actualmatch = string.match(pattern); expectedmatch = Array('{result.data.DATA}'); addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; expectedmatches[i] = expectedmatch; i++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-220367-001.js0000644000175000017500000000626511545150464023035 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2003 * the Initial Developer. All Rights Reserved. * * Contributor(s): * igor@fastmail.fm, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 26 September 2003 * SUMMARY: Regexp conformance test * * See http://bugzilla.mozilla.org/show_bug.cgi?id=220367 * */ //----------------------------------------------------------------------------- var i = 0; var BUGNUMBER = 220367; var summary = 'Regexp conformance test'; var status = ''; var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; var strings = new Array(); var actualmatch = ''; var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); status = inSection(1); string = 'a'; pattern = /(a)|(b)/; actualmatch = string.match(pattern); expectedmatch = Array(string, 'a', undefined); addThis(); status = inSection(2); string = 'b'; pattern = /(a)|(b)/; actualmatch = string.match(pattern); expectedmatch = Array(string, undefined, 'b'); addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; expectedmatches[i] = expectedmatch; i++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-223273.js0000644000175000017500000001557511545150464022542 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2003 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 23 October 2003 * SUMMARY: Unescaped, unbalanced parens in a regexp should cause SyntaxError. * * The same would also be true for unescaped, unbalanced brackets or braces * if we followed the ECMA-262 Ed. 3 spec on this. But it was decided for * backward compatibility reasons to follow Perl 5, which permits * * 1. an unescaped, unbalanced right bracket ] * 2. an unescaped, unbalanced left brace { * 3. an unescaped, unbalanced right brace } * * If any of these should occur, Perl treats each as a literal * character. Therefore we permit all three of these cases, even * though not ECMA-compliant. Note Perl errors on an unescaped, * unbalanced left bracket; so will we. * * See http://bugzilla.mozilla.org/show_bug.cgi?id=223273 * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 223273; var summary = 'Unescaped, unbalanced parens in regexp should be a SyntaxError'; var TEST_PASSED = 'SyntaxError'; var TEST_FAILED = 'Generated an error, but NOT a SyntaxError!'; var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; var CHECK_PASSED = 'Should not generate an error'; var CHECK_FAILED = 'Generated an error!'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; /* * All the following contain unescaped, unbalanced parens and * should generate SyntaxErrors. That's what we're testing for. * * To allow the test to compile and run, we have to hide the errors * inside eval strings, and check they are caught at run-time. * * Inside such strings, remember to escape any escape character! */ status = inSection(1); testThis(' /(/ '); status = inSection(2); testThis(' /)/ '); status = inSection(3); testThis(' /(abc\\)def(g/ '); status = inSection(4); testThis(' /\\(abc)def)g/ '); /* * These regexp patterns are correct and should not generate * any errors. Note we use checkThis() instead of testThis(). */ status = inSection(5); checkThis(' /\\(/ '); status = inSection(6); checkThis(' /\\)/ '); status = inSection(7); checkThis(' /(abc)def\\(g/ '); status = inSection(8); checkThis(' /(abc\\)def)g/ '); status = inSection(9); checkThis(' /(abc(\\))def)g/ '); status = inSection(10); checkThis(' /(abc([x\\)yz]+)def)g/ '); /* * Unescaped, unbalanced left brackets should be a SyntaxError */ status = inSection(11); testThis(' /[/ '); status = inSection(12); testThis(' /[abc\\]def[g/ '); /* * We permit unescaped, unbalanced right brackets, as does Perl. * No error should result, even though this is not ECMA-compliant. * Note we use checkThis() instead of testThis(). */ status = inSection(13); checkThis(' /]/ '); status = inSection(14); checkThis(' /\\[abc]def]g/ '); /* * These regexp patterns are correct and should not generate * any errors. Note we use checkThis() instead of testThis(). */ status = inSection(15); checkThis(' /\\[/ '); status = inSection(16); checkThis(' /\\]/ '); status = inSection(17); checkThis(' /[abc]def\\[g/ '); status = inSection(18); checkThis(' /[abc\\]def]g/ '); status = inSection(19); checkThis(' /(abc[\\]]def)g/ '); status = inSection(20); checkThis(' /[abc(x\\]yz+)def]g/ '); /* * Run some tests for unbalanced braces. We again follow Perl, and * thus permit unescaped unbalanced braces - both left and right, * even though this is not ECMA-compliant. * * Note we use checkThis() instead of testThis(). */ status = inSection(21); checkThis(' /abc{def/ '); status = inSection(22); checkThis(' /abc}def/ '); status = inSection(23); checkThis(' /a{2}bc{def/ '); status = inSection(24); checkThis(' /a}b{3}c}def/ '); /* * These regexp patterns are correct and should not generate * any errors. Note we use checkThis() instead of testThis(). */ status = inSection(25); checkThis(' /abc\\{def/ '); status = inSection(26); checkThis(' /abc\\}def/ '); status = inSection(27); checkThis(' /a{2}bc\\{def/ '); status = inSection(28); checkThis(' /a\\}b{3}c\\}def/ '); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- /* * Invalid syntax should generate a SyntaxError */ function testThis(sInvalidSyntax) { expect = TEST_PASSED; actual = TEST_FAILED_BADLY; try { eval(sInvalidSyntax); } catch(e) { if (e instanceof SyntaxError) actual = TEST_PASSED; else actual = TEST_FAILED; } statusitems[UBound] = status; expectedvalues[UBound] = expect; actualvalues[UBound] = actual; UBound++; } /* * Valid syntax shouldn't generate any errors */ function checkThis(sValidSyntax) { expect = CHECK_PASSED; actual = CHECK_PASSED; try { eval(sValidSyntax); } catch(e) { actual = CHECK_FAILED; } statusitems[UBound] = status; expectedvalues[UBound] = expect; actualvalues[UBound] = actual; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i','g'),""); stra=stra.replace(new RegExp('','g'),"
        "); } function runTest() { for (var j = 1000; j <= 10000; j += 1000) { neurodna(j); } } function neurodna(limit) { var prepare=""; for(var i=0;i])*-->', 'g'), ''); printStatus(data); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-309840.js0000644000175000017500000000430611545150464022535 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Phil Schwartau * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 309840; var summary = 'Treat / in a literal regexp class as valid'; var actual = 'No error'; var expect = 'No error'; printBugNumber(BUGNUMBER); printStatus (summary); try { var re = eval('/[/]/'); } catch(e) { actual = e.toString(); } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-311414.js0000644000175000017500000000605511545150464022526 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): timeless * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 311414; var summary = 'RegExp captured tail match should be O(N)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); function q1(n) { var c = []; c[n] = 1; c = c.join(" "); var d = Date.now(); var e = c.match(/(.*)foo$/); var f = Date.now(); return (f - d); } function q2(n) { var c = []; c[n] = 1; c = c.join(" "); var d = Date.now(); var e = /foo$/.test(c) && c.match(/(.*)foo$/); var f = Date.now(); return (f - d); } var data1 = {X:[], Y:[]}; var data2 = {X:[], Y:[]}; for (var x = 500; x < 5000; x += 500) { var y1 = q1(x); var y2 = q2(x); data1.X.push(x); data1.Y.push(y1); data2.X.push(x); data2.Y.push(y2); gc(); } var order1 = BigO(data1); var order2 = BigO(data2); var msg = ''; for (var p = 0; p < data1.X.length; p++) { msg += '(' + data1.X[p] + ', ' + data1.Y[p] + '); '; } printStatus(msg); printStatus('Order: ' + order1); reportCompare(true, order1 < 2 , summary + ' BigO ' + order1 + ' < 2'); msg = ''; for (var p = 0; p < data2.X.length; p++) { msg += '(' + data2.X[p] + ', ' + data2.Y[p] + '); '; } printStatus(msg); printStatus('Order: ' + order2); reportCompare(true, order2 < 2 , summary + ' BigO ' + order2 + ' < 2'); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-312351.js0000644000175000017500000000410311545150464022517 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): drimbk@yahoo.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 312351; var summary = 'Do not crash on RegExp(null)'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var x = RegExp(null); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-31316.js0000644000175000017500000000624511545150464022447 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 01 May 2001 * * SUMMARY: Regression test for Bugzilla bug 31316: * "Rhino: Regexp matches return garbage" * * See http://bugzilla.mozilla.org/show_bug.cgi?id=31316 */ //----------------------------------------------------------------------------- var i = 0; var BUGNUMBER = 31316; var summary = 'Regression test for Bugzilla bug 31316'; var cnEmptyString = ''; var status = ''; var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; var strings = new Array(); var actualmatch = ''; var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); status = inSection(1); pattern = /<([^\/<>][^<>]*[^\/])>|<([^\/<>])>/; string = '

        Some
        test

        '; actualmatch = string.match(pattern); expectedmatch = Array('

        ', undefined, 'p'); addThis(); //------------------------------------------------------------------------------------------------- test(); //------------------------------------------------------------------------------------------------- function addThis() { statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; expectedmatches[i] = expectedmatch; i++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-330684.js0000644000175000017500000000436311545150464022540 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Shaohua Wen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 330684; var summary = 'Do not hang on RegExp'; var actual = 'Do not hang on RegExp'; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var re = /^(?:(?:%[0-9A-Fa-f]{2})*[!\$&'\*-;=\?-Z_a-z]*)+$/; var url = "http://tw.yimg.com/a/tw/wenchuan/cam_240x400_381615_030806_2.swf?clickTAG=javascript:VRECopenWindow(1)"; printStatus(re.test(url)); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-334158.js0000644000175000017500000000454111545150464022536 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Andreas * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 334158; var summary = 'Parse error in control letter escapes (RegExp)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); expect = true; actual = /\ca/.test( "\x01" ); reportCompare(expect, actual, summary + ':/\ca/.test( "\x01" )'); expect = false actual = /\ca/.test( "\\ca" ); reportCompare(expect, actual, summary + ': /\ca/.test( "\\ca" )'); expect = false actual = /\c[a/]/.test( "\x1ba/]" ); reportCompare(expect, actual, summary + ': /\c[a/]/.test( "\x1ba/]" )'); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-346090.js0000644000175000017500000000457011545150464022536 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Priit Laes * Brian Crowder * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 346090; var summary = 'Do not crash with this regexp'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var r = /%((h[^l]+)|(l[^h]+)){0,2}?a/g; r.exec('%lld %d'); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-367888.js0000644000175000017500000000450011545150464022551 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 367888; var summary = 'RegExp /(|)??x/g.exec("y") barfs'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = null; actual = /(|)??x/g.exec("y"); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-375642.js0000644000175000017500000000444411545150464022543 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375642; var summary = 'RegExp /(?:a??)+?/.exec("")'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); /(?:a??)+?/.exec("") reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-375651.js0000755000175000017500000000450611545150464022545 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375651; var summary = 'Do not assert with regexp quantifiers'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); /(.{2,3}){0,2}?t/.exec("abt"); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-375711.js0000644000175000017500000000650111545150464022534 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375711; var summary = 'Do not assert with /[Q-b]/i.exec("")'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var s; // see bug 416933 print('see bug 416933 for changed behavior on Gecko 1.9'); try { s = '/[Q-b]/.exec("")'; expect = 'No Error'; print(s + ' expect ' + expect); eval(s); actual = 'No Error'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': ' + s); try { s ='/[Q-b]/i.exec("")'; expect = 'No Error'; print(s + ' expect ' + expect); eval(s); actual = 'No Error'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': ' + s); try { s = '/[q-b]/.exec("")'; expect = 'SyntaxError: invalid range in character class'; print(s + ' expect ' + expect); eval(s); actual = 'No Error'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': ' + s); try { s ='/[q-b]/i.exec("")'; expect = 'SyntaxError: invalid range in character class'; print(s + ' expect ' + expect); eval(s); actual = 'No Error'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': ' + s); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-375715-01-n.js0000644000175000017500000000474511545150464023221 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375715; var summary = 'Do not assert: (c2 <= cs->length) && (c1 <= c2)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); // note that the assertion does not fire if the regexp is // evald or used in new RegExp, so this test must be an -n // with uncaught SyntaxError. /[\Wb-G]/.exec(""); reportCompare(expect, actual, summary + ' /[\Wb-G]/.exec("")'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-375715-02.js0000644000175000017500000000446611545150464022767 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375715; var summary = 'Do not assert: (c2 <= cs->length) && (c1 <= c2)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); /[\s-:]/; reportCompare(expect, actual, summary + '/[\s-:]/'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-375715-03.js0000644000175000017500000000451011545150464022756 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375715; var summary = 'Do not assert: (c2 <= cs->length) && (c1 <= c2)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); /[_-t]/i.exec(""); reportCompare(expect, actual, summary + '/[_-t]/i.exec("")'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-375715-04.js0000644000175000017500000000476111545150464022767 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375715; var summary = 'Do not assert: (c2 <= cs->length) && (c1 <= c2)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { expect = 'SyntaxError: invalid range in character class'; (new RegExp("[\xDF-\xC7]]", "i")).exec(""); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + '(new RegExp("[\xDF-\xC7]]", "i")).exec("")'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-436700.js0000644000175000017500000000460211545150464022530 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Sylvain Pasche * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 436700; var summary = 'Do not assert: 1 <= num && num <= 0x10000'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { /\2147483648/.exec(String.fromCharCode(140) + "7483648").toString(); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-465862.js0000644000175000017500000000724611545150464022552 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Dave Mandelin * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 465862; var summary = 'Do case-insensitive matching correctly in JIT for non-ASCII-letters'; var i = 0; var status = ''; var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; var strings = new Array(); var actualmatch = ''; var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); // Note: we must call the RegExp constructor here instead of using // literals. Otherwise, because the regexps are compiled at parse // time, they will not be compiled to native code and we will not // actually be testing jitted regexps. jit(true); status = inSection(1); string = '@'; pattern = new RegExp('@', 'i'); actualmatch = string.match(pattern); expectedmatch = Array(string); addThis(); status = inSection(2); string = '`'; pattern = new RegExp('`', 'i'); actualmatch = string.match(pattern); expectedmatch = Array(string); addThis(); status = inSection(3); string = '@'; pattern = new RegExp('`', 'i'); actualmatch = string.match(pattern); expectedmatch = null; addThis(); status = inSection(4); string = '`'; pattern = new RegExp('@', 'i'); print(string + ' ' + pattern); actualmatch = string.match(pattern); print('z ' + actualmatch); print('`'.match(/@/i)); expectedmatch = null; addThis(); jit(false); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; expectedmatches[i] = expectedmatch; i++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-57572.js0000644000175000017500000001166111545150464022461 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 28 December 2000 * * SUMMARY: Testing regular expressions containing the ? character. * Arose from Bugzilla bug 57572: "RegExp with ? matches incorrectly" * * See http://bugzilla.mozilla.org/show_bug.cgi?id=57572 * */ //----------------------------------------------------------------------------- var i = 0; var BUGNUMBER = 57572; var summary = 'Testing regular expressions containing "?"'; var cnEmptyString = ''; var cnSingleSpace = ' '; var status = ''; var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; var strings = new Array(); var actualmatch = ''; var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); status = inSection(1); pattern = /(\S+)?(.*)/; string = 'Test this'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'Test', ' this'); //single space in front of 'this' addThis(); status = inSection(2); pattern = /(\S+)? ?(.*)/; //single space between the ? characters string= 'Test this'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'Test', 'this'); //NO space in front of 'this' addThis(); status = inSection(3); pattern = /(\S+)?(.*)/; string = 'Stupid phrase, with six - (short) words'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'Stupid', ' phrase, with six - (short) words'); //single space in front of 'phrase' addThis(); status = inSection(4); pattern = /(\S+)? ?(.*)/; //single space between the ? characters string = 'Stupid phrase, with six - (short) words'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'Stupid', 'phrase, with six - (short) words'); //NO space in front of 'phrase' addThis(); // let's add an extra back-reference this time - three instead of two - status = inSection(5); pattern = /(\S+)?( ?)(.*)/; //single space before second ? character string = 'Stupid phrase, with six - (short) words'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'Stupid', cnSingleSpace, 'phrase, with six - (short) words'); addThis(); status = inSection(6); pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character string = 'AAABBB'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'AAABB', cnEmptyString, 'B'); addThis(); status = inSection(7); pattern = /(\S+)?(!?)(.*)/; string = 'WOW !!! !!!'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'WOW', cnEmptyString, ' !!! !!!'); addThis(); status = inSection(8); pattern = /(.+)?(!?)(!+)/; string = 'WOW !!! !!!'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'WOW !!! !!', cnEmptyString, '!'); addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; expectedmatches[i] = expectedmatch; i++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-57631.js0000644000175000017500000001113011545150464022444 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com, zack-weg@gmx.de * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 26 November 2000 * * * SUMMARY: This test arose from Bugzilla bug 57631: * "RegExp with invalid pattern or invalid flag causes segfault" * * Either error should throw an exception of type SyntaxError, * and we check to see that it does... */ //----------------------------------------------------------------------------- var BUGNUMBER = '57631'; var summary = 'Testing new RegExp(pattern,flag) with illegal pattern or flag'; var statprefix = 'Testing for error creating illegal RegExp object on pattern '; var statsuffix = 'and flag '; var cnSUCCESS = 'SyntaxError'; var cnFAILURE = 'not a SyntaxError'; var singlequote = "'"; var i = -1; var j = -1; var s = ''; var f = ''; var obj = {}; var status = ''; var actual = ''; var expect = ''; var msg = ''; var legalpatterns = new Array(); var illegalpatterns = new Array(); var legalflags = new Array(); var illegalflags = new Array(); // valid regular expressions to try - legalpatterns[0] = ''; legalpatterns[1] = 'abc'; legalpatterns[2] = '(.*)(3-1)\s\w'; legalpatterns[3] = '(.*)(...)\\s\\w'; legalpatterns[4] = '[^A-Za-z0-9_]'; legalpatterns[5] = '[^\f\n\r\t\v](123.5)([4 - 8]$)'; // invalid regular expressions to try - illegalpatterns[0] = '(?)'; illegalpatterns[1] = '(a'; illegalpatterns[2] = '( ]'; //illegalpatterns[3] = '\d{1,s}'; // valid flags to try - legalflags[0] = 'i'; legalflags[1] = 'g'; legalflags[2] = 'm'; legalflags[3] = undefined; // invalid flags to try - illegalflags[0] = 'a'; illegalflags[1] = 123; illegalflags[2] = new RegExp(); //------------------------------------------------------------------------------------------------- test(); //------------------------------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testIllegalRegExps(legalpatterns, illegalflags); testIllegalRegExps(illegalpatterns, legalflags); testIllegalRegExps(illegalpatterns, illegalflags); exitFunc ('test'); } // This function will only be called where all the patterns are illegal, or all the flags function testIllegalRegExps(patterns, flags) { for (i in patterns) { s = patterns[i]; for (j in flags) { f = flags[j]; status = getStatus(s, f); actual = cnFAILURE; expect = cnSUCCESS; try { // This should cause an exception if either s or f is illegal - eval('obj = new RegExp(s, f);'); } catch(e) { // We expect to get a SyntaxError - test for this: if (e instanceof SyntaxError) actual = cnSUCCESS; } reportCompare(expect, actual, status); } } } function getStatus(regexp, flag) { return (statprefix + quote(regexp) + statsuffix + quote(flag)); } function quote(text) { return (singlequote + text + singlequote); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-67773.js0000644000175000017500000001357211545150464022470 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 06 February 2001 * * SUMMARY: Arose from Bugzilla bug 67773: * "Regular subexpressions followed by + failing to run to completion" * * See http://bugzilla.mozilla.org/show_bug.cgi?id=67773 * See http://bugzilla.mozilla.org/show_bug.cgi?id=69989 */ //----------------------------------------------------------------------------- var i = 0; var BUGNUMBER = 67773; var summary = 'Testing regular subexpressions followed by ? or +\n'; var cnSingleSpace = ' '; var status = ''; var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; var strings = new Array(); var actualmatch = ''; var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); pattern = /^(\S+)?( ?)(B+)$/; //single space before second ? character status = inSection(1); string = 'AAABBB AAABBB '; //single space at middle and at end - actualmatch = string.match(pattern); expectedmatch = null; addThis(); status = inSection(2); string = 'AAABBB BBB'; //single space in the middle actualmatch = string.match(pattern); expectedmatch = Array(string, 'AAABBB', cnSingleSpace, 'BBB'); addThis(); status = inSection(3); string = 'AAABBB AAABBB'; //single space in the middle actualmatch = string.match(pattern); expectedmatch = null; addThis(); pattern = /^(A+B)+$/; status = inSection(4); string = 'AABAAB'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'AAB'); addThis(); status = inSection(5); string = 'ABAABAAAAAAB'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'AAAAAAB'); addThis(); status = inSection(6); string = 'ABAABAABAB'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'AB'); addThis(); status = inSection(7); string = 'ABAABAABABB'; actualmatch = string.match(pattern); expectedmatch = null; // because string doesn't match at end addThis(); pattern = /^(A+1)+$/; status = inSection(8); string = 'AA1AA1'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'AA1'); addThis(); pattern = /^(\w+\-)+$/; status = inSection(9); string = ''; actualmatch = string.match(pattern); expectedmatch = null; addThis(); status = inSection(10); string = 'bla-'; actualmatch = string.match(pattern); expectedmatch = Array(string, string); addThis(); status = inSection(11); string = 'bla-bla'; // hyphen missing at end - actualmatch = string.match(pattern); expectedmatch = null; //because string doesn't match at end addThis(); status = inSection(12); string = 'bla-bla-'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'bla-'); addThis(); pattern = /^(\S+)+(A+)$/; status = inSection(13); string = 'asdldflkjAAA'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'asdldflkjAA', 'A'); addThis(); status = inSection(14); string = 'asdldflkj AAA'; // space in middle actualmatch = string.match(pattern); expectedmatch = null; //because of the space addThis(); pattern = /^(\S+)+(\d+)$/; status = inSection(15); string = 'asdldflkj122211'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'asdldflkj12221', '1'); addThis(); status = inSection(16); string = 'asdldflkj1111111aaa1'; actualmatch = string.match(pattern); expectedmatch = Array(string, 'asdldflkj1111111aaa', '1'); addThis(); /* * This one comes from Stephen Ostermiller. * See http://bugzilla.mozilla.org/show_bug.cgi?id=69989 */ pattern = /^[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)+$/; status = inSection(17); string = 'some.host.tld'; actualmatch = string.match(pattern); expectedmatch = Array(string, '.tld', '.'); addThis(); //------------------------------------------------------------------------------------------------- test(); //------------------------------------------------------------------------------------------------- function addThis() { statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; expectedmatches[i] = expectedmatch; i++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-72964.js0000644000175000017500000000751211545150464022463 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 2001-07-17 * * SUMMARY: Regression test for Bugzilla bug 72964: * "String method for pattern matching failed for Chinese Simplified (GB2312)" * * See http://bugzilla.mozilla.org/show_bug.cgi?id=72964 */ //----------------------------------------------------------------------------- var i = 0; var BUGNUMBER = 72964; var summary = 'Testing regular expressions containing non-Latin1 characters'; var cnSingleSpace = ' '; var status = ''; var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; var strings = new Array(); var actualmatch = ''; var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); pattern = /[\S]+/; // 4 low Unicode chars = Latin1; whole string should match status = inSection(1); string = '\u00BF\u00CD\u00BB\u00A7'; actualmatch = string.match(pattern); expectedmatch = Array(string); addThis(); // Now put a space in the middle; first half of string should match status = inSection(2); string = '\u00BF\u00CD \u00BB\u00A7'; actualmatch = string.match(pattern); expectedmatch = Array('\u00BF\u00CD'); addThis(); // 4 high Unicode chars = non-Latin1; whole string should match status = inSection(3); string = '\u4e00\uac00\u4e03\u4e00'; actualmatch = string.match(pattern); expectedmatch = Array(string); addThis(); // Now put a space in the middle; first half of string should match status = inSection(4); string = '\u4e00\uac00 \u4e03\u4e00'; actualmatch = string.match(pattern); expectedmatch = Array('\u4e00\uac00'); addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; expectedmatches[i] = expectedmatch; i++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-76683.js0000644000175000017500000000735311545150464022470 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 01 May 2001 * * SUMMARY: Regression test for Bugzilla bug 76683 on Rhino: * "RegExp regression (NullPointerException)" * * See http://bugzilla.mozilla.org/show_bug.cgi?id=76683 */ //----------------------------------------------------------------------------- var i = 0; var BUGNUMBER = 76683; var summary = 'Regression test for Bugzilla bug 76683'; var status = ''; var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; var strings = new Array(); var actualmatch = ''; var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); /* * Rhino (2001-04-19) crashed on the 3rd regular expression below. * It didn't matter what the string was. No problem in SpiderMonkey - */ string = 'abc'; status = inSection(1); pattern = /()|(<([\$\w:\.\-]+)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; actualmatch = string.match(pattern); expectedmatch = null; addThis(); status = inSection(2); pattern = /()|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))/; actualmatch = string.match(pattern); expectedmatch = null; addThis(); // This was the one causing a Rhino crash - status = inSection(3); pattern = /()|(<(tagPattern)((([ ][^\/>]*)?\/>)|(([ ][^>]*)?>)))|(<\/tagPattern[^>]*>)/; actualmatch = string.match(pattern); expectedmatch = null; addThis(); //------------------------------------------------------------------------------------------------- test(); //------------------------------------------------------------------------------------------------- function addThis() { statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; expectedmatches[i] = expectedmatch; i++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-78156.js0000644000175000017500000000735111545150464022463 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 06 February 2001 * * SUMMARY: Arose from Bugzilla bug 78156: * "m flag of regular expression does not work with $" * * See http://bugzilla.mozilla.org/show_bug.cgi?id=78156 * * The m flag means a regular expression should search strings * across multiple lines, i.e. across '\n', '\r'. */ //----------------------------------------------------------------------------- var i = 0; var BUGNUMBER = 78156; var summary = 'Testing regular expressions with ^, $, and the m flag -'; var status = ''; var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; var strings = new Array(); var actualmatch = ''; var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); /* * All patterns have an m flag; all strings are multiline. * Looking for digit characters at beginning/end of lines. */ string = 'aaa\n789\r\nccc\r\n345'; status = inSection(1); pattern = /^\d/gm; actualmatch = string.match(pattern); expectedmatch = ['7','3']; addThis(); status = inSection(2); pattern = /\d$/gm; actualmatch = string.match(pattern); expectedmatch = ['9','5']; addThis(); string = 'aaa\n789\r\nccc\r\nddd'; status = inSection(3); pattern = /^\d/gm; actualmatch = string.match(pattern); expectedmatch = ['7']; addThis(); status = inSection(4); pattern = /\d$/gm; actualmatch = string.match(pattern); expectedmatch = ['9']; addThis(); //------------------------------------------------------------------------------------------------- test(); //------------------------------------------------------------------------------------------------- function addThis() { statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; expectedmatches[i] = expectedmatch; i++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-85721.js0000644000175000017500000002411211545150464022451 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * rogerl@netscape.com, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 14 Feb 2002 * SUMMARY: Performance: Regexp performance degraded from 4.7 * See http://bugzilla.mozilla.org/show_bug.cgi?id=85721 * * Adjust this testcase if necessary. The FAST constant defines * an upper bound in milliseconds for any execution to take. * */ //----------------------------------------------------------------------------- var BUGNUMBER = 85721; var summary = 'Performance: execution of regular expression'; var FAST = 100; // execution should be 100 ms or less to pass the test var MSG_FAST = 'Execution took less than ' + FAST + ' ms'; var MSG_SLOW = 'Execution took '; var MSG_MS = ' ms'; var str = ''; var re = ''; var status = ''; var actual = ''; var expect= ''; printBugNumber(BUGNUMBER); printStatus (summary); function elapsedTime(startTime) { return new Date() - startTime; } function isThisFast(ms) { if (ms <= FAST) return MSG_FAST; return MSG_SLOW + ms + MSG_MS; } /* * The first regexp. We'll test for performance (Section 1) and accuracy (Section 2). */ str=' www.m.com drive.class\nfoo goo '; re = /\s*\s*([^\r\n]*?)\s*<\/sql:url>\s*\s*([^\r\n]*?)\s*<\/sql:driver>\s*(\s*\s*([^\r\n]*?)\s*<\/sql:userId>\s*)?\s*(\s*\s*([^\r\n]*?)\s*<\/sql:password>\s*)?\s*<\/sql:connection>/; expect = Array(" www.m.com drive.class\nfoo goo ","conn1","www.m.com","drive.class","foo ","foo","goo ","goo"); /* * Check performance - */ status = inSection(1); var start = new Date(); var result = re.exec(str); actual = elapsedTime(start); reportCompare(isThisFast(FAST), isThisFast(actual), status); /* * Check accuracy - */ status = inSection(2); testRegExp([status], [re], [str], [result], [expect]); /* * The second regexp (HUGE!). We'll test for performance (Section 3) and accuracy (Section 4). * It comes from the O'Reilly book "Mastering Regular Expressions" by Jeffrey Friedl, Appendix B */ //# Some things for avoiding backslashitis later on. $esc = '\\\\'; $Period = '\.'; $space = '\040'; $tab = '\t'; $OpenBR = '\\['; $CloseBR = '\\]'; $OpenParen = '\\('; $CloseParen = '\\)'; $NonASCII = '\x80-\xff'; $ctrl = '\000-\037'; $CRlist = '\n\015'; //# note: this should really be only \015. // Items 19, 20, 21 $qtext = '[^' + $esc + $NonASCII + $CRlist + '\"]'; // # for within "..." $dtext = '[^' + $esc + $NonASCII + $CRlist + $OpenBR + $CloseBR + ']'; // # for within [...] $quoted_pair = $esc + '[^' + $NonASCII + ']'; // # an escaped character //############################################################################## //# Items 22 and 23, comment. //# Impossible to do properly with a regex, I make do by allowing at most one level of nesting. $ctext = '[^' + $esc + $NonASCII + $CRlist + '()]'; //# $Cnested matches one non-nested comment. //# It is unrolled, with normal of $ctext, special of $quoted_pair. $Cnested = $OpenParen + // # ( $ctext + '*' + // # normal* '(?:' + $quoted_pair + $ctext + '*)*' + // # (special normal*)* $CloseParen; // # ) //# $comment allows one level of nested parentheses //# It is unrolled, with normal of $ctext, special of ($quoted_pair|$Cnested) $comment = $OpenParen + // # ( $ctext + '*' + // # normal* '(?:' + // # ( '(?:' + $quoted_pair + '|' + $Cnested + ')' + // # special $ctext + '*' + // # normal* ')*' + // # )* $CloseParen; // # ) //############################################################################## //# $X is optional whitespace/comments. $X = '[' + $space + $tab + ']*' + // # Nab whitespace. '(?:' + $comment + '[' + $space + $tab + ']*)*'; // # If comment found, allow more spaces. //# Item 10: atom $atom_char = '[^(' + $space + '<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $ctrl + $NonASCII + ']'; $atom = $atom_char + '+' + // # some number of atom characters... '(?!' + $atom_char + ')'; // # ..not followed by something that could be part of an atom // # Item 11: doublequoted string, unrolled. $quoted_str = '\"' + // # " $qtext + '*' + // # normal '(?:' + $quoted_pair + $qtext + '*)*' + // # ( special normal* )* '\"'; // # " //# Item 7: word is an atom or quoted string $word = '(?:' + $atom + // # Atom '|' + // # or $quoted_str + // # Quoted string ')' //# Item 12: domain-ref is just an atom $domain_ref = $atom; //# Item 13: domain-literal is like a quoted string, but [...] instead of "..." $domain_lit = $OpenBR + // # [ '(?:' + $dtext + '|' + $quoted_pair + ')*' + // # stuff $CloseBR; // # ] // # Item 9: sub-domain is a domain-ref or domain-literal $sub_domain = '(?:' + $domain_ref + '|' + $domain_lit + ')' + $X; // # optional trailing comments // # Item 6: domain is a list of subdomains separated by dots. $domain = $sub_domain + '(?:' + $Period + $X + $sub_domain + ')*'; //# Item 8: a route. A bunch of "@ $domain" separated by commas, followed by a colon. $route = '\@' + $X + $domain + '(?:,' + $X + '\@' + $X + $domain + ')*' + // # additional domains ':' + $X; // # optional trailing comments //# Item 6: local-part is a bunch of $word separated by periods $local_part = $word + $X '(?:' + $Period + $X + $word + $X + // # additional words ')*'; // # Item 2: addr-spec is local@domain $addr_spec = $local_part + '\@' + $X + $domain; //# Item 4: route-addr is $route_addr = '<' + $X + // # < '(?:' + $route + ')?' + // # optional route $addr_spec + // # address spec '>'; // # > //# Item 3: phrase........ $phrase_ctrl = '\000-\010\012-\037'; // # like ctrl, but without tab //# Like atom-char, but without listing space, and uses phrase_ctrl. //# Since the class is negated, this matches the same as atom-char plus space and tab $phrase_char = '[^()<>\@,;:\".' + $esc + $OpenBR + $CloseBR + $NonASCII + $phrase_ctrl + ']'; // # We've worked it so that $word, $comment, and $quoted_str to not consume trailing $X // # because we take care of it manually. $phrase = $word + // # leading word $phrase_char + '*' + // # "normal" atoms and/or spaces '(?:' + '(?:' + $comment + '|' + $quoted_str + ')' + // # "special" comment or quoted string $phrase_char + '*' + // # more "normal" ')*'; // ## Item #1: mailbox is an addr_spec or a phrase/route_addr $mailbox = $X + // # optional leading comment '(?:' + $phrase + $route_addr + // # name and address '|' + // # or $addr_spec + // # address ')'; //########################################################################### re = new RegExp($mailbox, "g"); str = 'Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>'; expect = Array('Jeffy<"That Tall Guy"@ora.com (this address is no longer active)>'); /* * Check performance - */ status = inSection(3); var start = new Date(); var result = re.exec(str); actual = elapsedTime(start); reportCompare(isThisFast(FAST), isThisFast(actual), status); /* * Check accuracy - */ status = inSection(4); testRegExp([status], [re], [str], [result], [expect]); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-87231.js0000644000175000017500000001074511545150464022456 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 22 June 2001 * * SUMMARY: Regression test for Bugzilla bug 87231: * "Regular expression /(A)?(A.*)/ picks 'A' twice" * * See http://bugzilla.mozilla.org/show_bug.cgi?id=87231 * Key case: * * pattern = /^(A)?(A.*)$/; * string = 'A'; * expectedmatch = Array('A', '', 'A'); * * * We expect the 1st subexpression (A)? NOT to consume the single 'A'. * Recall that "?" means "match 0 or 1 times". Here, it should NOT do * greedy matching: it should match 0 times instead of 1. This allows * the 2nd subexpression to make the only match it can: the single 'A'. * Such "altruism" is the only way there can be a successful global match... */ //----------------------------------------------------------------------------- var i = 0; var BUGNUMBER = 87231; var cnEmptyString = ''; var summary = 'Testing regular expression /(A)?(A.*)/'; var status = ''; var statusmessages = new Array(); var pattern = ''; var patterns = new Array(); var string = ''; var strings = new Array(); var actualmatch = ''; var actualmatches = new Array(); var expectedmatch = ''; var expectedmatches = new Array(); pattern = /^(A)?(A.*)$/; status = inSection(1); string = 'AAA'; actualmatch = string.match(pattern); expectedmatch = Array('AAA', 'A', 'AA'); addThis(); status = inSection(2); string = 'AA'; actualmatch = string.match(pattern); expectedmatch = Array('AA', 'A', 'A'); addThis(); status = inSection(3); string = 'A'; actualmatch = string.match(pattern); expectedmatch = Array('A', undefined, 'A'); // 'altruistic' case: see above addThis(); pattern = /(A)?(A.*)/; var strL = 'zxcasd;fl\\\ ^'; var strR = 'aaAAaaaf;lrlrzs'; status = inSection(4); string = strL + 'AAA' + strR; actualmatch = string.match(pattern); expectedmatch = Array('AAA' + strR, 'A', 'AA' + strR); addThis(); status = inSection(5); string = strL + 'AA' + strR; actualmatch = string.match(pattern); expectedmatch = Array('AA' + strR, 'A', 'A' + strR); addThis(); status = inSection(6); string = strL + 'A' + strR; actualmatch = string.match(pattern); expectedmatch = Array('A' + strR, undefined, 'A' + strR); // 'altruistic' case: see above addThis(); //------------------------------------------------------------------------------------------------- test(); //------------------------------------------------------------------------------------------------- function addThis() { statusmessages[i] = status; patterns[i] = pattern; strings[i] = string; actualmatches[i] = actualmatch; expectedmatches[i] = expectedmatch; i++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/RegExp/regress-98306.js0000644000175000017500000000563011545150464022460 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * jrgm@netscape.com, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 04 September 2001 * * SUMMARY: Regression test for Bugzilla bug 98306 * "JS parser crashes in ParseAtom for script using Regexp()" * * See http://bugzilla.mozilla.org/show_bug.cgi?id=98306 */ //----------------------------------------------------------------------------- var BUGNUMBER = 98306; var summary = "Testing that we don't crash on this code -"; var cnUBOUND = 10; var re; var s; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); s = '"Hello".match(/[/]/)'; tryThis(s); s = 're = /[/'; tryThis(s); s = 're = /[/]/'; tryThis(s); s = 're = /[//]/'; tryThis(s); reportCompare('No Crash', 'No Crash', ''); exitFunc ('test'); } // Try to provoke a crash - function tryThis(sCode) { // sometimes more than one attempt is necessary - for (var i=0; i 5) throw "bad"; i++; continue; } } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Regress/regress-469937.js0000755000175000017500000000444011545150464022775 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 469937; var summary = 'Properties without DontEnum are sometimes not enumerated'; var actual = false; var expect = true; printBugNumber(BUGNUMBER); printStatus (summary); (function(){ var o = { } o.PageLeft = 1; o.Rect2 = 6; delete o.Rect2; for (var p in o); o.Rect3 = 7; found = false; for (var p in o) if (p == 'Rect3') found = true; actual = found; })(); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Regress/regress-580544.js0000644000175000017500000000135711545150464022762 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var gTestfile = 'regress-580544.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 580544; var summary = 'Do not assert: new (this.prototype = this)'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { new (this.prototype = this); } catch (e) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Regress/shell.js0000644000175000017500000000000011545150464021630 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Statements/12.10-01.js0000644000175000017500000000460411545150464022133 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 462734; var summary = 'evaluating lhs "Reference" *before* evaluating rhs'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var x = 1; var o = {}; with (o) x = o.x = 2; print(x); expect = 4; actual = x + o.x; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Statements/12.6.3.js0000644000175000017500000000476011545150464022006 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Bryant Chen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 292731; var summary = 'for-in should not call valueOf method'; var actual = ''; var expect = ''; var i; printBugNumber(BUGNUMBER); printStatus (summary); function MyObject() { } MyObject.prototype.valueOf = function() { actual += 'MyObject.prototype.valueOf called. '; } var myobject = new MyObject(); var myfunction = new function() { this.valueOf = function() { actual += 'this.valueOf called. '; } } actual = ''; for (i in myobject) { //calls valueOf } reportCompare(expect, actual, 'for-in custom object'); actual = ''; for (i in myfunction) { //calls valueOf } reportCompare(expect, actual, 'for-in function expression'); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Statements/browser.js0000644000175000017500000000000011545150464022721 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Statements/jstests.list0000644000175000017500000000075711545150464023317 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_3/Statements/ script 12.10-01.js script 12.6.3.js skip script regress-121744.js # obsolete test script regress-131348.js script regress-157509.js script regress-194364.js script regress-226517.js script regress-302439.js script regress-324650.js script regress-444979.js script regress-74474-001.js script regress-74474-002.js script regress-74474-003.js script regress-83532-001.js script regress-83532-002.js script switch-001.js script switch-002.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Statements/regress-121744.js0000644000175000017500000001242711545150464023470 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 30 Jan 2002 * Revised: 10 Apr 2002 * Revised: 14 July 2002 * * SUMMARY: JS should error on |for(i in undefined)|, |for(i in null)| * See http://bugzilla.mozilla.org/show_bug.cgi?id=121744 * * ECMA-262 3rd Edition Final spec says such statements should error. See: * * Section 12.6.4 The for-in Statement * Section 9.9 ToObject * * * BUT: SpiderMonkey has decided NOT to follow this; it's a bug in the spec. * See http://bugzilla.mozilla.org/show_bug.cgi?id=131348 * * UPDATE: Rhino has also decided not to follow the spec on this. * See http://bugzilla.mozilla.org/show_bug.cgi?id=136893 * |--------------------------------------------------------------------| | | | So for now, adding an early return for this test so it won't run. | | | |--------------------------------------------------------------------| * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 121744; var summary = 'JS should error on |for(i in undefined)|, |for(i in null)|'; var TEST_PASSED = 'TypeError'; var TEST_FAILED = 'Generated an error, but NOT a TypeError!'; var TEST_FAILED_BADLY = 'Did not generate ANY error!!!'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; /* * AS OF 14 JULY 2002, DON'T RUN THIS TEST IN EITHER RHINO OR SPIDERMONKEY - */ quit(); status = inSection(1); expect = TEST_PASSED; actual = TEST_FAILED_BADLY; /* * OK, this should generate a TypeError */ try { for (var i in undefined) { print(i); } } catch(e) { if (e instanceof TypeError) actual = TEST_PASSED; else actual = TEST_FAILED; } addThis(); status = inSection(2); expect = TEST_PASSED; actual = TEST_FAILED_BADLY; /* * OK, this should generate a TypeError */ try { for (var i in null) { print(i); } } catch(e) { if (e instanceof TypeError) actual = TEST_PASSED; else actual = TEST_FAILED; } addThis(); status = inSection(3); expect = TEST_PASSED; actual = TEST_FAILED_BADLY; /* * Variable names that cannot be looked up generate ReferenceErrors; however, * property names like obj.ZZZ that cannot be looked up are set to |undefined| * * Therefore, this should indirectly test | for (var i in undefined) | */ try { for (var i in this.ZZZ) { print(i); } } catch(e) { if(e instanceof TypeError) actual = TEST_PASSED; else actual = TEST_FAILED; } addThis(); status = inSection(4); expect = TEST_PASSED; actual = TEST_FAILED_BADLY; /* * The result of an unsuccessful regexp match is the null value * Therefore, this should indirectly test | for (var i in null) | */ try { for (var i in 'bbb'.match(/aaa/)) { print(i); } } catch(e) { if(e instanceof TypeError) actual = TEST_PASSED; else actual = TEST_FAILED; } addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ var BUGNUMBER = 392378; var summary = '15.5.4.11 - String.prototype.replace'; var rex, f, a, i; reportCompare( 2, String.prototype.replace.length, "Section 1" ); reportCompare( "321", String.prototype.replace.call(123, "123", "321"), "Section 2" ); reportCompare( "ok", "ok".replace(), "Section 3" ); reportCompare( "undefined**", "***".replace("*"), "Section 4" ); reportCompare( "xnullz", "xyz".replace("y", null), "Section 5" ); reportCompare( "x123", "xyz".replace("yz", 123), "Section 6" ); reportCompare( "/x/g/x/g/x/g", "xxx".replace(/x/g, /x/g), "Section 7" ); reportCompare( "ok", "undefined".replace(undefined, "ok"), "Section 8" ); reportCompare( "ok", "null".replace(null, "ok"), "Section 9" ); reportCompare( "ok", "123".replace(123, "ok"), "Section 10" ); reportCompare( "xzyxyz", "xyzxyz".replace("yz", "zy"), "Section 11" ); reportCompare( "ok", "(xyz)".replace("(xyz)", "ok"), "Section 12" ); reportCompare( "*$&yzxyz", "xyzxyz".replace("x", "*$$&"), "Section 13" ); reportCompare( "xy*z*", "xyz".replace("z", "*$&*"), "Section 14" ); reportCompare( "xyxyzxyz", "xyzxyzxyz".replace("zxy", "$`"), "Section 15" ); reportCompare( "zxyzxyzzxyz", "xyzxyz".replace("xy", "$'xyz"), "Section 16" ); reportCompare( "$", "xyzxyz".replace("xyzxyz", "$"), "Section 17" ); reportCompare( "x$0$00xyz", "xyzxyz".replace("yz", "$0$00"), "Section 18" ); // Result for $1/$01 .. $99 is implementation-defined if searchValue is no // regular expression. $+ is a non-standard Mozilla extension. reportCompare( "$!$\"$-1$*$#$.$xyz$$", "xyzxyz$$".replace("xyz", "$!$\"$-1$*$#$.$"), "Section 19" ); reportCompare( "$$$&$$$&$&", "$$$&".replace("$$", "$$$$$$&$&$$&"), "Section 20" ); reportCompare( "yxx", "xxx".replace(/x/, "y"), "Section 21" ); reportCompare( "yyy", "xxx".replace(/x/g, "y"), "Section 22" ); rex = /x/, rex.lastIndex = 1; reportCompare( "yxx1", "xxx".replace(rex, "y") + rex.lastIndex, "Section 23" ); rex = /x/g, rex.lastIndex = 1; reportCompare( "yyy0", "xxx".replace(rex, "y") + rex.lastIndex, "Section 24" ); rex = /y/, rex.lastIndex = 1; reportCompare( "xxx1", "xxx".replace(rex, "y") + rex.lastIndex, "Section 25" ); rex = /y/g, rex.lastIndex = 1; reportCompare( "xxx0", "xxx".replace(rex, "y") + rex.lastIndex, "Section 26" ); rex = /x?/, rex.lastIndex = 1; reportCompare( "(x)xx1", "xxx".replace(rex, "($&)") + rex.lastIndex, "Section 27" ); rex = /x?/g, rex.lastIndex = 1; reportCompare( "(x)(x)(x)()0", "xxx".replace(rex, "($&)") + rex.lastIndex, "Section 28" ); rex = /y?/, rex.lastIndex = 1; reportCompare( "()xxx1", "xxx".replace(rex, "($&)") + rex.lastIndex, "Section 29" ); rex = /y?/g, rex.lastIndex = 1; reportCompare( "()x()x()x()0", "xxx".replace(rex, "($&)") + rex.lastIndex, "Section 30" ); reportCompare( "xy$0xy$zxy$zxyz$zxyz", "xyzxyzxyz".replace(/zxy/, "$0$`$$$&$$$'$"), "Section 31" ); reportCompare( "xy$0xy$zxy$zxyz$$0xyzxy$zxy$z$z", "xyzxyzxyz".replace(/zxy/g, "$0$`$$$&$$$'$"), "Section 32" ); reportCompare( "xyxyxyzxyxyxyz", "xyzxyz".replace(/(((x)(y)()()))()()()(z)/g, "$01$2$3$04$5$6$7$8$09$10"), "Section 33" ); rex = RegExp( "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()(y)"); reportCompare( "x(y)z", "xyz".replace(rex, "($99)"), "Section 34" ); rex = RegExp( "()()()()()()()()()(x)" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()(y)"); reportCompare( "(x0)z", "xyz".replace(rex, "($100)"), "Section 35" ); reportCompare( "xyz(XYZ)", "xyzXYZ".replace(/XYZ/g, "($&)"), "Section 36" ); reportCompare( "(xyz)(XYZ)", "xyzXYZ".replace(/xYz/gi, "($&)"), "Section 37" ); reportCompare( "xyz\rxyz\n", "xyz\rxyz\n".replace(/xyz$/g, "($&)"), "Section 38" ); reportCompare( "(xyz)\r(xyz)\n", "xyz\rxyz\n".replace(/xyz$/gm, "($&)"), "Section 39" ); f = function () { return "failure" }; reportCompare( "ok", "ok".replace("x", f), "Section 40" ); reportCompare( "ok", "ok".replace(/(?=k)ok/, f), "Section 41" ); reportCompare( "ok", "ok".replace(/(?!)ok/, f), "Section 42" ); reportCompare( "ok", "ok".replace(/ok(?!$)/, f), "Section 43" ); f = function (sub, offs, str) { return ["", sub, typeof sub, offs, typeof offs, str, typeof str, ""] .join("|"); }; reportCompare( "x|y|string|1|number|xyz|string|z", "xyz".replace("y", f), "Section 44" ); reportCompare( "x|(y)|string|1|number|x(y)z|string|z", "x(y)z".replace("(y)", f), "Section 45" ); reportCompare( "x|y*|string|1|number|xy*z|string|z", "xy*z".replace("y*", f), "Section 46" ); reportCompare( "12|3|string|2|number|12345|string|45", String.prototype.replace.call(1.2345e4, 3, f), "Section 47" ); reportCompare( "|x|string|0|number|xxx|string|xx", "xxx".replace(/^x/g, f), "Section 48" ); reportCompare( "xx|x|string|2|number|xxx|string|", "xxx".replace(/x$/g, f), "Section 49" ); f = function (sub, paren, offs, str) { return ["", sub, typeof sub, paren, typeof paren, offs, typeof offs, str, typeof str, ""].join("|"); }; reportCompare( "xy|z|string|z|string|2|number|xyz|string|", "xyz".replace(/(z)/g, f), "Section 50" ); reportCompare( "xyz||string||string|3|number|xyz|string|", "xyz".replace(/($)/g, f), "Section 51" ); reportCompare( "|xy|string|y|string|0|number|xyz|string|z", "xyz".replace(/(?:x)(y)/g, f), "Section 52" ); reportCompare( "|x|string|x|string|0|number|xyz|string|yz", "xyz".replace(/((?=xy)x)/g, f), "Section 53" ); reportCompare( "|x|string|x|string|0|number|xyz|string|yz", "xyz".replace(/(x(?=y))/g, f), "Section 54" ); reportCompare( "x|y|string|y|string|1|number|xyz|string|z", "xyz".replace(/((?!x)y)/g, f), "Section 55" ); reportCompare( "|x|string|x|string|0|number|xyz|string|" + "|y|string||undefined|1|number|xyz|string|z", "xyz".replace(/y|(x)/g, f), "Section 56" ); reportCompare( "xy|z|string||string|2|number|xyz|string|", "xyz".replace(/(z?)z/, f), "Section 57" ); reportCompare( "xy|z|string||undefined|2|number|xyz|string|", "xyz".replace(/(z)?z/, f), "Section 58" ); reportCompare( "xy|z|string||undefined|2|number|xyz|string|", "xyz".replace(/(z)?\1z/, f), "Section 59" ); reportCompare( "xy|z|string||undefined|2|number|xyz|string|", "xyz".replace(/\1(z)?z/, f), "Section 60" ); reportCompare( "xy|z|string||string|2|number|xyz|string|", "xyz".replace(/(z?\1)z/, f), "Section 61" ); f = function (sub, paren1, paren2, offs, str) { return ["", sub, typeof sub, paren1, typeof paren1, paren2, typeof paren2, offs, typeof offs, str, typeof str, ""].join("|"); }; reportCompare( "x|y|string|y|string||undefined|1|number|xyz|string|z", "xyz".replace(/(y)(\1)?/, f), "Section 62" ); reportCompare( "x|yy|string|y|string|y|string|1|number|xyyz|string|z", "xyyz".replace(/(y)(\1)?/g, f), "Section 63" ); reportCompare( "x|y|string|y|string||undefined|1|number|xyyz|string|" + "|y|string|y|string||undefined|2|number|xyyz|string|z", "xyyz".replace(/(y)(\1)??/g, f), "Section 64" ); reportCompare( "x|y|string|y|string|y|string|1|number|xyz|string|z", "xyz".replace(/(?=(y))(\1)?/, f), "Section 65" ); reportCompare( "xyy|z|string||undefined||string|3|number|xyyz|string|", "xyyz".replace(/(?!(y)y)(\1)z/, f), "Section 66" ); rex = RegExp( "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()" + "()()()()()()()()()()(z)?(y)"); a = ["sub"]; for (i = 1; i <= 102; ++i) a[i] = "p" + i; a[103] = "offs"; a[104] = "str"; a[105] = "return ['', sub, typeof sub, offs, typeof offs, str, typeof str, " + "p100, typeof p100, p101, typeof p101, p102, typeof p102, ''].join('|');"; f = Function.apply(null, a); reportCompare( "x|y|string|1|number|xyz|string||string||undefined|y|string|z", "xyz".replace(rex, f), "Section 67" ); reportCompare( "undefined", "".replace(/.*/g, function () {}), "Section 68" ); reportCompare( "nullxnullynullznull", "xyz".replace(/.??/g, function () { return null; }), "Section 69" ); reportCompare( "111", "xyz".replace(/./g, function () { return 1; }), "Section 70" ); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/String/15.5.4.14.js0000644000175000017500000000415711545150464021353 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Karsten Sperling * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 287630; var summary = '15.5.4.14 - String.prototype.split(/()/)'; var actual = ''; var expect = ['a'].toString(); printBugNumber(BUGNUMBER); printStatus (summary); actual = 'a'.split(/()/).toString(); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/String/browser.js0000644000175000017500000000000011545150464022040 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/String/jstests.list0000644000175000017500000000037511545150464022432 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_3/String/ fails script 15.5.4.11.js script 15.5.4.14.js script regress-104375.js script regress-189898.js script regress-304376.js script regress-313567.js fails script regress-392378.js script regress-83293.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/String/regress-104375.js0000644000175000017500000000652311545150464022610 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * k.mike@gmx.net, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 12 October 2001 * * SUMMARY: Regression test for string.replace bug 104375 * See http://bugzilla.mozilla.org/show_bug.cgi?id=104375 */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 104375; var summary = 'Testing string.replace() with backreferences'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; /* * Use the regexp to replace 'uid=31' with 'uid=15' * * In the second parameter of string.replace() method, * "$1" refers to the first backreference: 'uid=' */ var str = 'uid=31'; var re = /(uid=)(\d+)/; // try the numeric literal 15 status = inSection(1); actual = str.replace (re, "$1" + 15); expect = 'uid=15'; addThis(); // try the string literal '15' status = inSection(2); actual = str.replace (re, "$1" + '15'); expect = 'uid=15'; addThis(); // try a letter before the '15' status = inSection(3); actual = str.replace (re, "$1" + 'A15'); expect = 'uid=A15'; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i=0; i 'aaZaa' expect = strJim.replace(new RegExp(strA), strB); // expect 'aa$aaZ' reportCompare(expect, actual, status); * * Note: 'Zabc' is the result we expect for 'abc'.replace('', 'Z'). * * The string '' is supposed to be equivalent to new RegExp('') = //. * The regexp // means we should match the "empty string" conceived of * at the beginning boundary of the word, before the first character. * status = 'Section F of test'; strA = cnEmptyString; actual = str.replace(strA, strB); expect = 'Zabc'; reportCompare(expect, actual, status); status = 'Section G of test'; strA = cnEmptyString; actual = str.replace(strA, strB); expect = str.replace(new RegExp(strA), strB); reportCompare(expect, actual, status); ************************* END OF INCORRECT CASES ****************************/ ////////////////////////// OK, LET'S START OVER ////////////////////////////// status = 'Section 1 of test'; actual = 'abc'.replace('a', 'Z'); expect = 'Zbc'; reportCompare(expect, actual, status); status = 'Section 2 of test'; actual = 'abc'.replace('b', 'Z'); expect = 'aZc'; reportCompare(expect, actual, status); status = 'Section 3 of test'; actual = 'abc'.replace(undefined, 'Z'); expect = 'abc'; // String(undefined) == 'undefined'; no replacement possible reportCompare(expect, actual, status); status = 'Section 4 of test'; actual = 'abc'.replace(null, 'Z'); expect = 'abc'; // String(null) == 'null'; no replacement possible reportCompare(expect, actual, status); status = 'Section 5 of test'; actual = 'abc'.replace(true, 'Z'); expect = 'abc'; // String(true) == 'true'; no replacement possible reportCompare(expect, actual, status); status = 'Section 6 of test'; actual = 'abc'.replace(false, 'Z'); expect = 'abc'; // String(false) == 'false'; no replacement possible reportCompare(expect, actual, status); status = 'Section 7 of test'; actual = 'aa$aa'.replace('$', 'Z'); expect = 'aaZaa'; // NOT 'aa$aaZ' as in ECMA Final Draft; see above reportCompare(expect, actual, status); status = 'Section 8 of test'; actual = 'abc'.replace('.*', 'Z'); expect = 'abc'; // not 'Z' as in EMCA Final Draft reportCompare(expect, actual, status); status = 'Section 9 of test'; actual = 'abc'.replace('', 'Z'); expect = 'Zabc'; // Still expect 'Zabc' for this reportCompare(expect, actual, status); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/String/shell.js0000644000175000017500000000000011545150464021464 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/browser.js0000644000175000017500000000000011545150464022160 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/jstests.list0000644000175000017500000000037711545150464022554 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_3/Unicode/ script regress-352044-01.js script regress-352044-02-n.js script uc-001-n.js skip script uc-001.js # obsolete test script uc-002-n.js script uc-002.js script uc-003.js script uc-004.js script uc-005.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/regress-352044-01.js0000644000175000017500000000471211545150464023142 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352044; var summary = 'issues with Unicode escape sequences in JavaScript source code'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'SyntaxError: illegal character'; try { var i = 1; eval('i \\u002b= 1'); print(i); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/regress-352044-02-n.js0000644000175000017500000000475611545150464023406 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Martin Honnen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352044; var summary = 'issues with Unicode escape sequences in JavaScript source code'; var actual = 'No Error'; var expect = 'SyntaxError'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); print('This test case is expected to throw an uncaught SyntaxError'); try { var i = 1; i \u002b= 1; print(i); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/shell.js0000644000175000017500000000000011545150464021604 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/uc-001-n.js0000644000175000017500000000453311545150464021654 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Ginda rginda@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ test(); function test() { enterFunc ("test"); printStatus ("Unicode Characters 1C-1F negative test."); printBugNumber (23612); reportCompare ("error", eval ("'no'\u001C+' error'"), "Unicode whitespace test (1C.)"); reportCompare ("error", eval ("'no'\u001D+' error'"), "Unicode whitespace test (1D.)"); reportCompare ("error", eval ("'no'\u001E+' error'"), "Unicode whitespace test (1E.)"); reportCompare ("error", eval ("'no'\u001F+' error'"), "Unicode whitespace test (1F.)"); exitFunc ("test"); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/uc-001.js0000644000175000017500000000414711545150464021422 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Ginda rginda@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ test(); function test() { enterFunc ("test"); printStatus ("Unicode format-control character (Category Cf) test."); printBugNumber (23610); reportCompare ("no error", eval('"no\u200E error"'), "Unicode format-control character test (Category Cf.)"); exitFunc ("test"); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/uc-002-n.js0000644000175000017500000000421411545150464021651 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Ginda rginda@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ DESCRIPTION = "Non-character escapes in identifiers negative test."; EXPECTED = "error"; enterFunc ("test"); printStatus ("Non-character escapes in identifiers negative test."); printBugNumber (23607); eval("\u0020 = 5"); reportCompare('PASS', 'FAIL', "Previous statement should have thrown an error."); exitFunc ("test"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/uc-002.js0000644000175000017500000000432211545150464021416 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Ginda rginda@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ test(); function test() { enterFunc ("test"); printStatus ("Unicode non-breaking space character test."); printBugNumber (23613); reportCompare ("no error", eval("'no'\u00A0+ ' error'"), "Unicode non-breaking space character test."); var str = "\u00A0foo"; reportCompare (0, str.search(/^\sfoo$/), "Unicode non-breaking space character regexp test."); exitFunc ("test"); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/uc-003.js0000644000175000017500000000502411545150464021417 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Ginda rginda@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ test(); function test() { enterFunc ("test"); var \u0041 = 5; var A\u03B2 = 15; var c\u0061se = 25; printStatus ("Escapes in identifiers test."); printBugNumber (23608); printBugNumber (23607); reportCompare (5, eval("\u0041"), "Escaped ASCII Identifier test."); reportCompare (6, eval("++\u0041"), "Escaped ASCII Identifier test"); reportCompare (15, eval("A\u03B2"), "Escaped non-ASCII Identifier test"); reportCompare (16, eval("++A\u03B2"), "Escaped non-ASCII Identifier test"); reportCompare (25, eval("c\\u00" + "61se"), "Escaped keyword Identifier test"); reportCompare (26, eval("++c\\u00" + "61se"), "Escaped keyword Identifier test"); exitFunc ("test"); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/uc-004.js0000644000175000017500000000462311545150464021424 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Ginda rginda@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ test(); function test() { enterFunc ("test"); printStatus ("Unicode Characters 1C-1F with regexps test."); printBugNumber (23612); var ary = ["\u001Cfoo", "\u001Dfoo", "\u001Efoo", "\u001Ffoo"]; for (var i in ary) { reportCompare (0, ary[Number(i)].search(/^\Sfoo$/), "Unicode characters 1C-1F in regexps, ary[" + i + "] did not match \\S test (it should not.)"); reportCompare (-1, ary[Number(i)].search(/^\sfoo$/), "Unicode characters 1C-1F in regexps, ary[" + i + "] matched \\s test (it should not.)"); } exitFunc ("test"); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_3/Unicode/uc-005.js0000644000175000017500000001711311545150464021423 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * rogerl@netscape.com, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 15 July 2002 * SUMMARY: Testing identifiers with double-byte names * See http://bugzilla.mozilla.org/show_bug.cgi?id=58274 * * Here is a sample of the problem: * * js> function f\u02B1 () {} * * js> f\u02B1.toSource(); * function f¦() {} * * js> f\u02B1.toSource().toSource(); * (new String("function f\xB1() {}")) * * * See how the high-byte information (the 02) has been lost? * The same thing was happening with the toString() method: * * js> f\u02B1.toString(); * * function f¦() { * } * * js> f\u02B1.toString().toSource(); * (new String("\nfunction f\xB1() {\n}\n")) * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 58274; var summary = 'Testing identifiers with double-byte names'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; /* * Define a function that uses double-byte identifiers in * "every possible way" * * Then recover each double-byte identifier via f.toString(). * To make this easier, put a 'Z' token before every one. * * Our eval string will be: * * sEval = "function Z\u02b1(Z\u02b2, b) { * try { Z\u02b3 : var Z\u02b4 = Z\u02b1; } * catch (Z\u02b5) { for (var Z\u02b6 in Z\u02b5) * {for (1; 1<0; Z\u02b7++) {new Array()[Z\u02b6] = 1;} };} }"; * * It will be helpful to build this string in stages: */ var s0 = 'function Z'; var s1 = '\u02b1(Z'; var s2 = '\u02b2, b) {try { Z'; var s3 = '\u02b3 : var Z'; var s4 = '\u02b4 = Z'; var s5 = '\u02b1; } catch (Z' var s6 = '\u02b5) { for (var Z'; var s7 = '\u02b6 in Z'; var s8 = '\u02b5){for (1; 1<0; Z'; var s9 = '\u02b7++) {new Array()[Z'; var s10 = '\u02b6] = 1;} };} }'; /* * Concatenate these and eval() to create the function Z\u02b1 */ var sEval = s0 + s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10; eval(sEval); /* * Recover all the double-byte identifiers via Z\u02b1.toString(). * We'll recover the 1st one as arrID[1], the 2nd one as arrID[2], * and so on ... */ var arrID = getIdentifiers(Z\u02b1); /* * Now check that we got back what we put in - */ status = inSection(1); actual = arrID[1]; expect = s1.charAt(0); addThis(); status = inSection(2); actual = arrID[2]; expect = s2.charAt(0); addThis(); status = inSection(3); actual = arrID[3]; expect = s3.charAt(0); addThis(); status = inSection(4); actual = arrID[4]; expect = s4.charAt(0); addThis(); status = inSection(5); actual = arrID[5]; expect = s5.charAt(0); addThis(); status = inSection(6); actual = arrID[6]; expect = s6.charAt(0); addThis(); status = inSection(7); actual = arrID[7]; expect = s7.charAt(0); addThis(); status = inSection(8); actual = arrID[8]; expect = s8.charAt(0); addThis(); status = inSection(9); actual = arrID[9]; expect = s9.charAt(0); addThis(); status = inSection(10); actual = arrID[10]; expect = s10.charAt(0); addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- /* * Goal: recover the double-byte identifiers from f.toString() * by getting the very next character after each 'Z' token. * * The return value will be an array |arr| indexed such that * |arr[1]| is the 1st identifier, |arr[2]| the 2nd, and so on. * * Note, however, f.toString() is implementation-independent. * For example, it may begin with '\nfunction' instead of 'function'. * * Rhino uses a Unicode representation for f.toString(); whereas * SpiderMonkey uses an ASCII representation, putting escape sequences * for non-ASCII characters. For example, if a function is called f\u02B1, * then in Rhino the toString() method will present a 2-character Unicode * string for its name, whereas SpiderMonkey will present a 7-character * ASCII string for its name: the string literal 'f\u02B1'. * * So we force the lexer to condense the string before we use it. * This will give uniform results in Rhino and SpiderMonkey. */ function getIdentifiers(f) { var str = condenseStr(f.toString()); var arr = str.split('Z'); /* * The identifiers are the 1st char of each split substring * EXCEPT the first one, which is just ('\n' +) 'function '. * * Thus note the 1st identifier will be stored in |arr[1]|, * the 2nd one in |arr[2]|, etc., making the indexing easy - */ for (i in arr) arr[i] = arr[i].charAt(0); return arr; } /* * This function is the opposite of a functions like escape(), which take * Unicode characters and return escape sequences for them. Here, we force * the lexer to turn escape sequences back into single characters. * * Note we can't simply do |eval(str)|, since in practice |str| will be an * identifier somewhere in the program (e.g. a function name); thus |eval(str)| * would return the object that the identifier represents: not what we want. * * So we surround |str| lexicographically with quotes to force the lexer to * evaluate it as a string. Have to strip out any linefeeds first, however - */ function condenseStr(str) { /* * You won't be able to do the next step if |str| has * any carriage returns or linefeeds in it. For example: * * js> eval("'" + '\nHello' + "'"); * 1: SyntaxError: unterminated string literal: * 1: ' * 1: ^ * * So replace them with the empty string - */ str = str.replace(/[\r\n]/g, '') return eval("'" + str + "'") } function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i */ //----------------------------------------------------------------------------- var BUGNUMBER = 600392; var summary = 'Object.preventExtensions([]).length = 0 should do nothing, not throw'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ function testEmpty() { var a = []; assertEq(a.length, 0); assertEq(Object.preventExtensions(a), a); assertEq(a.length, 0); a.length = 0; assertEq(a.length, 0); } testEmpty(); function testEmptyStrict() { "use strict"; var a = []; assertEq(a.length, 0); assertEq(Object.preventExtensions(a), a); assertEq(a.length, 0); a.length = 0; assertEq(a.length, 0); } testEmptyStrict(); function testNonEmpty() { var a = [1, 2, 3]; assertEq(a.length, 3); assertEq(Object.preventExtensions(a), a); assertEq(a.length, 3); a.length = 0; assertEq(a.length, 0); } testNonEmpty(); function testNonEmptyStrict() { "use strict"; var a = [1, 2, 3]; assertEq(a.length, 3); assertEq(Object.preventExtensions(a), a); assertEq(a.length, 3); a.length = 0; assertEq(a.length, 0); } testNonEmptyStrict(); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Array/regress-599159.js0000644000175000017500000000033311545150464022435 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var b = Object.create(Array.prototype); b.length = 12; assertEq(b.length, 12); reportCompare(true,true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Array/shell.js0000644000175000017500000000000011545150464021276 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Array/sort-01.js0000644000175000017500000000116011545150464021404 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 604971; var summary = 'array.sort compare-function gets incorrect this'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ [1, 2, 3].sort(function() { "use strict"; assertEq(this, undefined); }); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Array/toLocaleString-01.js0000644000175000017500000000136711545150464023357 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ //----------------------------------------------------------------------------- var BUGNUMBER = 562446; var summary = 'ES5: Array.prototype.toLocaleString'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var o; o = { length: 2, 0: 7, 1: { toLocaleString: function() { return "baz" } } }; assertEq(Array.prototype.toLocaleString.call(o), "7,baz"); o = {}; assertEq(Array.prototype.toLocaleString.call(o), ""); /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Array/toString-01.js0000644000175000017500000000260711545150464022235 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ //----------------------------------------------------------------------------- var BUGNUMBER = 562446; var summary = 'ES5: Array.prototype.toString'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var o; o = { join: function() { assertEq(arguments.length, 0); return "ohai"; } }; assertEq(Array.prototype.toString.call(o), "ohai"); o = {}; assertEq(Array.prototype.toString.call(o), "[object Object]"); Array.prototype.join = function() { return "kthxbai"; }; assertEq(Array.prototype.toString.call([]), "kthxbai"); o = { join: 17 }; assertEq(Array.prototype.toString.call(o), "[object Object]"); o = { get join() { throw 42; } }; try { var str = Array.prototype.toString.call(o); assertEq(true, false, "expected an exception calling [].toString on an object with a " + "join getter that throws, got " + str + " instead"); } catch (e) { assertEq(e, 42, "expected thrown e === 42 when calling [].toString on an object " + "with a join getter that throws, got " + e); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Array/unshift-01.js0000644000175000017500000000174211545150464022103 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 614070; var summary = 'Array.prototype.unshift without args'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var a = {}; a.length = 4294967296; assertEq([].unshift.call(a), 0); assertEq(a.length, 0); function testGetSet(len, expected) { var newlen; var a = { get length() { return len; }, set length(v) { newlen = v; } }; var res = [].unshift.call(a); assertEq(res, expected); assertEq(newlen, expected); } testGetSet(0, 0); testGetSet(10, 10); testGetSet("1", 1); testGetSet(null, 0); testGetSet(4294967297, 1); testGetSet(-5, 4294967291); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Boolean/15.6.4.2.js0000644000175000017500000000161311545150464021376 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(raisesException(TypeError)('Boolean.prototype.toString.call(42)'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toString.call("")'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toString.call({})'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toString.call(null)'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toString.call([])'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toString.call(undefined)'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toString.call(new String())'), true); assertEq(completesNormally('Boolean.prototype.toString.call(true)'), true); assertEq(completesNormally('Boolean.prototype.toString.call(new Boolean(true))'), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Boolean/browser.js0000644000175000017500000000000011545150464022153 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Boolean/jstests.list0000644000175000017500000000011011545150464022530 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/Boolean/ script 15.6.4.2.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Boolean/shell.js0000644000175000017500000000000011545150464021577 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Date/15.9.4.2.js0000644000175000017500000001430011545150464020674 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Bruce Hoult * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 430930; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function iso(d){ return new Date(d).toISOString(); } function check(s, millis){ description = "Date.parse('"+s+"') == '"+iso(millis)+"'"; expected = millis; actual = Date.parse(s); reportCompare(expected, actual, description); } function dd(year, month, day, hour, minute, second, millis){ return Date.UTC(year, month-1, day, hour, minute, second, millis); } function TZAtDate(d){ return d.getTimezoneOffset() * 60000; } function TZInMonth(month){ return TZAtDate(new Date(dd(2009,month,1,0,0,0,0))); } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); JanTZ = TZInMonth(1); JulTZ = TZInMonth(7); CurrTZ = TZAtDate(new Date()); // formats with explicit timezone check("2009-07-23T19:53:21.001+12:00", dd(2009,7,23,7,53,21,1)); check("2009-07-23T19:53:21+12:00", dd(2009,7,23,7,53,21,0)); check("2009-07-23T19:53+12:00", dd(2009,7,23,7,53,0,0)); check("2009-07T19:53:21.001+12:00", dd(2009,7,1,7,53,21,1)); check("2009-07T19:53:21+12:00", dd(2009,7,1,7,53,21,0)); check("2009-07T19:53+12:00", dd(2009,7,1,7,53,0,0)); check("2009T19:53:21.001+12:00", dd(2009,1,1,7,53,21,1)); check("2009T19:53:21+12:00", dd(2009,1,1,7,53,21,0)); check("2009T19:53+12:00", dd(2009,1,1,7,53,0,0)); check("T19:53:21.001+12:00", dd(1970,1,1,7,53,21,1)); check("T19:53:21+12:00", dd(1970,1,1,7,53,21,0)); check("T19:53+12:00", dd(1970,1,1,7,53,0,0)); // formats without timezone uses the timezone as at that date check("2009-07-23T19:53:21.001", dd(2009,7,23,19,53,21,1)+JulTZ); check("2009-07-23T19:53:21", dd(2009,7,23,19,53,21,0)+JulTZ); check("2009-07-23T19:53", dd(2009,7,23,19,53,0,0)+JulTZ); check("2009-07T19:53:21.001", dd(2009,7,1,19,53,21,1)+JulTZ); check("2009-07T19:53:21", dd(2009,7,1,19,53,21,0)+JulTZ); check("2009-07T19:53", dd(2009,7,1,19,53,0,0)+JulTZ); check("2009T19:53:21.001", dd(2009,1,1,19,53,21,1)+JanTZ); check("2009T19:53:21", dd(2009,1,1,19,53,21,0)+JanTZ); check("2009T19:53", dd(2009,1,1,19,53,0,0)+JanTZ); check("T19:53:21.001", dd(1970,1,1,19,53,21,1)+JanTZ); check("T19:53:21", dd(1970,1,1,19,53,21,0)+JanTZ); check("T19:53", dd(1970,1,1,19,53,0,0)+JanTZ); // with no time at all assume UTC check("2009-07-23", dd(2009,7,23,0,0,0,0)); check("2009-07", dd(2009,7,1,0,0,0,0)); check("2009", dd(2009,1,1,0,0,0,0)); check("", NaN); // one field too big check("2009-13-23T19:53:21.001+12:00", NaN); check("2009-07-32T19:53:21.001+12:00", NaN); check("2009-07-23T25:53:21.001+12:00", NaN); check("2009-07-23T19:60:21.001+12:00", NaN); check("2009-07-23T19:53:60.001+12:00", NaN); check("2009-07-23T19:53:21.001+24:00", NaN); check("2009-07-23T19:53:21.001+12:60", NaN); // other month ends check("2009-06-30T19:53:21.001+12:00", dd(2009,6,30,7,53,21,1)); check("2009-06-31T19:53:21.001+12:00", NaN); check("2009-02-28T19:53:21.001+12:00", dd(2009,2,28,7,53,21,1)); check("2009-02-29T19:53:21.001+12:00", NaN); check("2008-02-29T19:53:21.001+12:00", dd(2008,2,29,7,53,21,1)); check("2008-02-30T19:53:21.001+12:00", NaN); // limits of representation check("-271821-04-19T23:59:59.999Z", NaN); check("-271821-04-20", -8.64e15); check("+275760-09-13", 8.64e15); check("+275760-09-13T00:00:00.001Z", NaN); check("-269845-07-23T19:53:21.001+12:00", dd(-269845,7,23,7,53,21,1)); check("+273785-07-23T19:53:21.001+12:00", dd(273785,7,23,7,53,21,1)); // explicit UTC check("2009-07-23T19:53:21.001Z", dd(2009,7,23,19,53,21,1)); check("+002009-07-23T19:53:21.001Z", dd(2009,7,23,19,53,21,1)); // different timezones check("2009-07-23T19:53:21.001+12:00", dd(2009,7,23,7,53,21,1)); check("2009-07-23T00:53:21.001-07:00", dd(2009,7,23,7,53,21,1)); // 00:00 and 24:00 check("2009-07-23T00:00:00.000-07:00", dd(2009,7,23,7,0,0,0)); check("2009-07-23T24:00:00.000-07:00", dd(2009,7,24,7,0,0,0)); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Date/browser.js0000644000175000017500000000000011545150464021451 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Date/jstests.list0000644000175000017500000000013111545150464022031 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/Date/ script 15.9.4.2.js script toJSON-01.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Date/shell.js0000644000175000017500000000000011545150464021075 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Date/toJSON-01.js0000644000175000017500000001506411545150464021340 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var gTestfile = 'toJSON-01.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 584811; var summary = "Date.prototype.toJSON isn't to spec"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var called; var dateToJSON = Date.prototype.toJSON; assertEq(Date.prototype.hasOwnProperty("toJSON"), true); assertEq(typeof dateToJSON, "function"); // brief test to exercise this outside of isolation, just for sanity var invalidDate = new Date(); invalidDate.setTime(NaN); assertEq(JSON.stringify({ p: invalidDate }), '{"p":null}'); /* 15.9.5.44 Date.prototype.toJSON ( key ) */ assertEq(dateToJSON.length, 1); /* * 1. Let O be the result of calling ToObject, giving it the this value as its * argument. */ try { dateToJSON.call(null); throw new Error("should have thrown a TypeError"); } catch (e) { assertEq(e instanceof TypeError, true, "ToObject throws TypeError for null/undefined"); } try { dateToJSON.call(undefined); throw new Error("should have thrown a TypeError"); } catch (e) { assertEq(e instanceof TypeError, true, "ToObject throws TypeError for null/undefined"); } /* * 2. Let tv be ToPrimitive(O, hint Number). * ...expands to: * 1. Let valueOf be the result of calling the [[Get]] internal method of object O with argument "valueOf". * 2. If IsCallable(valueOf) is true then, * a. Let val be the result of calling the [[Call]] internal method of valueOf, with O as the this value and * an empty argument list. * b. If val is a primitive value, return val. * 3. Let toString be the result of calling the [[Get]] internal method of object O with argument "toString". * 4. If IsCallable(toString) is true then, * a. Let str be the result of calling the [[Call]] internal method of toString, with O as the this value and * an empty argument list. * b. If str is a primitive value, return str. * 5. Throw a TypeError exception. */ try { var r = dateToJSON.call({ get valueOf() { throw 17; } }); throw new Error("didn't throw, returned: " + r); } catch (e) { assertEq(e, 17, "bad exception: " + e); } called = false; assertEq(dateToJSON.call({ valueOf: null, toString: function() { called = true; return 12; }, toISOString: function() { return "ohai"; } }), "ohai"); assertEq(called, true); called = false; assertEq(dateToJSON.call({ valueOf: function() { called = true; return 42; }, toISOString: function() { return null; } }), null); assertEq(called, true); try { called = false; dateToJSON.call({ valueOf: function() { called = true; return {}; }, get toString() { throw 42; } }); } catch (e) { assertEq(called, true); assertEq(e, 42, "bad exception: " + e); } called = false; assertEq(dateToJSON.call({ valueOf: function() { called = true; return {}; }, get toString() { return function() { return 8675309; }; }, toISOString: function() { return true; } }), true); assertEq(called, true); var asserted = false; called = false; assertEq(dateToJSON.call({ valueOf: function() { called = true; return {}; }, get toString() { assertEq(called, true); asserted = true; return function() { return 8675309; }; }, toISOString: function() { return NaN; } }), NaN); assertEq(asserted, true); try { var r = dateToJSON.call({ valueOf: null, toString: null, get toISOString() { throw new Error("shouldn't have been gotten"); } }); throw new Error("didn't throw, returned: " + r); } catch (e) { assertEq(e instanceof TypeError, true, "bad exception: " + e); } /* 3. If tv is a Number and is not finite, return null. */ assertEq(dateToJSON.call({ valueOf: function() { return Infinity; } }), null); assertEq(dateToJSON.call({ valueOf: function() { return -Infinity; } }), null); assertEq(dateToJSON.call({ valueOf: function() { return NaN; } }), null); assertEq(dateToJSON.call({ valueOf: function() { return Infinity; }, toISOString: function() { return {}; } }), null); assertEq(dateToJSON.call({ valueOf: function() { return -Infinity; }, toISOString: function() { return []; } }), null); assertEq(dateToJSON.call({ valueOf: function() { return NaN; }, toISOString: function() { return undefined; } }), null); /* * 4. Let toISO be the result of calling the [[Get]] internal method of O with * argument "toISOString". */ try { var r = dateToJSON.call({ get toISOString() { throw 42; } }); throw new Error("didn't throw, returned: " + r); } catch (e) { assertEq(e, 42, "bad exception: " + e); } /* 5. If IsCallable(toISO) is false, throw a TypeError exception. */ try { var r = dateToJSON.call({ toISOString: null }); throw new Error("didn't throw, returned: " + r); } catch (e) { assertEq(e instanceof TypeError, true, "bad exception: " + e); } try { var r = dateToJSON.call({ toISOString: undefined }); throw new Error("didn't throw, returned: " + r); } catch (e) { assertEq(e instanceof TypeError, true, "bad exception: " + e); } try { var r = dateToJSON.call({ toISOString: "oogabooga" }); throw new Error("didn't throw, returned: " + r); } catch (e) { assertEq(e instanceof TypeError, true, "bad exception: " + e); } try { var r = dateToJSON.call({ toISOString: Math.PI }); throw new Error("didn't throw, returned: " + r); } catch (e) { assertEq(e instanceof TypeError, true, "bad exception: " + e); } /* * 6. Return the result of calling the [[Call]] internal method of toISO with O * as the this value and an empty argument list. */ var o = { toISOString: function(a) { called = true; assertEq(this, o); assertEq(a, undefined); assertEq(arguments.length, 0); return obj; } }; var obj = {}; called = false; assertEq(dateToJSON.call(o), obj, "should have gotten obj back"); assertEq(called, true); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/browser.js0000644000175000017500000000000111545150464021524 0ustar chr1schr1s mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-fun-normalcaller-direct-normalcode.js0000644000175000017500000001065111545150464031072 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; function globalX() { return x; } var y = 42; function globalY() { return y; } var ev = eval; function testX() { var x = 2; var xcode = "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var global0 = globalX(); var f = eval(xcode); var inner1 = f("get"); var local1 = x; var global1 = globalX(); x = 7; var inner2 = f("get"); var local2 = x; var global2 = globalX(); f("set1"); var inner3 = f("get"); var local3 = x; var global3 = globalX(); var del = f("delete"); var inner4 = f("get"); var local4 = x; var global4 = globalX(); f("set2"); var inner5 = f("get"); var local5 = x; var global5 = globalX(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsX = testX(); assertEq(resultsX.local0, 2); assertEq(resultsX.global0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 4); assertEq(resultsX.global1, 17); assertEq(resultsX.inner2, 7); assertEq(resultsX.local2, 7); assertEq(resultsX.global2, 17); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 9); assertEq(resultsX.global3, 17); assertEq(resultsX.del, false); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 9); assertEq(resultsX.global4, 17); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 23); assertEq(resultsX.global5, 17); function testY() { var ycode = "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; var local0 = y; var global0 = globalY(); var f = eval(ycode); var inner1 = f("get"); var local1 = y; var global1 = globalY(); y = 8; var inner2 = f("get"); var local2 = y; var global2 = globalY(); f("set1"); var inner3 = f("get"); var local3 = y; var global3 = globalY(); var del = f("delete"); var inner4 = f("get"); var local4 = y; var global4 = globalY(); f("set2"); var inner5 = f("get"); var local5 = y; var global5 = globalY(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsY = testY(); assertEq(resultsY.local0, 42); assertEq(resultsY.global0, 42); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, 5); assertEq(resultsY.global1, 42); assertEq(resultsY.inner2, 8); assertEq(resultsY.local2, 8); assertEq(resultsY.global2, 42); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 2); assertEq(resultsY.global3, 42); assertEq(resultsY.del, true); assertEq(resultsY.inner4, 42); assertEq(resultsY.local4, 42); assertEq(resultsY.global4, 42); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 71); assertEq(resultsY.global5, 71); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-fun-normalcaller-direct-strictcode.js0000644000175000017500000001073711545150464031117 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; function globalX() { return x; } var y = 42; function globalY() { return y; } var ev = eval; function testX() { var x = 2; var xcode = "'use strict';" + "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var global0 = globalX(); var f = eval(xcode); var inner1 = f("get"); var local1 = x; var global1 = globalX(); x = 7; var inner2 = f("get"); var local2 = x; var global2 = globalX(); f("set1"); var inner3 = f("get"); var local3 = x; var global3 = globalX(); var del = f("delete"); var inner4 = f("get"); var local4 = x; var global4 = globalX(); f("set2"); var inner5 = f("get"); var local5 = x; var global5 = globalX(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsX = testX(); assertEq(resultsX.local0, 2); assertEq(resultsX.global0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 2); assertEq(resultsX.global1, 17); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.global2, 17); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.global3, 17); assertEq(resultsX.del, "SyntaxError"); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.global4, 17); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); assertEq(resultsX.global5, 17); function testY() { var ycode = "'use strict';" + "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; var local0 = y; var global0 = globalY(); var f = eval(ycode); var inner1 = f("get"); var local1 = y; var global1 = globalY(); y = 8; var inner2 = f("get"); var local2 = y; var global2 = globalY(); f("set1"); var inner3 = f("get"); var local3 = y; var global3 = globalY(); var del = f("delete"); var inner4 = f("get"); var local4 = y; var global4 = globalY(); f("set2"); var inner5 = f("get"); var local5 = y; var global5 = globalY(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsY = testY(); assertEq(resultsY.local0, 42); assertEq(resultsY.global0, 42); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, 42); assertEq(resultsY.global1, 42); assertEq(resultsY.inner2, 5); assertEq(resultsY.local2, 8); assertEq(resultsY.global2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 8); assertEq(resultsY.global3, 8); assertEq(resultsY.del, "SyntaxError"); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, 8); assertEq(resultsY.global4, 8); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 8); assertEq(resultsY.global5, 8); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-fun-normalcaller-indirect-normalcode.js0000644000175000017500000001063311545150464031421 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; function globalX() { return x; } var y = 42; function globalY() { return y; } var ev = eval; function testX() { var x = 2; var xcode = "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var global0 = globalX(); var f = ev(xcode); var inner1 = f("get"); var local1 = x; var global1 = globalX(); x = 7; var inner2 = f("get"); var local2 = x; var global2 = globalX(); f("set1"); var inner3 = f("get"); var local3 = x; var global3 = globalX(); var del = f("delete"); var inner4 = f("get"); var local4 = x; var global4 = globalX(); f("set2"); var inner5 = f("get"); var local5 = x; var global5 = globalX(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsX = testX(); assertEq(resultsX.local0, 2); assertEq(resultsX.global0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 2); assertEq(resultsX.global1, 4); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.global2, 4); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.global3, 9); assertEq(resultsX.del, false); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.global4, 9); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); assertEq(resultsX.global5, 23); function testY() { var ycode = "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; var local0 = y; var global0 = globalY(); var f = ev(ycode); var inner1 = f("get"); var local1 = y; var global1 = globalY(); y = 8; var inner2 = f("get"); var local2 = y; var global2 = globalY(); f("set1"); var inner3 = f("get"); var local3 = y; var global3 = globalY(); var del = f("delete"); var inner4 = f("get"); var local4 = y; var global4 = globalY(); f("set2"); var inner5 = f("get"); var local5 = y; var global5 = globalY(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsY = testY(); assertEq(resultsY.local0, 42); assertEq(resultsY.global0, 42); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, 5); assertEq(resultsY.global1, 5); assertEq(resultsY.inner2, 8); assertEq(resultsY.local2, 8); assertEq(resultsY.global2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 2); assertEq(resultsY.global3, 2); assertEq(resultsY.del, false); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, 2); assertEq(resultsY.global4, 2); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 71); assertEq(resultsY.global5, 71); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-fun-normalcaller-indirect-strictcode.js0000644000175000017500000001073311545150464031442 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; function globalX() { return x; } var y = 42; function globalY() { return y; } var ev = eval; function testX() { var x = 2; var xcode = "'use strict';" + "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var global0 = globalX(); var f = ev(xcode); var inner1 = f("get"); var local1 = x; var global1 = globalX(); x = 7; var inner2 = f("get"); var local2 = x; var global2 = globalX(); f("set1"); var inner3 = f("get"); var local3 = x; var global3 = globalX(); var del = f("delete"); var inner4 = f("get"); var local4 = x; var global4 = globalX(); f("set2"); var inner5 = f("get"); var local5 = x; var global5 = globalX(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsX = testX(); assertEq(resultsX.local0, 2); assertEq(resultsX.global0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 2); assertEq(resultsX.global1, 17); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.global2, 17); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.global3, 17); assertEq(resultsX.del, "SyntaxError"); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.global4, 17); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); assertEq(resultsX.global5, 17); function testY() { var ycode = "'use strict';" + "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; var local0 = y; var global0 = globalY(); var f = ev(ycode); var inner1 = f("get"); var local1 = y; var global1 = globalY(); y = 8; var inner2 = f("get"); var local2 = y; var global2 = globalY(); f("set1"); var inner3 = f("get"); var local3 = y; var global3 = globalY(); var del = f("delete"); var inner4 = f("get"); var local4 = y; var global4 = globalY(); f("set2"); var inner5 = f("get"); var local5 = y; var global5 = globalY(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsY = testY(); assertEq(resultsY.local0, 42); assertEq(resultsY.global0, 42); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, 42); assertEq(resultsY.global1, 42); assertEq(resultsY.inner2, 5); assertEq(resultsY.local2, 8); assertEq(resultsY.global2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 8); assertEq(resultsY.global3, 8); assertEq(resultsY.del, "SyntaxError"); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, 8); assertEq(resultsY.global4, 8); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 8); assertEq(resultsY.global5, 8); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-fun-strictcaller-direct-normalcode.js0000644000175000017500000001072511545150464031114 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; function globalX() { return x; } var y = 42; function globalY() { return y; } var ev = eval; function testX() { "use strict"; var x = 2; var xcode = "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var global0 = globalX(); var f = eval(xcode); var inner1 = f("get"); var local1 = x; var global1 = globalX(); x = 7; var inner2 = f("get"); var local2 = x; var global2 = globalX(); f("set1"); var inner3 = f("get"); var local3 = x; var global3 = globalX(); var del = f("delete"); var inner4 = f("get"); var local4 = x; var global4 = globalX(); f("set2"); var inner5 = f("get"); var local5 = x; var global5 = globalX(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsX = testX(); assertEq(resultsX.local0, 2); assertEq(resultsX.global0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 2); assertEq(resultsX.global1, 17); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.global2, 17); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.global3, 17); assertEq(resultsX.del, "SyntaxError"); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.global4, 17); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); assertEq(resultsX.global5, 17); function testY() { "use strict"; var ycode = "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; var local0 = y; var global0 = globalY(); var f = eval(ycode); var inner1 = f("get"); var local1 = y; var global1 = globalY(); y = 8; var inner2 = f("get"); var local2 = y; var global2 = globalY(); f("set1"); var inner3 = f("get"); var local3 = y; var global3 = globalY(); var del = f("delete"); var inner4 = f("get"); var local4 = y; var global4 = globalY(); f("set2"); var inner5 = f("get"); var local5 = y; var global5 = globalY(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsY = testY(); assertEq(resultsY.local0, 42); assertEq(resultsY.global0, 42); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, 42); assertEq(resultsY.global1, 42); assertEq(resultsY.inner2, 5); assertEq(resultsY.local2, 8); assertEq(resultsY.global2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 8); assertEq(resultsY.global3, 8); assertEq(resultsY.del, "SyntaxError"); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, 8); assertEq(resultsY.global4, 8); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 8); assertEq(resultsY.global5, 8); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-fun-strictcaller-direct-strictcode.js0000644000175000017500000001100111545150464031120 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; function globalX() { return x; } var y = 42; function globalY() { return y; } var ev = eval; function testX() { "use strict"; var x = 2; var xcode = "'use strict';" + "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var global0 = globalX(); var f = eval(xcode); var inner1 = f("get"); var local1 = x; var global1 = globalX(); x = 7; var inner2 = f("get"); var local2 = x; var global2 = globalX(); f("set1"); var inner3 = f("get"); var local3 = x; var global3 = globalX(); var del = f("delete"); var inner4 = f("get"); var local4 = x; var global4 = globalX(); f("set2"); var inner5 = f("get"); var local5 = x; var global5 = globalX(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsX = testX(); assertEq(resultsX.local0, 2); assertEq(resultsX.global0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 2); assertEq(resultsX.global1, 17); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.global2, 17); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.global3, 17); assertEq(resultsX.del, "SyntaxError"); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.global4, 17); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); assertEq(resultsX.global5, 17); function testY() { "use strict"; var ycode = "'use strict';" + "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; var local0 = y; var global0 = globalY(); var f = eval(ycode); var inner1 = f("get"); var local1 = y; var global1 = globalY(); y = 8; var inner2 = f("get"); var local2 = y; var global2 = globalY(); f("set1"); var inner3 = f("get"); var local3 = y; var global3 = globalY(); var del = f("delete"); var inner4 = f("get"); var local4 = y; var global4 = globalY(); f("set2"); var inner5 = f("get"); var local5 = y; var global5 = globalY(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsY = testY(); assertEq(resultsY.local0, 42); assertEq(resultsY.global0, 42); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, 42); assertEq(resultsY.global1, 42); assertEq(resultsY.inner2, 5); assertEq(resultsY.local2, 8); assertEq(resultsY.global2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 8); assertEq(resultsY.global3, 8); assertEq(resultsY.del, "SyntaxError"); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, 8); assertEq(resultsY.global4, 8); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 8); assertEq(resultsY.global5, 8); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-fun-strictcaller-indirect-normalcode.js0000644000175000017500000001067511545150464031447 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; function globalX() { return x; } var y = 42; function globalY() { return y; } var ev = eval; function testX() { "use strict"; var x = 2; var xcode = "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var global0 = globalX(); var f = ev(xcode); var inner1 = f("get"); var local1 = x; var global1 = globalX(); x = 7; var inner2 = f("get"); var local2 = x; var global2 = globalX(); f("set1"); var inner3 = f("get"); var local3 = x; var global3 = globalX(); var del = f("delete"); var inner4 = f("get"); var local4 = x; var global4 = globalX(); f("set2"); var inner5 = f("get"); var local5 = x; var global5 = globalX(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsX = testX(); assertEq(resultsX.local0, 2); assertEq(resultsX.global0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 2); assertEq(resultsX.global1, 4); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.global2, 4); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.global3, 9); assertEq(resultsX.del, false); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.global4, 9); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); assertEq(resultsX.global5, 23); function testY() { "use strict"; var ycode = "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; var local0 = y; var global0 = globalY(); var f = ev(ycode); var inner1 = f("get"); var local1 = y; var global1 = globalY(); y = 8; var inner2 = f("get"); var local2 = y; var global2 = globalY(); f("set1"); var inner3 = f("get"); var local3 = y; var global3 = globalY(); var del = f("delete"); var inner4 = f("get"); var local4 = y; var global4 = globalY(); f("set2"); var inner5 = f("get"); var local5 = y; var global5 = globalY(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsY = testY(); assertEq(resultsY.local0, 42); assertEq(resultsY.global0, 42); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, 5); assertEq(resultsY.global1, 5); assertEq(resultsY.inner2, 8); assertEq(resultsY.local2, 8); assertEq(resultsY.global2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 2); assertEq(resultsY.global3, 2); assertEq(resultsY.del, false); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, 2); assertEq(resultsY.global4, 2); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 71); assertEq(resultsY.global5, 71); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-fun-strictcaller-indirect-strictcode.js0000644000175000017500000001077511545150464031470 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; function globalX() { return x; } var y = 42; function globalY() { return y; } var ev = eval; function testX() { "use strict"; var x = 2; var xcode = "'use strict';" + "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var global0 = globalX(); var f = ev(xcode); var inner1 = f("get"); var local1 = x; var global1 = globalX(); x = 7; var inner2 = f("get"); var local2 = x; var global2 = globalX(); f("set1"); var inner3 = f("get"); var local3 = x; var global3 = globalX(); var del = f("delete"); var inner4 = f("get"); var local4 = x; var global4 = globalX(); f("set2"); var inner5 = f("get"); var local5 = x; var global5 = globalX(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsX = testX(); assertEq(resultsX.local0, 2); assertEq(resultsX.global0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 2); assertEq(resultsX.global1, 17); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.global2, 17); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.global3, 17); assertEq(resultsX.del, "SyntaxError"); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.global4, 17); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); assertEq(resultsX.global5, 17); function testY() { "use strict"; var ycode = "'use strict';" + "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; var local0 = y; var global0 = globalY(); var f = ev(ycode); var inner1 = f("get"); var local1 = y; var global1 = globalY(); y = 8; var inner2 = f("get"); var local2 = y; var global2 = globalY(); f("set1"); var inner3 = f("get"); var local3 = y; var global3 = globalY(); var del = f("delete"); var inner4 = f("get"); var local4 = y; var global4 = globalY(); f("set2"); var inner5 = f("get"); var local5 = y; var global5 = globalY(); return { local0: local0, global0: global0, inner1: inner1, local1: local1, global1: global1, inner2: inner2, local2: local2, global2: global2, inner3: inner3, local3: local3, global3: global3, del: del, inner4: inner4, local4: local4, global4: global4, inner5: inner5, local5: local5, global5: global5, }; } var resultsY = testY(); assertEq(resultsY.local0, 42); assertEq(resultsY.global0, 42); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, 42); assertEq(resultsY.global1, 42); assertEq(resultsY.inner2, 5); assertEq(resultsY.local2, 8); assertEq(resultsY.global2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 8); assertEq(resultsY.global3, 8); assertEq(resultsY.del, "SyntaxError"); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, 8); assertEq(resultsY.global4, 8); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 8); assertEq(resultsY.global5, 8); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-normalcaller-direct-normalcode.js0000644000175000017500000000653411545150464031547 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; var ev = eval; var xcode = "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var f = eval(xcode); var inner1 = f("get"); var local1 = x; x = 7; var inner2 = f("get"); var local2 = x; f("set1"); var inner3 = f("get"); var local3 = x; var del = f("delete"); var inner4 = f("get"); var local4 = x; f("set2"); var inner5 = f("get"); var local5 = x; var resultsX = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsX.local0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 4); assertEq(resultsX.inner2, 7); assertEq(resultsX.local2, 7); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 9); assertEq(resultsX.del, false); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 9); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 23); var ycode = "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; try { var local0 = y; } catch (e) { local0 = e.name; } var f = eval(ycode); var inner1 = f("get"); var local1 = y; y = 8; var inner2 = f("get"); var local2 = y; f("set1"); var inner3 = f("get"); var local3 = y; var del = f("delete"); try { var inner4 = f("get"); } catch (e) { inner4 = e.name; } try { var local4 = y; } catch (e) { local4 = e.name; } f("set2"); try { var inner5 = f("get"); } catch (e) { inner5 = e.name; } try { var local5 = y; } catch (e) { local5 = e.name; } var resultsY = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsY.local0, "ReferenceError"); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, 5); assertEq(resultsY.inner2, 8); assertEq(resultsY.local2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 2); assertEq(resultsY.del, true); assertEq(resultsY.inner4, "ReferenceError"); assertEq(resultsY.local4, "ReferenceError"); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 71); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-normalcaller-direct-strictcode.js0000644000175000017500000000665411545150464031572 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; var ev = eval; var xcode = "'use strict';" + "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var f = eval(xcode); var inner1 = f("get"); var local1 = x; x = 7; var inner2 = f("get"); var local2 = x; f("set1"); var inner3 = f("get"); var local3 = x; var del = f("delete"); var inner4 = f("get"); var local4 = x; f("set2"); var inner5 = f("get"); var local5 = x; var resultsX = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsX.local0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 17); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.del, "SyntaxError"); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); var ycode = "'use strict';" + "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; try { var local0 = y; } catch (e) { local0 = e.name; } var f = eval(ycode); var inner1 = f("get"); try { var local1 = y; } catch (e) { local1 = e.name; } y = 8; var inner2 = f("get"); var local2 = y; f("set1"); var inner3 = f("get"); var local3 = y; var del = f("delete"); try { var inner4 = f("get"); } catch (e) { inner4 = e.name; } try { var local4 = y; } catch (e) { local4 = e.name; } f("set2"); try { var inner5 = f("get"); } catch (e) { inner5 = e.name; } try { var local5 = y; } catch (e) { local5 = e.name; } var resultsY = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsY.local0, "ReferenceError"); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, "ReferenceError"); assertEq(resultsY.inner2, 5); assertEq(resultsY.local2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 8); assertEq(resultsY.del, "SyntaxError"); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, 8); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 8); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-normalcaller-indirect-normalcode.jsmozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-normalcaller-indirect-normalcode.j0000644000175000017500000000653011545150464031707 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; var ev = eval; var xcode = "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var f = ev(xcode); var inner1 = f("get"); var local1 = x; x = 7; var inner2 = f("get"); var local2 = x; f("set1"); var inner3 = f("get"); var local3 = x; var del = f("delete"); var inner4 = f("get"); var local4 = x; f("set2"); var inner5 = f("get"); var local5 = x; var resultsX = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsX.local0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 4); assertEq(resultsX.inner2, 7); assertEq(resultsX.local2, 7); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 9); assertEq(resultsX.del, false); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 9); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 23); var ycode = "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; try { var local0 = y; } catch (e) { local0 = e.name; } var f = ev(ycode); var inner1 = f("get"); var local1 = y; y = 8; var inner2 = f("get"); var local2 = y; f("set1"); var inner3 = f("get"); var local3 = y; var del = f("delete"); try { var inner4 = f("get"); } catch (e) { inner4 = e.name; } try { var local4 = y; } catch (e) { local4 = e.name; } f("set2"); try { var inner5 = f("get"); } catch (e) { inner5 = e.name; } try { var local5 = y; } catch (e) { local5 = e.name; } var resultsY = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsY.local0, "ReferenceError"); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, 5); assertEq(resultsY.inner2, 8); assertEq(resultsY.local2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 2); assertEq(resultsY.del, true); assertEq(resultsY.inner4, "ReferenceError"); assertEq(resultsY.local4, "ReferenceError"); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 71); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-normalcaller-indirect-strictcode.jsmozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-normalcaller-indirect-strictcode.j0000644000175000017500000000665011545150464031732 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; var ev = eval; var xcode = "'use strict';" + "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var f = ev(xcode); var inner1 = f("get"); var local1 = x; x = 7; var inner2 = f("get"); var local2 = x; f("set1"); var inner3 = f("get"); var local3 = x; var del = f("delete"); var inner4 = f("get"); var local4 = x; f("set2"); var inner5 = f("get"); var local5 = x; var resultsX = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsX.local0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 17); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.del, "SyntaxError"); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); var ycode = "'use strict';" + "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; try { var local0 = y; } catch (e) { local0 = e.name; } var f = ev(ycode); var inner1 = f("get"); try { var local1 = y; } catch (e) { local1 = e.name; } y = 8; var inner2 = f("get"); var local2 = y; f("set1"); var inner3 = f("get"); var local3 = y; var del = f("delete"); try { var inner4 = f("get"); } catch (e) { inner4 = e.name; } try { var local4 = y; } catch (e) { local4 = e.name; } f("set2"); try { var inner5 = f("get"); } catch (e) { inner5 = e.name; } try { var local5 = y; } catch (e) { local5 = e.name; } var resultsY = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsY.local0, "ReferenceError"); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, "ReferenceError"); assertEq(resultsY.inner2, 5); assertEq(resultsY.local2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 8); assertEq(resultsY.del, "SyntaxError"); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, 8); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 8); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-strictcaller-direct-normalcode.js0000644000175000017500000000712611545150464031565 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ "use strict"; //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; var ev = eval; var xcode = "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var f = eval(xcode); var inner1 = f("get"); var local1 = x; x = 7; var inner2 = f("get"); var local2 = x; f("set1"); var inner3 = f("get"); var local3 = x; var del = f("delete"); var inner4 = f("get"); var local4 = x; f("set2"); var inner5 = f("get"); var local5 = x; var resultsX = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsX.local0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 17); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.del, "SyntaxError"); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); var ycode = "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; try { var local0 = y; } catch (e) { local0 = e.name; } var f = eval(ycode); var inner1 = f("get"); try { var local1 = y; } catch (e) { local1 = e.name; } try { y = 8; } catch (e) { assertEq(e.name, "ReferenceError"); } var inner2 = f("get"); try { var local2 = y; } catch (e) { local2 = e.name; } f("set1"); var inner3 = f("get"); try { var local3 = y; } catch (e) { local3 = e.name; } var del = f("delete"); try { var inner4 = f("get"); } catch (e) { inner4 = e.name; } try { var local4 = y; } catch (e) { local4 = e.name; } f("set2"); try { var inner5 = f("get"); } catch (e) { inner5 = e.name; } try { var local5 = y; } catch (e) { local5 = e.name; } var resultsY = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsY.local0, "ReferenceError"); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, "ReferenceError"); assertEq(resultsY.inner2, 5); assertEq(resultsY.local2, "ReferenceError"); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, "ReferenceError"); assertEq(resultsY.del, "SyntaxError"); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, "ReferenceError"); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, "ReferenceError"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-strictcaller-direct-strictcode.js0000644000175000017500000000717611545150464031612 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ "use strict"; //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; var ev = eval; var xcode = "'use strict';" + "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var f = eval(xcode); var inner1 = f("get"); var local1 = x; x = 7; var inner2 = f("get"); var local2 = x; f("set1"); var inner3 = f("get"); var local3 = x; var del = f("delete"); var inner4 = f("get"); var local4 = x; f("set2"); var inner5 = f("get"); var local5 = x; var resultsX = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsX.local0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 17); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.del, "SyntaxError"); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); var ycode = "'use strict';" + "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; try { var local0 = y; } catch (e) { local0 = e.name; } var f = eval(ycode); var inner1 = f("get"); try { var local1 = y; } catch (e) { local1 = e.name; } try { y = 8; } catch (e) { assertEq(e.name, "ReferenceError"); } var inner2 = f("get"); try { var local2 = y; } catch (e) { local2 = e.name; } f("set1"); var inner3 = f("get"); try { var local3 = y; } catch (e) { local3 = e.name; } var del = f("delete"); try { var inner4 = f("get"); } catch (e) { inner4 = e.name; } try { var local4 = y; } catch (e) { local4 = e.name; } f("set2"); try { var inner5 = f("get"); } catch (e) { inner5 = e.name; } try { var local5 = y; } catch (e) { local5 = e.name; } var resultsY = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsY.local0, "ReferenceError"); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, "ReferenceError"); assertEq(resultsY.inner2, 5); assertEq(resultsY.local2, "ReferenceError"); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, "ReferenceError"); assertEq(resultsY.del, "SyntaxError"); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, "ReferenceError"); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, "ReferenceError"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-strictcaller-indirect-normalcode.jsmozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-strictcaller-indirect-normalcode.j0000644000175000017500000000664011545150464031731 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ "use strict"; //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; var ev = eval; var xcode = "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var f = ev(xcode); var inner1 = f("get"); var local1 = x; x = 7; var inner2 = f("get"); var local2 = x; f("set1"); var inner3 = f("get"); var local3 = x; var del = f("delete"); var inner4 = f("get"); var local4 = x; f("set2"); var inner5 = f("get"); var local5 = x; var resultsX = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsX.local0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 4); assertEq(resultsX.inner2, 7); assertEq(resultsX.local2, 7); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 9); assertEq(resultsX.del, false); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 9); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 23); var ycode = "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; try { var local0 = y; } catch (e) { local0 = e.name; } var f = ev(ycode); var inner1 = f("get"); var local1 = y; try { y = 8; } catch (e) { assertEq(e.name, "ReferenceError"); } var inner2 = f("get"); var local2 = y; f("set1"); var inner3 = f("get"); var local3 = y; var del = f("delete"); try { var inner4 = f("get"); } catch (e) { inner4 = e.name; } try { var local4 = y; } catch (e) { local4 = e.name; } f("set2"); try { var inner5 = f("get"); } catch (e) { inner5 = e.name; } try { var local5 = y; } catch (e) { local5 = e.name; } var resultsY = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsY.local0, "ReferenceError"); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, 5); assertEq(resultsY.inner2, 8); assertEq(resultsY.local2, 8); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, 2); assertEq(resultsY.del, true); assertEq(resultsY.inner4, "ReferenceError"); assertEq(resultsY.local4, "ReferenceError"); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, 71); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-strictcaller-indirect-strictcode.jsmozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/exhaustive-global-strictcaller-indirect-strictcode.j0000644000175000017500000000717211545150464031752 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ "use strict"; //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "eval in all its myriad flavors"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = 17; var ev = eval; var xcode = "'use strict';" + "var x = 4;" + "function actX(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return x;" + " case 'set1':" + " x = 9;" + " return;" + " case 'set2':" + " x = 23;" + " return;" + " case 'delete':" + " try { return eval('delete x'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actX;"; var local0 = x; var f = ev(xcode); var inner1 = f("get"); var local1 = x; x = 7; var inner2 = f("get"); var local2 = x; f("set1"); var inner3 = f("get"); var local3 = x; var del = f("delete"); var inner4 = f("get"); var local4 = x; f("set2"); var inner5 = f("get"); var local5 = x; var resultsX = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsX.local0, 17); assertEq(resultsX.inner1, 4); assertEq(resultsX.local1, 17); assertEq(resultsX.inner2, 4); assertEq(resultsX.local2, 7); assertEq(resultsX.inner3, 9); assertEq(resultsX.local3, 7); assertEq(resultsX.del, "SyntaxError"); assertEq(resultsX.inner4, 9); assertEq(resultsX.local4, 7); assertEq(resultsX.inner5, 23); assertEq(resultsX.local5, 7); var ycode = "'use strict';" + "var y = 5;" + "function actY(action)" + "{" + " switch (action)" + " {" + " case 'get':" + " return y;" + " case 'set1':" + " y = 2;" + " return;" + " case 'set2':" + " y = 71;" + " return;" + " case 'delete':" + " try { return eval('delete y'); }" + " catch (e) { return e.name; }" + " }" + "}" + "actY;"; try { var local0 = y; } catch (e) { local0 = e.name; } var f = ev(ycode); var inner1 = f("get"); try { var local1 = y; } catch (e) { local1 = e.name; } try { y = 8; } catch (e) { assertEq(e.name, "ReferenceError"); } var inner2 = f("get"); try { var local2 = y; } catch (e) { local2 = e.name; } f("set1"); var inner3 = f("get"); try { var local3 = y; } catch (e) { local3 = e.name; } var del = f("delete"); try { var inner4 = f("get"); } catch (e) { inner4 = e.name; } try { var local4 = y; } catch (e) { local4 = e.name; } f("set2"); try { var inner5 = f("get"); } catch (e) { inner5 = e.name; } try { var local5 = y; } catch (e) { local5 = e.name; } var resultsY = { local0: local0, inner1: inner1, local1: local1, inner2: inner2, local2: local2, inner3: inner3, local3: local3, del: del, inner4: inner4, local4: local4, inner5: inner5, local5: local5, }; assertEq(resultsY.local0, "ReferenceError"); assertEq(resultsY.inner1, 5); assertEq(resultsY.local1, "ReferenceError"); assertEq(resultsY.inner2, 5); assertEq(resultsY.local2, "ReferenceError"); assertEq(resultsY.inner3, 2); assertEq(resultsY.local3, "ReferenceError"); assertEq(resultsY.del, "SyntaxError"); assertEq(resultsY.inner4, 2); assertEq(resultsY.local4, "ReferenceError"); assertEq(resultsY.inner5, 71); assertEq(resultsY.local5, "ReferenceError"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/jstests.list0000644000175000017500000000467611545150464022125 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/eval/ # # A dazzling variety of characteristics of an invocation of the eval function # affect its semantics: # # - Is it called from a function (one written by the user, or one provided by # ES5), from global code, or from nothing (e.g. setTimeout, setInterval, or # at the entry point to the JSAPI)? # - If it is called from script (whether global or function), is the caller # strict mode code? # - Is the call direct or indirect? (ES5 15.1.2.1) # - Is the eval code itself strict mode? # # We test all of these in their basic configurations in an attempt to verify # correct general behavior. These tests won't help any special-case # optimizations we might perform -- add new tests for such changes as needed. # script exhaustive-fun-normalcaller-direct-normalcode.js script exhaustive-fun-normalcaller-direct-strictcode.js script exhaustive-fun-normalcaller-indirect-normalcode.js script exhaustive-fun-normalcaller-indirect-strictcode.js script exhaustive-fun-strictcaller-direct-normalcode.js script exhaustive-fun-strictcaller-direct-strictcode.js script exhaustive-fun-strictcaller-indirect-normalcode.js script exhaustive-fun-strictcaller-indirect-strictcode.js script exhaustive-global-normalcaller-direct-normalcode.js script exhaustive-global-normalcaller-direct-strictcode.js script exhaustive-global-normalcaller-indirect-normalcode.js script exhaustive-global-normalcaller-indirect-strictcode.js script exhaustive-global-strictcaller-direct-normalcode.js script exhaustive-global-strictcaller-direct-strictcode.js script exhaustive-global-strictcaller-indirect-normalcode.js script exhaustive-global-strictcaller-indirect-strictcode.js # Not written yet! These require a new shell primitive to work there, though # browser could probably use setTimeout for this. Moreover, we haven't # implemented calling eval without a scripted frame yet (FIXME: bug 602994). # script exhaustive-nothing-normalcaller-direct-normalcode.js # script exhaustive-nothing-normalcaller-direct-strictcode.js # script exhaustive-nothing-normalcaller-indirect-normalcode.js # script exhaustive-nothing-normalcaller-indirect-strictcode.js # script exhaustive-nothing-strictcaller-direct-normalcode.js # script exhaustive-nothing-strictcaller-direct-strictcode.js # script exhaustive-nothing-strictcaller-indirect-normalcode.js # script exhaustive-nothing-strictcaller-indirect-strictcode.js script undeclared-name-in-nested-strict-eval.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/shell.js0000644000175000017500000000000011545150464021147 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/eval/undeclared-name-in-nested-strict-eval.js0000644000175000017500000000135311545150464027217 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ "use strict"; //----------------------------------------------------------------------------- var BUGNUMBER = 514568; var summary = "Verify that we don't optimize free names to gnames in eval code that's " + "global, when the name refers to a binding introduced by a strict mode " + "eval frame"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var x = "global"; assertEq(eval('var x = "eval"; eval("x")'), "eval"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Expressions/11.1.5-01.js0000644000175000017500000000237711545150464022417 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 520696; var summary = 'Implement support for string literals as names for properties defined ' + 'using ES5 get/set syntax'; print(BUGNUMBER + ": " + summary); var o; o = { get "a b c"() { return 17; } }; assertEq("get" in Object.getOwnPropertyDescriptor(o, "a b c"), true); o = eval('({ get "a b c"() { return 17; } })'); assertEq("get" in Object.getOwnPropertyDescriptor(o, "a b c"), true); var f = eval("(function literalInside() { return { set 'c d e'(q) { } }; })"); f = function literalInside() { return { set 'c d e'(q) { } }; }; function checkO() { assertEq(3.141592654 in o, true, "fractional-named property isn't in object"); assertEq(10000 in o, true, "exponential-named property is in object"); assertEq(0xdeadbeef in o, true, "hex-named property is in object"); assertEq("Infinity" in o, true, "numeric index stringified correctly"); } o = eval('({ 3.141592654: "pi", 1e4: 17, 0xdeadbeef: "hex", 1e3000: "Infinity" })'); checkO(); o = { 3.141592654: "pi", 1e4: 17, 0xdeadbeef: "hex", 1e3000: "Infinity" }; checkO(); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Expressions/browser.js0000644000175000017500000000000011545150464023116 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Expressions/jstests.list0000644000175000017500000000030411545150464023500 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/Expressions/ script 11.1.5-01.js script named-accessor-function.js script nested-delete-name-in-evalcode.js script object-literal-accessor-arguments.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Expressions/named-accessor-function.js0000644000175000017500000000177711545150464026170 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ // Contributor: // Jeff Walden //----------------------------------------------------------------------------- var BUGNUMBER = 999999; var summary = '{ get x y() { } } is not valid getter syntax'; print(BUGNUMBER + ": " + summary); var BAD_CODE = ["({ get x y() { } })", "({ set x y(v) { } })"]; for (var i = 0, sz = BAD_CODE.length; i < sz; i++) { var code = BAD_CODE[i]; var err = "no exception"; try { eval(code); } catch (e) { err = e; } if (!(err instanceof SyntaxError)) { assertEq(true, false, "bad or no exception thrown for eval(" + code + "): " + err); } err = "no exception"; try { new Function(code); } catch (e) { err = e; } if (!(err instanceof SyntaxError)) { assertEq(true, false, "bad or no exception thrown for Function(" + code + "): " + err); } } reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Expressions/nested-delete-name-in-evalcode.js0000644000175000017500000000754211545150464027301 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 616294; var summary = "|delete x| inside a function in eval code, where that eval code includes " + "|var x| at top level, actually does delete the binding for x"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var f; function testOuterVar() { return eval("var x; (function() { return delete x; })"); } f = testOuterVar(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testOuterFunction() { return eval("function x() { } (function() { return delete x; })"); } f = testOuterFunction(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testOuterForVar() { return eval("for (var x; false; ); (function() { return delete x; })"); } f = testOuterForVar(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testOuterForInVar() { return eval("for (var x in {}); (function() { return delete x; })"); } f = testOuterForInVar(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testOuterNestedVar() { return eval("for (var q = 0; q < 5; q++) { var x; } (function() { return delete x; })"); } f = testOuterNestedVar(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testOuterNestedConditionalVar() { return eval("for (var q = 0; q < 5; q++) { if (false) { var x; } } (function() { return delete x; })"); } f = testOuterNestedConditionalVar(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testVarInWith() { return eval("with ({}) { var x; } (function() { return delete x; })"); } f = testVarInWith(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testForVarInWith() { return eval("with ({}) { for (var x = 0; x < 5; x++); } (function() { return delete x; })"); } f = testForVarInWith(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testForInVarInWith() { return eval("with ({}) { for (var x in {}); } (function() { return delete x; })"); } f = testForInVarInWith(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testUnknown() { return eval("nameToDelete = 17; (function() { return delete nameToDelete; })"); } f = testUnknown(); assertEq(f(), true); // configurable global property, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testArgumentShadow() { return eval("var x; (function(x) { return delete x; })"); } f = testArgumentShadow(); assertEq(f(), false); // non-configurable argument => false function testArgument() { return eval("(function(x) { return delete x; })"); } f = testArgument(); assertEq(f(), false); // non-configurable argument => false function testFunctionLocal() { return eval("(function() { var x; return delete x; })"); } f = testFunctionLocal(); assertEq(f(), false); // defined by function code => not configurable => false /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Expressions/object-literal-accessor-arguments.js0000644000175000017500000000236211545150464030153 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var gTestfile = 'object-literal-accessor-arguments.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 536472; var summary = 'ES5: { get x(v) { } } and { set x(v, v2) { } } should be syntax errors'; print(BUGNUMBER + ": " + summary); //----------------------------------------------------------------------------- function expectSyntaxError(s) { try { eval(s); throw new Error("no error thrown"); } catch (e) { assertEq(e instanceof SyntaxError, true, "expected syntax error parsing '" + s + "', got: " + e); } } expectSyntaxError("({ get x(a) { } })"); expectSyntaxError("({ get x(a, a) { } })"); expectSyntaxError("({ get x(a, b) { } })"); expectSyntaxError("({ get x(a, a, b) { } })"); expectSyntaxError("({ get x(a, b, c) { } })"); expectSyntaxError("({ set x() { } })"); expectSyntaxError("({ set x(a, a) { } })"); expectSyntaxError("({ set x(a, b) { } })"); expectSyntaxError("({ set x(a, a, b) { } })"); expectSyntaxError("({ set x(a, b, c) { } })"); //----------------------------------------------------------------------------- reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Expressions/shell.js0000644000175000017500000000030211545150464022547 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/15.4.4.11.js0000644000175000017500000000175611545150464022304 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function arr() { return Object.defineProperty([20, 10, 30], 0, {writable: false}); } assertEq(testLenientAndStrict('var a = arr(); a.sort()', raisesException(TypeError), raisesException(TypeError)), true); function obj() { var o = {0: 20, 1: 10, 2: 30, length: 3}; Object.defineProperty(o, 0, {writable: false}); return o; } assertEq(testLenientAndStrict('var o = obj(); Array.prototype.sort.call(o)', raisesException(TypeError), raisesException(TypeError)), true); // The behavior of sort is implementation-defined if the object being // sorted is sparse, so I'm not sure how to test its behavior on // non-configurable properties. reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/8.12.5-01.js0000644000175000017500000000335711545150464022303 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jason Orendorff * Jeff Walden */ //----------------------------------------------------------------------------- var BUGNUMBER = 523846; var summary = "Assignments to a property that has a getter but not a setter should not " + "throw a TypeError per ES5 (at least not until strict mode is supported)"; var actual = "Early failure"; var expect = "No errors"; printBugNumber(BUGNUMBER); printStatus(summary); var o = { get p() { return "a"; } }; function test1() { o.p = "b"; // strict-mode violation here assertEq(o.p, "a"); } function test2() { function T() {} T.prototype = o; y = new T(); y.p = "b"; // strict-mode violation here assertEq(y.p, "a"); } var errors = []; try { try { test1(); } catch (e) { errors.push(e); } try { test2(); } catch (e) { errors.push(e); } options("strict"); options("werror"); try { test1(); errors.push("strict+werror didn't make test1 fail"); } catch (e) { if (!(e instanceof TypeError)) errors.push("test1 with strict+werror failed without a TypeError: " + e); } try { test2(); errors.push("strict+werror didn't make test2 fail"); } catch (e) { if (!(e instanceof TypeError)) errors.push("test2 with strict+werror failed without a TypeError: " + e); } options("strict"); options("werror"); } catch (e) { errors.push("Unexpected error: " + e); } finally { actual = errors.length > 0 ? errors.join(", ") : "No errors"; } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/Boolean-toSource.js0000644000175000017500000000161311545150464024503 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(raisesException(TypeError)('Boolean.prototype.toSource.call(42)'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toSource.call("")'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toSource.call({})'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toSource.call(null)'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toSource.call([])'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toSource.call(undefined)'), true); assertEq(raisesException(TypeError)('Boolean.prototype.toSource.call(new String())'), true); assertEq(completesNormally('Boolean.prototype.toSource.call(true)'), true); assertEq(completesNormally('Boolean.prototype.toSource.call(new Boolean(true))'), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/browser.js0000644000175000017500000000000111545150464022774 0ustar chr1schr1s mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/bug352085.js0000644000175000017500000000044211545150464022566 0ustar chr1schr1svar a = function (t) { return t % 0; } var b = function (t) { return t % ""; } var c = function (t) { return t % ("" + ""); } assertEq(a.toString(), b.toString()); assertEq(a.toString(), c.toString()); if (typeof reportCompare === "function") reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/bug472534.js0000644000175000017500000000152111545150464022567 0ustar chr1schr1sfunction monthNames () { return [ /jan(uar(y)?)?/, 0, /feb(ruar(y)?)?/, 1, /m\u00e4r|mar|m\u00e4rz|maerz|march/, 2, /apr(il)?/, 3, /ma(i|y)/, 4, /jun(i|o|e)?/, 5, /jul(i|y)?/, 6, /aug(ust)?/, 7, /sep((t)?(ember))?/, 8, /o(c|k)t(ober)?/, 9, /nov(ember)?/, 10, /de(c|z)(ember)?/, 11 ]; }; var actual = ''; var expected = '(jan(uar(y)?)?)|(feb(ruar(y)?)?)|(m\\u00e4r|mar|m\\u00e4rz|maerz|march)|(apr(il)?)|(ma(i|y))|(jun(i|o|e)?)|(jul(i|y)?)|(aug(ust)?)|(sep((t)?(ember))?)|(o(c|k)t(ober)?)|(nov(ember)?)|(de(c|z)(ember)?)'; var mn = monthNames(); for (var i = 0; i < mn.length; ++i) { if (actual) actual += '|'; actual += '(' + mn[i++].source + ')'; } assertEq(actual, expected); if (typeof reportCompare === "function") reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/bug496985.js0000644000175000017500000000036511545150464022614 0ustar chr1schr1svar a = function() { return function ({x: arguments}) { return arguments; } } var b = eval(uneval(a)); assertEq(a()({x: 1}), 1); assertEq(b()({x: 1}), 1); if (typeof reportCompare === "function") reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/bug566661.js0000644000175000017500000000026411545150464022577 0ustar chr1schr1svar f = function (q) { return q['\xC7']; } var d = eval(uneval(f)); assertEq(d({'\xC7': 'good'}), 'good'); if (typeof reportCompare === "function") reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/eval-native-callback-is-indirect.js0000644000175000017500000000176011545150464027503 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 604504; var summary = "eval called from a native function is indirect"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var originalEval = eval; var global = this; var directCheckCode = "this === global"; function testArrayGeneric() { var global = "psych!"; var eval = Array.map; var mapped = eval([directCheckCode], originalEval); assertEq(mapped[0], true); } function testStringGeneric() { var global = "psych!"; var eval = String.replace; var newString = eval(directCheckCode, directCheckCode, originalEval); assertEq(newString, "true"); } testStringGeneric(); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/extension-methods-reject-null-undefined-this.jsmozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/extension-methods-reject-null-undefined-this.j0000644000175000017500000000630711545150464031750 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 619283; var summary = "ECMAScript built-in methods that immediately throw when |this| is " + "|undefined| or |null| (due to CheckObjectCoercible, ToObject, or ToString)"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ // This test fills out for the non-standard methods which // ecma_5/misc/builtin-methods-reject-null-undefined-this.js declines to test. var ClassToMethodMap = { Object: [/* * Don't box this just yet for these methods -- they're used too * much without qualification to do that. :-( */ /* "__defineGetter__", "__defineSetter__", */ "__lookupGetter__", "__lookupSetter__", "watch", "unwatch", "toSource"], Function: ["toSource"], Array: ["toSource"], String: ["toSource", "quote", "bold", "italics", "fixed", "fontsize", "fontcolor", "link", "anchor", "strike", "small", "big", "blink", "sup", "sub", "substr", "trimLeft", "trimRight", "toJSON"], Boolean: ["toSource", "toJSON"], Number: ["toSource", "toJSON"], Date: ["toSource", "toLocaleFormat", "getYear", "setYear", "toGMTString"], RegExp: ["toSource"], Error: ["toSource"], }; var badThisValues = [null, undefined]; function testMethod(Class, className, method) { var expr; // Try out explicit this values for (var i = 0, sz = badThisValues.length; i < sz; i++) { var badThis = badThisValues[i]; expr = className + ".prototype." + method + ".call(" + badThis + ")"; try { Class.prototype[method].call(badThis); throw new Error(expr + " didn't throw a TypeError"); } catch (e) { assertEq(e instanceof TypeError, true, "wrong error for " + expr + ", instead threw " + e); } expr = className + ".prototype." + method + ".apply(" + badThis + ")"; try { Class.prototype[method].apply(badThis); throw new Error(expr + " didn't throw a TypeError"); } catch (e) { assertEq(e instanceof TypeError, true, "wrong error for " + expr + ", instead threw " + e); } } // ..and for good measure.. expr = "(0, " + className + ".prototype." + method + ")()" try { // comma operator to call GetValue() on the method and de-Reference it (0, Class.prototype[method])(); throw new Error(expr + " didn't throw a TypeError"); } catch (e) { assertEq(e instanceof TypeError, true, "wrong error for " + expr + ", instead threw " + e); } } for (var className in ClassToMethodMap) { var Class = this[className]; var methodNames = ClassToMethodMap[className]; for (var i = 0, sz = methodNames.length; i < sz; i++) { var method = methodNames[i]; testMethod(Class, className, method); } } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/function-definition-with.js0000644000175000017500000000303111545150464026243 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 577325; var summary = 'Implement the ES5 algorithm for processing function statements'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var called, obj; function inFile1() { return "in file"; } called = false; obj = { set inFile1(v) { called = true; } }; with (obj) function inFile1() { return "in file in with"; }; assertEq(inFile1(), "in file in with"); assertEq("set" in Object.getOwnPropertyDescriptor(obj, "inFile1"), true); assertEq(called, false); evaluate("function notInFile1() { return 'not in file'; }"); called = false; obj = { set notInFile1(v) { called = true; return "not in file 2"; } }; with (obj) function notInFile1() { return "not in file in with"; }; assertEq(notInFile1(), "not in file in with"); assertEq("set" in Object.getOwnPropertyDescriptor(obj, "notInFile1"), true); assertEq(called, false); function inFile2() { return "in file 1"; } called = false; obj = Object.defineProperty({}, "inFile2", { value: 42, configurable: false, enumerable: false }); with (obj) function inFile2() { return "in file 2"; }; assertEq(inFile2(), "in file 2"); assertEq(obj.inFile2, 42); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/iterator-in-catch.js0000644000175000017500000000043611545150464024642 0ustar chr1schr1s//Bug 350712 function iterator () { for (var i in []); } try { try { throw 5; } catch(error if iterator()) { assertEq(false, true); } } catch(error) { assertEq(error, 5); } if (typeof reportCompare === "function") reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/jstests.list0000644000175000017500000000206211545150464023360 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/extensions/ script 8.12.5-01.js script 15.4.4.11.js script Boolean-toSource.js script Number-toSource.js script Object-keys-and-object-ids.js script String-toSource.js script bug352085.js script bug472534.js script bug496985.js script bug566661.js script eval-native-callback-is-indirect.js script extension-methods-reject-null-undefined-this.js skip-if(!xulRuntime.shell) script function-definition-with.js # needs evaluate() script iterator-in-catch.js fails script nested-delete-name-in-evalcode.js # bug 604301, at a minimum script proxy-strict.js script regress-bug567606.js script regress-bug607284.js script regress-bug629723.js script strict-function-statements.js script strict-option-redeclared-parameter.js script string-literal-getter-setter-decompilation.js script uneval-strict-functions.js script watch-array-length.js script watch-inherited-property.js script watch-replaced-setter.js script watch-setter-become-setter.js script watch-value-prop-becoming-setter.js script watchpoint-deletes-JSPropertyOp-setter.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/nested-delete-name-in-evalcode.js0000644000175000017500000000445211545150464027153 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 616294; var summary = "|delete x| inside a function in eval code, where that eval code includes " + "|var x| at top level, actually does delete the binding for x"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var f; function testOuterLet() { return eval("let x; (function() { return delete x; })"); } f = testOuterLet(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testOuterForLet() { return eval("for (let x; false; ); (function() { return delete x; })"); } f = testOuterForLet(); assertEq(f(), true); // not there => true (only non-configurable => false) function testOuterForInLet() { return eval("for (let x in {}); (function() { return delete x; })"); } f = testOuterForInLet(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // not there => true (only non-configurable => false) function testOuterNestedVarInLetBlock() { return eval("let (x = 7) { var x = 9; } (function() { return delete x; })"); } f = testOuterNestedVarInLetBlock(); assertEq(f(), true); // configurable var, so remove => true assertEq(f(), true); // let still there, configurable => true assertEq(f(), true); // nothing at all => true function testOuterNestedVarInForLet() { return eval("for (let q = 0; q < 5; q++) { var x; } (function() { return delete x; })"); } f = testOuterNestedVarInForLet(); assertEq(f(), true); // configurable, so remove => true assertEq(f(), true); // there => true function testArgumentShadowLet() { return eval("let x; (function(x) { return delete x; })"); } f = testArgumentShadowLet(); assertEq(f(), false); // non-configurable argument => false function testFunctionLocal() { return eval("(function() { let x; return delete x; })"); } f = testFunctionLocal(); assertEq(f(), false); // defined by function code => not configurable => false /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/Number-toSource.js0000644000175000017500000000160411545150464024354 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(raisesException(TypeError)('Number.prototype.toSource.call("")'), true); assertEq(raisesException(TypeError)('Number.prototype.toSource.call(true)'), true); assertEq(raisesException(TypeError)('Number.prototype.toSource.call({})'), true); assertEq(raisesException(TypeError)('Number.prototype.toSource.call(null)'), true); assertEq(raisesException(TypeError)('Number.prototype.toSource.call([])'), true); assertEq(raisesException(TypeError)('Number.prototype.toSource.call(undefined)'), true); assertEq(raisesException(TypeError)('Number.prototype.toSource.call(new Boolean(true))'), true); assertEq(completesNormally('Number.prototype.toSource.call(42)'), true); assertEq(completesNormally('Number.prototype.toSource.call(new Number(42))'), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/Object-keys-and-object-ids.js0000644000175000017500000000047411545150464026267 0ustar chr1schr1svar o = { normal:"a" }; Object.defineProperty(o, new QName, { enumerable:true }); var keys = Object.keys(o); assertEq(keys.length, 1); assertEq(keys[0], "normal"); var o = {}; Object.defineProperty(o, new QName, { enumerable:true }); var keys = Object.keys(o); assertEq(keys.length, 0); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/proxy-strict.js0000644000175000017500000000043711545150464024015 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var s = "grape"; function f() { "use strict"; return this; } var p = Proxy.createFunction(f, f); String.prototype.p = p; assertEq(s.p(), "grape"); reportCompare(true,true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/regress-bug567606.js0000644000175000017500000000064711545150464024254 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var global = this; (function() { function f() { this.b = function() {}; Object.defineProperty(this, "b", ({ configurable: global.__defineSetter__("", function() {}) })); } for each(y in [0]) { _ = new f(); } })(); uneval(this); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/regress-bug607284.js0000644000175000017500000000073411545150464024246 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ if ("evalcx" in this) { var sandbox = evalcx(""); var obj = { get foo() { throw("FAIL"); } }; var getter = obj.__lookupGetter__("foo"); var desc = sandbox.Object.getOwnPropertyDescriptor(obj, "foo"); reportCompare(desc.get, getter, "getter is correct"); reportCompare(desc.set, undefined, "setter is correct"); } else { reportCompare(true, true); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/regress-bug629723.js0000644000175000017500000000065511545150464024252 0ustar chr1schr1sfunction f(foo) { "use strict"; foo.bar; } var actual; try { f(); actual = "no error"; } catch (x) { actual = (x instanceof TypeError) ? "type error" : "some other error"; actual += (/use strict/.test(x)) ? " with directive" : " without directive"; } reportCompare("type error without directive", actual, "decompiled expressions in error messages should not include directive prologues"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/shell.js0000644000175000017500000000000011545150464022417 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/strict-function-statements.js0000644000175000017500000001010111545150464026633 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ // Ordinary function definitions should be unaffected. assertEq(testLenientAndStrict("function f() { }", parsesSuccessfully, parsesSuccessfully), true); // Function statements within blocks are forbidden in strict mode code. assertEq(testLenientAndStrict("{ function f() { } }", parsesSuccessfully, parseRaisesException(SyntaxError)), true); // Lambdas are always permitted within blocks. assertEq(testLenientAndStrict("{ (function f() { }) }", parsesSuccessfully, parsesSuccessfully), true); // Function statements within any sort of statement are forbidden in strict mode code. assertEq(testLenientAndStrict("if (true) function f() { }", parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict("while (true) function f() { }", parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict("do function f() { } while (true);", parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict("for(;;) function f() { }", parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict("for(x in []) function f() { }", parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict("with(o) function f() { }", parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict("switch(1) { case 1: function f() { } }", parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict("x: function f() { }", parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict("try { function f() { } } catch (x) { }", parsesSuccessfully, parseRaisesException(SyntaxError)), true); // Lambdas are always permitted within any sort of statement. assertEq(testLenientAndStrict("if (true) (function f() { })", parsesSuccessfully, parsesSuccessfully), true); // Function statements are permitted in blocks within lenient functions. assertEq(parsesSuccessfully("function f() { function g() { } }"), true); // Function statements are permitted in any statement within lenient functions. assertEq(parsesSuccessfully("function f() { if (true) function g() { } }"), true); assertEq(parseRaisesException(SyntaxError) ("function f() { 'use strict'; if (true) function g() { } }"), true); assertEq(parseRaisesException(SyntaxError) ("function f() { 'use strict'; { function g() { } } }"), true); assertEq(parsesSuccessfully("function f() { 'use strict'; if (true) (function g() { }) }"), true); assertEq(parsesSuccessfully("function f() { 'use strict'; { (function g() { }) } }"), true); // Eval should behave the same way. (The parse-only tests use the Function constructor.) assertEq(testLenientAndStrict("function f() { }", completesNormally, completesNormally), true); assertEq(testLenientAndStrict("{ function f() { } }", completesNormally, raisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/strict-option-redeclared-parameter.js0000644000175000017500000000170111545150464030205 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 630770; var summary = 'Correctly warn about duplicate parameters when the strict option is enabled'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ // Verify that duplicate parameters, with the strict option set, don't provoke // an assertion. Ideally we'd also verify that we warn exactly once per // duplicated parameter name, but at present there's no way to test that // without more effort (further customizing the shell JSErrorReporter) than we // want to make now. options("strict"); eval("function a(x, x, x, x) { }"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/string-literal-getter-setter-decompilation.js0000644000175000017500000000232611545150464031706 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var f; try { f = eval("(function literalInside() { return { set 'c d e'(v) { } }; })"); } catch (e) { assertEq(true, false, "string-literal property name in setter in object literal in " + "function statement failed to parse: " + e); } var fstr = "" + f; assertEq(fstr.indexOf("set") < fstr.indexOf("c d e"), true, "should be using new-style syntax with string literal in place of " + "property identifier"); assertEq(fstr.indexOf("setter") < 0, true, "using old-style syntax?"); var o = f(); var ostr = "" + o; assertEq("c d e" in o, true, "missing the property?"); assertEq("set" in Object.getOwnPropertyDescriptor(o, "c d e"), true, "'c d e' property not a setter?"); // disabled because we still generate old-style syntax here (toSource // decompilation is as yet unfixed) // assertEq(ostr.indexOf("set") < ostr.indexOf("c d e"), true, // "should be using new-style syntax when getting the source of a " + // "getter/setter while decompiling an object"); // assertEq(ostr.indexOf("setter") < 0, true, "using old-style syntax?"); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/String-toSource.js0000644000175000017500000000131511545150464024371 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(raisesException(TypeError)('String.prototype.toSource.call(42)'), true); assertEq(raisesException(TypeError)('String.prototype.toSource.call(true)'), true); assertEq(raisesException(TypeError)('String.prototype.toSource.call({})'), true); assertEq(raisesException(TypeError)('String.prototype.toSource.call(null)'), true); assertEq(raisesException(TypeError)('String.prototype.toSource.call([])'), true); assertEq(raisesException(TypeError)('String.prototype.toSource.call(undefined)'), true); assertEq(completesNormally('String.prototype.toSource.call("")'), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/uneval-strict-functions.js0000644000175000017500000000333411545150464026133 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* Check that strict mode functions get decompiled properly. */ function lenient() { return typeof this == "object"; } assertEq(eval(uneval(lenient) + "lenient;")(), true); function strict() { 'use strict'; return typeof this == "undefined"; } print(uneval(strict)); assertEq(eval(uneval(strict) + "strict;")(), true); function lenient_outer() { function lenient_inner() { return typeof this == "object"; } return lenient_inner; } assertEq(eval(uneval(lenient_outer()) + "lenient_inner;")(), true); function strict_outer() { "use strict"; function strict_inner() { return typeof this == "undefined"; } return strict_inner; } assertEq(eval(uneval(strict_outer()) + "strict_inner;")(), true); function lenient_outer_closure() { return function lenient_inner_closure() { return typeof this == "object"; }; } assertEq(eval(uneval(lenient_outer_closure()))(), true); function strict_outer_closure() { "use strict"; return function strict_inner_closure() { return typeof this == "undefined"; }; } assertEq(eval(uneval(strict_outer_closure()))(), true); function lenient_outer_expr() { return function lenient_inner_expr() (typeof this == "object"); } assertEq(eval(uneval(lenient_outer_expr()))(), true); /* * This doesn't work, because we have no way to include strict mode * directives in expression closures. * * function strict_outer_expr() { * return function strict_inner_expr() (typeof this == "undefined"); * } * assertEq(eval(uneval(strict_outer_expr()))(), true); */ reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/watch-array-length.js0000644000175000017500000000234611545150464025030 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var hitCount; function watcher(p,o,n) { hitCount++; return n; } var a = [1]; a.watch('length', watcher); hitCount = 0; a.length = 0; reportCompare(1, hitCount, "lenient; configurable: watchpoint hit"); var b = Object.defineProperty([1],'0',{configurable:false}); b.watch('length', watcher); hitCount = 0; var result; try { b.length = 0; result = "no error"; } catch (x) { result = x.toString(); } reportCompare(1, hitCount, "lenient; non-configurable: watchpoint hit"); reportCompare(1, b.length, "lenient; non-configurable: length unchanged"); reportCompare("no error", result, "lenient; non-configurable: no error thrown"); var c = Object.defineProperty([1],'0',{configurable:false}); c.watch('length', watcher); hitCount = 0; var threwTypeError; try { (function(){'use strict'; c.length = 0;})(); threwTypeError = false; } catch (x) { threwTypeError = x instanceof TypeError; } reportCompare(1, hitCount, "strict; non-configurable: watchpoint hit"); reportCompare(1, c.length, "strict; non-configurable: length unchanged"); reportCompare(true, threwTypeError, "strict; non-configurable: TypeError thrown"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/watch-inherited-property.js0000644000175000017500000000212111545150464026257 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* Create a prototype object with a setter property. */ var protoSetterCount; var proto = ({ set x(v) { protoSetterCount++; } }); /* Put a watchpoint on that setter. */ var protoWatchCount; proto.watch('x', function() { protoWatchCount++; }); /* Make an object with the above as its prototype. */ function C() { } C.prototype = proto; var o = new C(); /* * Set a watchpoint on the property in the inheriting object. We have * defined this to mean "duplicate the property, setter and all, in the * inheriting object." I don't think debugging observation mechanisms * should mutate the program being run, but that's what we've got. */ var oWatchCount; o.watch('x', function() { oWatchCount++; }); /* * Assign to the property. This should trip the watchpoint on the inheriting object and * the setter. */ protoSetterCount = protoWatchCount = oWatchCount = 0; o.x = 1; assertEq(protoWatchCount, 0); assertEq(oWatchCount, 1); assertEq(protoSetterCount, 1); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/watch-replaced-setter.js0000644000175000017500000000254211545150464025514 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* A stock watcher function. */ var watcherCount; function watcher(id, oldval, newval) { watcherCount++; return newval; } /* Create an object with a JavaScript setter. */ var setterCount; var o = { w:2, set x(v) { setterCount++; } }; /* * Put the object in dictionary mode, so that JSObject::putProperty will * mutate its shapes instead of creating new ones. */ delete o.w; /* * Place a watchpoint on the property. The watchpoint structure holds the * original JavaScript setter, and a pointer to the shape. */ o.watch('x', watcher); /* * Replace the accessor property with a value property. The shape's setter * should become a non-JS setter, js_watch_set, and the watchpoint * structure's saved setter should be updated (in this case, cleared). */ Object.defineProperty(o, 'x', { value:3, writable:true, enumerable:true, configurable:true }); /* * Assign to the property. This should trigger js_watch_set, which should * call the handler, and then see that there is no JS-level setter to pass * control on to, and return. */ watcherCount = setterCount = 0; o.x = 3; assertEq(watcherCount, 1); assertEq(setterCount, 0); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/watch-setter-become-setter.js0000644000175000017500000000232211545150464026467 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* Create an object with a JavaScript setter. */ var firstSetterCount; var o = { w:2, set x(v) { firstSetterCount++; } }; /* * Put the object in dictionary mode, so that JSObject::putProperty will * mutate its shapes instead of creating new ones. */ delete o.w; /* A stock watcher function. */ var watcherCount; function watcher(id, oldval, newval) { watcherCount++; return newval; } /* * Place a watchpoint on the property. The property's shape now has the * watchpoint setter, with the original setter saved in the watchpoint * structure. */ o.watch('x', watcher); /* * Replace the setter with a new setter. The shape should get updated to * refer to the new setter, and then the watchpoint setter should be * re-established. */ var secondSetterCount; Object.defineProperty(o, 'x', { set: function () { secondSetterCount++ } }); /* * Assign to the property. This should trigger the watchpoint and the new setter. */ watcherCount = firstSetterCount = secondSetterCount = 0; o.x = 3; assertEq(watcherCount, 1); assertEq(firstSetterCount, 0); assertEq(secondSetterCount, 1); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/watch-value-prop-becoming-setter.js0000644000175000017500000000172211545150464027607 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* A stock watcher function. */ var watcherCount; function watcher(id, old, newval) { watcherCount++; return newval; } /* Create an object with a value property. */ var o = { w:2, x:3 }; /* * Place a watchpoint on the value property. The watchpoint structure holds * the original JavaScript setter, and a pointer to the shape. */ o.watch('x', watcher); /* * Put the object in dictionary mode, so that JSObject::putProperty will * mutate its shapes instead of creating new ones. */ delete o.w; /* * Replace the value property with a setter. */ var setterCount; o.__defineSetter__('x', function() { setterCount++; }); /* * Trigger the watchpoint. The watchpoint handler should run, and then the * setter should run. */ watcherCount = setterCount = 0; o.x = 4; assertEq(watcherCount, 1); assertEq(setterCount, 1); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/extensions/watchpoint-deletes-JSPropertyOp-setter.js0000644000175000017500000000377111545150464031017 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function make_watcher(name) { return function (id, oldv, newv) { print("watched " + name + "[0]"); }; } var o, p; function f(flag) { if (flag) { o = arguments; } else { p = arguments; o.watch(0, make_watcher('o')); p.watch(0, make_watcher('p')); /* * Previously, the watchpoint implementation actually substituted its magic setter * functions for the setters of shared shapes, and then 1) carefully ignored calls * to its magic setter from unrelated objects, and 2) avoided restoring the * original setter until all watchpoints on that shape had been removed. * * However, when the watchpoint code began using JSObject::changeProperty and * js_ChangeNativePropertyAttrs to change shapes' setters, the shape tree code * became conscious of the presence of watchpoints, and shared shapes between * objects only when their watchpoint nature coincided. Clearing the magic setter * from one object's shape would not affect other objects, because the * watchpointed and non-watchpointed shapes were distinct if they were shared. * * Thus, the first unwatch call must go ahead and fix p's shape, even though a * watchpoint exists on the same shape in o. o's watchpoint's presence shouldn't * cause 'unwatch' to leave p's magic setter in place. */ /* DropWatchPointAndUnlock would see o's watchpoint, and not change p's property. */ p.unwatch(0); /* DropWatchPointAndUnlock would fix o's property, but not p's; p's setter would be gone. */ o.unwatch(0); /* This would fail to invoke the arguments object's setter. */ p[0] = 4; /* And the formal parameter would not get updated. */ assertEq(flag, 4); } } f(true); f(false); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/10.2.1.1.6.js0000644000175000017500000000150611545150464021734 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function strictThis() { 'use strict'; return this; } /* Check that calls of flat closure slots get the right |this|. */ function flat(g) { function h() { return g(); } return h; } assertEq(flat(strictThis)(), undefined); /* Check that calls up upvars get the right |this|. */ function upvar(f) { function h() { return f(); } return h(); } assertEq(upvar(strictThis), undefined); /* Check that calls to with-object properties get an appropriate 'this'. */ var obj = { f: strictThis }; with (obj) { /* * The method won't compile anything containing a 'with', but it can * compile 'g'. */ function g() { return f(); } assertEq(g(), obj); } reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/15.3.4.3-01.js0000644000175000017500000001404211545150464022020 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ //----------------------------------------------------------------------------- var BUGNUMBER = 562448; var summary = 'Function.prototype.apply should accept any arraylike arguments'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ function expectTypeError(fun, msg) { try { fun(); assertEq(true, false, "should have thrown a TypeError"); } catch (e) { assertEq(e instanceof TypeError, true, msg + "; instead threw " + e); } } function fun() { } var global = this; /* Step 1. */ var nonfuns = [null, 1, -1, 2.5, "[[Call]]", undefined, true, false, {}]; for (var i = 0, sz = nonfuns.length; i < sz; i++) { var f = function() { Function.prototype.apply.apply(nonfuns[i], [1, 2, 3]); }; var msg = "expected TypeError calling Function.prototype.apply with uncallable this"; expectTypeError(f, msg); } /* Step 2. */ var thisObj = {}; var currentThis, currentThisBox; function funLength() { assertEq(arguments.length, 0, "should have been called with no arguments"); assertEq(this, currentThis, "wrong this"); } function strictFunLength() { "use strict"; assertEq(arguments.length, 0, "should have been called with no arguments"); assertEq(this, currentThis, "wrong this"); } currentThis = global; funLength.apply(); funLength.apply(undefined); funLength.apply(undefined, undefined); funLength.apply(undefined, null); currentThis = undefined; strictFunLength.apply(); strictFunLength.apply(undefined); strictFunLength.apply(undefined, undefined); strictFunLength.apply(undefined, null); currentThis = null; strictFunLength.apply(null); strictFunLength.apply(null, undefined); strictFunLength.apply(null, null); currentThis = thisObj; funLength.apply(thisObj); funLength.apply(thisObj, null); funLength.apply(thisObj, undefined); strictFunLength.apply(thisObj); strictFunLength.apply(thisObj, null); strictFunLength.apply(thisObj, undefined); currentThis = 17; strictFunLength.apply(17); strictFunLength.apply(17, null); strictFunLength.apply(17, undefined); function funThisPrimitive() { assertEq(arguments.length, 0, "should have been called with no arguments"); assertEq(this instanceof currentThisBox, true, "this not instanceof " + currentThisBox); assertEq(this.valueOf(), currentThis, "wrong this valueOf()"); } currentThis = 17; currentThisBox = Number; funThisPrimitive.apply(17); funThisPrimitive.apply(17, undefined); funThisPrimitive.apply(17, null); currentThis = "foopy"; currentThisBox = String; funThisPrimitive.apply("foopy"); funThisPrimitive.apply("foopy", undefined); funThisPrimitive.apply("foopy", null); currentThis = false; currentThisBox = Boolean; funThisPrimitive.apply(false); funThisPrimitive.apply(false, undefined); funThisPrimitive.apply(false, null); /* Step 3. */ var nonobjs = [1, -1, 2.5, "[[Call]]", true, false]; for (var i = 0, sz = nonobjs.length; i < sz; i++) { var f = function() { fun.apply(thisObj, nonobjs[i]); }; var msg = "should have thrown a TypeError with non-object arguments"; expectTypeError(f, msg); } /* Step 4. */ var args = { get length() { throw 42; } }; try { fun.apply(thisObj, args); } catch (e) { assertEq(e, 42, "didn't throw result of [[Get]] on arguments object"); } /* * NB: There was an erratum removing the steps numbered 5 and 7 in the original * version of ES5; see also the comments in js_fun_apply. */ /* Step 5. */ var called = false; var argsObjectLength = { length: { valueOf: function() { called = true; return 17; } } }; fun.apply({}, argsObjectLength); assertEq(called, true, "should have been set in valueOf called via ToUint32"); var upvar = "unset"; var argsObjectPrimitiveLength = { length: { valueOf: function() { upvar = "valueOf"; return {}; }, toString: function() { upvar = upvar === "valueOf" ? "both" : "toString"; return 17; } } }; fun.apply({}, argsObjectPrimitiveLength); assertEq(upvar, "both", "didn't call all hooks properly"); /* Step 6-9. */ var seenThis, res, steps; var argsAccessors = { length: 4, get 0() { steps.push("0"); return 1; }, get 1() { steps.push("1"); return 2; }, // make sure values shine through holes get 3() { steps.push("3"); return 8; }, }; Object.prototype[2] = 729; seenThis = "not seen"; function argsAsArray() { seenThis = this; steps.push(Math.PI); return Array.prototype.map.call(arguments, function(v) { return v; }); } steps = []; res = argsAsArray.apply(thisObj, argsAccessors); assertEq(seenThis, thisObj, "saw wrong this"); assertEq(steps.length, 4, "wrong steps: " + steps); assertEq(steps[0], "0", "bad step 0"); assertEq(steps[1], "1", "bad step 1"); assertEq(steps[2], "3", "bad step 3"); assertEq(steps[3], Math.PI, "bad last step"); assertEq(res.length, 4, "wrong return: " + res); assertEq(res[0], 1, "wrong ret[0]"); assertEq(res[1], 2, "wrong ret[0]"); assertEq(res[2], 729, "wrong ret[0]"); assertEq(res[3], 8, "wrong ret[0]"); seenThis = "not seen"; function strictArgsAsArray() { "use strict"; seenThis = this; steps.push(NaN); return Array.prototype.map.call(arguments, function(v) { return v; }); } steps = []; res = strictArgsAsArray.apply(null, argsAccessors); assertEq(seenThis, null, "saw wrong this"); assertEq(steps.length, 4, "wrong steps: " + steps); assertEq(steps[0], "0", "bad step 0"); assertEq(steps[1], "1", "bad step 1"); assertEq(steps[2], "3", "bad step 3"); assertEq(steps[3], 0 / 0, "bad last step"); assertEq(res.length, 4, "wrong return: " + res); assertEq(res[0], 1, "wrong ret[0]"); assertEq(res[1], 2, "wrong ret[0]"); assertEq(res[2], 729, "wrong ret[0]"); assertEq(res[3], 8, "wrong ret[0]"); strictArgsAsArray.apply(17, argsAccessors); assertEq(seenThis, 17, "saw wrong this"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/arguments-caller-callee.js0000644000175000017500000000324111545150464025400 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var gTestfile = 'arguments-caller-callee.js'; var BUGNUMBER = 514563; var summary = "arguments.caller and arguments.callee are poison pills in ES5"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ // behavior function expectTypeError(fun) { try { fun(); throw new Error("didn't throw"); } catch (e) { assertEq(e instanceof TypeError, true, "expected TypeError calling function" + ("name" in fun ? " " + fun.name : "") + ", instead got: " + e); } } function bar() { "use strict"; return arguments; } expectTypeError(function barCaller() { bar().caller; }); expectTypeError(function barCallee() { bar().callee; }); function baz() { return arguments; } assertEq(baz().callee, baz); // accessor identity function strictMode() { "use strict"; return arguments; } var canonicalTTE = Object.getOwnPropertyDescriptor(strictMode(), "caller").get; var args = strictMode(); var argsCaller = Object.getOwnPropertyDescriptor(args, "caller"); assertEq("get" in argsCaller, true); assertEq("set" in argsCaller, true); assertEq(argsCaller.get, canonicalTTE); assertEq(argsCaller.set, canonicalTTE); var argsCallee = Object.getOwnPropertyDescriptor(args, "callee"); assertEq("get" in argsCallee, true); assertEq("set" in argsCallee, true); assertEq(argsCallee.get, canonicalTTE); assertEq(argsCallee.set, canonicalTTE); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/arguments-property-attributes.js0000644000175000017500000000652311545150464026771 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var gTestfile = 'arguments-property-attributes.js'; var BUGNUMBER = 516255; var summary = "Attributes for properties of arguments objects"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ // normal function args() { return arguments; } var a = args(0, 1); var argProps = Object.getOwnPropertyNames(a).sort(); assertEq(argProps.indexOf("callee") >= 0, true); assertEq(argProps.indexOf("0") >= 0, true); assertEq(argProps.indexOf("1") >= 0, true); assertEq(argProps.indexOf("length") >= 0, true); var calleeDesc = Object.getOwnPropertyDescriptor(a, "callee"); assertEq(calleeDesc.value, args); assertEq(calleeDesc.writable, true); assertEq(calleeDesc.enumerable, false); assertEq(calleeDesc.configurable, true); var zeroDesc = Object.getOwnPropertyDescriptor(a, "0"); assertEq(zeroDesc.value, 0); assertEq(zeroDesc.writable, true); assertEq(zeroDesc.enumerable, true); assertEq(zeroDesc.configurable, true); var oneDesc = Object.getOwnPropertyDescriptor(a, "1"); assertEq(oneDesc.value, 1); assertEq(oneDesc.writable, true); assertEq(oneDesc.enumerable, true); assertEq(oneDesc.configurable, true); var lengthDesc = Object.getOwnPropertyDescriptor(a, "length"); assertEq(lengthDesc.value, 2); assertEq(lengthDesc.writable, true); assertEq(lengthDesc.enumerable, false); assertEq(lengthDesc.configurable, true); // strict function strictArgs() { "use strict"; return arguments; } var sa = strictArgs(0, 1); var strictArgProps = Object.getOwnPropertyNames(sa).sort(); assertEq(strictArgProps.indexOf("callee") >= 0, true); assertEq(strictArgProps.indexOf("caller") >= 0, true); assertEq(strictArgProps.indexOf("0") >= 0, true); assertEq(strictArgProps.indexOf("1") >= 0, true); assertEq(strictArgProps.indexOf("length") >= 0, true); var strictCalleeDesc = Object.getOwnPropertyDescriptor(sa, "callee"); assertEq(typeof strictCalleeDesc.get, "function"); assertEq(typeof strictCalleeDesc.set, "function"); assertEq(strictCalleeDesc.get, strictCalleeDesc.set); assertEq(strictCalleeDesc.enumerable, false); assertEq(strictCalleeDesc.configurable, false); var strictCallerDesc = Object.getOwnPropertyDescriptor(sa, "caller"); assertEq(typeof strictCallerDesc.get, "function"); assertEq(typeof strictCallerDesc.set, "function"); assertEq(strictCallerDesc.get, strictCallerDesc.set); assertEq(strictCallerDesc.enumerable, false); assertEq(strictCallerDesc.configurable, false); var strictZeroDesc = Object.getOwnPropertyDescriptor(sa, "0"); assertEq(strictZeroDesc.value, 0); assertEq(strictZeroDesc.writable, true); assertEq(strictZeroDesc.enumerable, true); assertEq(strictZeroDesc.configurable, true); var strictOneDesc = Object.getOwnPropertyDescriptor(sa, "1"); assertEq(strictOneDesc.value, 1); assertEq(strictOneDesc.writable, true); assertEq(strictOneDesc.enumerable, true); assertEq(strictOneDesc.configurable, true); var strictLengthDesc = Object.getOwnPropertyDescriptor(sa, "length"); assertEq(strictLengthDesc.value, 2); assertEq(strictLengthDesc.writable, true); assertEq(strictLengthDesc.enumerable, false); assertEq(strictLengthDesc.configurable, true); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/browser.js0000644000175000017500000000000111545150464022362 0ustar chr1schr1s mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/builtin-no-prototype.js0000644000175000017500000000235211545150464025035 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(undefined, void 0); assertEq(Function.prototype.hasOwnProperty('prototype'), false); assertEq(Function.prototype.prototype, undefined); var builtin_ctors = [ Object, Function, Array, String, Boolean, Number, Date, RegExp, Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError ]; for (var i = 0; i < builtin_ctors.length; i++) { var c = builtin_ctors[i]; assertEq(typeof c.prototype, (c === Function) ? "function" : "object"); assertEq(c.prototype.constructor, c); } var builtin_funcs = [ eval, isFinite, isNaN, parseFloat, parseInt, decodeURI, decodeURIComponent, encodeURI, encodeURIComponent ]; for (var i = 0; i < builtin_funcs.length; i++) { assertEq(builtin_funcs[i].hasOwnProperty('prototype'), false); assertEq(builtin_funcs[i].prototype, undefined); } var names = Object.getOwnPropertyNames(Math); for (var i = 0; i < names.length; i++) { var m = Math[names[i]]; if (typeof m === "function") assertEq(m.prototype, undefined); } reportCompare(0, 0, "don't crash"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/Function-arguments-gc.js0000644000175000017500000000163611545150464025075 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Christian Holler */ //----------------------------------------------------------------------------- var BUGNUMBER = 623301; var summary = "Properly root argument names during Function()"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ if (typeof gczeal === "function") gczeal(2); function crashMe(n) { var nasty = []; while (n--) nasty.push("a" + n); return Function.apply(null, nasty); } var count = 64; // exact value not important assertEq(crashMe(count + 1).length, count); if (typeof gczeal === "function") gczeal(0); // reset /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/function-bind.js0000644000175000017500000002051211545150464023447 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var gTestfile = 'function-bind.js'; var BUGNUMBER = 429507; var summary = "ES5: Function.prototype.bind"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ // ad-hoc testing assertEq(Function.prototype.hasOwnProperty("bind"), true); var bind = Function.prototype.bind; assertEq(bind.length, 1); var strictReturnThis = function() { "use strict"; return this; }; assertEq(strictReturnThis.bind(undefined)(), undefined); assertEq(strictReturnThis.bind(null)(), null); var obj = {}; assertEq(strictReturnThis.bind(obj)(), obj); assertEq(strictReturnThis.bind(NaN)(), NaN); assertEq(strictReturnThis.bind(true)(), true); assertEq(strictReturnThis.bind(false)(), false); assertEq(strictReturnThis.bind("foopy")(), "foopy"); // rigorous, step-by-step testing function expectThrowTypeError(fun) { try { var r = fun(); throw new Error("didn't throw TypeError, returned " + r); } catch (e) { assertEq(e instanceof TypeError, true, "didn't throw TypeError, got: " + e); } } /* * 1. Let Target be the this value. * 2. If IsCallable(Target) is false, throw a TypeError exception. */ expectThrowTypeError(function() { bind.call(null); }); expectThrowTypeError(function() { bind.call(undefined); }); expectThrowTypeError(function() { bind.call(NaN); }); expectThrowTypeError(function() { bind.call(0); }); expectThrowTypeError(function() { bind.call(-0); }); expectThrowTypeError(function() { bind.call(17); }); expectThrowTypeError(function() { bind.call(42); }); expectThrowTypeError(function() { bind.call("foobar"); }); expectThrowTypeError(function() { bind.call(true); }); expectThrowTypeError(function() { bind.call(false); }); expectThrowTypeError(function() { bind.call([]); }); expectThrowTypeError(function() { bind.call({}); }); /* * 3. Let A be a new (possibly empty) internal list of all of the argument * values provided after thisArg (arg1, arg2 etc), in order. * 4. Let F be a new native ECMAScript object . * 5. Set all the internal methods, except for [[Get]], of F as specified in * 8.12. * 6. Set the [[Get]] internal property of F as specified in 15.3.5.4. * 7. Set the [[TargetFunction]] internal property of F to Target. * 8. Set the [[BoundThis]] internal property of F to the value of thisArg. * 9. Set the [[BoundArgs]] internal property of F to A. */ // throughout /* 10. Set the [[Class]] internal property of F to "Function". */ var toString = Object.prototype.toString; assertEq(toString.call(function(){}), "[object Function]"); assertEq(toString.call(function a(){}), "[object Function]"); assertEq(toString.call(function(a){}), "[object Function]"); assertEq(toString.call(function a(b){}), "[object Function]"); assertEq(toString.call(function(){}.bind()), "[object Function]"); assertEq(toString.call(function a(){}.bind()), "[object Function]"); assertEq(toString.call(function(a){}.bind()), "[object Function]"); assertEq(toString.call(function a(b){}.bind()), "[object Function]"); /* * 11. Set the [[Prototype]] internal property of F to the standard built-in * Function prototype object as specified in 15.3.3.1. */ assertEq(Object.getPrototypeOf(bind.call(function(){})), Function.prototype); assertEq(Object.getPrototypeOf(bind.call(function a(){})), Function.prototype); assertEq(Object.getPrototypeOf(bind.call(function(a){})), Function.prototype); assertEq(Object.getPrototypeOf(bind.call(function a(b){})), Function.prototype); /* * 12. Set the [[Call]] internal property of F as described in 15.3.4.5.1. */ var a = Array.bind(1, 2); assertEq(a().length, 2); assertEq(a(4).length, 2); assertEq(a(4, 8).length, 3); function t() { return this; } var bt = t.bind(t); assertEq(bt(), t); function callee() { return arguments.callee; } var call = callee.bind(); assertEq(call(), callee); assertEq(new call(), callee); /* * 13. Set the [[Construct]] internal property of F as described in 15.3.4.5.2. */ function Point(x, y) { this.x = x; this.y = y; } var YAxisPoint = Point.bind(null, 0) assertEq(YAxisPoint.hasOwnProperty("prototype"), false); var p = new YAxisPoint(5); assertEq(p.x, 0); assertEq(p.y, 5); assertEq(p instanceof Point, true); assertEq(p instanceof YAxisPoint, true); assertEq(Object.prototype.toString.call(YAxisPoint), "[object Function]"); assertEq(YAxisPoint.length, 1); /* * 14. Set the [[HasInstance]] internal property of F as described in * 15.3.4.5.3. */ function JoinArguments() { this.args = Array.prototype.join.call(arguments, ", "); } var Join1 = JoinArguments.bind(null, 1); var Join2 = Join1.bind(null, 2); var Join3 = Join2.bind(null, 3); var Join4 = Join3.bind(null, 4); var Join5 = Join4.bind(null, 5); var Join6 = Join5.bind(null, 6); var r = new Join6(7); assertEq(r instanceof Join6, true); assertEq(r instanceof Join5, true); assertEq(r instanceof Join4, true); assertEq(r instanceof Join3, true); assertEq(r instanceof Join2, true); assertEq(r instanceof Join1, true); assertEq(r instanceof JoinArguments, true); assertEq(r.args, "1, 2, 3, 4, 5, 6, 7"); /* * 15. If the [[Class]] internal property of Target is "Function", then * a. Let L be the length property of Target minus the length of A. * b. Set the length own property of F to either 0 or L, whichever is larger. * 16. Else set the length own property of F to 0. */ function none() { return arguments.length; } assertEq(none.bind(1, 2)(3, 4), 3); assertEq(none.bind(1, 2)(), 1); assertEq(none.bind(1)(2, 3), 2); assertEq(none.bind().length, 0); assertEq(none.bind(null).length, 0); assertEq(none.bind(null, 1).length, 0); assertEq(none.bind(null, 1, 2).length, 0); function one(a) { } assertEq(one.bind().length, 1); assertEq(one.bind(null).length, 1); assertEq(one.bind(null, 1).length, 0); assertEq(one.bind(null, 1, 2).length, 0); // retch var br = Object.create(null, { length: { value: 0 } }); try { br = bind.call(/a/g, /a/g, "aaaa"); } catch (e) { /* nothing */ } assertEq(br.length, 0); /* * 17. Set the attributes of the length own property of F to the values * specified in 15.3.5.1. */ var len1Desc = Object.getOwnPropertyDescriptor(function(a, b, c){}.bind(), "length"); assertEq(len1Desc.value, 3); assertEq(len1Desc.writable, false); assertEq(len1Desc.enumerable, false); assertEq(len1Desc.configurable, false); var len2Desc = Object.getOwnPropertyDescriptor(function(a, b, c){}.bind(null, 2), "length"); assertEq(len2Desc.value, 2); assertEq(len2Desc.writable, false); assertEq(len2Desc.enumerable, false); assertEq(len2Desc.configurable, false); /* * 18. Set the [[Extensible]] internal property of F to true. */ var bound = (function() { }).bind(); var isExtensible = Object.isExtensible || function() { return true; }; assertEq(isExtensible(bound), true); bound.foo = 17; var fooDesc = Object.getOwnPropertyDescriptor(bound, "foo"); assertEq(fooDesc.value, 17); assertEq(fooDesc.writable, true); assertEq(fooDesc.enumerable, true); assertEq(fooDesc.configurable, true); /* * 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3). * 20. Call the [[DefineOwnProperty]] internal method of F with arguments * "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]: thrower, * [[Enumerable]]: false, [[Configurable]]: false}, and false. * 21. Call the [[DefineOwnProperty]] internal method of F with arguments * "arguments", PropertyDescriptor {[[Get]]: thrower, [[Set]]: thrower, * [[Enumerable]]: false, [[Configurable]]: false}, and false. */ function f() { "use strict"; } var canonicalTTE = Object.getOwnPropertyDescriptor(f, "caller").get; var tte; var boundf = f.bind(); var boundfCaller = Object.getOwnPropertyDescriptor(boundf, "caller"); assertEq("get" in boundfCaller, true); assertEq("set" in boundfCaller, true); tte = boundfCaller.get; assertEq(tte, canonicalTTE); assertEq(tte, boundfCaller.set); var boundfArguments = Object.getOwnPropertyDescriptor(boundf, "arguments"); assertEq("get" in boundfArguments, true); assertEq("set" in boundfArguments, true); tte = boundfArguments.get; assertEq(tte, canonicalTTE); assertEq(tte, boundfArguments.set); /* 22. Return F. */ var passim = function p(){}.bind(1); assertEq(typeof passim, "function"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/function-call.js0000644000175000017500000000542411545150464023453 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ //----------------------------------------------------------------------------- var BUGNUMBER = 575535; var summary = 'Function.prototype.call'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ function expectTypeError(fun, msg) { try { fun(); assertEq(true, false, "should have thrown a TypeError"); } catch (e) { assertEq(e instanceof TypeError, true, msg + "; instead threw " + e); } } function fun() { } var global = this; assertEq(Function.prototype.call.length, 1); /* Step 1. */ var nonfuns = [null, 1, -1, 2.5, "[[Call]]", undefined, true, false, {}]; for (var i = 0, sz = nonfuns.length; i < sz; i++) { var f = function() { Function.prototype.call.apply(nonfuns[i]); }; var msg = "expected TypeError calling Function.prototype.call with uncallable this"; expectTypeError(f, msg); } /* Steps 2-4. */ function none() { assertEq(this, global, "bad this"); assertEq(arguments.length, 0, "wrong arguments"); } none.call(); none.call(undefined); none.call(null); var seenThis; function strictNone() { "use strict"; assertEq(this, seenThis, "bad this"); assertEq(arguments.length, 0, "wrong arguments"); } seenThis = undefined; strictNone.call(); strictNone.call(undefined); seenThis = null; strictNone.call(null); seenThis = 17; strictNone.call(17); var seenThisBox, args; function some() { assertEq(this instanceof seenThisBox, true, "this not instanceof " + seenThisBox); assertEq(this.valueOf(), seenThis, "wrong this valueOf()"); assertEq(arguments.length, args.length, "wrong arguments count"); for (var i = 0; i < args.length; i++) assertEq(arguments[i], args[i], "wrong argument " + i); } seenThis = false; seenThisBox = Boolean; args = [8, 6, 7, NaN, undefined, 0.3]; some.call(false, 8, 6, 7, NaN, undefined, 0.3); var obj = {}; seenThis = "foo"; seenThisBox = String; args = [obj]; some.call("foo", obj); seenThis = obj; seenThisBox = Object; some.call(obj, obj); function strictSome() { "use strict"; assertEq(this, seenThis, "wrong this"); assertEq(arguments.length, args.length, "wrong arguments count"); for (var i = 0; i < args.length; i++) assertEq(arguments[i], args[i], "wrong argument " + i); } seenThis = NaN; args = [8, 6, 7, NaN, undefined, 0.3]; strictSome.call(NaN, 8, 6, 7, NaN, undefined, 0.3); seenThis = "foo"; args = [obj]; strictSome.call("foo", obj); seenThis = obj; strictSome.call(obj, obj); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/function-caller.js0000644000175000017500000000406211545150464023777 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var gTestfile = 'function-caller.js'; var BUGNUMBER = 514581; var summary = "Function.prototype.caller should throw a TypeError for " + "strict-mode functions"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ // behavior function expectTypeError(fun) { try { fun(); throw new Error("didn't throw"); } catch (e) { assertEq(e instanceof TypeError, true, "expected TypeError calling function" + ("name" in fun ? " " + fun.name : "") + ", instead got: " + e); } } function bar() { "use strict"; } expectTypeError(function barCaller() { bar.caller; }); function baz() { "use strict"; return 17; } expectTypeError(function bazCaller() { baz.caller; }); // accessor identity function strictMode() { "use strict"; return 42; } var canonicalTTE = Object.getOwnPropertyDescriptor(strictMode, "caller").get; var barCaller = Object.getOwnPropertyDescriptor(bar, "caller"); assertEq("get" in barCaller, true); assertEq("set" in barCaller, true); assertEq(barCaller.get, canonicalTTE); assertEq(barCaller.set, canonicalTTE); var barArguments = Object.getOwnPropertyDescriptor(bar, "arguments"); assertEq("get" in barArguments, true); assertEq("set" in barArguments, true); assertEq(barArguments.get, canonicalTTE); assertEq(barArguments.set, canonicalTTE); var bazCaller = Object.getOwnPropertyDescriptor(baz, "caller"); assertEq("get" in bazCaller, true); assertEq("set" in bazCaller, true); assertEq(bazCaller.get, canonicalTTE); assertEq(bazCaller.set, canonicalTTE); var bazArguments = Object.getOwnPropertyDescriptor(baz, "arguments"); assertEq("get" in bazArguments, true); assertEq("set" in bazArguments, true); assertEq(bazArguments.get, canonicalTTE); assertEq(bazArguments.set, canonicalTTE); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/jstests.list0000644000175000017500000000056311545150464022752 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/Function/ script 10.2.1.1.6.js script 15.3.4.3-01.js script arguments-caller-callee.js script function-caller.js script strict-arguments.js script arguments-property-attributes.js script function-bind.js script function-call.js script redefine-arguments-length.js script builtin-no-prototype.js script Function-arguments-gc.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/redefine-arguments-length.js0000644000175000017500000000306311545150464025755 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var gTestfile = 'redefine-arguments-length.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 539766; var summary = "Object.defineProperty sets arguments.length without setting the " + "length-overridden bit"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ function test_JSOP_ARGCNT() { var length = "length"; Object.defineProperty(arguments, length, { value: 17 }); assertEq(arguments.length, 17); assertEq(arguments[length], 17); } test_JSOP_ARGCNT(); function test_js_fun_apply() { var length = "length"; Object.defineProperty(arguments, length, { value: 17 }); function fun() { assertEq(arguments.length, 17); assertEq(arguments[length], 17); assertEq(arguments[0], "foo"); for (var i = 1; i < 17; i++) assertEq(arguments[i], undefined); } fun.apply(null, arguments); } test_js_fun_apply("foo"); function test_array_toString_sub_1() { Object.defineProperty(arguments, "length", { value: 1 }); arguments.join = [].join; assertEq([].toString.call(arguments), "1"); } test_array_toString_sub_1(1, 2); function test_array_toString_sub_2() { Object.defineProperty(arguments, "length", { value: 1 }); assertEq([].toLocaleString.call(arguments), "1"); } test_array_toString_sub_2(1, 2); /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/shell.js0000644000175000017500000000000011545150464022005 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Function/strict-arguments.js0000644000175000017500000002375411545150464024236 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var gTestfile = 'strict-arguments.js'; var BUGNUMBER = 516255; var summary = "ES5 strict mode: arguments objects of strict mode functions must copy " + "argument values"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ function arrayEvery(arr, fun) { return Array.prototype.every.call(arr, fun); } function arraysEqual(a1, a2) { return a1.length === a2.length && arrayEvery(a1, function(v, i) { return v === a2[i]; }); } /************************ * NON-STRICT ARGUMENTS * ************************/ var obj = {}; function noargs() { return arguments; } assertEq(arraysEqual(noargs(), []), true); assertEq(arraysEqual(noargs(1), [1]), true); assertEq(arraysEqual(noargs(2, obj, 8), [2, obj, 8]), true); function args(a) { return arguments; } assertEq(arraysEqual(args(), []), true); assertEq(arraysEqual(args(1), [1]), true); assertEq(arraysEqual(args(1, obj), [1, obj]), true); assertEq(arraysEqual(args("foopy"), ["foopy"]), true); function assign(a) { a = 17; return arguments; } assertEq(arraysEqual(assign(1), [17]), true); function getLaterAssign(a) { var o = arguments; a = 17; return o; } assertEq(arraysEqual(getLaterAssign(1), [17]), true); function assignElementGetParameter(a) { arguments[0] = 17; return a; } assertEq(assignElementGetParameter(42), 17); function assignParameterGetElement(a) { a = 17; return arguments[0]; } assertEq(assignParameterGetElement(42), 17); /******************** * STRICT ARGUMENTS * ********************/ function strictNoargs() { "use strict"; return arguments; } assertEq(arraysEqual(strictNoargs(), []), true); assertEq(arraysEqual(strictNoargs(1), [1]), true); assertEq(arraysEqual(strictNoargs(1, obj), [1, obj]), true); function strictArgs(a) { "use strict"; return arguments; } assertEq(arraysEqual(strictArgs(), []), true); assertEq(arraysEqual(strictArgs(1), [1]), true); assertEq(arraysEqual(strictArgs(1, obj), [1, obj]), true); function strictAssign(a) { "use strict"; a = 17; return arguments; } assertEq(arraysEqual(strictAssign(), []), true); assertEq(arraysEqual(strictAssign(1), [1]), true); assertEq(arraysEqual(strictAssign(1, obj), [1, obj]), true); var upper; function strictAssignAfter(a) { "use strict"; upper = arguments; a = 42; return upper; } assertEq(arraysEqual(strictAssignAfter(), []), true); assertEq(arraysEqual(strictAssignAfter(17), [17]), true); assertEq(arraysEqual(strictAssignAfter(obj), [obj]), true); function strictMaybeAssignOuterParam(p) { "use strict"; function inner() { p = 17; } return arguments; } assertEq(arraysEqual(strictMaybeAssignOuterParam(), []), true); assertEq(arraysEqual(strictMaybeAssignOuterParam(42), [42]), true); assertEq(arraysEqual(strictMaybeAssignOuterParam(obj), [obj]), true); function strictAssignOuterParam(p) { "use strict"; function inner() { p = 17; } inner(); return arguments; } assertEq(arraysEqual(strictAssignOuterParam(), []), true); assertEq(arraysEqual(strictAssignOuterParam(17), [17]), true); assertEq(arraysEqual(strictAssignOuterParam(obj), [obj]), true); function strictAssignOuterParamPSYCH(p) { "use strict"; function inner(p) { p = 17; } inner(); return arguments; } assertEq(arraysEqual(strictAssignOuterParamPSYCH(), []), true); assertEq(arraysEqual(strictAssignOuterParamPSYCH(17), [17]), true); assertEq(arraysEqual(strictAssignOuterParamPSYCH(obj), [obj]), true); function strictEval(code, p) { "use strict"; eval(code); return arguments; } assertEq(arraysEqual(strictEval("1", 2), ["1", 2]), true); assertEq(arraysEqual(strictEval("arguments"), ["arguments"]), true); assertEq(arraysEqual(strictEval("p = 2"), ["p = 2"]), true); assertEq(arraysEqual(strictEval("p = 2", 17), ["p = 2", 17]), true); assertEq(arraysEqual(strictEval("arguments[0] = 17"), [17]), true); assertEq(arraysEqual(strictEval("arguments[0] = 17", 42), [17, 42]), true); function strictMaybeNestedEval(code, p) { "use strict"; function inner() { eval(code); } return arguments; } assertEq(arraysEqual(strictMaybeNestedEval("1", 2), ["1", 2]), true); assertEq(arraysEqual(strictMaybeNestedEval("arguments"), ["arguments"]), true); assertEq(arraysEqual(strictMaybeNestedEval("p = 2"), ["p = 2"]), true); assertEq(arraysEqual(strictMaybeNestedEval("p = 2", 17), ["p = 2", 17]), true); function strictNestedEval(code, p) { "use strict"; function inner() { eval(code); } inner(); return arguments; } assertEq(arraysEqual(strictNestedEval("1", 2), ["1", 2]), true); assertEq(arraysEqual(strictNestedEval("arguments"), ["arguments"]), true); assertEq(arraysEqual(strictNestedEval("p = 2"), ["p = 2"]), true); assertEq(arraysEqual(strictNestedEval("p = 2", 17), ["p = 2", 17]), true); assertEq(arraysEqual(strictNestedEval("arguments[0] = 17"), ["arguments[0] = 17"]), true); assertEq(arraysEqual(strictNestedEval("arguments[0] = 17", 42), ["arguments[0] = 17", 42]), true); function strictAssignArguments(a) { "use strict"; arguments[0] = 42; return a; } assertEq(strictAssignArguments(), undefined); assertEq(strictAssignArguments(obj), obj); assertEq(strictAssignArguments(17), 17); function strictAssignParameterGetElement(a) { "use strict"; a = 17; return arguments[0]; } assertEq(strictAssignParameterGetElement(42), 42); function strictNestedAssignShadowVar(p) { "use strict"; function inner() { var p = 12; function innermost() { p = 1776; return 12; } return innermost(); } return arguments; } assertEq(arraysEqual(strictNestedAssignShadowVar(), []), true); assertEq(arraysEqual(strictNestedAssignShadowVar(99), [99]), true); assertEq(arraysEqual(strictNestedAssignShadowVar(""), [""]), true); assertEq(arraysEqual(strictNestedAssignShadowVar(obj), [obj]), true); function strictNestedAssignShadowCatch(p) { "use strict"; function inner() { try { } catch (p) { var f = function innermost() { p = 1776; return 12; }; f(); } } return arguments; } assertEq(arraysEqual(strictNestedAssignShadowCatch(), []), true); assertEq(arraysEqual(strictNestedAssignShadowCatch(99), [99]), true); assertEq(arraysEqual(strictNestedAssignShadowCatch(""), [""]), true); assertEq(arraysEqual(strictNestedAssignShadowCatch(obj), [obj]), true); function strictNestedAssignShadowCatchCall(p) { "use strict"; function inner() { try { } catch (p) { var f = function innermost() { p = 1776; return 12; }; f(); } } inner(); return arguments; } assertEq(arraysEqual(strictNestedAssignShadowCatchCall(), []), true); assertEq(arraysEqual(strictNestedAssignShadowCatchCall(99), [99]), true); assertEq(arraysEqual(strictNestedAssignShadowCatchCall(""), [""]), true); assertEq(arraysEqual(strictNestedAssignShadowCatchCall(obj), [obj]), true); function strictNestedAssignShadowFunction(p) { "use strict"; function inner() { function p() { } p = 1776; } return arguments; } assertEq(arraysEqual(strictNestedAssignShadowFunction(), []), true); assertEq(arraysEqual(strictNestedAssignShadowFunction(99), [99]), true); assertEq(arraysEqual(strictNestedAssignShadowFunction(""), [""]), true); assertEq(arraysEqual(strictNestedAssignShadowFunction(obj), [obj]), true); function strictNestedAssignShadowFunctionCall(p) { "use strict"; function inner() { function p() { } p = 1776; } return arguments; } assertEq(arraysEqual(strictNestedAssignShadowFunctionCall(), []), true); assertEq(arraysEqual(strictNestedAssignShadowFunctionCall(99), [99]), true); assertEq(arraysEqual(strictNestedAssignShadowFunctionCall(""), [""]), true); assertEq(arraysEqual(strictNestedAssignShadowFunctionCall(obj), [obj]), true); function strictNestedShadowAndMaybeEval(code, p) { "use strict"; function inner(p) { eval(code); } return arguments; } assertEq(arraysEqual(strictNestedShadowAndMaybeEval("1", 2), ["1", 2]), true); assertEq(arraysEqual(strictNestedShadowAndMaybeEval("arguments"), ["arguments"]), true); assertEq(arraysEqual(strictNestedShadowAndMaybeEval("p = 2"), ["p = 2"]), true); assertEq(arraysEqual(strictNestedShadowAndMaybeEval("p = 2", 17), ["p = 2", 17]), true); assertEq(arraysEqual(strictNestedShadowAndMaybeEval("arguments[0] = 17"), ["arguments[0] = 17"]), true); assertEq(arraysEqual(strictNestedShadowAndMaybeEval("arguments[0] = 17", 42), ["arguments[0] = 17", 42]), true); function strictNestedShadowAndEval(code, p) { "use strict"; function inner(p) { eval(code); } return arguments; } assertEq(arraysEqual(strictNestedShadowAndEval("1", 2), ["1", 2]), true); assertEq(arraysEqual(strictNestedShadowAndEval("arguments"), ["arguments"]), true); assertEq(arraysEqual(strictNestedShadowAndEval("p = 2"), ["p = 2"]), true); assertEq(arraysEqual(strictNestedShadowAndEval("p = 2", 17), ["p = 2", 17]), true); assertEq(arraysEqual(strictNestedShadowAndEval("arguments[0] = 17"), ["arguments[0] = 17"]), true); assertEq(arraysEqual(strictNestedShadowAndEval("arguments[0] = 17", 42), ["arguments[0] = 17", 42]), true); function strictEvalContainsMutation(code) { "use strict"; return eval(code); } assertEq(arraysEqual(strictEvalContainsMutation("code = 17; arguments"), ["code = 17; arguments"]), true); assertEq(arraysEqual(strictEvalContainsMutation("arguments[0] = 17; arguments"), [17]), true); assertEq(strictEvalContainsMutation("arguments[0] = 17; code"), "arguments[0] = 17; code"); function strictNestedAssignShadowFunctionName(p) { "use strict"; function inner() { function p() { p = 1776; } p(); } inner(); return arguments; } assertEq(arraysEqual(strictNestedAssignShadowFunctionName(), []), true); assertEq(arraysEqual(strictNestedAssignShadowFunctionName(99), [99]), true); assertEq(arraysEqual(strictNestedAssignShadowFunctionName(""), [""]), true); assertEq(arraysEqual(strictNestedAssignShadowFunctionName(obj), [obj]), true); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/adding-global-var-nonextensible-error.js0000644000175000017500000000156211545150464027603 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 621432; var summary = "If a var statement can't create a global property because the global " + "object isn't extensible, and an error is thrown while decompiling the " + "global, don't assert"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var toSource = []; Object.preventExtensions(this); try { eval("var x;"); throw new Error("no error thrown"); } catch (e) { reportCompare(e instanceof TypeError, true, "expected TypeError, got: " + e); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/browser.js0000644000175000017500000000000111545150464021775 0ustar chr1schr1s mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/direct-eval-but-not.js0000644000175000017500000000134411545150464024112 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 609256; var summary = "Don't crash doing a direct eval when eval doesn't resolve to an object " + "(let alone the original eval function)"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var eval = ""; try { eval(); throw new Error("didn't throw?"); } catch (e) { assertEq(e instanceof TypeError, true); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/eval-01.js0000644000175000017500000000211111545150464021463 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var a = 9; var global = this; function test() { var a = 0; // direct eval sees local a assertEq(eval('a+1'), 1); assertEq(eval('eval("a+1")'), 1); // indirect: using a name other than 'eval' var foo = eval; assertEq(foo('a+1'), 10); assertEq(eval('foo("a+1")'), 10); // outer eval is direct, inner foo("a+1") is indirect // indirect: qualified method call assertEq(this.eval("a+1"), 10); assertEq(global.eval("a+1"), 10); var obj = {foo: eval, eval: eval}; assertEq(obj.foo('a+1'), 10); assertEq(obj.eval('a+1'), 10); var name = "eval"; assertEq(obj[name]('a+1'), 10); assertEq([eval][0]('a+1'), 10); // indirect: not called from a CallExpression at all assertEq(eval.call(undefined, 'a+1'), 10); assertEq(eval.call(global, 'a+1'), 10); assertEq(eval.apply(undefined, ['a+1']), 10); assertEq(eval.apply(global, ['a+1']), 10); assertEq(['a+1'].map(eval)[0], 10); } test(); reportCompare(0, 0); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/eval-02.js0000644000175000017500000000136711545150464021500 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var a = 9; function directArg(eval, s) { var a = 1; return eval(s); } function directVar(f, s) { var eval = f; var a = 1; return eval(s); } function directWith(obj, s) { var f; with (obj) { f = function () { var a = 1; return eval(s); }; } return f(); } // direct eval, even though 'eval' is an argument assertEq(directArg(eval, 'a+1'), 2); // direct eval, even though 'eval' is a var assertEq(directVar(eval, 'a+1'), 2); // direct eval, even though 'eval' is found via a with block assertEq(directWith(this, 'a+1'), 2); assertEq(directWith({eval: eval, a: -1000}, 'a+1'), 2); reportCompare(0, 0); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/eval-in-strict-eval-in-normal-function.js0000644000175000017500000000162011545150464027625 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 620130; var summary = "Calls to eval with same code + varying strict mode of script containing " + "eval == fail"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ function t(code) { return eval(code); } assertEq(t("'use strict'; try { eval('with (5) 17'); } catch (e) { 'threw'; }"), "threw"); assertEq(t("try { eval('with (5) 17'); } catch (e) { 'threw'; }"), 17); assertEq(t("'use strict'; try { eval('with (5) 17'); } catch (e) { 'threw'; }"), "threw"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/eval-inside-with-is-direct.js0000644000175000017500000000121411545150464025353 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 601307; var summary = "with (...) eval(...) is a direct eval"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var t = "global"; function test() { var t = "local"; with ({}) return eval("t"); } assertEq(test(), "local"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/eval-native-callback-is-indirect.js0000644000175000017500000000141311545150464026477 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 604504; var summary = "eval called from a native function is indirect"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var originalEval = eval; var global = this; var directCheckCode = "this === global"; function testBound() { var global = "psych!"; var eval = originalEval.bind(undefined, directCheckCode); assertEq(eval(), true); } testBound(); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/jstests.list0000644000175000017500000000063011545150464022360 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/Global/ fails-if(!xulRuntime.shell) script adding-global-var-nonextensible-error.js script parseInt-01.js script parseFloat-01.js script eval-01.js script eval-02.js script eval-inside-with-is-direct.js script parenthesized-eval-is-direct.js script eval-native-callback-is-indirect.js script direct-eval-but-not.js script eval-in-strict-eval-in-normal-function.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/parenthesized-eval-is-direct.js0000644000175000017500000000254511545150464026004 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- print("(eval)(...) is a direct eval, (1, eval)() isn't, etc."); /************** * BEGIN TEST * **************/ /* * Justification: * * https://mail.mozilla.org/pipermail/es5-discuss/2010-October/003724.html * * Note also bug 537673. */ var t = "global"; function group() { var t = "local"; return (eval)("t"); } assertEq(group(), "local"); function groupAndComma() { var t = "local"; return (1, eval)("t"); } assertEq(groupAndComma(), "global"); function groupAndTrueTernary() { var t = "local"; return (true ? eval : null)("t"); } assertEq(groupAndTrueTernary(), "global"); function groupAndEmptyStringTernary() { var t = "local"; return ("" ? null : eval)("t"); } assertEq(groupAndEmptyStringTernary(), "global"); function groupAndZeroTernary() { var t = "local"; return (0 ? null : eval)("t"); } assertEq(groupAndZeroTernary(), "global"); function groupAndNaNTernary() { var t = "local"; return (0 / 0 ? null : eval)("t"); } assertEq(groupAndNaNTernary(), "global"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/parseFloat-01.js0000644000175000017500000000130411545150464022637 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 613492; var summary = "ES5 15.1.2.3 parseFloat(string)"; print(BUGNUMBER + ": " + summary); assertEq(parseFloat("Infinity"), Infinity); assertEq(parseFloat("+Infinity"), Infinity); assertEq(parseFloat("-Infinity"), -Infinity); assertEq(parseFloat("inf"), NaN); assertEq(parseFloat("Inf"), NaN); assertEq(parseFloat("infinity"), NaN); assertEq(parseFloat("nan"), NaN); assertEq(parseFloat("NaN"), NaN); if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/parseInt-01.js0000644000175000017500000001224211545150464022327 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 577536; var summary = "ES5 15.1.2.2 parseInt(string, radix)"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var str, radix; var upvar; /* 1. Let inputString be ToString(string). */ assertEq(parseInt({ toString: function() { return "17" } }, 10), 17); upvar = 0; str = { get toString() { upvar++; return function() { upvar++; return "12345"; } } }; assertEq(parseInt(str, 10), 12345); assertEq(upvar, 2); /* * 2. Let S be a newly created substring of inputString consisting of the first * character that is not a StrWhiteSpaceChar and all characters following * that character. (In other words, remove leading white space.) */ var ws = ["\t", "\v", "\f", " ", "\xA0", "\uFEFF", "\u2004", "\u3000", // a few Unicode whitespaces "\r", "\n", "\u2028", "\u2029"]; str = "8675309"; for (var i = 0, sz = ws.length; i < sz; i++) { assertEq(parseInt(ws[i] + str, 10), 8675309); for (var j = 0, sz = ws.length; j < sz; j++) { assertEq(parseInt(ws[i] + ws[j] + str, 10), 8675309, ws[i].charCodeAt(0).toString(16) + ", " + ws[j].charCodeAt(0).toString(16)); } } /* * 3. Let sign be 1. * 4. If S is not empty and the first character of S is a minus sign -, let * sign be −1. */ str = "5552368"; assertEq(parseInt("-" + str, 10), -parseInt(str, 10)); assertEq(parseInt(" -" + str, 10), -parseInt(str, 10)); assertEq(parseInt("-", 10), NaN); assertEq(parseInt("", 10), NaN); assertEq(parseInt("-0", 10), -0); /* * 5. If S is not empty and the first character of S is a plus sign + or a * minus sign -, then remove the first character from S. */ assertEq(parseInt("+12345", 10), 12345); assertEq(parseInt(" +12345", 10), 12345); assertEq(parseInt("-12345", 10), -12345); assertEq(parseInt(" -12345", 10), -12345); /* * 6. Let R = ToInt32(radix). */ upvar = ""; str = { toString: function() { if (!upvar) upvar = "string"; return "42"; } }; radix = { toString: function() { if (!upvar) upvar = "radix"; return "10"; } }; assertEq(parseInt(str, radix), 42); assertEq(upvar, "string"); assertEq(parseInt("123", null), 123); assertEq(parseInt("123", undefined), 123); assertEq(parseInt("123", NaN), 123); assertEq(parseInt("123", -0), 123); assertEq(parseInt("10", 72057594037927950), 16); assertEq(parseInt("10", -4294967292), 4); assertEq(parseInt("0x10", 1e308), 16); assertEq(parseInt("10", 1e308), 10); assertEq(parseInt("10", { valueOf: function() { return 16; } }), 16); /* * 7. Let stripPrefix be true. * 8. If R ≠ 0, then * a. If R < 2 or R > 36, then return NaN. * b. If R ≠ 16, let stripPrefix be false. * 9. Else, R = 0 * a. Let R = 10. * 10. If stripPrefix is true, then * a. If the length of S is at least 2 and the first two characters of S * are either “0x†or “0Xâ€, then remove the first two characters from S and * let R = 16. */ var vs = ["1", "51", "917", "2343", "99963"]; for (var i = 0, sz = vs.length; i < sz; i++) assertEq(parseInt(vs[i], 0), parseInt(vs[i], 10), "bad " + vs[i]); assertEq(parseInt("0x10"), 16); assertEq(parseInt("0x10", 0), 16); assertEq(parseInt("0x10", 16), 16); assertEq(parseInt("0x10", 8), 0); assertEq(parseInt("-0x10", 16), -16); assertEq(parseInt("5", 1), NaN); assertEq(parseInt("5", 37), NaN); assertEq(parseInt("5", { valueOf: function() { return -1; } }), NaN); /* * 11. If S contains any character that is not a radix-R digit, then let Z be * the substring of S consisting of all characters before the first such * character; otherwise, let Z be S. * 12. If Z is empty, return NaN. */ assertEq(parseInt(""), NaN); assertEq(parseInt("ohai"), NaN); assertEq(parseInt("0xohai"), NaN); assertEq(parseInt("-ohai"), NaN); assertEq(parseInt("+ohai"), NaN); assertEq(parseInt(" ohai"), NaN); assertEq(parseInt("0xaohai"), 10); assertEq(parseInt("hohai", 18), 17); /* * 13. Let mathInt be the mathematical integer value that is represented by Z * in radix-R notation, using the letters A-Z and a-z for digits with * values 10 through 35. (However, if R is 10 and Z contains more than 20 * significant digits, every significant digit after the 20th may be * replaced by a 0 digit, at the option of the implementation; and if R is * not 2, 4, 8, 10, 16, or 32, then mathInt may be an implementation- * dependent approximation to the mathematical integer value that is * represented by Z in radix-R notation.) * 14. Let number be the Number value for mathInt. * 15. Return sign × number. */ assertEq(parseInt("ohai", 36), 1142154); assertEq(parseInt("0ohai", 36), 1142154); assertEq(parseInt("00ohai", 36), 1142154); assertEq(parseInt("A", 16), 10); assertEq(parseInt("0A", 16), 10); assertEq(parseInt("00A", 16), 10); assertEq(parseInt("A", 17), 10); assertEq(parseInt("0A", 17), 10); assertEq(parseInt("00A", 17), 10); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Global/shell.js0000644000175000017500000000000011545150464021420 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/JSON/browser.js0000644000175000017500000000000111545150464021346 0ustar chr1schr1s mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/JSON/cyclic-stringify.js0000644000175000017500000000442111545150464023157 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 578273; var summary = "ES5: Properly detect cycles in JSON.stringify (throw TypeError, check for " + "cycles rather than imprecisely rely on recursion limits)"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ // objects var count = 0; var desc = { get: function() { count++; return obj; }, enumerable: true, configurable: true }; var obj = Object.defineProperty({ p1: 0 }, "p2", desc); try { var str = JSON.stringify(obj); assertEq(false, true, "should have thrown, got " + str); } catch (e) { assertEq(e instanceof TypeError, true, "wrong error type: " + e.constructor.name); assertEq(count, 1, "cyclic data structures not detected immediately"); } count = 0; var obj2 = Object.defineProperty({}, "obj", desc); try { var str = JSON.stringify(obj2); assertEq(false, true, "should have thrown, got " + str); } catch (e) { assertEq(e instanceof TypeError, true, "wrong error type: " + e.constructor.name); assertEq(count, 2, "cyclic data structures not detected immediately"); } // arrays var count = 0; var desc = { get: function() { count++; return arr; }, enumerable: true, configurable: true }; var arr = Object.defineProperty([], "0", desc); try { var str = JSON.stringify(arr); assertEq(false, true, "should have thrown, got " + str); } catch (e) { assertEq(e instanceof TypeError, true, "wrong error type: " + e.constructor.name); assertEq(count, 1, "cyclic data structures not detected immediately"); } count = 0; var arr2 = Object.defineProperty([], "0", desc); try { var str = JSON.stringify(arr2); assertEq(false, true, "should have thrown, got " + str); } catch (e) { assertEq(e instanceof TypeError, true, "wrong error type: " + e.constructor.name); assertEq(count, 2, "cyclic data structures not detected immediately"); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/JSON/jstests.list0000644000175000017500000000023111545150464021726 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/JSON/ script cyclic-stringify.js script small-codepoints.js script trailing-comma.js script stringify-gap.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/JSON/shell.js0000644000175000017500000000140111545150464020777 0ustar chr1schr1sgTestsubsuite='JSON'; function testJSON(str, expectSyntaxError) { try { JSON.parse(str); reportCompare(false, expectSyntaxError, "string <" + str + "> " + "should" + (expectSyntaxError ? "n't" : "") + " " + "have parsed as JSON"); } catch (e) { if (!(e instanceof SyntaxError)) { reportCompare(true, false, "parsing string <" + str + "> threw a non-SyntaxError " + "exception: " + e); } else { reportCompare(true, expectSyntaxError, "string <" + str + "> " + "should" + (expectSyntaxError ? "n't" : "") + " " + "have parsed as JSON, exception: " + e); } } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/JSON/small-codepoints.js0000644000175000017500000000075211545150464023155 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var gTestfile = 'small-codepoints.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 554079; var summary = 'JSON.parse should reject U+0000 through U+001F'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ for (var i = 0; i <= 0x1F; i++) testJSON('["a' + String.fromCharCode(i) + 'c"]', true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/JSON/stringify-gap.js0000644000175000017500000000230211545150464022454 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var gTestfile = 'stringify-gap.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 584909; var summary = "JSON.stringify(_1, _2, numberGreaterThanOne) produces wrong output"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var LF = "\n"; var GAP = " "; var obj = { a: { b: [1, 2], c: { d: 3, e: 4 }, f: [], g: {}, h: [5], i: { j: 6 } } }; var expected = '{\n' + ' "a": {\n' + ' "b": [\n' + ' 1,\n' + ' 2\n' + ' ],\n' + ' "c": {\n' + ' "d": 3,\n' + ' "e": 4\n' + ' },\n' + ' "f": [],\n' + ' "g": {},\n' + ' "h": [\n' + ' 5\n' + ' ],\n' + ' "i": {\n' + ' "j": 6\n' + ' }\n' + ' }\n' + '}'; assertEq(JSON.stringify(obj, null, 3), expected); assertEq(JSON.stringify(obj, null, " "), expected); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/JSON/trailing-comma.js0000644000175000017500000000152511545150464022602 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var gTestfile = 'trailing-comma.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 564621; var summary = 'JSON.parse should reject {"a" : "b",} or [1,]'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ testJSON('[]', false); testJSON('[1]', false); testJSON('["a"]', false); testJSON('{}', false); testJSON('{"a":1}', false); testJSON('{"a":"b"}', false); testJSON('{"a":true}', false); testJSON('[{}]', false); testJSON('[1,]', true); testJSON('["a",]', true); testJSON('{,}', true); testJSON('{"a":1,}', true); testJSON('{"a":"b",}', true); testJSON('{"a":true,}', true); testJSON('[{,}]', true); testJSON('[[1,]]', true); testJSON('[{"a":"b",}]', true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/browser.js0000644000175000017500000000000111545150464021530 0ustar chr1schr1s mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/builtin-methods-reject-null-undefined-this.js0000644000175000017500000001314711545150464030321 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 619283; var summary = "ECMAScript built-in methods that immediately throw when |this| is " + "|undefined| or |null| (due to CheckObjectCoercible, ToObject, or ToString)"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ // We can't just exhaustively loop over everything because 1) method properties // might be extensions with special |this| handling, and 2) some methods don't // *quite* immediately throw a TypeError, first thing, if |this| is |undefined| // or |null|, or their algorithms are very slightly ambiguous about whether they // do. Why? Ipse-dixitism. *shrug* var ClassToMethodMap = { Object: [/* "toString" has special |this| handling */ "toLocaleString", "valueOf", "hasOwnProperty", /* * "isPrototypeOf" has special |this| handling already tested in * ecma_5/Object/isPrototypeOf.js. */ /* * "isPrototypeOf" has special |this| handling already tested in * ecma_5/Object/propertyIsEnumerable.js. */], // Function methods often don't ToObject(this) as their very first step, // and they're already stepwise well-tested such that manual tests here // would be redundant. Array: ["toString", "toLocaleString", "concat", "join", "pop", "push", "reverse", "shift", "slice", "sort", "splice", "unshift", "indexOf", "lastIndexOf", "every", "some", "forEach", "map", "filter", "reduce", "reduceRight"], String: ["toString", "valueOf", "charAt", "charCodeAt", "concat", "indexOf", "lastIndexOf", "localeCompare", "match", "replace", "search", "slice", "split", "substring", "toLowerCase", "toLocaleLowerCase", "toUpperCase", "toLocaleUpperCase", "trim", /* * "trimLeft" and "trimRight" are non-standard and thus are tested * in ecma_5/extensions/trim-extensions.js. */ ], Boolean: ["toString", "valueOf"], Number: ["toString", "toLocaleString", "valueOf", /* * toFixed doesn't *immediately* test |this| for number or * Number-ness, but because the ToInteger(void 0) which arguably * precedes it in the toFixed algorithm won't throw in this test, * we don't need to specially test it. */ "toFixed", "toExponential", "toPrecision"], Date: ["toString", "toDateString", "toTimeString", "toLocaleString", "toLocaleDateString", "toLocaleTimeString", "valueOf", "getTime", "getFullYear", "getUTCFullYear", "getMonth", "getUTCMonth", "getDate", "getUTCDate", "getDay", "getUTCDay", "getHours", "getUTCHours", "getMinutes", "getUTCMinutes", "getSeconds", "getUTCSeconds", "getMilliseconds", "getUTCMilliseconds", /* * toFixed doesn't *immediately* test |this| for number or * Number-ness, but because the TimeClip(ToNumber(void 0)) which * arguably precedes it in the setTime algorithm won't throw in * this test, we don't need to specially test it. */ "setTime", "getTimezoneOffset", "setMilliseconds", "setUTCMilliseconds", "setSeconds", "setUTCSeconds", "setMinutes", "setUTCMinutes", "setHours", "setUTCHours", "setDate", "setUTCDate", "setMonth", "setUTCMonth", "setFullYear", "setUTCFullYear", "toUTCString", "toISOString", "toJSON"], RegExp: ["exec", "test", "toString"], Error: ["toString"], }; var badThisValues = [null, undefined]; function testMethod(Class, className, method) { var expr; // Try out explicit this values for (var i = 0, sz = badThisValues.length; i < sz; i++) { var badThis = badThisValues[i]; expr = className + ".prototype." + method + ".call(" + badThis + ")"; try { Class.prototype[method].call(badThis); throw new Error(expr + " didn't throw a TypeError"); } catch (e) { assertEq(e instanceof TypeError, true, "wrong error for " + expr + ", instead threw " + e); } expr = className + ".prototype." + method + ".apply(" + badThis + ")"; try { Class.prototype[method].apply(badThis); throw new Error(expr + " didn't throw a TypeError"); } catch (e) { assertEq(e instanceof TypeError, true, "wrong error for " + expr + ", instead threw " + e); } } // ..and for good measure.. expr = "(0, " + className + ".prototype." + method + ")()" try { // comma operator to call GetValue() on the method and de-Reference it (0, Class.prototype[method])(); throw new Error(expr + " didn't throw a TypeError"); } catch (e) { assertEq(e instanceof TypeError, true, "wrong error for " + expr + ", instead threw " + e); } } for (var className in ClassToMethodMap) { var Class = this[className]; var methodNames = ClassToMethodMap[className]; for (var i = 0, sz = methodNames.length; i < sz; i++) { var method = methodNames[i]; testMethod(Class, className, method); } } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/enumerate-undefined.js0000644000175000017500000000116011545150464024000 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 547087; var summary = 'JS_EnumerateStandardClasses uses wrong attributes for undefined'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ for (var p in this); assertEq(Object.getOwnPropertyDescriptor(this, "undefined").writable, false); /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/explicit-undefined-optional-argument.js0000644000175000017500000000144011545150464027300 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var BUGNUMBER = 373118; var summary = 'Properly handle explicitly-undefined optional arguments to a bunch of ' + 'functions'; print(BUGNUMBER + ": " + summary); //----------------------------------------------------------------------------- var a; a = "abc".slice(0, undefined); assertEq(a, "abc"); a = "abc".substr(0, undefined); assertEq(a, "abc"); a = "abc".substring(0, undefined); assertEq(a, "abc"); a = [1, 2, 3].slice(0, undefined); assertEq(a.join(), '1,2,3'); a = [1, 2, 3].sort(undefined); assertEq(a.join(), '1,2,3'); assertEq((20).toString(undefined), '20'); //----------------------------------------------------------------------------- reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/function-definition-eval.js0000644000175000017500000002566511545150464024774 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 577325; var summary = 'Implement the ES5 algorithm for processing function statements'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var outer, desc; /////////////////////////////////////////////////// // Function definitions over accessor properties // /////////////////////////////////////////////////// var getCalled, setCalled; // configurable properties get blown away getCalled = false, setCalled = false; Object.defineProperty(this, "acc1", { get: function() { getCalled = true; throw "FAIL get 1"; }, set: function(v) { setCalled = true; throw "FAIL set 1 " + v; }, configurable: true, enumerable: false }); // does not throw outer = undefined; eval("function acc1() { throw 'FAIL redefined 1'; } outer = acc1;"); assertEq(getCalled, false); assertEq(setCalled, false); assertEq(typeof acc1, "function"); assertEq(acc1, outer); desc = Object.getOwnPropertyDescriptor(this, "acc1"); assertEq(desc.value, acc1); assertEq(desc.writable, true); assertEq(desc.enumerable, true); assertEq(desc.configurable, true); getCalled = false, setCalled = false; Object.defineProperty(this, "acc2", { get: function() { getCalled = true; throw "FAIL get 2"; }, set: function(v) { setCalled = true; throw "FAIL set 2 " + v; }, configurable: true, enumerable: true }); // does not throw outer = undefined; eval("function acc2() { throw 'FAIL redefined 2'; } outer = acc2;"); assertEq(getCalled, false); assertEq(setCalled, false); assertEq(typeof acc2, "function"); assertEq(acc2, outer); desc = Object.getOwnPropertyDescriptor(this, "acc2"); assertEq(desc.value, acc2); assertEq(desc.writable, true); assertEq(desc.enumerable, true); assertEq(desc.configurable, true); // non-configurable properties produce a TypeError getCalled = false, setCalled = false; Object.defineProperty(this, "acc3", { get: function() { getCalled = true; throw "FAIL get 3"; }, set: function(v) { setCalled = true; throw "FAIL set 3 " + v; }, configurable: false, enumerable: true }); outer = undefined; try { eval("function acc3() { throw 'FAIL redefined 3'; }; outer = acc3"); throw new Error("should have thrown trying to redefine global function " + "over a non-configurable, enumerable accessor"); } catch (e) { assertEq(e instanceof TypeError, true, "global function definition, when that function would overwrite " + "a non-configurable, enumerable accessor, must throw a TypeError " + "per ES5+errata: " + e); desc = Object.getOwnPropertyDescriptor(this, "acc3"); assertEq(typeof desc.get, "function"); assertEq(typeof desc.set, "function"); assertEq(desc.enumerable, true); assertEq(desc.configurable, false); assertEq(outer, undefined); assertEq(getCalled, false); assertEq(setCalled, false); } getCalled = false, setCalled = false; Object.defineProperty(this, "acc4", { get: function() { getCalled = true; throw "FAIL get 4"; }, set: function(v) { setCalled = true; throw "FAIL set 4 " + v; }, configurable: false, enumerable: false }); outer = undefined; try { eval("function acc4() { throw 'FAIL redefined 4'; }; outer = acc4"); throw new Error("should have thrown trying to redefine global function " + "over a non-configurable, non-enumerable accessor"); } catch (e) { assertEq(e instanceof TypeError, true, "global function definition, when that function would overwrite " + "a non-configurable, non-enumerable accessor, must throw a " + "TypeError per ES5+errata: " + e); desc = Object.getOwnPropertyDescriptor(this, "acc4"); assertEq(typeof desc.get, "function"); assertEq(typeof desc.set, "function"); assertEq(desc.enumerable, false); assertEq(desc.configurable, false); assertEq(outer, undefined); assertEq(getCalled, false); assertEq(setCalled, false); } /////////////////////////////////////////////// // Function definitions over data properties // /////////////////////////////////////////////// // configurable properties, regardless of other attributes, get blown away Object.defineProperty(this, "data1", { configurable: true, enumerable: true, writable: true, value: "data1" }); outer = undefined; eval("function data1() { return 'data1 function'; } outer = data1;"); assertEq(typeof data1, "function"); assertEq(data1, outer); desc = Object.getOwnPropertyDescriptor(this, "data1"); assertEq(desc.configurable, true); assertEq(desc.enumerable, true); assertEq(desc.writable, true); assertEq(desc.value, data1); Object.defineProperty(this, "data2", { configurable: true, enumerable: true, writable: false, value: "data2" }); outer = undefined; eval("function data2() { return 'data2 function'; } outer = data2;"); assertEq(typeof data2, "function"); assertEq(data2, outer); desc = Object.getOwnPropertyDescriptor(this, "data2"); assertEq(desc.configurable, true); assertEq(desc.enumerable, true); assertEq(desc.writable, true); assertEq(desc.value, data2); Object.defineProperty(this, "data3", { configurable: true, enumerable: false, writable: true, value: "data3" }); outer = undefined; eval("function data3() { return 'data3 function'; } outer = data3;"); assertEq(typeof data3, "function"); assertEq(data3, outer); desc = Object.getOwnPropertyDescriptor(this, "data3"); assertEq(desc.configurable, true); assertEq(desc.enumerable, true); assertEq(desc.writable, true); assertEq(desc.value, data3); Object.defineProperty(this, "data4", { configurable: true, enumerable: false, writable: false, value: "data4" }); outer = undefined; eval("function data4() { return 'data4 function'; } outer = data4;"); assertEq(typeof data4, "function"); assertEq(data4, outer); desc = Object.getOwnPropertyDescriptor(this, "data4"); assertEq(desc.value, data4); assertEq(desc.writable, true); assertEq(desc.enumerable, true); assertEq(desc.configurable, true); // non-configurable data properties are trickier Object.defineProperty(this, "data5", { configurable: false, enumerable: true, writable: true, value: "data5" }); outer = undefined; eval("function data5() { return 'data5 function'; } outer = data5;"); assertEq(typeof data5, "function"); assertEq(data5, outer); desc = Object.getOwnPropertyDescriptor(this, "data5"); assertEq(desc.configurable, false); assertEq(desc.enumerable, true); assertEq(desc.writable, true); assertEq(desc.value, data5); Object.defineProperty(this, "data6", { configurable: false, enumerable: true, writable: false, value: "data6" }); outer = undefined; try { eval("function data6() { return 'data6 function'; } outer = data6;"); throw new Error("should have thrown trying to redefine global function " + "over a non-configurable, enumerable, non-writable accessor"); } catch (e) { assertEq(e instanceof TypeError, true, "global function definition, when that function would overwrite " + "a non-configurable, enumerable, non-writable data property, must " + "throw a TypeError per ES5+errata: " + e); assertEq(data6, "data6"); assertEq(outer, undefined); desc = Object.getOwnPropertyDescriptor(this, "data6"); assertEq(desc.configurable, false); assertEq(desc.enumerable, true); assertEq(desc.writable, false); assertEq(desc.value, "data6"); } Object.defineProperty(this, "data7", { configurable: false, enumerable: false, writable: true, value: "data7" }); outer = undefined; try { eval("function data7() { return 'data7 function'; } outer = data7;"); throw new Error("should have thrown trying to redefine global function " + "over a non-configurable, non-enumerable, writable data" + "property"); } catch (e) { assertEq(e instanceof TypeError, true, "global function definition, when that function would overwrite " + "a non-configurable, non-enumerable, writable data property, must " + "throw a TypeError per ES5+errata: " + e); assertEq(data7, "data7"); assertEq(outer, undefined); desc = Object.getOwnPropertyDescriptor(this, "data7"); assertEq(desc.configurable, false); assertEq(desc.enumerable, false); assertEq(desc.writable, true); assertEq(desc.value, "data7"); } Object.defineProperty(this, "data8", { configurable: false, enumerable: false, writable: false, value: "data8" }); outer = undefined; try { eval("function data8() { return 'data8 function'; } outer = data8;"); throw new Error("should have thrown trying to redefine global function " + "over a non-configurable, non-enumerable, non-writable data" + "property"); } catch (e) { assertEq(e instanceof TypeError, true, "global function definition, when that function would overwrite " + "a non-configurable, non-enumerable, non-writable data property, " + "must throw a TypeError per ES5+errata: " + e); assertEq(data8, "data8"); assertEq(outer, undefined); desc = Object.getOwnPropertyDescriptor(this, "data8"); assertEq(desc.configurable, false); assertEq(desc.enumerable, false); assertEq(desc.writable, false); assertEq(desc.value, "data8"); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/function-definition-evaluate.js0000644000175000017500000002575311545150464025651 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 577325; var summary = 'Implement the ES5 algorithm for processing function statements'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var outer, desc; /////////////////////////////////////////////////// // Function definitions over accessor properties // /////////////////////////////////////////////////// var getCalled, setCalled; // configurable properties get blown away getCalled = false, setCalled = false; Object.defineProperty(this, "acc1", { get: function() { getCalled = true; throw "FAIL get 1"; }, set: function(v) { setCalled = true; throw "FAIL set 1 " + v; }, configurable: true, enumerable: false }); // does not throw outer = undefined; evaluate("function acc1() { throw 'FAIL redefined 1'; } outer = acc1;"); assertEq(getCalled, false); assertEq(setCalled, false); assertEq(typeof acc1, "function"); assertEq(acc1, outer); desc = Object.getOwnPropertyDescriptor(this, "acc1"); assertEq(desc.value, acc1); assertEq(desc.writable, true); assertEq(desc.enumerable, true); assertEq(desc.configurable, false); getCalled = false, setCalled = false; Object.defineProperty(this, "acc2", { get: function() { getCalled = true; throw "FAIL get 2"; }, set: function(v) { setCalled = true; throw "FAIL set 2 " + v; }, configurable: true, enumerable: true }); // does not throw outer = undefined; evaluate("function acc2() { throw 'FAIL redefined 2'; } outer = acc2;"); assertEq(getCalled, false); assertEq(setCalled, false); assertEq(typeof acc2, "function"); assertEq(acc2, outer); desc = Object.getOwnPropertyDescriptor(this, "acc2"); assertEq(desc.value, acc2); assertEq(desc.writable, true); assertEq(desc.enumerable, true); assertEq(desc.configurable, false); // non-configurable properties produce a TypeError getCalled = false, setCalled = false; Object.defineProperty(this, "acc3", { get: function() { getCalled = true; throw "FAIL get 3"; }, set: function(v) { setCalled = true; throw "FAIL set 3 " + v; }, configurable: false, enumerable: true }); outer = undefined; try { evaluate("function acc3() { throw 'FAIL redefined 3'; }; outer = acc3"); throw new Error("should have thrown trying to redefine global function " + "over a non-configurable, enumerable accessor"); } catch (e) { assertEq(e instanceof TypeError, true, "global function definition, when that function would overwrite " + "a non-configurable, enumerable accessor, must throw a TypeError " + "per ES5+errata: " + e); desc = Object.getOwnPropertyDescriptor(this, "acc3"); assertEq(typeof desc.get, "function"); assertEq(typeof desc.set, "function"); assertEq(desc.enumerable, true); assertEq(desc.configurable, false); assertEq(outer, undefined); assertEq(getCalled, false); assertEq(setCalled, false); } getCalled = false, setCalled = false; Object.defineProperty(this, "acc4", { get: function() { getCalled = true; throw "FAIL get 4"; }, set: function(v) { setCalled = true; throw "FAIL set 4 " + v; }, configurable: false, enumerable: false }); outer = undefined; try { evaluate("function acc4() { throw 'FAIL redefined 4'; }; outer = acc4"); throw new Error("should have thrown trying to redefine global function " + "over a non-configurable, non-enumerable accessor"); } catch (e) { assertEq(e instanceof TypeError, true, "global function definition, when that function would overwrite " + "a non-configurable, non-enumerable accessor, must throw a " + "TypeError per ES5+errata: " + e); desc = Object.getOwnPropertyDescriptor(this, "acc4"); assertEq(typeof desc.get, "function"); assertEq(typeof desc.set, "function"); assertEq(desc.enumerable, false); assertEq(desc.configurable, false); assertEq(outer, undefined); assertEq(getCalled, false); assertEq(setCalled, false); } /////////////////////////////////////////////// // Function definitions over data properties // /////////////////////////////////////////////// // configurable properties, regardless of other attributes, get blown away Object.defineProperty(this, "data1", { configurable: true, enumerable: true, writable: true, value: "data1" }); outer = undefined; evaluate("function data1() { return 'data1 function'; } outer = data1;"); assertEq(typeof data1, "function"); assertEq(data1, outer); desc = Object.getOwnPropertyDescriptor(this, "data1"); assertEq(desc.configurable, false); assertEq(desc.enumerable, true); assertEq(desc.writable, true); assertEq(desc.value, data1); Object.defineProperty(this, "data2", { configurable: true, enumerable: true, writable: false, value: "data2" }); outer = undefined; evaluate("function data2() { return 'data2 function'; } outer = data2;"); assertEq(typeof data2, "function"); assertEq(data2, outer); desc = Object.getOwnPropertyDescriptor(this, "data2"); assertEq(desc.configurable, false); assertEq(desc.enumerable, true); assertEq(desc.writable, true); assertEq(desc.value, data2); Object.defineProperty(this, "data3", { configurable: true, enumerable: false, writable: true, value: "data3" }); outer = undefined; evaluate("function data3() { return 'data3 function'; } outer = data3;"); assertEq(typeof data3, "function"); assertEq(data3, outer); desc = Object.getOwnPropertyDescriptor(this, "data3"); assertEq(desc.configurable, false); assertEq(desc.enumerable, true); assertEq(desc.writable, true); assertEq(desc.value, data3); Object.defineProperty(this, "data4", { configurable: true, enumerable: false, writable: false, value: "data4" }); outer = undefined; evaluate("function data4() { return 'data4 function'; } outer = data4;"); assertEq(typeof data4, "function"); assertEq(data4, outer); desc = Object.getOwnPropertyDescriptor(this, "data4"); assertEq(desc.value, data4); assertEq(desc.writable, true); assertEq(desc.enumerable, true); assertEq(desc.configurable, false); // non-configurable data properties are trickier Object.defineProperty(this, "data5", { configurable: false, enumerable: true, writable: true, value: "data5" }); outer = undefined; evaluate("function data5() { return 'data5 function'; } outer = data5;"); assertEq(typeof data5, "function"); assertEq(data5, outer); desc = Object.getOwnPropertyDescriptor(this, "data5"); assertEq(desc.configurable, false); assertEq(desc.enumerable, true); assertEq(desc.writable, true); assertEq(desc.value, data5); Object.defineProperty(this, "data6", { configurable: false, enumerable: true, writable: false, value: "data6" }); outer = undefined; try { evaluate("function data6() { return 'data6 function'; } outer = data6;"); throw new Error("should have thrown trying to redefine global function " + "over a non-configurable, enumerable, non-writable accessor"); } catch (e) { assertEq(e instanceof TypeError, true, "global function definition, when that function would overwrite " + "a non-configurable, enumerable, non-writable data property, must " + "throw a TypeError per ES5+errata: " + e); assertEq(data6, "data6"); assertEq(outer, undefined); desc = Object.getOwnPropertyDescriptor(this, "data6"); assertEq(desc.configurable, false); assertEq(desc.enumerable, true); assertEq(desc.writable, false); assertEq(desc.value, "data6"); } Object.defineProperty(this, "data7", { configurable: false, enumerable: false, writable: true, value: "data7" }); outer = undefined; try { evaluate("function data7() { return 'data7 function'; } outer = data7;"); throw new Error("should have thrown trying to redefine global function " + "over a non-configurable, non-enumerable, writable data" + "property"); } catch (e) { assertEq(e instanceof TypeError, true, "global function definition, when that function would overwrite " + "a non-configurable, non-enumerable, writable data property, must " + "throw a TypeError per ES5+errata: " + e); assertEq(data7, "data7"); assertEq(outer, undefined); desc = Object.getOwnPropertyDescriptor(this, "data7"); assertEq(desc.configurable, false); assertEq(desc.enumerable, false); assertEq(desc.writable, true); assertEq(desc.value, "data7"); } Object.defineProperty(this, "data8", { configurable: false, enumerable: false, writable: false, value: "data8" }); outer = undefined; try { evaluate("function data8() { return 'data8 function'; } outer = data8;"); throw new Error("should have thrown trying to redefine global function " + "over a non-configurable, non-enumerable, non-writable data" + "property"); } catch (e) { assertEq(e instanceof TypeError, true, "global function definition, when that function would overwrite " + "a non-configurable, non-enumerable, non-writable data property, " + "must throw a TypeError per ES5+errata: " + e); assertEq(data8, "data8"); assertEq(outer, undefined); desc = Object.getOwnPropertyDescriptor(this, "data8"); assertEq(desc.configurable, false); assertEq(desc.enumerable, false); assertEq(desc.writable, false); assertEq(desc.value, "data8"); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/future-reserved-words.js0000644000175000017500000002643211545150464024350 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 497869; var summary = "Implement FutureReservedWords per-spec"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var futureReservedWords = [ "class", // "const", // Mozilla extension enabled even for versionless code "enum", "export", "extends", "import", "super", ]; var strictFutureReservedWords = [ "implements", "interface", "let", // enabled: this file doesn't execute as JS1.7 "package", "private", "protected", "public", "static", "yield", // enabled: this file doesn't execute as JS1.7 ]; function testWord(word, expectNormal, expectStrict) { var actual, status; // USE AS LHS FOR ASSIGNMENT if (expectNormal !== "skip") { actual = ""; status = summary + ": " + word + ": normal assignment"; try { eval(word + " = 'foo';"); actual = "no error"; } catch(e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectNormal, actual, status); } actual = ""; status = summary + ": " + word + ": strict assignment"; try { eval("'use strict'; " + word + " = 'foo';"); actual = "no error"; } catch(e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); // USE IN VARIABLE DECLARATION if (expectNormal !== "skip") { actual = ""; status = summary + ": " + word + ": normal var"; try { eval("var " + word + ";"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectNormal, actual, status); } actual = ""; status = summary + ": " + word + ": strict var"; try { eval("'use strict'; var " + word + ";"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); // USE IN FOR-IN VARIABLE DECLARATION if (expectNormal !== "skip") { actual = ""; status = summary + ": " + word + ": normal for-in var"; try { eval("for (var " + word + " in {});"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectNormal, actual, status); } actual = ""; status = summary + ": " + word + ": strict for-in var"; try { eval("'use strict'; for (var " + word + " in {});"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); // USE AS CATCH IDENTIFIER if (expectNormal !== "skip") { actual = ""; status = summary + ": " + word + ": normal var"; try { eval("try { } catch (" + word + ") { }"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectNormal, actual, status); } actual = ""; status = summary + ": " + word + ": strict var"; try { eval("'use strict'; try { } catch (" + word + ") { }"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); // USE AS LABEL if (expectNormal !== "skip") { actual = ""; status = summary + ": " + word + ": normal label"; try { eval(word + ": while (false);"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectNormal, actual, status); } actual = ""; status = summary + ": " + word + ": strict label"; try { eval("'use strict'; " + word + ": while (false);"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); // USE AS ARGUMENT NAME IN FUNCTION DECLARATION if (expectNormal !== "skip") { actual = ""; status = summary + ": " + word + ": normal function argument"; try { eval("function foo(" + word + ") { }"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectNormal, actual, status); } actual = ""; status = summary + ": " + word + ": strict function argument"; try { eval("'use strict'; function foo(" + word + ") { }"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); actual = ""; status = summary + ": " + word + ": function argument retroactively strict"; try { eval("function foo(" + word + ") { 'use strict'; }"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); // USE AS ARGUMENT NAME IN FUNCTION EXPRESSION if (expectNormal !== "skip") { actual = ""; status = summary + ": " + word + ": normal function expression argument"; try { eval("var s = (function foo(" + word + ") { });"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectNormal, actual, status); } actual = ""; status = summary + ": " + word + ": strict function expression argument"; try { eval("'use strict'; var s = (function foo(" + word + ") { });"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); actual = ""; status = summary + ": " + word + ": function expression argument retroactively strict"; try { eval("var s = (function foo(" + word + ") { 'use strict'; });"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); // USE AS ARGUMENT NAME WITH FUNCTION CONSTRUCTOR if (expectNormal !== "skip") { actual = ""; status = summary + ": " + word + ": argument with normal Function"; try { Function(word, "return 17"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectNormal, actual, status); } actual = ""; status = summary + ": " + word + ": argument with strict Function"; try { Function(word, "'use strict'; return 17"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); // USE AS ARGUMENT NAME IN PROPERTY SETTER if (expectNormal !== "skip") { actual = ""; status = summary + ": " + word + ": normal property setter argument"; try { eval("var o = { set x(" + word + ") { } };"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectNormal, actual, status); } actual = ""; status = summary + ": " + word + ": strict property setter argument"; try { eval("'use strict'; var o = { set x(" + word + ") { } };"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); actual = ""; status = summary + ": " + word + ": property setter argument retroactively strict"; try { eval("var o = { set x(" + word + ") { 'use strict'; } };"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); // USE AS FUNCTION NAME IN FUNCTION DECLARATION if (expectNormal !== "skip") { actual = ""; status = summary + ": " + word + ": normal function name"; try { eval("function " + word + "() { }"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectNormal, actual, status); } actual = ""; status = summary + ": " + word + ": strict function name"; try { eval("'use strict'; function " + word + "() { }"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); actual = ""; status = summary + ": " + word + ": function name retroactively strict"; try { eval("function " + word + "() { 'use strict'; }"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); // USE AS FUNCTION NAME IN FUNCTION EXPRESSION if (expectNormal !== "skip") { actual = ""; status = summary + ": " + word + ": normal function expression name"; try { eval("var s = (function " + word + "() { });"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectNormal, actual, status); } actual = ""; status = summary + ": " + word + ": strict function expression name"; try { eval("'use strict'; var s = (function " + word + "() { });"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); actual = ""; status = summary + ": " + word + ": function expression name retroactively strict"; try { eval("var s = (function " + word + "() { 'use strict'; });"); actual = "no error"; } catch (e) { actual = e.name; status += ", " + e.name + ": " + e.message + " "; } reportCompare(expectStrict, actual, status); } function testFutureReservedWord(word) { /* * NON-STANDARD DEVIATION: At one point in history SpiderMonkey unreserved * most of the reserved words in ES3, including those words which are * FutureReservedWords in ES5. It's too late this release cycle to expect * "SyntaxError" for the normal code cases, so for now we "skip" testing * these words in normal code. (We don't test for "no error" because that * would be contrary to the spec, and this test is not in an extensions/ * directory.) */ testWord(word, "skip", "SyntaxError"); } function testStrictFutureReservedWord(word) { testWord(word, "no error", "SyntaxError"); } futureReservedWords.forEach(testFutureReservedWord); strictFutureReservedWords.forEach(testStrictFutureReservedWord); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/global-numeric-properties.js0000644000175000017500000000326111545150464025152 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 537863; var summary = 'undefined, Infinity, and NaN global properties should not be writable'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var desc, old, error; var global = this; var names = ["NaN", "Infinity", "undefined"]; for (var i = 0; i < names.length; i++) { var name = names[i]; desc = Object.getOwnPropertyDescriptor(global, name); assertEq(desc !== undefined, true, name + " should be present"); assertEq(desc.enumerable, false, name + " should not be enumerable"); assertEq(desc.configurable, false, name + " should not be configurable"); assertEq(desc.writable, false, name + " should not be writable"); old = global[name]; global[name] = 17; assertEq(global[name], old, name + " changed on setting?"); error = "before"; try { throw new TypeError("SpiderMonkey doesn't currently implement " + "strict-mode throwing when setting a readonly " + "property, not running this bit of test for now; " + "see bug 537873"); (function() { "use strict"; global[name] = 42; error = "didn't throw"; })(); } catch (e) { if (e instanceof TypeError) error = "typeerror"; else error = "bad exception: " + e; } assertEq(error, "typeerror", "wrong strict mode error setting " + name); } /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/jstests.list0000644000175000017500000000073511545150464022121 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/misc/ script global-numeric-properties.js script redeclare-var-non-writable-property.js script enumerate-undefined.js script unwrapped-no-such-method.js script explicit-undefined-optional-argument.js script function-definition-eval.js skip-if(!xulRuntime.shell) script function-definition-evaluate.js # needs evaluate() script future-reserved-words.js script builtin-methods-reject-null-undefined-this.js script regress-bug632003.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/redeclare-var-non-writable-property.js0000644000175000017500000000106711545150464027057 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 539488; var summary = '|var| statements for existing, read-only/permanent properties should not ' + 'be errors'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var undefined; /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/regress-bug632003.js0000644000175000017500000000354211545150464022765 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: */ var BUGNUMBER = 632003; var summary = 'The var statement should add the property to the global if it exists on the prototype'; // Define properties on Object.prototype with various attributes and // value-getter-setter combinations then check that a var statement // can always define a variable with the same name in the global object. if (typeof evaluate != "undefined") { var global_case = def_all("global_case"); evaluate(global_case.source); check_values(this, global_case.var_list); } var eval_case = def_all("eval_case"); eval(eval_case.source); check_values(this, eval_case.var_list); function def_all(prefix) { var builder, index, i, j; builder = {source: "", var_list: []}; index = 0; for (i = 0; i <= 1; ++i) { for (j = 0; j <= 1; ++j) { def({value: index}); def({value: index, writable: true}); def({get: Function("return "+index+";")}); def({set: function() { }}); def({get: Function("return "+index+";"), set: function() { }}); } } return builder; function def(descriptor_seed) { var var_name = prefix + index; descriptor_seed.configurable = !!i; descriptor_seed.enumerable = !!j; Object.defineProperty(Object.prototype, var_name, descriptor_seed); var var_value = index + 0.5; builder.source += "var "+var_name+" = "+var_value+";\n"; builder.var_list.push({name: var_name, expected_value: var_value}); ++index; } } function check_values(obj, var_list) { for (i = 0; i != var_list.length; ++i) { var name = var_list[i].name; assertEq(obj.hasOwnProperty(name), true); assertEq(obj[name], var_list[i].expected_value); } } reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/shell.js0000644000175000017500000000000011545150464021153 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/misc/unwrapped-no-such-method.js0000644000175000017500000000063011545150464024712 0ustar chr1schr1s// Our __noSuchMethod__ handling should only be called when |this| is an object. var x = ""; // Reached from interpreter's JSOP_CALLPROP, and js::mjit::ic::CallProp. try { x.i(); } catch (ex) { } // Reached from interpreter's JSOP_CALLELEM, and js::mjit::stubs::CallElem. try { x[x](); } catch (ex) { } // Reached from js::mjit::stubs::CallProp: try { true.i(); } catch(ex) { } reportCompare(true,true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Number/15.7.4.2.js0000644000175000017500000000227011545150464021250 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(raisesException(TypeError)('Number.prototype.toString.call(true)'), true); assertEq(raisesException(TypeError)('Number.prototype.toString.call("")'), true); assertEq(raisesException(TypeError)('Number.prototype.toString.call({})'), true); assertEq(raisesException(TypeError)('Number.prototype.toString.call(null)'), true); assertEq(raisesException(TypeError)('Number.prototype.toString.call([])'), true); assertEq(raisesException(TypeError)('Number.prototype.toString.call(undefined)'), true); assertEq(raisesException(TypeError)('Number.prototype.toString.call(new Boolean(true))'), true); assertEq(completesNormally('Number.prototype.toString.call(42)'), true); assertEq(completesNormally('Number.prototype.toString.call(new Number(42))'), true); function testAround(middle) { var range = 260; var low = middle - range/2; for (var i = 0; i < range; ++i) assertEq(low + i, parseInt(String(low + i))); } testAround(-Math.pow(2,32)); testAround(-Math.pow(2,16)); testAround(0); testAround(+Math.pow(2,16)); testAround(+Math.pow(2,32)); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Number/browser.js0000644000175000017500000000000011545150464022024 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Number/jstests.list0000644000175000017500000000010711545150464022407 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/Number/ script 15.7.4.2.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Number/shell.js0000644000175000017500000000000011545150464021450 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.12.js0000644000175000017500000000317311545150464021304 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* Object.isFrozen */ assertEq(Object.isFrozen({}), false); assertEq(Object.isFrozen(Object.preventExtensions({})), true); var o = Object.defineProperty({}, 'x', { writable:true, configurable:true }); Object.preventExtensions(o); assertEq(Object.isFrozen(o), false); var o = Object.defineProperty({}, 'x', { writable:false, configurable:true }); Object.preventExtensions(o); assertEq(Object.isFrozen(o), false); var o = Object.defineProperty({}, 'x', { writable:true, configurable:false }); Object.preventExtensions(o); assertEq(Object.isFrozen(o), false); var o = Object.defineProperty({}, 'x', { writable:false, configurable:false }); assertEq(Object.isFrozen(o), false); var o = Object.defineProperty({}, 'x', { writable:false, configurable:false }); Object.preventExtensions(o); assertEq(Object.isFrozen(o), true); var o = Object.defineProperties({}, { x: { writable:true, configurable:true }, y: { writable:false, configurable:false } }); Object.preventExtensions(o); assertEq(Object.isFrozen(o), false); var o = Object.defineProperties({}, { x: { writable:false, configurable:false }, y: { writable:true, configurable:true } }); Object.preventExtensions(o); assertEq(Object.isFrozen(o), false); var o = Object.defineProperties({}, { x: { writable:true, configurable:true }, y: { writable:true, configurable:true } }); Object.preventExtensions(o); assertEq(Object.isFrozen(o), false); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.14-01.js0000644000175000017500000000404411545150464021522 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 307791; var summary = 'ES5 Object.keys(O)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus(summary); function arraysEqual(a1, a2) { return a1.length === a2.length && a1.every(function(v, i) { return v === a2[i]; }); } /************** * BEGIN TEST * **************/ assertEq(Object.keys.length, 1); var o, keys; o = { a: 3, b: 2 }; keys = Object.keys(o); assertEq(arraysEqual(keys, ["a", "b"]), true, "" + keys); o = { get a() { return 17; }, b: 2 }; keys = Object.keys(o), assertEq(arraysEqual(keys, ["a", "b"]), true, "" + keys); o = { __iterator__: function() { return Iterator({a: 2, b: 3}); } }; keys = Object.keys(o); assertEq(arraysEqual(keys, ["__iterator__"]), true, "" + keys); o = { a: 1, b: 2 }; delete o.a; o.a = 3; keys = Object.keys(o); assertEq(arraysEqual(keys, ["b", "a"]), true, "" + keys); o = [0, 1, 2]; keys = Object.keys(o); assertEq(arraysEqual(keys, ["0", "1", "2"]), true, "" + keys); o = /./.exec("abc"); keys = Object.keys(o); assertEq(arraysEqual(keys, ["0", "index", "input"]), true, "" + keys); o = { a: 1, b: 2, c: 3 }; delete o.b; o.b = 5; keys = Object.keys(o); assertEq(arraysEqual(keys, ["a", "c", "b"]), true, "" + keys); function f() { } f.prototype.p = 1; o = new f(); o.g = 1; keys = Object.keys(o); assertEq(arraysEqual(keys, ["g"]), true, "" + keys); if (typeof Namespace !== "undefined" && typeof QName !== "undefined") { var o2 = {}; var qn = new QName(new Namespace("foo"), "v"); o2.f = 1; o2[qn] = 3; o2.baz = 4; var keys2 = Object.keys(o2); assertEq(arraysEqual(keys2, ["f", "foo::v", "baz"]), true, "" + keys2); } /******************************************************************************/ reportCompare(expect, actual, "Object.keys"); printStatus("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.3-01.js0000644000175000017500000002026711545150464021445 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is SpiderMonkey ES5 tests. * * The Initial Developer of the Original Code is * Mozilla Corporation. * Portions created by the Initial Developer are Copyright (C) 2009 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Jeff Walden (original author) * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 505587; var summary = 'ES5 Object.getOwnPropertyDescriptor(O)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); /************** * BEGIN TEST * **************/ function assertEq(a, e, msg) { function SameValue(v1, v2) { if (v1 === 0 && v2 === 0) return 1 / v1 === 1 / v2; if (v1 !== v1 && v2 !== v2) return true; return v1 === v2; } if (!SameValue(a, e)) { var stack = new Error().stack || ""; throw "Assertion failed: got " + a + ", expected " + e + (msg ? ": " + msg : "") + (stack ? "\nStack:\n" + stack : ""); } } function expectDescriptor(actual, expected) { if (actual === undefined && expected === undefined) return; assertEq(typeof actual, "object"); assertEq(typeof expected, "object"); var fields = { value: true, get: true, set: true, enumerable: true, writable: true, configurable: true }; for (var p in fields) assertEq(actual.hasOwnProperty(p), expected.hasOwnProperty(p), p); for (var p in actual) assertEq(p in fields, true, p); for (var p in expected) assertEq(p in fields, true, p); assertEq(actual.hasOwnProperty("value"), actual.hasOwnProperty("writable")); assertEq(actual.hasOwnProperty("get"), actual.hasOwnProperty("set")); if (actual.hasOwnProperty("value")) { assertEq(actual.value, expected.value); assertEq(actual.writable, expected.writable); } else { assertEq(actual.get, expected.get); assertEq(actual.set, expected.set); } assertEq(actual.hasOwnProperty("enumerable"), true); assertEq(actual.hasOwnProperty("configurable"), true); assertEq(actual.enumerable, expected.enumerable); assertEq(actual.configurable, expected.configurable); } function adjustDescriptorField(o, actual, expect, field) { assertEq(field === "get" || field === "set", true); var lookup = "__lookup" + (field === "get" ? "G" : "S") + "etter"; if (typeof o[lookup] === "function") expect[field] = o[lookup](field); else actual[field] = expect[field] = undefined; /* censor if we can't lookup */ } /******************************************************************************/ var o, pd, expected; o = { get x() { return 12; } }; pd = Object.getOwnPropertyDescriptor(o, "x"); expected = { set: undefined, enumerable: true, configurable: true }; adjustDescriptorField(o, pd, expected, "get"); expectDescriptor(pd, expected); /******************************************************************************/ o = {}; o.b = 12; pd = Object.getOwnPropertyDescriptor(o, "b"); expected = { value: 12, writable: true, enumerable: true, configurable: true }; expectDescriptor(pd, expected); /******************************************************************************/ o = { get y() { return 17; }, set y(z) { } }; pd = Object.getOwnPropertyDescriptor(o, "y"); expected = { enumerable: true, configurable: true }; adjustDescriptorField(o, pd, expected, "get"); adjustDescriptorField(o, pd, expected, "set"); expectDescriptor(pd, expected); /******************************************************************************/ o = {}; pd = Object.getOwnPropertyDescriptor(o, "absent"); expectDescriptor(pd, undefined); /******************************************************************************/ pd = Object.getOwnPropertyDescriptor([], "length"); expected = { value: 0, writable: true, enumerable: false, configurable: false }; expectDescriptor(pd, expected); pd = Object.getOwnPropertyDescriptor([1], "length"); expected = { value: 1, writable: true, enumerable: false, configurable: false }; expectDescriptor(pd, expected); pd = Object.getOwnPropertyDescriptor([1,], "length"); expected = { value: 1, writable: true, enumerable: false, configurable: false }; expectDescriptor(pd, expected); pd = Object.getOwnPropertyDescriptor([1,,], "length"); expected = { value: 2, writable: true, enumerable: false, configurable: false }; expectDescriptor(pd, expected); /******************************************************************************/ pd = Object.getOwnPropertyDescriptor(new String("foobar"), "length"); expected = { value: 6, writable: false, enumerable: false, configurable: false }; expectDescriptor(pd, expected); /******************************************************************************/ function foo() { } o = foo; pd = Object.getOwnPropertyDescriptor(o, "length"); expected = { value: 0, writable: false, enumerable: false, configurable: false }; expectDescriptor(pd, expected); pd = Object.getOwnPropertyDescriptor(o, "prototype"); expected = { value: foo.prototype, writable: true, enumerable: false, configurable: false }; expectDescriptor(pd, expected); /******************************************************************************/ pd = Object.getOwnPropertyDescriptor(Function, "length"); expected = { value: 1, writable: false, enumerable: false, configurable: false }; expectDescriptor(pd, expected); /******************************************************************************/ o = /foo/im; pd = Object.getOwnPropertyDescriptor(o, "source"); expected = { value: "foo", writable: false, enumerable: false, configurable: false }; expectDescriptor(pd, expected); pd = Object.getOwnPropertyDescriptor(o, "global"); expected = { value: false, writable: false, enumerable: false, configurable: false }; expectDescriptor(pd, expected); pd = Object.getOwnPropertyDescriptor(o, "ignoreCase"); expected = { value: true, writable: false, enumerable: false, configurable: false }; expectDescriptor(pd, expected); pd = Object.getOwnPropertyDescriptor(o, "multiline"); expected = { value: true, writable: false, enumerable: false, configurable: false }; expectDescriptor(pd, expected); pd = Object.getOwnPropertyDescriptor(o, "lastIndex"); expected = { value: 0, writable: true, enumerable: false, configurable: false }; expectDescriptor(pd, expected); /******************************************************************************/ reportCompare(expect, actual, "Object.getOwnPropertyDescriptor"); printStatus("All tests passed"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.4-01.js0000644000175000017500000000151511545150464021441 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ //----------------------------------------------------------------------------- var BUGNUMBER = 518663; var summary = 'Object.getOwnPropertyNames should play nicely with enumerator caching'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ for (var p in JSON); var names = Object.getOwnPropertyNames(JSON); assertEq(names.length >= 2, true, "wrong number of property names? [" + names + "]"); assertEq(names.indexOf("parse") >= 0, true); assertEq(names.indexOf("stringify") >= 0, true); /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.4-02.js0000644000175000017500000000223511545150464021442 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ //----------------------------------------------------------------------------- var BUGNUMBER = 518663; var summary = 'Object.getOwnPropertyNames: array objects'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var a, names, expected; function arraysEqual(a1, a2) { return a1.length === a2.length && a1.every(function(v, i) { return v === a2[i]; }); } a = [0, 1, 2]; names = Object.getOwnPropertyNames(a).sort(); expected = ["0", "1", "2", "length"].sort(); a = [1, , , 7]; a.p = 2; Object.defineProperty(a, "q", { value: 42, enumerable: false }); names = Object.getOwnPropertyNames(a).sort(); expected = ["0", "3", "p", "q", "length"].sort(); assertEq(arraysEqual(names, expected), true); a = []; names = Object.getOwnPropertyNames(a).sort(); expected = ["length"]; assertEq(arraysEqual(names, expected), true); /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.4-03.js0000644000175000017500000000273711545150464021452 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ //----------------------------------------------------------------------------- var BUGNUMBER = 518663; var summary = 'Object.getOwnPropertyNames: function objects'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ function two(a, b) { } assertEq(Object.getOwnPropertyNames(two).indexOf("length") >= 0, true); var bound0 = Function.prototype.bind ? two.bind("this") : function two(a, b) { }; assertEq(Object.getOwnPropertyNames(bound0).indexOf("length") >= 0, true); assertEq(bound0.length, 2); var bound1 = Function.prototype.bind ? two.bind("this", 1) : function one(a) { }; assertEq(Object.getOwnPropertyNames(bound1).indexOf("length") >= 0, true); assertEq(bound1.length, 1); var bound2 = Function.prototype.bind ? two.bind("this", 1, 2) : function zero() { }; assertEq(Object.getOwnPropertyNames(bound2).indexOf("length") >= 0, true); assertEq(bound2.length, 0); var bound3 = Function.prototype.bind ? two.bind("this", 1, 2, 3) : function zero() { }; assertEq(Object.getOwnPropertyNames(bound3).indexOf("length") >= 0, true); assertEq(bound3.length, 0); /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.4-04.js0000644000175000017500000000154611545150464021450 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ //----------------------------------------------------------------------------- var BUGNUMBER = 518663; var summary = 'Object.getOwnPropertyNames: regular expression objects'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var actual = Object.getOwnPropertyNames(/a/); var expected = ["lastIndex", "source", "global", "ignoreCase", "multiline"]; for (var i = 0; i < expected.length; i++) { reportCompare(actual.indexOf(expected[i]) >= 0, true, expected[i] + " should be a property name on a RegExp"); } /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.5-01.js0000644000175000017500000000346611545150464021451 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 492840; var summary = 'ES5 Object.create(O [, Properties])'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ assertEq("create" in Object, true); assertEq(Object.create.length, 2); var o, desc, props, proto; o = Object.create(null); assertEq(Object.getPrototypeOf(o), null, "bad null-proto"); o = Object.create(null, { a: { value: 17, enumerable: false } }); assertEq(Object.getPrototypeOf(o), null, "bad null-proto"); assertEq("a" in o, true); desc = Object.getOwnPropertyDescriptor(o, "a"); assertEq(desc !== undefined, true, "no descriptor?"); assertEq(desc.value, 17); assertEq(desc.enumerable, false); assertEq(desc.configurable, false); assertEq(desc.writable, false); props = Object.create({ bar: 15 }); Object.defineProperty(props, "foo", { enumerable: false, value: 42 }); proto = { baz: 12 }; o = Object.create(proto, props); assertEq(Object.getPrototypeOf(o), proto); assertEq(Object.getOwnPropertyDescriptor(o, "foo"), undefined); assertEq("foo" in o, false); assertEq(Object.getOwnPropertyDescriptor(o, "bar"), undefined); assertEq("bar" in o, false); assertEq(Object.getOwnPropertyDescriptor(o, "baz"), undefined); assertEq(o.baz, 12); assertEq(o.hasOwnProperty("baz"), false); try { var actual = Object.create(Object.create({}, { boom: { get: function() { return "base"; }}}), { boom: { get: function() { return "overridden"; }}}).boom } catch (e) { } assertEq(actual, "overridden"); /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-define-over-method.js0000644000175000017500000000125011545150464024700 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 568786; var summary = '"Assertion failure: !(attrs & (JSPROP_GETTER | JSPROP_SETTER))," with ' + 'Object.defineProperty'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var o = { x: function(){} }; Object.defineProperty(o, "x", { get: function(){} }); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-1-of-8.js0000644000175000017500000000031211545150464026744 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runDictionaryPropertyPresentTestsFraction(1, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-2-of-8.js0000644000175000017500000000031211545150464026745 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runDictionaryPropertyPresentTestsFraction(2, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-3-of-8.js0000644000175000017500000000031211545150464026746 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runDictionaryPropertyPresentTestsFraction(3, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-4-of-8.js0000644000175000017500000000031211545150464026747 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runDictionaryPropertyPresentTestsFraction(4, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-5-of-8.js0000644000175000017500000000031211545150464026750 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runDictionaryPropertyPresentTestsFraction(5, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-6-of-8.js0000644000175000017500000000031211545150464026751 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runDictionaryPropertyPresentTestsFraction(6, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-7-of-8.js0000644000175000017500000000031211545150464026752 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runDictionaryPropertyPresentTestsFraction(7, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-dictionary-redefinition-8-of-8.js0000644000175000017500000000031211545150464026753 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runDictionaryPropertyPresentTestsFraction(8, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-function-length.js0000644000175000017500000000154311545150464024330 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 430133; var summary = 'ES5 Object.defineProperty(O, P, Attributes): Function.length'; print(BUGNUMBER + ": " + summary); load("ecma_5/Object/defineProperty-setup.js"); /************** * BEGIN TEST * **************/ try { new TestRunner().runFunctionLengthTests(); } catch (e) { throw "Error thrown during testing: " + e + " at line " + e.lineNumber + "\n" + (e.stack ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n" : ""); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-1-of-8.js0000644000175000017500000000031311545150464026036 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runNonTerminalPropertyPresentTestsFraction(1, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-2-of-8.js0000644000175000017500000000031311545150464026037 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runNonTerminalPropertyPresentTestsFraction(2, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-3-of-8.js0000644000175000017500000000031311545150464026040 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runNonTerminalPropertyPresentTestsFraction(3, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-4-of-8.js0000644000175000017500000000031311545150464026041 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runNonTerminalPropertyPresentTestsFraction(4, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-5-of-8.js0000644000175000017500000000031311545150464026042 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runNonTerminalPropertyPresentTestsFraction(5, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-6-of-8.js0000644000175000017500000000031311545150464026043 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runNonTerminalPropertyPresentTestsFraction(6, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-7-of-8.js0000644000175000017500000000031311545150464026044 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runNonTerminalPropertyPresentTestsFraction(7, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-middle-redefinition-8-of-8.js0000644000175000017500000000031311545150464026045 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ load("ecma_5/Object/defineProperty-setup.js"); runNonTerminalPropertyPresentTestsFraction(8, 8); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-miscellaneous.js0000644000175000017500000000415511545150464024071 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 430133; var summary = 'ES5 Object.defineProperty(O, P, Attributes)'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var o = []; Object.defineProperty(o, 0, { value: 17 }); var desc = Object.getOwnPropertyDescriptor(o, 0); assertEq(desc !== undefined, true); assertEq(desc.value, 17); assertEq(desc.enumerable, false); assertEq(desc.configurable, false); assertEq(desc.writable, false); desc = Object.getOwnPropertyDescriptor(o, "length"); assertEq(desc !== undefined, true); assertEq(desc.enumerable, false); assertEq(desc.configurable, false); assertEq(desc.writable, true); assertEq(desc.value, 1); assertEq(o.length, 1); Object.defineProperty(o, "foobar", { value: 42, enumerable: false, configurable: true }); assertEq(o.foobar, 42); desc = Object.getOwnPropertyDescriptor(o, "foobar"); assertEq(desc !== undefined, true); assertEq(desc.value, 42); assertEq(desc.configurable, true); assertEq(desc.enumerable, false); assertEq(desc.writable, false); var called = false; o = { set x(a) { called = true; } }; Object.defineProperty(o, "x", { get: function() { return "get"; } }); desc = Object.getOwnPropertyDescriptor(o, "x"); assertEq("set" in desc, true); assertEq("get" in desc, true); assertEq(called, false); o.x = 13; assertEq(called, true); var toSource = Object.prototype.toSource || function() { }; toSource.call(o); // a test for this not crashing var called = false; var o = Object.defineProperty({}, "foo", { get: function() { return 17; }, set: function(v) { called = true; } }); assertEq(o.foo, 17); o.foo = 42; assertEq(called, true); /* * XXX need tests for Object.defineProperty(array, "length", { ... }) when we * support it! */ /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-new-definition.js0000644000175000017500000000153611545150464024145 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 430133; var summary = 'ES5 Object.defineProperty(O, P, Attributes): new definition'; print(BUGNUMBER + ": " + summary); load("ecma_5/Object/defineProperty-setup.js"); /************** * BEGIN TEST * **************/ try { new TestRunner().runNotPresentTests(); } catch (e) { throw "Error thrown during testing: " + e + " at line " + e.lineNumber + "\n" + (e.stack ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n" : ""); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-1-of-4.js0000644000175000017500000000165311545150464024606 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var PART = 1, PARTS = 4; //----------------------------------------------------------------------------- var BUGNUMBER = 430133; var summary = 'ES5 Object.defineProperty(O, P, Attributes): redefinition ' + PART + ' of ' + PARTS; print(BUGNUMBER + ": " + summary); load("ecma_5/Object/defineProperty-setup.js"); /************** * BEGIN TEST * **************/ try { new TestRunner().runPropertyPresentTestsFraction(PART, PARTS); } catch (e) { throw "Error thrown during testing: " + e + " at line " + e.lineNumber + "\n" + (e.stack ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n" : ""); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-2-of-4.js0000644000175000017500000000165311545150464024607 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var PART = 2, PARTS = 4; //----------------------------------------------------------------------------- var BUGNUMBER = 430133; var summary = 'ES5 Object.defineProperty(O, P, Attributes): redefinition ' + PART + ' of ' + PARTS; print(BUGNUMBER + ": " + summary); load("ecma_5/Object/defineProperty-setup.js"); /************** * BEGIN TEST * **************/ try { new TestRunner().runPropertyPresentTestsFraction(PART, PARTS); } catch (e) { throw "Error thrown during testing: " + e + " at line " + e.lineNumber + "\n" + (e.stack ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n" : ""); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-3-of-4.js0000644000175000017500000000165311545150464024610 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var PART = 3, PARTS = 4; //----------------------------------------------------------------------------- var BUGNUMBER = 430133; var summary = 'ES5 Object.defineProperty(O, P, Attributes): redefinition ' + PART + ' of ' + PARTS; print(BUGNUMBER + ": " + summary); load("ecma_5/Object/defineProperty-setup.js"); /************** * BEGIN TEST * **************/ try { new TestRunner().runPropertyPresentTestsFraction(PART, PARTS); } catch (e) { throw "Error thrown during testing: " + e + " at line " + e.lineNumber + "\n" + (e.stack ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n" : ""); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.6-redefinition-4-of-4.js0000644000175000017500000000165311545150464024611 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ var PART = 4, PARTS = 4; //----------------------------------------------------------------------------- var BUGNUMBER = 430133; var summary = 'ES5 Object.defineProperty(O, P, Attributes): redefinition ' + PART + ' of ' + PARTS; print(BUGNUMBER + ": " + summary); load("ecma_5/Object/defineProperty-setup.js"); /************** * BEGIN TEST * **************/ try { new TestRunner().runPropertyPresentTestsFraction(PART, PARTS); } catch (e) { throw "Error thrown during testing: " + e + " at line " + e.lineNumber + "\n" + (e.stack ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n" : ""); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.7-01.js0000644000175000017500000000721511545150464021447 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 430133; var summary = 'ES5 Object.defineProperties(O, Properties)'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ assertEq("defineProperties" in Object, true); assertEq(Object.defineProperties.length, 2); var o, props, desc, passed; o = {}; props = { a: { value: 17, enumerable: true, configurable: true, writable: true }, b: { value: 42, enumerable: false, configurable: false, writable: false } }; Object.defineProperties(o, props); assertEq("a" in o, true); assertEq("b" in o, true); desc = Object.getOwnPropertyDescriptor(o, "a"); assertEq(desc.value, 17); assertEq(desc.enumerable, true); assertEq(desc.configurable, true); assertEq(desc.writable, true); desc = Object.getOwnPropertyDescriptor(o, "b"); assertEq(desc.value, 42); assertEq(desc.enumerable, false); assertEq(desc.configurable, false); assertEq(desc.writable, false); props = { c: { value: NaN, enumerable: false, configurable: true, writable: true }, b: { value: 44 } }; var error = "before"; try { Object.defineProperties(o, props); error = "no exception thrown"; } catch (e) { if (e instanceof TypeError) error = "typeerror"; else error = "bad exception: " + e; } assertEq(error, "typeerror", "didn't throw or threw wrongly"); assertEq("c" in o, true, "new property added"); assertEq(o.b, 42, "old property value preserved"); function Properties() { } Properties.prototype = { b: { value: 42, enumerable: true } }; props = new Properties(); Object.defineProperty(props, "a", { enumerable: false }); o = {}; Object.defineProperties(o, props); assertEq("a" in o, false); assertEq(Object.getOwnPropertyDescriptor(o, "a"), undefined, "Object.defineProperties(O, Properties) should only use enumerable " + "properties on Properties"); assertEq("b" in o, false); assertEq(Object.getOwnPropertyDescriptor(o, "b"), undefined, "Object.defineProperties(O, Properties) should only use enumerable " + "properties directly on Properties"); Number.prototype.foo = { value: 17, enumerable: true }; Boolean.prototype.bar = { value: 8675309, enumerable: true }; String.prototype.quux = { value: "Are you HAPPY yet?", enumerable: true }; o = {}; Object.defineProperties(o, 5); // ToObject only throws for null/undefined assertEq("foo" in o, false, "foo is not an enumerable own property"); Object.defineProperties(o, false); assertEq("bar" in o, false, "bar is not an enumerable own property"); Object.defineProperties(o, ""); assertEq("quux" in o, false, "quux is not an enumerable own property"); error = "before"; try { Object.defineProperties(o, "1"); } catch (e) { if (e instanceof TypeError) error = "typeerror"; else error = "bad exception: " + e; } assertEq(error, "typeerror", "should throw on Properties == '1' due to '1'[0] not being a " + "property descriptor"); error = "before"; try { Object.defineProperties(o, null); } catch (e) { if (e instanceof TypeError) error = "typeerror"; else error = "bad exception: " + e; } assertEq(error, "typeerror", "should throw on Properties == null"); error = "before"; try { Object.defineProperties(o, undefined); } catch (e) { if (e instanceof TypeError) error = "typeerror"; else error = "bad exception: " + e; } assertEq(error, "typeerror", "should throw on Properties == undefined"); /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/15.2.3.9.js0000644000175000017500000000440211545150464021226 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* Object.freeze */ function getme() { return 42; }; function setme(x) { }; var properties = { all: { value:1, writable:true, configurable:true, enumerable: true }, readOnly: { value:2, writable:false, configurable:true, enumerable: true }, nonConfig: { value:3, writable:true, configurable:false, enumerable: true }, none: { value:4, writable:false, configurable:false, enumerable: true }, getter: { get: getme, configurable:false, enumerable: true }, setter: { set: setme, configurable:false, enumerable: true }, getandset: { get: getme, set: setme, configurable:false, enumerable: true } }; var o = Object.defineProperties({}, properties); Object.freeze(o); function getPropertyOf(obj) { return function (prop) { return Object.getOwnPropertyDescriptor(obj, prop); }; }; assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'all'), { value: 1, writable:false, enumerable:true, configurable:false }), true); assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'readOnly'), { value: 2, writable:false, enumerable:true, configurable:false }), true); assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'nonConfig'), { value: 3, writable:false, enumerable:true, configurable:false }), true); assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'none'), { value: 4, writable:false, enumerable:true, configurable:false }), true); assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'getter'), { get: getme, set: (void 0), enumerable:true, configurable:false }), true); assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'setter'), { set: setme, get: (void 0), enumerable:true, configurable:false }), true); assertEq(deepEqual(Object.getOwnPropertyDescriptor(o, 'getandset'), { get: getme, set: setme, enumerable:true, configurable:false }), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/add-property-non-extensible.js0000644000175000017500000000542711545150464025703 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ var gTestfile = 'add-property-non-extensible.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 602144; var summary = 'Properly method-compile attempted addition of properties to ' + 'non-extensible objects'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ // No property var o1 = {}; for (var i = 0; i < 5; i++) o1.a = 3; assertEq(o1.a, 3); var o2 = Object.preventExtensions({}); for (var i = 0; i < 5; i++) o2.a = 3; assertEq(Object.getOwnPropertyDescriptor(o2, "a"), undefined); var o3 = Object.seal({}); for (var i = 0; i < 5; i++) o3.a = 3; assertEq(Object.getOwnPropertyDescriptor(o3, "a"), undefined); var o4 = Object.freeze({}); for (var i = 0; i < 5; i++) o4.a = 3; assertEq(Object.getOwnPropertyDescriptor(o4, "a"), undefined); // Has property var o5 = { a: 2 }; for (var i = 0; i < 5; i++) o5.a = 3; assertEq(o5.a, 3); var o6 = Object.preventExtensions({ a: 2 }); for (var i = 0; i < 5; i++) o6.a = 3; assertEq(o6.a, 3); var o7 = Object.seal({ a: 2 }); for (var i = 0; i < 5; i++) o7.a = 3; assertEq(o7.a, 3); var o8 = Object.freeze({ a: 2 }); for (var i = 0; i < 5; i++) o8.a = 3; assertEq(o8.a, 2); // Extensible, hit up the prototype chain var o9 = Object.create({ a: 2 }); for (var i = 0; i < 5; i++) o9.a = 3; assertEq(o9.a, 3); var o10 = Object.create(Object.preventExtensions({ a: 2 })); for (var i = 0; i < 5; i++) o10.a = 3; assertEq(o10.a, 3); var o11 = Object.create(Object.seal({ a: 2 })); for (var i = 0; i < 5; i++) o11.a = 3; assertEq(o11.a, 3); var o12 = Object.create(Object.freeze({ a: 2 })); for (var i = 0; i < 5; i++) o12.a = 3; assertEq(Object.getOwnPropertyDescriptor(o12, "a"), undefined); // Not extensible, hit up the prototype chain var o13 = Object.preventExtensions(Object.create({ a: 2 })); for (var i = 0; i < 5; i++) o13.a = 3; assertEq(Object.getOwnPropertyDescriptor(o13, "a"), undefined); var o14 = Object.preventExtensions(Object.create(Object.preventExtensions({ a: 2 }))); for (var i = 0; i < 5; i++) o14.a = 3; assertEq(Object.getOwnPropertyDescriptor(o14, "a"), undefined); var o15 = Object.preventExtensions(Object.create(Object.seal({ a: 2 }))); for (var i = 0; i < 5; i++) o15.a = 3; assertEq(Object.getOwnPropertyDescriptor(o15, "a"), undefined); var o16 = Object.preventExtensions(Object.create(Object.freeze({ a: 2 }))); for (var i = 0; i < 5; i++) o16.a = 3; assertEq(Object.getOwnPropertyDescriptor(o16, "a"), undefined); /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/browser.js0000644000175000017500000000000111545150464022003 0ustar chr1schr1s mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/defineProperty-setup.js0000644000175000017500000007314311545150464024476 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ assertEq("defineProperty" in Object, true); assertEq(Object.defineProperty.length, 3); if (!Object.prototype.toSource) { Object.defineProperty(Object.prototype, "toSource", { value: function toSource() { if (this instanceof RegExp) { var v = "new RegExp(" + uneval(this.source); var f = (this.multiline ? "m" : "") + (this.global ? "g" : "") + (this.ignoreCase ? "i" : ""); return v + (f ? ", '" + f + "'" : "") + ")"; } return JSON.stringify(this); }, enumerable: false, configurable: true, writable: true }); } if (!("uneval" in this)) { Object.defineProperty(this, "uneval", { value: function uneval(v) { if (v === null) return "null"; if (typeof v === "object") return v.toSource(); if (typeof v === "string") { v = JSON.stringify({v:v}); return v.substring(5, v.length - 1); } return "" + v; }, enumerable: false, configurable: true, writable: true }); } // reimplemented for the benefit of engines which don't have this helper function assertEq(v1, v2, m) { if (!SameValue(v1, v2)) { throw "assertion failed: " + "got " + uneval(v1) + ", expected " + uneval(v2) + (m ? ": " + m : ""); } } function SameValue(v1, v2) { if (v1 === 0 && v2 === 0) return 1 / v1 === 1 / v2; if (v1 !== v1 && v2 !== v2) return true; return v1 === v2; } function PropertyDescriptor(pd) { if (pd) this.update(pd); } PropertyDescriptor.prototype.update = function update(pd) { if ("get" in pd) this.get = pd.get; if ("set" in pd) this.set = pd.set; if ("configurable" in pd) this.configurable = pd.configurable; if ("writable" in pd) this.writable = pd.writable; if ("enumerable" in pd) this.enumerable = pd.enumerable; if ("value" in pd) this.value = pd.value; }; PropertyDescriptor.prototype.convertToDataDescriptor = function convertToDataDescriptor() { delete this.get; delete this.set; this.writable = false; this.value = undefined; }; PropertyDescriptor.prototype.convertToAccessorDescriptor = function convertToAccessorDescriptor() { delete this.writable; delete this.value; this.get = undefined; this.set = undefined; }; function compareDescriptors(d1, d2) { if (d1 === undefined) { assertEq(d2, undefined, "non-descriptors"); return; } if (d2 === undefined) { assertEq(true, false, "descriptor-equality mismatch: " + uneval(d1) + ", " + uneval(d2)); return; } var props = ["value", "get", "set", "enumerable", "configurable", "writable"]; for (var i = 0, sz = props.length; i < sz; i++) { var p = props[i]; assertEq(p in d1, p in d2, p + " different in d1/d2"); if (p in d1) assertEq(d1[p], d2[p], p); } } function examine(desc, field, allowDefault) { if (field in desc) return desc[field]; assertEq(allowDefault, true, "reimplementation error"); switch (field) { case "value": case "get": case "set": return undefined; case "writable": case "enumerable": case "configurable": return false; default: assertEq(true, false, "bad field name: " + field); } } function IsAccessorDescriptor(desc) { if (!desc) return false; if (!("get" in desc) && !("set" in desc)) return false; return true; } function IsDataDescriptor(desc) { if (!desc) return false; if (!("value" in desc) && !("writable" in desc)) return false; return true; } function IsGenericDescriptor(desc) { if (!desc) return false; if (!IsAccessorDescriptor(desc) && !IsDataDescriptor(desc)) return true; return false; } function CustomObject() { this.properties = {}; this.extensible = true; } CustomObject.prototype = { _reject: function _reject(throwing, msg) { if (throwing) throw new TypeError(msg + "; rejected!"); return false; }, defineOwnProperty: function defineOwnProperty(propname, desc, throwing) { assertEq(typeof propname, "string", "non-string propname"); // Step 1. var current = this.properties[propname]; // Step 2. var extensible = this.extensible; // Step 3. if (current === undefined && !extensible) return this._reject(throwing, "object not extensible"); // Step 4. if (current === undefined && extensible) { var p; // Step 4(a). if (IsGenericDescriptor(desc) || IsDataDescriptor(desc)) { p = new PropertyDescriptor(); p.value = examine(desc, "value", true); p.writable = examine(desc, "writable", true); p.enumerable = examine(desc, "enumerable", true); p.configurable = examine(desc, "configurable", true); } // Step 4(b). else { p = new PropertyDescriptor(); p.get = examine(desc, "get", true); p.set = examine(desc, "set", true); p.enumerable = examine(desc, "enumerable", true); p.configurable = examine(desc, "configurable", true); } this.properties[propname] = p; // Step 4(c). return true; } // Step 5. if (!("value" in desc) && !("get" in desc) && !("set" in desc) && !("writable" in desc) && !("enumerable" in desc) && !("configurable" in desc)) { return; } // Step 6. do { if ("value" in desc) { if (!("value" in current) || !SameValue(desc.value, current.value)) break; } if ("get" in desc) { if (!("get" in current) || !SameValue(desc.get, current.get)) break; } if ("set" in desc) { if (!("set" in current) || !SameValue(desc.set, current.set)) break; } if ("writable" in desc) { if (!("writable" in current) || !SameValue(desc.writable, current.writable)) { break; } } if ("enumerable" in desc) { if (!("enumerable" in current) || !SameValue(desc.enumerable, current.enumerable)) { break; } } if ("configurable" in desc) { if (!("configurable" in current) || !SameValue(desc.configurable, current.configurable)) { break; } } // all fields in desc also in current, with the same values return true; } while (false); // Step 7. if (!examine(current, "configurable")) { if ("configurable" in desc && examine(desc, "configurable")) return this._reject(throwing, "can't make configurable again"); if ("enumerable" in desc && examine(current, "enumerable") !== examine(desc, "enumerable")) { return this._reject(throwing, "can't change enumerability"); } } // Step 8. if (IsGenericDescriptor(desc)) { // do nothing } // Step 9. else if (IsDataDescriptor(current) !== IsDataDescriptor(desc)) { // Step 9(a). if (!examine(current, "configurable")) return this._reject(throwing, "can't change unconfigurable descriptor's type"); // Step 9(b). if (IsDataDescriptor(current)) current.convertToAccessorDescriptor(); // Step 9(c). else current.convertToDataDescriptor(); } // Step 10. else if (IsDataDescriptor(current) && IsDataDescriptor(desc)) { // Step 10(a) if (!examine(current, "configurable")) { // Step 10(a).i. if (!examine(current, "writable") && "writable" in desc && examine(desc, "writable")) { return this._reject(throwing, "can't make data property writable again"); } // Step 10(a).ii. if (!examine(current, "writable")) { if ("value" in desc && !SameValue(examine(desc, "value"), examine(current, "value"))) { return this._reject(throwing, "can't change value if not writable"); } } } // Step 10(b). else { assertEq(examine(current, "configurable"), true, "spec bug step 10(b)"); } } // Step 11. else { assertEq(IsAccessorDescriptor(current) && IsAccessorDescriptor(desc), true, "spec bug"); // Step 11(a). if (!examine(current, "configurable")) { // Step 11(a).i. if ("set" in desc && !SameValue(examine(desc, "set"), examine(current, "set"))) { return this._reject(throwing, "can't change setter if not configurable"); } // Step 11(a).ii. if ("get" in desc && !SameValue(examine(desc, "get"), examine(current, "get"))) { return this._reject(throwing, "can't change getter if not configurable"); } } } // Step 12. current.update(desc); // Step 13. return true; } }; function IsCallable(v) { return typeof v === "undefined" || typeof v === "function"; } var NativeTest = { newObject: function newObject() { return {}; }, defineProperty: function defineProperty(obj, propname, propdesc) { Object.defineProperty(obj, propname, propdesc); }, getDescriptor: function getDescriptor(obj, propname) { return Object.getOwnPropertyDescriptor(obj, propname); } }; var ReimplTest = { newObject: function newObject() { return new CustomObject(); }, defineProperty: function defineProperty(obj, propname, propdesc) { assertEq(obj instanceof CustomObject, true, "obj not instanceof CustomObject"); if ("get" in propdesc || "set" in propdesc) { if ("value" in propdesc || "writable" in propdesc) throw new TypeError("get/set and value/writable"); if (!IsCallable(propdesc.get)) throw new TypeError("get defined, uncallable"); if (!IsCallable(propdesc.set)) throw new TypeError("set defined, uncallable"); } return obj.defineOwnProperty(propname, propdesc, true); }, getDescriptor: function getDescriptor(obj, propname) { if (!(propname in obj.properties)) return undefined; return new PropertyDescriptor(obj.properties[propname]); } }; var JSVAL_INT_MAX = Math.pow(2, 30) - 1; var JSVAL_INT_MIN = -Math.pow(2, 30); function isValidDescriptor(propdesc) { if ("get" in propdesc || "set" in propdesc) { if ("value" in propdesc || "writable" in propdesc) return false; // We permit null here simply because this test's author believes the // implementation may sometime be susceptible to making mistakes in this // regard and would prefer to be cautious. if (propdesc.get !== null && propdesc.get !== undefined && !IsCallable(propdesc.get)) return false; if (propdesc.set !== null && propdesc.set !== undefined && !IsCallable(propdesc.set)) return false; } return true; } var OMIT = {}; var VALUES = [-Infinity, JSVAL_INT_MIN, -0, +0, 1.5, JSVAL_INT_MAX, Infinity, NaN, "foo", "bar", null, undefined, true, false, {}, /a/, OMIT]; var GETS = [undefined, function get1() { return 1; }, function get2() { return 2; }, null, 5, OMIT]; var SETS = [undefined, function set1() { return 1; }, function set2() { return 2; }, null, 5, OMIT]; var ENUMERABLES = [true, false, OMIT]; var CONFIGURABLES = [true, false, OMIT]; var WRITABLES = [true, false, OMIT]; function mapTestDescriptors(filter) { var descs = []; var desc = {}; function put(field, value) { if (value !== OMIT) desc[field] = value; } VALUES.forEach(function(value) { GETS.forEach(function(get) { SETS.forEach(function(set) { ENUMERABLES.forEach(function(enumerable) { CONFIGURABLES.forEach(function(configurable) { WRITABLES.forEach(function(writable) { desc = {}; put("value", value); put("get", get); put("set", set); put("enumerable", enumerable); put("configurable", configurable); put("writable", writable); if (filter(desc)) descs.push(desc); }); }); }); }); }); }); return descs; } var ALL_DESCRIPTORS = mapTestDescriptors(function(d) { return true; }); var VALID_DESCRIPTORS = mapTestDescriptors(isValidDescriptor); var SKIP_FULL_FUNCTION_LENGTH_TESTS = true; function TestRunner() { this._logLines = []; } TestRunner.prototype = { // MAIN METHODS runFunctionLengthTests: function runFunctionLengthTests() { var self = this; function functionLengthTests() { if (SKIP_FULL_FUNCTION_LENGTH_TESTS) { print("Skipping full tests for redefining Function.length for now " + "because we don't support redefinition of properties with " + "native getter or setter..."); self._simpleFunctionLengthTests(); } else { self._simpleFunctionLengthTests(); self._fullFunctionLengthTests(function() { }, 0); self._fullFunctionLengthTests(function(one) { }, 1); self._fullFunctionLengthTests(function(one, two) { }, 2); } } this._runTestSet(functionLengthTests, "Function length tests completed!"); }, runNotPresentTests: function runNotPresentTests() { var self = this; function notPresentTests() { print("Running not-present tests now..."); for (var i = 0, sz = ALL_DESCRIPTORS.length; i < sz; i++) self._runSingleNotPresentTest(ALL_DESCRIPTORS[i]); }; this._runTestSet(notPresentTests, "Not-present length tests completed!"); }, runPropertyPresentTestsFraction: function runPropertyPresentTestsFraction(part, parts) { var self = this; function propertyPresentTests() { print("Running already-present tests now..."); var total = VALID_DESCRIPTORS.length; var start = Math.floor((part - 1) / parts * total); var end = Math.floor(part / parts * total); for (var i = start; i < end; i++) { var old = VALID_DESCRIPTORS[i]; print("Starting test with old descriptor " + old.toSource() + "..."); for (var j = 0, sz2 = VALID_DESCRIPTORS.length; j < sz2; j++) self._runSinglePropertyPresentTest(old, VALID_DESCRIPTORS[j], []); } } this._runTestSet(propertyPresentTests, "Property-present fraction " + part + " of " + parts + " completed!"); }, runNonTerminalPropertyPresentTestsFraction: function runNonTerminalPropertyPresentTestsFraction(part, parts) { var self = this; /* * A plain old property to define on the object before redefining the * originally-added property, to test redefinition of a property that's * not also lastProperty. NB: we could loop over every possible * descriptor here if we wanted, even try adding more than one, but we'd * hit cubic complexity and worse, and SpiderMonkey only distinguishes by * the mere presence of the middle property, not its precise details. */ var middleDefines = [{ property: "middle", descriptor: { value: 17, writable: true, configurable: true, enumerable: true } }]; function nonTerminalPropertyPresentTests() { print("Running non-terminal already-present tests now..."); var total = VALID_DESCRIPTORS.length; var start = Math.floor((part - 1) / parts * total); var end = Math.floor(part / parts * total); for (var i = start; i < end; i++) { var old = VALID_DESCRIPTORS[i]; print("Starting test with old descriptor " + old.toSource() + "..."); for (var j = 0, sz2 = VALID_DESCRIPTORS.length; j < sz2; j++) { self._runSinglePropertyPresentTest(old, VALID_DESCRIPTORS[j], middleDefines); } } } this._runTestSet(nonTerminalPropertyPresentTests, "Non-terminal property-present fraction " + part + " of " + parts + " completed!"); }, runDictionaryPropertyPresentTestsFraction: function runDictionaryPropertyPresentTestsFraction(part, parts) { var self = this; /* * Add and readd properties such that the scope for the object is in * dictionary mode. */ var middleDefines = [ { property: "mid1", descriptor: { value: 17, writable: true, configurable: true, enumerable: true } }, { property: "mid2", descriptor: { value: 17, writable: true, configurable: true, enumerable: true } }, { property: "mid1", descriptor: { get: function g() { }, set: function s(v){}, configurable: false, enumerable: true } }, ]; function dictionaryPropertyPresentTests() { print("Running dictionary already-present tests now..."); var total = VALID_DESCRIPTORS.length; var start = Math.floor((part - 1) / parts * total); var end = Math.floor(part / parts * total); for (var i = start; i < end; i++) { var old = VALID_DESCRIPTORS[i]; print("Starting test with old descriptor " + old.toSource() + "..."); for (var j = 0, sz2 = VALID_DESCRIPTORS.length; j < sz2; j++) { self._runSinglePropertyPresentTest(old, VALID_DESCRIPTORS[j], middleDefines); } } } this._runTestSet(dictionaryPropertyPresentTests, "Dictionary property-present fraction " + part + " of " + parts + " completed!"); }, // HELPERS runPropertyPresentTests: function runPropertyPresentTests() { print("Running already-present tests now..."); for (var i = 0, sz = VALID_DESCRIPTORS.length; i < sz; i++) { var old = VALID_DESCRIPTORS[i]; print("Starting test with old descriptor " + old.toSource() + "..."); for (var j = 0, sz2 = VALID_DESCRIPTORS.length; j < sz2; j++) this._runSinglePropertyPresentTest(old, VALID_DESCRIPTORS[j], []); } }, _runTestSet: function _runTestSet(fun, completeMessage) { try { fun(); print(completeMessage); } catch (e) { print("ERROR, EXITING (line " + (e.lineNumber || -1) + "): " + e); throw e; } finally { this._reportAllErrors(); } }, _reportAllErrors: function _reportAllErrors() { var errorCount = this._logLines.length; print("Full accumulated number of errors: " + errorCount); if (errorCount > 0) throw errorCount + " errors detected, FAIL"; }, _simpleFunctionLengthTests: function _simpleFunctionLengthTests(fun) { print("Running simple Function.length tests now.."); function expectThrowTypeError(o, p, desc) { var err = "", passed = false; try { Object.defineProperty(o, p, desc); } catch (e) { err = e; passed = e instanceof TypeError; } assertEq(passed, true, fun + " didn't throw TypeError when called: " + err); } expectThrowTypeError(function a() { }, "length", { value: 1 }); expectThrowTypeError(function a() { }, "length", { enumerable: true }); expectThrowTypeError(function a() { }, "length", { configurable: true }); expectThrowTypeError(function a() { }, "length", { writable: true }); }, _fullFunctionLengthTests: function _fullFunctionLengthTests(fun) { var len = fun.length; print("Running Function.length (" + len + ") tests now..."); var desc; var gen = new DescriptorState(); while ((desc = gen.nextDescriptor())) this._runSingleFunctionLengthTest(fun, len, desc); }, _log: function _log(v) { var m = "" + v; print(m); this._logLines.push(m); }, _runSingleNotPresentTest: function _runSingleNotPresentTest(desc) { var nativeObj = NativeTest.newObject(); var reimplObj = ReimplTest.newObject(); try { NativeTest.defineProperty(nativeObj, "foo", desc); } catch (e) { try { ReimplTest.defineProperty(reimplObj, "foo", desc); } catch (e2) { if (e.constructor !== e2.constructor) { this._log("Difference when comparing native/reimplementation " + "behavior for new descriptor " + desc.toSource() + ", native threw " + e + ", reimpl threw " + e2); } return; } this._log("Difference when comparing native/reimplementation " + "behavior for new descriptor " + desc.toSource() + ", error " + e); return; } try { ReimplTest.defineProperty(reimplObj, "foo", desc); } catch (e) { this._log("Reimpl threw defining new descriptor " + desc.toSource() + ", error: " + e); return; } var nativeDesc = NativeTest.getDescriptor(nativeObj, "foo"); var reimplDesc = ReimplTest.getDescriptor(reimplObj, "foo"); try { compareDescriptors(nativeDesc, reimplDesc); } catch (e) { this._log("Difference comparing returned descriptors for new " + "property defined with descriptor " + desc.toSource() + "; error: " + e); return; } }, _runSinglePropertyPresentTest: function _runSinglePropertyPresentTest(old, add, middleDefines) { var nativeObj = NativeTest.newObject(); var reimplObj = ReimplTest.newObject(); try { NativeTest.defineProperty(nativeObj, "foo", old); } catch (e) { if (!SameValue(NativeTest.getDescriptor(nativeObj, "foo"), undefined)) { this._log("defining bad property descriptor: " + old.toSource()); return; } try { ReimplTest.defineProperty(reimplObj, "foo", old); } catch (e2) { if (!SameValue(ReimplTest.getDescriptor(reimplObj, "foo"), undefined)) { this._log("defining bad property descriptor: " + old.toSource() + "; reimplObj: " + uneval(reimplObj)); } if (e.constructor !== e2.constructor) { this._log("Different errors defining bad property descriptor: " + old.toSource() + "; native threw " + e + ", reimpl " + "threw " + e2); } return; } this._log("Difference defining a property with descriptor " + old.toSource() + ", error " + e); return; } try { ReimplTest.defineProperty(reimplObj, "foo", old); } catch (e) { this._log("Difference when comparing native/reimplementation " + "behavior when adding descriptor " + add.toSource() + ", error: " + e); return; } // Now add (or even readd) however many properties were specified between // the original property to add and the new one, to test redefining // non-last-properties and properties in scopes in dictionary mode. for (var i = 0, sz = middleDefines.length; i < sz; i++) { var middle = middleDefines[i]; var prop = middle.property; var desc = middle.descriptor; try { NativeTest.defineProperty(nativeObj, prop, desc); ReimplTest.defineProperty(reimplObj, prop, desc); } catch (e) { this._log("failure defining middle descriptor: " + desc.toSource() + ", error " + e); return; } // Sanity check var nativeDesc = NativeTest.getDescriptor(nativeObj, prop); var reimplDesc = ReimplTest.getDescriptor(reimplObj, prop); compareDescriptors(nativeDesc, reimplDesc); compareDescriptors(nativeDesc, desc); } try { NativeTest.defineProperty(nativeObj, "foo", add); } catch (e) { try { ReimplTest.defineProperty(reimplObj, "foo", add); } catch (e2) { if (e.constructor !== e2.constructor) { this._log("Difference when comparing native/reimplementation " + "behavior for descriptor " + add.toSource() + " overwriting descriptor " + old.toSource() + "; " + "native threw " + e + ", reimpl threw " + e2); } return; } this._log("Difference when comparing native/reimplementation " + "behavior for added descriptor " + add.toSource() + ", " + "initial was " + old.toSource() + "; error: " + e); return; } try { ReimplTest.defineProperty(reimplObj, "foo", add); } catch (e) { this._log("Difference when comparing native/reimplementation " + "behavior for readded descriptor " + add.toSource() + ", " + "initial was " + old.toSource() + "; native readd didn't " + "throw, reimpl add did, error: " + e); return; } var nativeDesc = NativeTest.getDescriptor(nativeObj, "foo"); var reimplDesc = ReimplTest.getDescriptor(reimplObj, "foo"); try { compareDescriptors(nativeDesc, reimplDesc); } catch (e) { this._log("Difference comparing returned descriptors for readded " + "property defined with descriptor " + add.toSource() + "; " + "initial was " + old.toSource() + "; error: " + e); return; } }, _runSingleFunctionLengthTest: function _runSingleFunctionLengthTest(fun, len, desc) { var nativeObj = fun; var reimplObj = ReimplTest.newObject(); ReimplTest.defineProperty(reimplObj, "length", { value: len, enumerable: false, configurable: false, writable: false }); try { NativeTest.defineProperty(nativeObj, "length", desc); } catch (e) { try { ReimplTest.defineProperty(reimplObj, "length", desc); } catch (e2) { if (e.constructor !== e2.constructor) { this._log("Difference when comparing native/reimplementation " + "behavior defining fun.length with " + desc.toSource() + "; native threw " + e + ", reimpl threw " + e2); } return; } this._log("Difference when comparing Function.length native/reimpl " + "behavior for descriptor " + desc.toSource() + ", native impl threw error " + e); return; } try { ReimplTest.defineProperty(reimplObj, "length", desc); } catch (e) { this._log("Difference defining new Function.length descriptor: impl " + "succeeded, reimpl threw for descriptor " + desc.toSource() + ", error: " + e); return; } var nativeDesc = NativeTest.getDescriptor(nativeObj, "length"); var reimplDesc = ReimplTest.getDescriptor(reimplObj, "length"); try { compareDescriptors(nativeDesc, reimplDesc); } catch (e) { this._log("Difference comparing returned descriptors for " + "Function.length with descriptor " + desc.toSource() + "; error: " + e); return; } } }; function runDictionaryPropertyPresentTestsFraction(PART, PARTS) { var testfile = '15.2.3.6-dictionary-redefinition-' + PART + '-of-' + PARTS + '.js'; var BUGNUMBER = 560566; var summary = 'ES5 Object.defineProperty(O, P, Attributes): dictionary redefinition ' + PART + ' of ' + PARTS; print(BUGNUMBER + ": " + summary); try { new TestRunner().runDictionaryPropertyPresentTestsFraction(PART, PARTS); } catch (e) { throw "Error thrown during testing: " + e + " at line " + e.lineNumber + "\n" + (e.stack ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n" : ""); } if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); } function runNonTerminalPropertyPresentTestsFraction(PART, PARTS) { var BUGNUMBER = 560566; var summary = 'ES5 Object.defineProperty(O, P, Attributes): middle redefinition ' + PART + ' of ' + PARTS; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ try { new TestRunner().runNonTerminalPropertyPresentTestsFraction(PART, PARTS); } catch (e) { throw "Error thrown during testing: " + e + " at line " + e.lineNumber + "\n" + (e.stack ? "Stack: " + e.stack.split("\n").slice(2).join("\n") + "\n" : ""); } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("Tests complete!"); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/extensibility-01.js0000644000175000017500000000444511545150464023452 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ var gTestfile = '15.2.3.10-01.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 492849; var summary = 'ES5: Implement Object.preventExtensions, Object.isExtensible'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ function trySetProperty(o, p, v, strict) { function strictSetProperty() { "use strict"; o[p] = v; } function setProperty() { o[p] = v; } assertEq(Object.prototype.hasOwnProperty.call(o, p), false); try { if (strict) strictSetProperty(); else setProperty(); if (o[p] === v) return "set"; if (p in o) return "set-converted"; return "swallowed"; } catch (e) { return "throw"; } } function tryDefineProperty(o, p, v) { assertEq(Object.prototype.hasOwnProperty.call(o, p), false); try { Object.defineProperty(o, p, { value: v }); if (o[p] === v) return "set"; if (p in o) return "set-converted"; return "swallowed"; } catch (e) { return "throw"; } } assertEq(typeof Object.preventExtensions, "function"); assertEq(Object.preventExtensions.length, 1); var slowArray = [1, 2, 3]; slowArray.slow = 5; var objs = [{}, { 1: 2 }, { a: 3 }, [], [1], [, 1], slowArray, function a(){}, /a/]; for (var i = 0, sz = objs.length; i < sz; i++) { var o = objs[i]; assertEq(Object.isExtensible(o), true, "object " + i + " not extensible?"); var o2 = Object.preventExtensions(o); assertEq(o, o2); assertEq(Object.isExtensible(o), false, "object " + i + " is extensible?"); assertEq(trySetProperty(o, "baz", 17, true), "throw", "unexpected behavior for strict-mode property-addition to " + "object " + i); assertEq(trySetProperty(o, "baz", 17, false), "swallowed", "unexpected behavior for property-addition to object " + i); assertEq(tryDefineProperty(o, "baz", 17), "throw", "unexpected behavior for new property definition on object " + i); } /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/extensibility-02.js0000644000175000017500000000214511545150464023446 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ var gTestfile = '15.2.3.4-01.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 492849; var summary = 'ES5: Implement Object.preventExtensions, Object.isExtensible'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ assertEq(typeof Object.isExtensible, "function"); assertEq(Object.isExtensible.length, 1); var slowArray = [1, 2, 3]; slowArray.slow = 5; var objs = [{}, { 1: 2 }, { a: 3 }, [], [1], [, 1], slowArray, function a(){}, /a/]; for (var i = 0, sz = objs.length; i < sz; i++) { var o = objs[i]; assertEq(Object.isExtensible(o), true, "object " + i + " not extensible?"); var o2 = Object.preventExtensions(o); assertEq(o, o2); assertEq(Object.isExtensible(o), false, "object " + i + " is extensible?"); } /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/freeze-global-eval-const.js0000644000175000017500000000043611545150464025123 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ try { evalcx("Object.freeze(this); eval('const q;')"); } catch (e) { assertEq(e.message, "({lazy:false}) is not extensible"); } reportCompare(0, 0, "don't crash"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/isPrototypeOf.js0000644000175000017500000000472011545150464023162 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var gTestfile = 'isPrototypeOf.js'; var BUGNUMBER = 619283; var summary = "Object.prototype.isPrototypeOf"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ function expectThrowTypeError(fun) { try { var r = fun(); throw new Error("didn't throw TypeError, returned " + r); } catch (e) { assertEq(e instanceof TypeError, true, "didn't throw TypeError, got: " + e); } } var isPrototypeOf = Object.prototype.isPrototypeOf; /* * 1. If V is not an Object, return false. */ assertEq(isPrototypeOf(), false); assertEq(isPrototypeOf(1), false); assertEq(isPrototypeOf(Number.MAX_VALUE), false); assertEq(isPrototypeOf(NaN), false); assertEq(isPrototypeOf(""), false); assertEq(isPrototypeOf("sesquicentennial"), false); assertEq(isPrototypeOf(true), false); assertEq(isPrototypeOf(false), false); assertEq(isPrototypeOf(0.72), false); assertEq(isPrototypeOf(undefined), false); assertEq(isPrototypeOf(null), false); /* * 2. Let O be the result of calling ToObject passing the this value as the * argument. */ var protoGlobal = Object.create(this); expectThrowTypeError(function() { isPrototypeOf.call(null, {}); }); expectThrowTypeError(function() { isPrototypeOf.call(undefined, {}); }); expectThrowTypeError(function() { isPrototypeOf({}); }); expectThrowTypeError(function() { isPrototypeOf.call(null, protoGlobal); }); expectThrowTypeError(function() { isPrototypeOf.call(undefined, protoGlobal); }); expectThrowTypeError(function() { isPrototypeOf(protoGlobal); }); /* * 3. Repeat */ /* * 3a. Let V be the value of the [[Prototype]] internal property of V. * 3b. If V is null, return false. */ assertEq(Object.prototype.isPrototypeOf(Object.prototype), false); assertEq(String.prototype.isPrototypeOf({}), false); assertEq(Object.prototype.isPrototypeOf(Object.create(null)), false); /* 3c. If O and V refer to the same object, return true. */ assertEq(Object.prototype.isPrototypeOf({}), true); assertEq(this.isPrototypeOf(protoGlobal), true); assertEq(Object.prototype.isPrototypeOf({}), true); assertEq(Object.prototype.isPrototypeOf(new Number(17)), true); assertEq(Object.prototype.isPrototypeOf(function(){}), true); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/jstests.list0000644000175000017500000000571011545150464022372 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/Object/ skip script defineProperty-setup.js # not a test. script 15.2.3.3-01.js script 15.2.3.4-01.js script 15.2.3.4-02.js script 15.2.3.4-03.js script 15.2.3.4-04.js script 15.2.3.5-01.js skip-if(!xulRuntime.shell) script 15.2.3.6-function-length.js # uses shell load() function script 15.2.3.6-miscellaneous.js skip-if(!xulRuntime.shell) script 15.2.3.6-new-definition.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-redefinition-1-of-4.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-redefinition-2-of-4.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-redefinition-3-of-4.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-redefinition-4-of-4.js # uses shell load() function script 15.2.3.7-01.js script 15.2.3.9.js script 15.2.3.12.js script extensibility-01.js script extensibility-02.js script 15.2.3.14-01.js # does not use reportCompare skip-if(!xulRuntime.shell) script 15.2.3.6-middle-redefinition-1-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-middle-redefinition-2-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-middle-redefinition-3-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-middle-redefinition-4-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-middle-redefinition-5-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-middle-redefinition-6-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-middle-redefinition-7-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-middle-redefinition-8-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-dictionary-redefinition-1-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-dictionary-redefinition-2-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-dictionary-redefinition-3-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-dictionary-redefinition-4-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-dictionary-redefinition-5-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-dictionary-redefinition-6-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-dictionary-redefinition-7-of-8.js # uses shell load() function skip-if(!xulRuntime.shell) script 15.2.3.6-dictionary-redefinition-8-of-8.js # uses shell load() function script 15.2.3.6-define-over-method.js script mutation-prevention-methods.js script object-toString-01.js script vacuous-accessor-unqualified-name.js script add-property-non-extensible.js skip-if(!xulRuntime.shell) script freeze-global-eval-const.js # uses evalcx script preventExtensions-idempotent.js script isPrototypeOf.js script propertyIsEnumerable.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/mutation-prevention-methods.js0000644000175000017500000000565011545150464026027 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ var gTestfile = 'mutation-prevention-methods.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 492849; var summary = 'Object.is{Sealed,Frozen}, Object.{seal,freeze}'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ // Empty object var o1 = {}; assertEq(Object.isExtensible(o1), true); assertEq(Object.isSealed(o1), false); assertEq(Object.isFrozen(o1), false); Object.preventExtensions(o1); // An non-extensible empty object has no properties, so it is vacuously sealed // and frozen. assertEq(Object.isExtensible(o1), false); assertEq(Object.isSealed(o1), true); assertEq(Object.isFrozen(o1), true); // Object with a data property var o2 = { 1: 2 }; assertEq(Object.isExtensible(o2), true); assertEq(Object.isSealed(o2), false); assertEq(Object.isFrozen(o2), false); Object.preventExtensions(o2); assertEq(Object.isExtensible(o2), false); assertEq(Object.isSealed(o2), false); assertEq(Object.isFrozen(o2), false); Object.seal(o2); assertEq(Object.isExtensible(o2), false); assertEq(Object.isSealed(o2), true); assertEq(Object.isFrozen(o2), false); assertEq(o2[1], 2); var desc; desc = Object.getOwnPropertyDescriptor(o2, "1"); assertEq(typeof desc, "object"); assertEq(desc.enumerable, true); assertEq(desc.configurable, false); assertEq(desc.value, 2); assertEq(desc.writable, true); o2[1] = 17; assertEq(o2[1], 17); desc = Object.getOwnPropertyDescriptor(o2, "1"); assertEq(typeof desc, "object"); assertEq(desc.enumerable, true); assertEq(desc.configurable, false); assertEq(desc.value, 17); assertEq(desc.writable, true); Object.freeze(o2); assertEq(o2[1], 17); desc = Object.getOwnPropertyDescriptor(o2, "1"); assertEq(typeof desc, "object"); assertEq(desc.enumerable, true); assertEq(desc.configurable, false); assertEq(desc.value, 17); assertEq(desc.writable, false); // Object with an accessor property var o3 = { get foo() { return 17; } }; assertEq(Object.isExtensible(o3), true); assertEq(Object.isSealed(o3), false); assertEq(Object.isFrozen(o3), false); Object.preventExtensions(o3); assertEq(Object.isExtensible(o3), false); assertEq(Object.isSealed(o3), false); assertEq(Object.isFrozen(o3), false); Object.seal(o3); // An accessor property in a sealed object is unchanged if that object is // frozen, so a sealed object containing only accessor properties is also // vacuously frozen. assertEq(Object.isExtensible(o3), false); assertEq(Object.isSealed(o3), true); assertEq(Object.isFrozen(o3), true); Object.freeze(o3); assertEq(Object.isExtensible(o3), false); assertEq(Object.isSealed(o3), true); assertEq(Object.isFrozen(o3), true); /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/object-toString-01.js0000644000175000017500000000262211545150464023626 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ var gTestfile = 'object-toString-01.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 575522; var summary = '({}).toString.call(null) == "[object Null]", ' + '({}).toString.call(undefined) == "[object Undefined]", '; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var toString = Object.prototype.toString; assertEq(toString.call(null), "[object Null]"); assertEq(toString.call(undefined), "[object Undefined]"); assertEq(toString.call(true), "[object Boolean]"); assertEq(toString.call(false), "[object Boolean]"); assertEq(toString.call(0), "[object Number]"); assertEq(toString.call(-0), "[object Number]"); assertEq(toString.call(1), "[object Number]"); assertEq(toString.call(-1), "[object Number]"); assertEq(toString.call(NaN), "[object Number]"); assertEq(toString.call(Infinity), "[object Number]"); assertEq(toString.call(-Infinity), "[object Number]"); assertEq(toString.call("foopy"), "[object String]"); assertEq(toString.call({}), "[object Object]"); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/preventExtensions-idempotent.js0000644000175000017500000000152011545150464026240 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jeff Walden */ var gTestfile = 'preventExtensions-idempotent.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 599459; var summary = 'Object.preventExtensions should be idempotent'; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var obj = {}; assertEq(Object.preventExtensions(obj), obj); assertEq(Object.isExtensible(obj), false); assertEq(Object.preventExtensions(obj), obj); assertEq(Object.isExtensible(obj), false); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/propertyIsEnumerable.js0000644000175000017500000001411611545150464024514 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var gTestfile = 'propertyIsEnumerable.js'; var BUGNUMBER = 619283; var summary = "Object.prototype.propertyIsEnumerable"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ function expectThrowError(errorCtor, fun) { try { var r = fun(); throw "didn't throw TypeError, returned " + r; } catch (e) { assertEq(e instanceof errorCtor, true, "didn't throw " + errorCtor.prototype.name + ", got: " + e); } } function expectThrowTypeError(fun) { expectThrowError(TypeError, fun); } function withToString(fun) { return { toString: fun }; } function withValueOf(fun) { return { toString: null, valueOf: fun }; } var propertyIsEnumerable = Object.prototype.propertyIsEnumerable; /* * 1. Let P be ToString(V). */ expectThrowError(ReferenceError, function() { propertyIsEnumerable(withToString(function() { fahslkjdfhlkjdsl; })); }); expectThrowError(ReferenceError, function() { propertyIsEnumerable.call(null, withToString(function() { fahslkjdfhlkjdsl; })); }); expectThrowError(ReferenceError, function() { propertyIsEnumerable.call(undefined, withToString(function() { fahslkjdfhlkjdsl; })); }); expectThrowError(ReferenceError, function() { propertyIsEnumerable(withValueOf(function() { fahslkjdfhlkjdsl; })); }); expectThrowError(ReferenceError, function() { propertyIsEnumerable.call(null, withValueOf(function() { fahslkjdfhlkjdsl; })); }); expectThrowError(ReferenceError, function() { propertyIsEnumerable.call(undefined, withValueOf(function() { fahslkjdfhlkjdsl; })); }); expectThrowError(SyntaxError, function() { propertyIsEnumerable(withToString(function() { eval("}"); })); }); expectThrowError(SyntaxError, function() { propertyIsEnumerable.call(null, withToString(function() { eval("}"); })); }); expectThrowError(SyntaxError, function() { propertyIsEnumerable.call(undefined, withToString(function() { eval("}"); })); }); expectThrowError(SyntaxError, function() { propertyIsEnumerable(withValueOf(function() { eval("}"); })); }); expectThrowError(SyntaxError, function() { propertyIsEnumerable.call(null, withValueOf(function() { eval("}"); })); }); expectThrowError(SyntaxError, function() { propertyIsEnumerable.call(undefined, withValueOf(function() { eval("}"); })); }); expectThrowError(RangeError, function() { propertyIsEnumerable(withToString(function() { [].length = -1; })); }); expectThrowError(RangeError, function() { propertyIsEnumerable.call(null, withToString(function() { [].length = -1; })); }); expectThrowError(RangeError, function() { propertyIsEnumerable.call(undefined, withToString(function() { [].length = -1; })); }); expectThrowError(RangeError, function() { propertyIsEnumerable(withValueOf(function() { [].length = -1; })); }); expectThrowError(RangeError, function() { propertyIsEnumerable.call(null, withValueOf(function() { [].length = -1; })); }); expectThrowError(RangeError, function() { propertyIsEnumerable.call(undefined, withValueOf(function() { [].length = -1; })); }); expectThrowError(RangeError, function() { propertyIsEnumerable(withToString(function() { [].length = 0.7; })); }); expectThrowError(RangeError, function() { propertyIsEnumerable.call(null, withToString(function() { [].length = 0.7; })); }); expectThrowError(RangeError, function() { propertyIsEnumerable.call(undefined, withToString(function() { [].length = 0.7; })); }); expectThrowError(RangeError, function() { propertyIsEnumerable(withValueOf(function() { [].length = 0.7; })); }); expectThrowError(RangeError, function() { propertyIsEnumerable.call(null, withValueOf(function() { [].length = 0.7; })); }); expectThrowError(RangeError, function() { propertyIsEnumerable.call(undefined, withValueOf(function() { [].length = 0.7; })); }); /* * 2. Let O be the result of calling ToObject passing the this value as the * argument. */ expectThrowTypeError(function() { propertyIsEnumerable("s"); }); expectThrowTypeError(function() { propertyIsEnumerable.call(null, "s"); }); expectThrowTypeError(function() { propertyIsEnumerable.call(undefined, "s"); }); expectThrowTypeError(function() { propertyIsEnumerable(true); }); expectThrowTypeError(function() { propertyIsEnumerable.call(null, true); }); expectThrowTypeError(function() { propertyIsEnumerable.call(undefined, true); }); expectThrowTypeError(function() { propertyIsEnumerable(NaN); }); expectThrowTypeError(function() { propertyIsEnumerable.call(null, NaN); }); expectThrowTypeError(function() { propertyIsEnumerable.call(undefined, NaN); }); expectThrowTypeError(function() { propertyIsEnumerable({}); }); expectThrowTypeError(function() { propertyIsEnumerable.call(null, {}); }); expectThrowTypeError(function() { propertyIsEnumerable.call(undefined, {}); }); /* * 3. Let desc be the result of calling the [[GetOwnProperty]] internal method * of O passing P as the argument. * 4. If desc is undefined, return false. */ assertEq(propertyIsEnumerable.call({}, "valueOf"), false); assertEq(propertyIsEnumerable.call({}, "toString"), false); assertEq(propertyIsEnumerable.call("s", 1), false); assertEq(propertyIsEnumerable.call({}, "dsfiodjfs"), false); assertEq(propertyIsEnumerable.call(true, "toString"), false); assertEq(propertyIsEnumerable.call({}, "__proto__"), false); assertEq(propertyIsEnumerable.call(Object, "getOwnPropertyDescriptor"), false); assertEq(propertyIsEnumerable.call(this, "expectThrowTypeError"), true); assertEq(propertyIsEnumerable.call("s", "length"), false); assertEq(propertyIsEnumerable.call("s", 0), true); assertEq(propertyIsEnumerable.call(Number, "MAX_VALUE"), false); assertEq(propertyIsEnumerable.call({ x: 9 }, "x"), true); assertEq(propertyIsEnumerable.call(function() { }, "prototype"), false); assertEq(propertyIsEnumerable.call(function() { }, "length"), false); assertEq(propertyIsEnumerable.call(function() { "use strict"; }, "caller"), false); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/shell.js0000644000175000017500000000000011545150464021426 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Object/vacuous-accessor-unqualified-name.js0000644000175000017500000000124111545150464027036 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var gTestfile = 'vacuous-accessor-unqualified-name.js'; //----------------------------------------------------------------------------- var BUGNUMBER = 560216; var summary = "Using a name referring to a { get: undefined, set: undefined } descriptor " + "shouldn't assert"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ Object.defineProperty(this, "x", { set: undefined }); x; /******************************************************************************/ reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/RegExp/15.10.5-01.js0000644000175000017500000000064411545150464021346 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var BUGNUMBER = 614603; var summary = "RegExp.length"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ assertEq(RegExp.length, 2); assertEq(/a/.constructor.length, 2); if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/RegExp/15.10.7.5-01.js0000644000175000017500000000313611545150464021512 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var BUGNUMBER = 465199; var summary = "RegExp lastIndex property set should not coerce type to number"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var called = false; var o = { valueOf: function() { called = true; return 1; } }; var r = /a/g; var desc, m; assertEq(r.lastIndex, 0); desc = Object.getOwnPropertyDescriptor(r, "lastIndex"); assertEq(desc.enumerable, false); assertEq(desc.configurable, false); assertEq(desc.value, 0); assertEq(desc.writable, true); r.lastIndex = o; assertEq(r.lastIndex, o); desc = Object.getOwnPropertyDescriptor(r, "lastIndex"); assertEq(desc.enumerable, false); assertEq(desc.configurable, false); assertEq(desc.value, o); assertEq(desc.writable, true); assertEq(called, false); assertEq(r.exec("aaaa").length, 1); assertEq(called, true); assertEq(r.lastIndex, 2); desc = Object.getOwnPropertyDescriptor(r, "lastIndex"); assertEq(desc.enumerable, false); assertEq(desc.configurable, false); assertEq(desc.value, 2); assertEq(desc.writable, true); r.lastIndex = -0.2; assertEq(r.lastIndex, -0.2); m = r.exec("aaaa"); assertEq(Array.isArray(m), true); assertEq(m.length, 1); assertEq(m[0], "a"); assertEq(r.lastIndex, 1); m = r.exec("aaaa"); assertEq(Array.isArray(m), true); assertEq(m.length, 1); assertEq(m[0], "a"); assertEq(r.lastIndex, 2); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/RegExp/7.8.5-01.js0000644000175000017500000000142711545150464021216 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var BUGNUMBER = 615070; var summary = "Line terminator after backslash is invalid in regexp literals"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var regexps = ["/\\\u000A/", "/\\\u000D/", "/\\\u2028/", "/\\\u2029/", "/ab\\\n/", "/ab\\\r/", "/ab\\\u2028/", "/ab\\\u2029/", "/ab[c\\\n]/", "/a[bc\\", "/\\"]; for(var i=0; i */ /* Length of 32 */ var foo = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; /* Make len(foo) 32768 */ for (i = 0; i < 10; ++i) { foo += foo; } /* Add one "a" to cause overflow later */ foo += "a"; var bar = "bbbbbbbbbbbbbbbb"; /* Make len(bar) 65536 */ for (i = 0; i < 12; ++i) { bar += bar; } /* * Resulting string should be * len(foo)*len(bar) = (2^10 * 32 + 1) * 65536 = 2147549184 * which will be negative as jsint */ try { foo.replace(/[a]/g, bar); } catch (e) { reportCompare(e instanceof InternalError, true, "Internal error due to overallocation is ok."); } reportCompare(true, true, "No crash occurred."); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/RegExp/shell.js0000644000175000017500000000000011545150464021412 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/10.4.2.js0000644000175000017500000000333711545150464021163 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* Direct calls to eval should inherit the strictness of the calling code. */ assertEq(testLenientAndStrict("eval('010')", completesNormally, raisesException(SyntaxError)), true); /* * Directives in the eval code itself should always override a direct * caller's strictness. */ assertEq(testLenientAndStrict("eval('\"use strict\"; 010')", raisesException(SyntaxError), raisesException(SyntaxError)), true); /* Code passed to indirect calls to eval should never be strict. */ assertEq(testLenientAndStrict("var evil=eval; evil('010')", completesNormally, completesNormally), true); /* * Code passed to the Function constructor never inherits the caller's * strictness. */ assertEq(completesNormally("Function('010')"), true); assertEq(raisesException(SyntaxError)("Function('\"use strict\"; 010')"), true); /* * If 'eval' causes a frame's primitive |this| to become wrapped, the frame should see the same * wrapper object as the eval code. */ var call_this, eval_this; function f(code) { /* * At this point, a primitive |this| has not yet been wrapped. A * reference to |this| from the eval call should wrap it, and the wrapper * should be stored where the call frame can see it. */ eval(code); call_this = this; } f.call(true, 'eval_this = this'); assertEq(call_this, eval_this); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/10.4.3.js0000644000175000017500000000330111545150464021153 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var obj = {} function strict() { "use strict"; return this; } assertEq(strict.call(""), ""); assertEq(strict.call(true), true); assertEq(strict.call(42), 42); assertEq(strict.call(null), null); assertEq(strict.call(undefined), undefined); assertEq(strict.call(obj), obj); assertEq(new strict() instanceof Object, true); /* * The compiler internally converts x['foo'] to x.foo. Writing x[s] where * s='foo' is enough to throw it off the scent for now. */ var strictString = 'strict'; Boolean.prototype.strict = strict; assertEq(true.strict(), true); assertEq(true[strictString](), true); Number.prototype.strict = strict; assertEq((42).strict(), 42); assertEq(42[strictString](), 42); String.prototype.strict = strict; assertEq("".strict(), ""); assertEq(""[strictString](), ""); function lenient() { return this; } assertEq(lenient.call("") instanceof String, true); assertEq(lenient.call(true) instanceof Boolean, true); assertEq(lenient.call(42) instanceof Number, true); assertEq(lenient.call(null), this); assertEq(lenient.call(undefined), this); assertEq(lenient.call(obj), obj); assertEq(new lenient() instanceof Object, true); var lenientString = 'lenient'; Boolean.prototype.lenient = lenient; assertEq(true.lenient() instanceof Boolean, true); assertEq(true[lenientString]() instanceof Boolean, true); Number.prototype.lenient = lenient; assertEq(42[lenientString]() instanceof Number, true); String.prototype.lenient = lenient; assertEq(""[lenientString]() instanceof String, true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/10.6.js0000644000175000017500000000351511545150464021023 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function callFunctionBody(expr) { return ( '(function f() {\n' + 'Object.defineProperties(arguments, {1: { writable: false },\n' + ' 2: { configurable: false },\n' + ' 3: { writable: false,\n' + ' configurable: false }});\n' + 'return (' + expr + ');\n' + '})(0, 1, 2, 3);'); } assertEq(testLenientAndStrict(callFunctionBody('arguments[0] = 42'), returns(42), returns(42)), true); assertEq(testLenientAndStrict(callFunctionBody('delete arguments[0]'), returns(true), returns(true)), true); assertEq(testLenientAndStrict(callFunctionBody('arguments[1] = 42'), returns(42), raisesException(TypeError)), true); assertEq(testLenientAndStrict(callFunctionBody('delete arguments[1]'), returns(true), returns(true)), true); assertEq(testLenientAndStrict(callFunctionBody('arguments[2] = 42'), returns(42), returns(42)), true); assertEq(testLenientAndStrict(callFunctionBody('delete arguments[2]'), returns(false), raisesException(TypeError)), true); assertEq(testLenientAndStrict(callFunctionBody('arguments[3] = 42'), returns(42), raisesException(TypeError)), true); assertEq(testLenientAndStrict(callFunctionBody('delete arguments[3]'), returns(false), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/11.1.5.js0000644000175000017500000001500611545150464021160 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* Simple identifier labels. */ assertEq(testLenientAndStrict('({x:1, x:1})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({x:1, y:1})', parsesSuccessfully, parsesSuccessfully), true); assertEq(testLenientAndStrict('({x:1, y:1, x:1})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); /* Property names can be written as strings, too. */ assertEq(testLenientAndStrict('({x:1, "x":1})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({"x":1, x:1})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({"x":1, "x":1})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); /* Numeric property names. */ assertEq(testLenientAndStrict('({1.5:1, 1.5:1})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({1.5:1, 15e-1:1})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({6.02214179e23:1, 6.02214179e23:1})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({6.02214179e23:1, 3.1415926535:1})', parsesSuccessfully, parsesSuccessfully), true); assertEq(testLenientAndStrict('({ 1: 1, "1": 2 })', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({ "1": 1, 1: 2 })', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({ 2.5: 1, "2.5": 2 })', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({ "2.5": 1, 2.5: 2 })', parsesSuccessfully, parseRaisesException(SyntaxError)), true); /* Many properties, to exercise JSAtomList's hash-table variant. */ assertEq(testLenientAndStrict('({a:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1, i:1, j:1, k:1, l:1, m:1, n:1, o:1, p:1, q:1, r:1, s:1, t:1, u:1, v:1, w:1, x:1, y:1, z:1})', parsesSuccessfully, parsesSuccessfully), true); assertEq(testLenientAndStrict('({a:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1, i:1, j:1, k:1, l:1, m:1, n:1, o:1, p:1, q:1, r:1, s:1, t:1, u:1, v:1, w:1, x:1, y:1, a:1})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); /* * Getters, setters, and value properties should conflict only when * appropriate. */ assertEq(testLenientAndStrict('({get x() {}, x:1})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({x:1, get x() {}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x(q) {}, x:1})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({x:1, set x(q) {}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({1:1, set 1(q) {}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set 1(q) {}, 1:1})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({"1":1, set 1(q) {}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set 1(q) {}, "1":1})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({get x() {}, set x(q) {}})', parsesSuccessfully, parsesSuccessfully), true); assertEq(testLenientAndStrict('({set x(q) {}, get x() {}})', parsesSuccessfully, parsesSuccessfully), true); assertEq(testLenientAndStrict('({get x() {}, set x(q) {}, x:1})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x(q) {}, get x() {}, x:1})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({get x() {}, get x() {}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x() {}, set x() {}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({get x() {}, set x(q) {}, y:1})', parsesSuccessfully, parsesSuccessfully), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/11.13.1.js0000644000175000017500000000201511545150464021233 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * Simple assignment expressions in strict mode code must not be * assignments to 'eval' or 'arguments'. */ assertEq(testLenientAndStrict('arguments=1', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('eval=1', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(arguments)=1', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(eval)=1', parsesSuccessfully, parseRaisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/11.13.2.js0000644000175000017500000000202311545150464021233 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * Compound assignment expressions in strict mode code must not be * assignments to 'eval' or 'arguments'. */ assertEq(testLenientAndStrict('arguments+=1', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('eval+=1', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(arguments)+=1', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(eval)+=1', parsesSuccessfully, parseRaisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/11.3.1.js0000644000175000017500000000177611545150464021167 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * Postfix increment expressions must not have 'eval' or 'arguments' * as their operands. */ assertEq(testLenientAndStrict('arguments++', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('eval++', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(arguments)++', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(eval)++', parsesSuccessfully, parseRaisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/11.3.2.js0000644000175000017500000000177611545150464021170 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * Postfix decrement expressions must not have 'eval' or 'arguments' * as their operands. */ assertEq(testLenientAndStrict('arguments--', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('eval--', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(arguments)--', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(eval)--', parsesSuccessfully, parseRaisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/11.4.1.js0000644000175000017500000000277211545150464021165 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* Deleting an identifier is a syntax error in strict mode code only. */ assertEq(testLenientAndStrict('delete x;', parsesSuccessfully, parseRaisesException(SyntaxError)), true); /* * A reference expression surrounded by parens is itself a reference * expression. */ assertEq(testLenientAndStrict('delete (x);', parsesSuccessfully, parseRaisesException(SyntaxError)), true); /* Deleting other sorts of expressions are not syntax errors in either mode. */ assertEq(testLenientAndStrict('delete x.y;', parsesSuccessfully, parsesSuccessfully), true); /* Functions should inherit the surrounding code's strictness. */ assertEq(testLenientAndStrict('function f() { delete x; }', parsesSuccessfully, parseRaisesException(SyntaxError)), true); /* Local directives override the surrounding code's strictness. */ assertEq(testLenientAndStrict('function f() { "use strict"; delete x; }', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/11.4.4.js0000644000175000017500000000177511545150464021172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * Prefix increment expressions must not have 'eval' or 'arguments' as * their operands. */ assertEq(testLenientAndStrict('++arguments', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('++eval', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('++(arguments)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('++(eval)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/11.4.5.js0000644000175000017500000000177511545150464021173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * Prefix decrement expressions must not have 'eval' or 'arguments' as * their operands. */ assertEq(testLenientAndStrict('--arguments', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('--eval', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('--(arguments)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('--(eval)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/12.10.1.js0000644000175000017500000000177211545150464021242 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * 'with' statements are forbidden in strict top-level code. This is * eval code, but that's close enough. */ assertEq(testLenientAndStrict('with (1) {}', completesNormally, raisesException(SyntaxError)), true); /* 'with' statements are forbidden in strict function code. */ assertEq(testLenientAndStrict('function f() { "use strict"; with (1) {} }', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); /* * A use strict directive in a function mustn't affect the strictness * of subsequent code. */ assertEq(parsesSuccessfully('function f() { "use strict"; }; with (1) {}'), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/12.14.1.js0000644000175000017500000000266111545150464021244 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * In strict mode, the identifier bound by a 'catch' clause may not * be 'eval' or 'arguments'. */ assertEq(testLenientAndStrict('try{}catch(eval){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('try{}catch([eval]){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('try{}catch({x:eval}){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('try{}catch(arguments){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('try{}catch([arguments]){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('try{}catch({x:arguments}){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/12.2.1.js0000644000175000017500000000165011545150464021156 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(testLenientAndStrict('var eval;', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('var x,eval;', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('var arguments;', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('var x,arguments;', parsesSuccessfully, parseRaisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/13.1.js0000644000175000017500000003655711545150464021035 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * In strict mode, it is a syntax error for an identifier to appear * more than once in a function's argument list. */ /* * The parameters of ordinary function definitions should not contain * duplicate identifiers. */ assertEq(testLenientAndStrict('function f(x,y) {}', parsesSuccessfully, parsesSuccessfully), true); assertEq(testLenientAndStrict('function f(x,x) {}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f(x,y,z,y) {}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); /* Exercise the hashed local name map case. */ assertEq(testLenientAndStrict('function f(a,b,c,d,e,f,g,h,d) {}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); /* * SpiderMonkey has always treated duplicates in destructuring * patterns as an error. Strict mode should not affect this. */ assertEq(testLenientAndStrict('function f([x,y]) {}', parsesSuccessfully, parsesSuccessfully), true); assertEq(testLenientAndStrict('function f([x,x]){}', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f(x,[x]){}', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); /* * Strict rules apply to the parameters if the function's body is * strict. */ assertEq(testLenientAndStrict('function f(x,x) { "use strict" };', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); /* * Calls to the function constructor should not be affected by the * strictness of the calling code, but should be affected by the * strictness of the function body. */ assertEq(testLenientAndStrict('Function("x","x","")', completesNormally, completesNormally), true); assertEq(testLenientAndStrict('Function("x","y","")', completesNormally, completesNormally), true); assertEq(testLenientAndStrict('Function("x","x","\'use strict\'")', raisesException(SyntaxError), raisesException(SyntaxError)), true); assertEq(testLenientAndStrict('Function("x","y","\'use strict\'")', completesNormally, completesNormally), true); /* * The parameter lists of function expressions should not contain * duplicate identifiers. */ assertEq(testLenientAndStrict('(function (x,x) 2)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function (x,y) 2)', parsesSuccessfully, parsesSuccessfully), true); /* * All permutations of: * - For the two magic identifiers 'arguments' or 'eval' * - For function definitions, function expressions, expression closures, * and getter and setter property definitions, * - For forms that inherit their context's strictness, and forms that * include their own strictness directives, * - For ordinary parameters, array destructuring parameters, and * object destructuring parameters, * - the magic identifiers may be used to name such parameters * in lenient code, but not in strict code * - the magic identifiers may be used as function names in lenient code, * but not in strict code */ assertEq(testLenientAndStrict('function f(eval){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f([eval]){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f({x:eval}){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function eval(){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f(eval){"use strict";}', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f([eval]){"use strict";}', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f({x:eval}){"use strict";}', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function eval(){"use strict";}', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f(eval){})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f([eval]){})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f({x:eval}){})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function eval(){})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f(eval){"use strict";})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f([eval]){"use strict";})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f({x:eval}){"use strict";})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function eval(){"use strict";})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f(eval) 2)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f([eval]) 2)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f({x:eval}) 2)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function eval() 2)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x(eval){}})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x([eval]){}})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x({x:eval}){}})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x(eval){"use strict";}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x([eval]){"use strict";}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x({x:eval}){"use strict";}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f(arguments){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f([arguments]){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f({x:arguments}){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function arguments(){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f(arguments){"use strict";}', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f([arguments]){"use strict";}', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function f({x:arguments}){"use strict";}', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('function arguments(){"use strict";}', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f(arguments){})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f([arguments]){})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f({x:arguments}){})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function arguments(){})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f(arguments){"use strict";})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f([arguments]){"use strict";})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f({x:arguments}){"use strict";})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function arguments(){"use strict";})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f(arguments) 2)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f([arguments]) 2)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function f({x:arguments}) 2)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('(function arguments() 2)', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x(arguments){}})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x([arguments]){}})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x({x:arguments}){}})', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x(arguments){"use strict";}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x([arguments]){"use strict";}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('({set x({x:arguments}){"use strict";}})', parseRaisesException(SyntaxError), parseRaisesException(SyntaxError)), true); /* * Functions produced using the Function constructor may not use * 'eval' or 'arguments' as a parameter name if their body is strict * mode code. The strictness of the calling code does not affect the * constraints applied to the parameters. */ assertEq(testLenientAndStrict('Function("eval","")', completesNormally, completesNormally), true); assertEq(testLenientAndStrict('Function("eval","\'use strict\';")', raisesException(SyntaxError), raisesException(SyntaxError)), true); assertEq(testLenientAndStrict('Function("arguments","")', completesNormally, completesNormally), true); assertEq(testLenientAndStrict('Function("arguments","\'use strict\';")', raisesException(SyntaxError), raisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.10.7.js0000644000175000017500000000345511545150464021253 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(testLenientAndStrict('var r = /foo/; r.source = "bar"; r.source', returns("foo"), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var r = /foo/; delete r.source', returns(false), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var r = /foo/; r.global = true; r.global', returns(false), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var r = /foo/; delete r.global', returns(false), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var r = /foo/; r.ignoreCase = true; r.ignoreCase', returns(false), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var r = /foo/; delete r.ignoreCase', returns(false), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var r = /foo/; r.multiline = true; r.multiline', returns(false), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var r = /foo/; delete r.multiline', returns(false), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var r = /foo/; r.lastIndex = 42; r.lastIndex', returns(42), returns(42)), true); assertEq(testLenientAndStrict('var r = /foo/; delete r.lastIndex', returns(false), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.3.4.5.js0000644000175000017500000000147311545150464021333 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function strict() { 'use strict'; return this; } function lenient() { return this; } var obj = {}; assertEq(strict.bind(true)(), true); assertEq(strict.bind(42)(), 42); assertEq(strict.bind("")(), ""); assertEq(strict.bind(null)(), null); assertEq(strict.bind(undefined)(), undefined); assertEq(strict.bind(obj)(), obj); assertEq(lenient.bind(true)() instanceof Boolean, true); assertEq(lenient.bind(42)() instanceof Number, true); assertEq(lenient.bind("")() instanceof String, true); assertEq(lenient.bind(null)(), this); assertEq(lenient.bind(undefined)(), this); assertEq(lenient.bind(obj)(), obj); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.3.5.1.js0000644000175000017500000000111011545150464021314 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function fn() { return function(a, b, c) { }; } assertEq(testLenientAndStrict('var f = fn(); f.length = 1; f.length', returns(3), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var f = fn(); delete f.length', returns(false), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.3.5.2.js0000644000175000017500000000065611545150464021333 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function fn() { return function(a, b, c) { }; } assertEq(testLenientAndStrict('var f = fn(); delete f.prototype', returns(false), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.4.4.12.js0000644000175000017500000000277411545150464021417 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function arr() { return Object.defineProperty([1, 2, 3], 0, {writable: false}); } function obj() { var o = {0: 1, 1: 2, 2: 3, length: 3}; Object.defineProperty(o, 0, {writable: false}); return o; } assertEq(testLenientAndStrict('var a = arr(); [a.splice(0, 1), a]', raisesException(TypeError), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var o = obj(); [Array.prototype.splice.call(o, 0, 1), o]', raisesException(TypeError), raisesException(TypeError)), true); function agap() { var a = [1, 2, , 4]; Object.defineProperty(a, 1, {configurable: false}); return a; } function ogap() { var o = {0: 1, 1: 2, /* no 2 */ 3: 4, length: 4}; Object.defineProperty(o, 1, {configurable: false}); return o; } assertEq(testLenientAndStrict('var a = agap(); [a.splice(0, 1), a]', raisesException(TypeError), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var o = ogap(); [Array.prototype.splice.call(o, 0, 1), o]', raisesException(TypeError), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.4.4.13.js0000644000175000017500000000277611545150464021422 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function arr() { return Object.defineProperty([1, 2, 3], 0, {writable: false}); } function obj() { var o = {0: 1, 1: 2, 2: 3, length: 3}; Object.defineProperty(o, 0, {writable: false}); return o; } assertEq(testLenientAndStrict('var a = arr(); [a.unshift(40, 50), a]', raisesException(TypeError), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var o = obj(); [Array.prototype.unshift.call(o, 40, 50), o]', raisesException(TypeError), raisesException(TypeError)), true); function agap() { var a = [1, 2, , 4]; Object.defineProperty(a, 3, {configurable: false}); return a; } function ogap() { var o = {0: 1, 1: 2, /* no 2 */ 3: 4, length: 4}; Object.defineProperty(o, 3, {configurable: false}); return o; } assertEq(testLenientAndStrict('var a = agap(); [a.unshift(9), a]', raisesException(TypeError), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var o = ogap(); [Array.prototype.unshift.call(o, 9), o]', raisesException(TypeError), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.4.4.6.js0000644000175000017500000000151711545150464021334 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function arr() { return Object.defineProperty([1, 2, 3], 2, {configurable: false}); } function obj() { var o = {0: 1, 1: 2, 2: 3, length: 3}; Object.defineProperty(o, 2, {configurable: false}); return o; } assertEq(testLenientAndStrict('var a = arr(); [a.pop(), a]', raisesException(TypeError), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var o = obj(); [Array.prototype.pop.call(o), o]', raisesException(TypeError), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.4.4.8.js0000644000175000017500000000273011545150464021334 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function arr() { return Object.defineProperty([1, 2, 3], 0, {writable: false}); } function obj() { var o = {0: 1, 1: 2, 2: 3, length: 3}; Object.defineProperty(o, 0, {writable: false}); return o; } assertEq(testLenientAndStrict('var a = arr(); a.reverse()', raisesException(TypeError), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var o = obj(); Array.prototype.reverse.call(o)', raisesException(TypeError), raisesException(TypeError)), true); function agap() { var a = [1, 2, , 4]; Object.defineProperty(a, 1, {configurable: false}); return a; } function ogap() { var o = {0: 1, 1: 2, /* no 2 */ 3: 4, length: 4}; Object.defineProperty(o, 1, {configurable: false}); return o; } assertEq(testLenientAndStrict('var a = agap(); a.reverse()', raisesException(TypeError), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var o = ogap(); Array.prototype.reverse.call(o)', raisesException(TypeError), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.4.4.9.js0000644000175000017500000000275211545150464021341 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function arr() { return Object.defineProperty([10, 20, 30], 0, {writable: false}); } function obj() { var o = {0: 10, 1: 20, 2: 30, length: 3}; Object.defineProperty(o, 0, {writable: false}); return o; } assertEq(testLenientAndStrict('var a = arr(); [a.shift(), a]', raisesException(TypeError), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var o = obj(); [Array.prototype.shift.call(o), o]', raisesException(TypeError), raisesException(TypeError)), true); function agap() { var a = [1, 2, , 4]; Object.defineProperty(a, 1, {configurable: false}); return a; } function ogap() { var o = {0: 1, 1: 2, /* no 2 */ 3: 4, length: 4}; Object.defineProperty(o, 1, {configurable: false}); return o; } assertEq(testLenientAndStrict('var a = agap(); [a.shift(), a]', raisesException(TypeError), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var o = ogap(); [Array.prototype.shift.call(o), o]', raisesException(TypeError), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.4.5.1.js0000644000175000017500000000172211545150464021326 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function arr() { return Object.defineProperty([1, 2, 3, 4], 2, {configurable: false}); } assertEq(testLenientAndStrict('var a = arr(); a.length = 2; a', returnsCopyOf([1, 2, 3]), raisesException(TypeError)), true); // Internally, SpiderMonkey has two representations for arrays: // fast-but-inflexible, and slow-but-flexible. Adding a non-index property // to an array turns it into the latter. We should test on both kinds. function addx(obj) { obj.x = 5; return obj; } assertEq(testLenientAndStrict('var a = addx(arr()); a.length = 2; a', returnsCopyOf(addx([1, 2, 3])), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.5.5.1.js0000644000175000017500000000154111545150464021326 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function str() { return new String("foo"); } assertEq(testLenientAndStrict('var s = str(); s.length = 1; s.length', returns(3), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var s = str(); delete s.length', returns(false), raisesException(TypeError)), true); assertEq(testLenientAndStrict('"foo".length = 1', returns(1), raisesException(TypeError)), true); assertEq(testLenientAndStrict('delete "foo".length', returns(false), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/15.5.5.2.js0000644000175000017500000000075711545150464021337 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(testLenientAndStrict('"foo"[0] = 1', returns(1), raisesException(TypeError)), true); assertEq(testLenientAndStrict('delete "foo"[0]', returns(false), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/8.12.5.js0000644000175000017500000000571611545150464021177 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function obj() { var o = {all: 1, nowrite: 1, noconfig: 1, noble: 1}; Object.defineProperty(o, 'nowrite', {writable: false}); Object.defineProperty(o, 'noconfig', {configurable: false}); Object.defineProperty(o, 'noble', {writable: false, configurable: false}); return o; } assertEq(testLenientAndStrict('var o = obj(); o.all = 2; o.all', returns(2), returns(2)), true); assertEq(testLenientAndStrict('var o = obj(); o.nowrite = 2; o.nowrite', returns(1), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var o = obj(); o.noconfig = 2; o.noconfig', returns(2), returns(2)), true); assertEq(testLenientAndStrict('var o = obj(); o.noble = 2; o.noble', returns(1), raisesException(TypeError)), true); assertEq(testLenientAndStrict('obj().nowrite++', returns(1), raisesException(TypeError)), true); assertEq(testLenientAndStrict('++obj().nowrite', returns(2), raisesException(TypeError)), true); assertEq(testLenientAndStrict('obj().nowrite--', returns(1), raisesException(TypeError)), true); assertEq(testLenientAndStrict('--obj().nowrite', returns(0), raisesException(TypeError)), true); function arr() { return Object.defineProperties([1, 1, 1, 1], { 1: { writable: false }, 2: { configurable: false }, 3: { writable: false, configurable: false }}); } assertEq(testLenientAndStrict('var a = arr(); a[0] = 2; a[0]', returns(2), returns(2)), true); assertEq(testLenientAndStrict('var a = arr(); a[1] = 2; a[1]', returns(1), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var a = arr(); a[2] = 2; a[2]', returns(2), returns(2)), true); assertEq(testLenientAndStrict('var a = arr(); a[3] = 2; a[3]', returns(1), raisesException(TypeError)), true); assertEq(testLenientAndStrict('arr()[1]++', returns(1), raisesException(TypeError)), true); assertEq(testLenientAndStrict('++arr()[1]', returns(2), raisesException(TypeError)), true); assertEq(testLenientAndStrict('arr()[1]--', returns(1), raisesException(TypeError)), true); assertEq(testLenientAndStrict('--arr()[1]', returns(0), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/8.12.7.js0000644000175000017500000000212711545150464021172 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function setup() { var o = {all: 1, nowrite: 1, noconfig: 1, noble: 1}; Object.defineProperty(o, 'nowrite', {writable: false}); Object.defineProperty(o, 'noconfig', {configurable: false}); Object.defineProperty(o, 'noble', {writable: false, configurable: false}); return o; } assertEq(testLenientAndStrict('var o = setup(); delete o.all', returns(true), returns(true)), true); assertEq(testLenientAndStrict('var o = setup(); delete o.nowrite', returns(true), returns(true)), true); assertEq(testLenientAndStrict('var o = setup(); delete o.noconfig', returns(false), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var o = setup(); delete o.noble', returns(false), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/8.7.2.js0000644000175000017500000000361211545150464021111 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * These tests depend on the fact that testLenientAndStrict tries the * strict case first; otherwise, the non-strict evaluation creates the * variable. Ugh. Ideally, we would use evalcx, but that's not * available in the browser. */ /* Assigning to an undeclared variable should fail in strict mode. */ assertEq(testLenientAndStrict('undeclared=1', completesNormally, raisesException(ReferenceError)), true); /* * Assigning to a var-declared variable should be okay in strict and * lenient modes. */ assertEq(testLenientAndStrict('var var_declared; var_declared=1', completesNormally, completesNormally), true); /* * We mustn't report errors until the code is actually run; the variable * could be created in the mean time. */ assertEq(testLenientAndStrict('undeclared_at_compiletime=1', parsesSuccessfully, parsesSuccessfully), true); function obj() { var o = { x: 1, y: 1 }; Object.defineProperty(o, 'x', { writable: false }); return o; } /* Put EXPR in a strict mode code context with 'with' bindings in scope. */ function in_strict_with(expr) { return "with(obj()) { (function () { 'use strict'; " + expr + " })(); }"; } assertEq(raisesException(TypeError)(in_strict_with('x = 2; y = 2;')), true); assertEq(raisesException(TypeError)(in_strict_with('x++;')), true); assertEq(raisesException(TypeError)(in_strict_with('++x;')), true); assertEq(raisesException(TypeError)(in_strict_with('x--;')), true); assertEq(raisesException(TypeError)(in_strict_with('--x;')), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/assign-to-callee-name.js0000644000175000017500000000174411545150464024506 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var gTestfile = 'assign-to-callee-name.js'; var BUGNUMBER = 610350; var summary = "Assigning to a function expression's name within that function should " + "throw a TypeError in strict mode code"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ var f = function assignSelfStrict() { "use strict"; assignSelfStrict = 12; }; try { var r = f(); throw new Error("should have thrown a TypeError, returned " + r); } catch (e) { assertEq(e instanceof TypeError, true, "didn't throw a TypeError: " + e); } var assignSelf = 42; var f2 = function assignSelf() { assignSelf = 12; }; f2(); // shouldn't throw, does nothing assertEq(assignSelf, 42); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/B.1.1.js0000644000175000017500000000163011545150464021112 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* Octal integer literal at top level. */ assertEq(testLenientAndStrict('010', parsesSuccessfully, parseRaisesException(SyntaxError)), true); /* Octal integer literal in strict function body */ assertEq(parseRaisesException(SyntaxError) ('function f() { "use strict"; 010; }'), true); /* * Octal integer literal after strict function body (restoration of * scanner state) */ assertEq(parsesSuccessfully('function f() { "use strict"; }; 010'), true); /* Octal integer literal in function body */ assertEq(parsesSuccessfully('function f() { 010; }'), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/B.1.2.js0000644000175000017500000000231411545150464021113 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(testLenientAndStrict('"\\010"', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('"\\00"', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('"\\1"', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('"\\08"', parsesSuccessfully, parseRaisesException(SyntaxError)), true); assertEq(testLenientAndStrict('"\\0"', parsesSuccessfully, parsesSuccessfully), true); assertEq(testLenientAndStrict('"\\0x"', parsesSuccessfully, parsesSuccessfully), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/browser.js0000644000175000017500000000000011545150464022104 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/directive-prologue-01.js0000644000175000017500000000352011545150464024461 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ //----------------------------------------------------------------------------- var BUGNUMBER = 601262; var summary = "A string literal containing an octal escape before a strict mode " + "directive should be a syntax error"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ try { eval(" '\\145'; 'use strict'; "); throw new Error("no error thrown for eval"); } catch (e) { assertEq(e instanceof SyntaxError, true, "wrong error for octal-escape before strict directive in eval"); } try { Function(" '\\145'; 'use strict'; "); throw new Error("no error thrown for Function"); } catch (e) { assertEq(e instanceof SyntaxError, true, "wrong error for octal-escape before strict directive in Function"); } try { eval(" function f(){ '\\145'; 'use strict'; } "); throw new Error("no error thrown for eval of function"); } catch (e) { assertEq(e instanceof SyntaxError, true, "wrong error for octal-escape before strict directive in eval of " + "function"); } try { Function(" function f(){ '\\145'; 'use strict'; } "); throw new Error("no error thrown for eval of function"); } catch (e) { assertEq(e instanceof SyntaxError, true, "wrong error for octal-escape before strict directive in eval of " + "function"); } eval("function notAnError1() { 5; '\\145'; function g() { 'use strict'; } }"); Function("function notAnError2() { 5; '\\145'; function g() { 'use strict'; } }"); function notAnError3() { 5; "\145"; function g() { "use strict"; } } /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/eval-variable-environment.js0000644000175000017500000000306311545150464025511 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var code; code = "eval('var x = 2; typeof x');"; assertEq(testLenientAndStrict(code, returns("number"), returns("number")), true); code = "eval('\"use strict\"; var x = 2; typeof x');"; assertEq(testLenientAndStrict(code, returns("number"), returns("number")), true); code = "eval('var x = 2;'); " + "typeof x"; assertEq(testLenientAndStrict(code, returns("number"), returns("undefined")), true); code = "eval('\"use strict\"; var x = 2;'); " + "typeof x"; assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")), true); code = "eval('\"use strict\"; var x = 2; typeof x'); " + "typeof x"; assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")), true); code = "function test() " + "{ " + " eval('var x = 2;'); " + " return typeof x; " + "} " + "test();"; assertEq(testLenientAndStrict(code, returns("number"), returns("undefined")), true); code = "function test() " + "{ " + " 'use strict'; " + " eval('var x = 2;'); " + " return typeof x; " + "} " + "test();"; assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")), true); code = "function test() " + "{ " + " eval('\"use strict\"; var x = 2;'); " + " return typeof x; " + "} " + "test();"; assertEq(testLenientAndStrict(code, returns("undefined"), returns("undefined")), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/function-name-arity.js0000644000175000017500000000157511545150464024334 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ function fn() { return function f(a, b, c) { }; } assertEq(testLenientAndStrict('var f = fn(); f.name = "g"; f.name', returns("f"), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var f = fn(); delete f.name', returns(false), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var f = fn(); f.arity = 4; f.arity', returns(3), raisesException(TypeError)), true); assertEq(testLenientAndStrict('var f = fn(); delete f.arity', returns(false), raisesException(TypeError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/jstests.list0000644000175000017500000000171111545150464022471 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/strict/ script 8.7.2.js script 8.12.5.js script 8.12.7.js script 10.4.2.js script 10.4.3.js script 10.6.js script 11.1.5.js script 11.3.1.js script 11.3.2.js script 11.4.1.js script 11.4.4.js script 11.4.5.js script 11.13.1.js script 11.13.2.js script 12.2.1.js script 12.10.1.js script 12.14.1.js script 13.1.js script 15.3.4.5.js script 15.3.5.1.js script 15.3.5.2.js script 15.4.4.6.js script 15.4.4.8.js script 15.4.4.9.js script 15.4.4.12.js script 15.4.4.13.js script 15.4.5.1.js script 15.5.5.1.js script 15.5.5.2.js script 15.10.7.js script B.1.1.js script B.1.2.js script function-name-arity.js script primitive-this-no-writeback.js script regress-532254.js script regress-532041.js script regress-599159.js script unbrand-this.js script this-for-function-expression-recursion.js script assign-to-callee-name.js script directive-prologue-01.js script eval-variable-environment.js script strict-this-is-not-truthy.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/primitive-this-no-writeback.js0000644000175000017500000000102511545150464025771 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* Verify that GETTHISPROP does not update the frame's |this| slot. */ var f = String.prototype.m = function () { "use strict"; assertEq(this, "s"); // The GETTHISPROP should not cause |this| to become wrapped. return [this.m, this]; }; var a = "s".m(); assertEq(a[0], f); assertEq(a[1], "s"); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/regress-532041.js0000644000175000017500000000102711545150464022641 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* * JSFunction::findDuplicateFormal (nee js_FindDuplicateFormal), used * by strict checks, sometimes failed to choose the correct branch of * the fun->u.i.names union: it used the argument count, not the * overall name count. */ function f(a1,a2,a3,a4,a5) { "use strict"; var v1, v2, v3, v4, v5, v6, v7; } reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/regress-532254.js0000644000175000017500000000063211545150464022650 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(testLenientAndStrict('function f(eval,[x]){}', parsesSuccessfully, parseRaisesException(SyntaxError)), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/regress-599159.js0000644000175000017500000000130011545150464022662 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ // Shu's test function test(makeNonArray) { function C() {} C.prototype = [] if (makeNonArray) C.prototype.constructor = C c = new C(); c.push("foo"); return c.length } assertEq(test(true), 1); assertEq(test(false), 1); // jorendorff's longer test var a = []; a.slowify = 1; var b = Object.create(a); b.length = 12; assertEq(b.length, 12); // jorendorff's shorter test var b = Object.create(Array.prototype); b.length = 12; assertEq(b.length, 12); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/shell.js0000644000175000017500000000000011545150464021530 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/strict-this-is-not-truthy.js0000644000175000017500000000037111545150464025455 0ustar chr1schr1s// Any copyright is dedicated to the Public Domain. // http://creativecommons.org/licenses/publicdomain/ // See bug 630543. function f() { "use strict"; return !this; } assertEq(f.call(null), true); reportCompare(0, 0, 'ok'); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/this-for-function-expression-recursion.js0000644000175000017500000000220711545150464030216 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var gTestfile = 'this-for-function-expression-recursion.js'; var BUGNUMBER = 611276; var summary = "JSOP_CALLEE should push undefined, not null, for this"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ // Calling a named function expression (not function statement) uses the // JSOP_CALLEE opcode. This opcode pushes its own |this|, distinct from the // normal call path; verify that that |this| value is properly |undefined|. var calleeThisFun = function calleeThisFun(recurring) { if (recurring) return this; return calleeThisFun(true); }; assertEq(calleeThisFun(false), this); var calleeThisStrictFun = function calleeThisStrictFun(recurring) { "use strict"; if (recurring) return this; return calleeThisStrictFun(true); }; assertEq(calleeThisStrictFun(false), undefined); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/strict/unbrand-this.js0000644000175000017500000000157711545150464023043 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ /* Test JSOP_UNBRANDTHIS's behavior on object and non-object |this| values. */ function strict() { "use strict"; this.insert = function(){ bar(); }; function bar() {} } var exception; // Try 'undefined' as a |this| value. exception = null; try { strict.call(undefined); } catch (x) { exception = x; } assertEq(exception instanceof TypeError, true); // Try 'null' as a |this| value. exception = null; try { strict.call(null); } catch (x) { exception = x; } assertEq(exception instanceof TypeError, true); // An object as a |this| value should be fine. exception = null; try { strict.call({}); } catch (x) { exception = x; } assertEq(exception, null); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/String/15.5.4.11-01.js0000644000175000017500000000404311545150464021562 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var BUGNUMBER = 587366; var summary = "String.prototype.replace with non-regexp searchValue"; print(BUGNUMBER + ": " + summary); /************** * BEGIN TEST * **************/ /* * Check that regexp statics are preserved across the whole test. * If the engine is trying to cheat by turning stuff into regexps, * we should catch it! */ /(a|(b)|c)+/.exec('abcabc'); var before = { "source" : RegExp.source, "$`": RegExp.leftContext, "$'": RegExp.rightContext, "$&": RegExp.lastMatch, "$1": RegExp.$1, "$2": RegExp.$2 }; var text = 'I once was lost but now am found.'; var searchValue = 'found'; var replaceValue; /* Lambda substitution. */ replaceValue = function(matchStr, matchStart, textStr) { assertEq(matchStr, searchValue); assertEq(matchStart, 27); assertEq(textStr, text); return 'not watching that show anymore'; } var result = text.replace(searchValue, replaceValue); assertEq(result, 'I once was lost but now am not watching that show anymore.'); /* Dollar substitution. */ replaceValue = "...wait, where was I again? And where is all my $$$$$$? Oh right, $`$&$'" + " But with no $$$$$$"; /* Note the dot is not replaced and trails the end. */ result = text.replace(searchValue, replaceValue); assertEq(result, 'I once was lost but now am ...wait, where was I again?' + ' And where is all my $$$? Oh right, I once was lost but now am found.' + ' But with no $$$.'); /* Missing capture group dollar substitution. */ replaceValue = "$1$&$2$'$3"; result = text.replace(searchValue, replaceValue); assertEq(result, 'I once was lost but now am $1found$2.$3.'); /* Check RegExp statics haven't been mutated. */ for (var ident in before) assertEq(RegExp[ident], before[ident]); /******************************************************************************/ if (typeof reportCompare === "function") reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/String/15.5.4.2.js0000644000175000017500000000131511545150464021263 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ assertEq(raisesException(TypeError)('String.prototype.toString.call(42)'), true); assertEq(raisesException(TypeError)('String.prototype.toString.call(true)'), true); assertEq(raisesException(TypeError)('String.prototype.toString.call({})'), true); assertEq(raisesException(TypeError)('String.prototype.toString.call(null)'), true); assertEq(raisesException(TypeError)('String.prototype.toString.call([])'), true); assertEq(raisesException(TypeError)('String.prototype.toString.call(undefined)'), true); assertEq(completesNormally('String.prototype.toString.call("")'), true); reportCompare(true, true); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/String/15.5.4.7.js0000644000175000017500000000100011545150464021257 0ustar chr1schr1s/* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ var BUGNUMBER = 612838; var summary = "String.prototype.indexOf with empty searchString"; print(BUGNUMBER + ": " + summary); assertEq("123".indexOf("", -1), 0); assertEq("123".indexOf("", 0), 0); assertEq("123".indexOf("", 1), 1); assertEq("123".indexOf("", 3), 3); assertEq("123".indexOf("", 4), 3); assertEq("123".indexOf("", 12345), 3); reportCompare(true, true); print("All tests passed!"); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/String/browser.js0000644000175000017500000000000111545150464022043 0ustar chr1schr1s mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/String/jstests.list0000644000175000017500000000016111545150464022425 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/String/ script 15.5.4.2.js script 15.5.4.7.js script 15.5.4.11-01.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/String/shell.js0000644000175000017500000000000011545150464021466 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Types/8.12.5-01.js0000644000175000017500000000350711545150464021205 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: * Jason Orendorff * Jeff Walden */ //----------------------------------------------------------------------------- var BUGNUMBER = 523846; var summary = "Assignments to a property that has a getter but not a setter should not " + "throw a TypeError per ES5 (at least not until strict mode is supported)"; var actual = "Early failure"; var expect = "No errors"; printBugNumber(BUGNUMBER); printStatus(summary); var o = { get p() { return "a"; } }; function test1() { o.p = "b"; assertEq(o.p, "a"); } function test2() { function T() {} T.prototype = o; y = new T(); y.p = "b"; assertEq(y.p, "a"); } function strictTest1() { "use strict"; o.p = "b"; // strict-mode violation here assertEq(o.p, "a"); } function strictTest2() { "use strict"; function T() {} T.prototype = o; y = new T; y.p = "b"; // strict-mode violation here assertEq(y.p, "a"); } var errors = []; try { try { test1(); } catch (e) { errors.push(e); } try { test2(); } catch (e) { errors.push(e); } try { strictTest1(); errors.push("strictTest1 didn't fail"); } catch (e) { if (!(e instanceof TypeError)) errors.push("strictTest1 didn't fail with a TypeError: " + e); } try { strictTest2(); errors.push("strictTest2 didn't fail"); } catch (e) { if (!(e instanceof TypeError)) errors.push("strictTest2 didn't fail with a TypeError: " + e); } } catch (e) { errors.push("Unexpected error: " + e); } finally { actual = errors.length > 0 ? errors.join(", ") : "No errors"; } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Types/browser.js0000644000175000017500000000000111545150464021701 0ustar chr1schr1s mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Types/jstests.list0000644000175000017500000000010711545150464022263 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=ecma_5/Types/ script 8.12.5-01.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/ecma_5/Types/shell.js0000644000175000017500000000000011545150464021324 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_1/regress/browser.js0000644000175000017500000000000011545150464022032 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_1/regress/function-001.js0000644000175000017500000000533611545150464022513 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: boolean-001.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 * * eval("function f(){}function g(){}") at top level is an error for JS1.2 and above (missing ; between named function expressions), but declares f and g as functions below 1.2. * * Fails to produce error regardless of version: * js> version(100) 120 js> eval("function f(){}function g(){}") js> version(120); 100 js> eval("function f(){}function g(){}") js> * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "function-001.js"; var VERSION = "JS1_1"; var TITLE = "functions not separated by semicolons are not errors in version 110 "; var BUGNUMBER="99232"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); result = "passed"; new TestCase( SECTION, "eval(\"function f(){}function g(){}\")", void 0, eval("function f(){}function g(){}") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_1/regress/jstests.list0000644000175000017500000000011311545150464022412 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_1/regress/ script function-001.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_1/regress/shell.js0000644000175000017500000000000011545150464021456 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Array/array_split_1.js0000644000175000017500000000534711545150464022550 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: array_split_1.js ECMA Section: Array.split() Description: These are tests from free perl suite. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "Free Perl"; var VERSION = "JS1_2"; var TITLE = "Array.split()"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "('a,b,c'.split(',')).length", 3, ('a,b,c'.split(',')).length ); new TestCase( SECTION, "('a,b'.split(',')).length", 2, ('a,b'.split(',')).length ); new TestCase( SECTION, "('a'.split(',')).length", 1, ('a'.split(',')).length ); /* * Deviate from ECMA by never splitting an empty string by any separator * string into a non-empty array (an array of length 1 that contains the * empty string). */ new TestCase( SECTION, "(''.split(',')).length", 0, (''.split(',')).length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Array/browser.js0000644000175000017500000000000011545150464021437 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Array/general1.js0000644000175000017500000000627511545150464021476 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: general1.js Description: 'This tests out some of the functionality on methods on the Array objects' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'String:push,unshift,shift'; writeHeaderToLog('Executing script: general1.js'); writeHeaderToLog( SECTION + " "+ TITLE); var array1 = []; array1.push(123); //array1 = [123] array1.push("dog"); //array1 = [123,dog] array1.push(-99); //array1 = [123,dog,-99] array1.push("cat"); //array1 = [123,dog,-99,cat] new TestCase( SECTION, "array1.pop()", array1.pop(),'cat'); //array1 = [123,dog,-99] array1.push("mouse"); //array1 = [123,dog,-99,mouse] new TestCase( SECTION, "array1.shift()", array1.shift(),123); //array1 = [dog,-99,mouse] array1.unshift(96); //array1 = [96,dog,-99,mouse] new TestCase( SECTION, "state of array", String([96,"dog",-99,"mouse"]), String(array1)); new TestCase( SECTION, "array1.length", array1.length,4); array1.shift(); //array1 = [dog,-99,mouse] array1.shift(); //array1 = [-99,mouse] array1.shift(); //array1 = [mouse] new TestCase( SECTION, "array1.shift()", array1.shift(),"mouse"); new TestCase( SECTION, "array1.shift()", "undefined", String(array1.shift())); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Array/general2.js0000644000175000017500000000620411545150464021467 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: general2.js Description: 'This tests out some of the functionality on methods on the Array objects' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'String:push,splice,concat,unshift,sort'; writeHeaderToLog('Executing script: general2.js'); writeHeaderToLog( SECTION + " "+ TITLE); array1 = new Array(); array2 = []; size = 10; // this for loop populates array1 and array2 as follows: // array1 = [0,1,2,3,4,....,size - 2,size - 1] // array2 = [size - 1, size - 2,...,4,3,2,1,0] for (var i = 0; i < size; i++) { array1.push(i); array2.push(size - 1 - i); } // the following for loop reverses the order of array1 so // that it should be similarly ordered to array2 for (i = array1.length; i > 0; i--) { array3 = array1.slice(1,i); array1.splice(1,i-1); array1 = array3.concat(array1); } // the following for loop reverses the order of array1 // and array2 for (i = 0; i < size; i++) { array1.push(array1.shift()); array2.unshift(array2.pop()); } new TestCase( SECTION, "Array.push,pop,shift,unshift,slice,splice", true,String(array1) == String(array2)); array1.sort(); array2.sort(); new TestCase( SECTION, "Array.sort", true,String(array1) == String(array2)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Array/jstests.list0000644000175000017500000000041511545150464022024 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_2/Array/ skip script array_split_1.js # obsolete test script general1.js script general2.js script slice.js script splice1.js script splice2.js skip script tostring_1.js # obsolete test skip script tostring_2.js # obsolete test mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Array/shell.js0000644000175000017500000000000011545150464021063 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Array/slice.js0000644000175000017500000001011311545150464021061 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: slice.js Description: 'This tests out some of the functionality on methods on the Array objects' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'String:slice'; writeHeaderToLog('Executing script: slice.js'); writeHeaderToLog( SECTION + " "+ TITLE); var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']]; var b = [1,2,3,4,5,6,7,8,9,0]; exhaustiveSliceTest("exhaustive slice test 1", a); exhaustiveSliceTest("exhaustive slice test 2", b); test(); function mySlice(a, from, to) { var from2 = from; var to2 = to; var returnArray = []; var i; if (from2 < 0) from2 = a.length + from; if (to2 < 0) to2 = a.length + to; if ((to2 > from2)&&(to2 > 0)&&(from2 < a.length)) { if (from2 < 0) from2 = 0; if (to2 > a.length) to2 = a.length; for (i = from2; i < to2; ++i) returnArray.push(a[i]); } return returnArray; } // This function tests the slice command on an Array // passed in. The arguments passed into slice range in // value from -5 to the length of the array + 4. Every // combination of the two arguments is tested. The expected // result of the slice(...) method is calculated and // compared to the actual result from the slice(...) method. // If the Arrays are not similar false is returned. function exhaustiveSliceTest(testname, a) { var x = 0; var y = 0; var errorMessage; var reason = ""; var passed = true; for (x = -(2 + a.length); x <= (2 + a.length); x++) for (y = (2 + a.length); y >= -(2 + a.length); y--) { var b = a.slice(x,y); var c = mySlice(a,x,y); if (String(b) != String(c)) { errorMessage = "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" + " test: " + "a.slice(" + x + "," + y + ")\n" + " a: " + String(a) + "\n" + " actual result: " + String(b) + "\n" + " expected result: " + String(c) + "\n"; writeHeaderToLog(errorMessage); reason = reason + errorMessage; passed = false; } } var testCase = new TestCase(SECTION, testname, true, passed); if (passed == false) testCase.reason = reason; return testCase; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Array/splice1.js0000644000175000017500000001217611545150464021335 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: splice1.js Description: 'Tests Array.splice(x,y) w/no var args' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; var TITLE = 'String:splice 1'; var BUGNUMBER="123795"; startTest(); writeHeaderToLog('Executing script: splice1.js'); writeHeaderToLog( SECTION + " "+ TITLE); var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']]; var b = [1,2,3,4,5,6,7,8,9,0]; exhaustiveSpliceTest("exhaustive splice w/no optional args 1",a); exhaustiveSpliceTest("exhaustive splice w/no optional args 1",b); test(); function mySplice(testArray, splicedArray, first, len, elements) { var removedArray = []; var adjustedFirst = first; var adjustedLen = len; if (adjustedFirst < 0) adjustedFirst = testArray.length + first; if (adjustedFirst < 0) adjustedFirst = 0; if (adjustedLen < 0) adjustedLen = 0; for (i = 0; (i < adjustedFirst)&&(i < testArray.length); ++i) splicedArray.push(testArray[i]); if (adjustedFirst < testArray.length) for (i = adjustedFirst; (i < adjustedFirst + adjustedLen) && (i < testArray.length); ++i) { removedArray.push(testArray[i]); } for (i = 0; i < elements.length; i++) splicedArray.push(elements[i]); for (i = adjustedFirst + adjustedLen; i < testArray.length; i++) splicedArray.push(testArray[i]); return removedArray; } function exhaustiveSpliceTest(testname, testArray) { var errorMessage; var passed = true; var reason = ""; for (var first = -(testArray.length+2); first <= 2 + testArray.length; first++) { var actualSpliced = []; var expectedSpliced = []; var actualRemoved = []; var expectedRemoved = []; for (var len = 0; len < testArray.length + 2; len++) { actualSpliced = []; expectedSpliced = []; for (var i = 0; i < testArray.length; ++i) actualSpliced.push(testArray[i]); actualRemoved = actualSpliced.splice(first,len); expectedRemoved = mySplice(testArray,expectedSpliced,first,len,[]); var adjustedFirst = first; if (adjustedFirst < 0) adjustedFirst = testArray.length + first; if (adjustedFirst < 0) adjustedFirst = 0; if ( (String(actualSpliced) != String(expectedSpliced)) ||(String(actualRemoved) != String(expectedRemoved))) { if ( (String(actualSpliced) == String(expectedSpliced)) &&(String(actualRemoved) != String(expectedRemoved)) ) { if ( (expectedRemoved.length == 1) &&(String(actualRemoved) == String(expectedRemoved[0]))) continue; if ( expectedRemoved.length == 0 && actualRemoved == void 0) continue; } errorMessage = "ERROR: 'TEST FAILED'\n" + " test: " + "a.splice(" + first + "," + len + ",-97,new String('test arg'),[],9.8)\n" + " a: " + String(testArray) + "\n" + " actual spliced: " + String(actualSpliced) + "\n" + " expected spliced: " + String(expectedSpliced) + "\n" + " actual removed: " + String(actualRemoved) + "\n" + " expected removed: " + String(expectedRemoved) + "\n"; writeHeaderToLog(errorMessage); reason = reason + errorMessage; passed = false; } } } var testcase = new TestCase( SECTION, testname, true, passed); if (!passed) testcase.reason = reason; return testcase; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Array/splice2.js0000644000175000017500000001234711545150464021336 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: splice2.js Description: 'Tests Array.splice(x,y) w/4 var args' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; var TITLE = 'String:splice 2'; var BUGNUMBER="123795"; startTest(); writeHeaderToLog('Executing script: splice2.js'); writeHeaderToLog( SECTION + " "+ TITLE); var a = ['a','test string',456,9.34,new String("string object"),[],['h','i','j','k']]; var b = [1,2,3,4,5,6,7,8,9,0]; exhaustiveSpliceTestWithArgs("exhaustive splice w/2 optional args 1",a); exhaustiveSpliceTestWithArgs("exhaustive splice w/2 optional args 2",b); test(); function mySplice(testArray, splicedArray, first, len, elements) { var removedArray = []; var adjustedFirst = first; var adjustedLen = len; if (adjustedFirst < 0) adjustedFirst = testArray.length + first; if (adjustedFirst < 0) adjustedFirst = 0; if (adjustedLen < 0) adjustedLen = 0; for (i = 0; (i < adjustedFirst)&&(i < testArray.length); ++i) splicedArray.push(testArray[i]); if (adjustedFirst < testArray.length) for (i = adjustedFirst; (i < adjustedFirst + adjustedLen) && (i < testArray.length); ++i) removedArray.push(testArray[i]); for (i = 0; i < elements.length; i++) splicedArray.push(elements[i]); for (i = adjustedFirst + adjustedLen; i < testArray.length; i++) splicedArray.push(testArray[i]); return removedArray; } function exhaustiveSpliceTestWithArgs(testname, testArray) { var passed = true; var errorMessage; var reason = ""; for (var first = -(testArray.length+2); first <= 2 + testArray.length; first++) { var actualSpliced = []; var expectedSpliced = []; var actualRemoved = []; var expectedRemoved = []; for (var len = 0; len < testArray.length + 2; len++) { actualSpliced = []; expectedSpliced = []; for (var i = 0; i < testArray.length; ++i) actualSpliced.push(testArray[i]); actualRemoved = actualSpliced.splice(first,len,-97,new String("test arg"),[],9.8); expectedRemoved = mySplice(testArray,expectedSpliced,first,len,[-97,new String("test arg"),[],9.8]); var adjustedFirst = first; if (adjustedFirst < 0) adjustedFirst = testArray.length + first; if (adjustedFirst < 0) adjustedFirst = 0; if ( (String(actualSpliced) != String(expectedSpliced)) ||(String(actualRemoved) != String(expectedRemoved))) { if ( (String(actualSpliced) == String(expectedSpliced)) &&(String(actualRemoved) != String(expectedRemoved)) ) { if ( (expectedRemoved.length == 1) &&(String(actualRemoved) == String(expectedRemoved[0]))) continue; if ( expectedRemoved.length == 0 && actualRemoved == void 0 ) continue; } errorMessage = "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" + " test: " + "a.splice(" + first + "," + len + ",-97,new String('test arg'),[],9.8)\n" + " a: " + String(testArray) + "\n" + " actual spliced: " + String(actualSpliced) + "\n" + " expected spliced: " + String(expectedSpliced) + "\n" + " actual removed: " + String(actualRemoved) + "\n" + " expected removed: " + String(expectedRemoved); reason = reason + errorMessage; writeHeaderToLog(errorMessage); passed = false; } } } var testcase = new TestCase(SECTION, testname, true, passed); if (!passed) testcase.reason = reason; return testcase; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Array/tostring_1.js0000644000175000017500000000666111545150464022070 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: tostring_1.js ECMA Section: Array.toString() Description: This checks the ToString value of Array objects under JavaScript 1.2. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "JS1_2"; var VERSION = "JS1_2"; startTest(); var TITLE = "Array.toString()"; writeHeaderToLog( SECTION + " "+ TITLE); var a = new Array(); var VERSION = 0; if ( version() == 120 ) { VERSION = "120"; } else { VERSION = ""; } new TestCase ( SECTION, "var a = new Array(); a.toString()", ( VERSION == "120" ? "[]" : "" ), a.toString() ); a[0] = void 0; new TestCase ( SECTION, "a[0] = void 0; a.toString()", ( VERSION == "120" ? "[, ]" : "" ), a.toString() ); new TestCase( SECTION, "a.length", 1, a.length ); a[1] = void 0; new TestCase( SECTION, "a[1] = void 0; a.toString()", ( VERSION == "120" ? "[, , ]" : "," ), a.toString() ); a[1] = "hi"; new TestCase( SECTION, "a[1] = \"hi\"; a.toString()", ( VERSION == "120" ? "[, \"hi\"]" : ",hi" ), a.toString() ); a[2] = void 0; new TestCase( SECTION, "a[2] = void 0; a.toString()", ( VERSION == "120" ?"[, \"hi\", , ]":",hi,"), a.toString() ); var b = new Array(1000); var bstring = ""; for ( blen=0; blen<999; blen++) { bstring += ","; } new TestCase ( SECTION, "var b = new Array(1000); b.toString()", ( VERSION == "120" ? "[1000]" : bstring ), b.toString() ); new TestCase( SECTION, "b.length", ( VERSION == "120" ? 1 : 1000 ), b.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Array/tostring_2.js0000644000175000017500000000513211545150464022061 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: tostring_2.js Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=114564 Description: toString in version 120 Author: christine@netscape.com Date: 15 June 1998 */ var SECTION = "Array/tostring_2.js"; var VERSION = "JS_12"; startTest(); var TITLE = "Array.toString"; writeHeaderToLog( SECTION + " "+ TITLE); var a = []; if ( version() == 120 ) { VERSION = "120"; } else { VERSION = ""; } new TestCase ( SECTION, "a.toString()", ( VERSION == "120" ? "[]" : "" ), a.toString() ); new TestCase ( SECTION, "String( a )", ( VERSION == "120" ? "[]" : "" ), String( a ) ); new TestCase ( SECTION, "a +''", ( VERSION == "120" ? "[]" : "" ), a+"" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/browser.js0000644000175000017500000000000011545150464022206 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/definition-1.js0000644000175000017500000000521611545150464023027 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: definition-1.js Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=111284 Description: Regression test for declaring functions. Author: christine@netscape.com Date: 15 June 1998 */ var SECTION = "function/definition-1.js"; var VERSION = "JS_12"; startTest(); var TITLE = "Regression test for 111284"; writeHeaderToLog( SECTION + " "+ TITLE); f1 = function() { return "passed!" } function f2() { f3 = function() { return "passed!" }; return f3(); } new TestCase( SECTION, 'f1 = function() { return "passed!" }; f1()', "passed!", f1() ); new TestCase( SECTION, 'function f2() { f3 = function { return "passed!" }; return f3() }; f2()', "passed!", f2() ); new TestCase( SECTION, 'f3()', "passed!", f3() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/function-001-n.js0000644000175000017500000000535111545150464023117 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: boolean-001.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 * * eval("function f(){}function g(){}") at top level is an error for JS1.2 * and above (missing ; between named function expressions), but declares f * and g as functions below 1.2. * * Fails to produce error regardless of version: * js> version(100) * 120 * js> eval("function f(){}function g(){}") * js> version(120); * 100 * js> eval("function f(){}function g(){}") * js> * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "function-001.js"; var VERSION = "JS1_1"; var TITLE = "functions not separated by semicolons are errors in version 120 and higher"; var BUGNUMBER="99232"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "eval(\"function f(){}function g(){}\")", "error", eval("function f(){}function g(){}") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/Function_object.js0000644000175000017500000000542411545150464023655 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: Function_object.js Description: 'Testing Function objects' Author: Nick Lerissa Date: April 17, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'functions: Function_object'; writeHeaderToLog('Executing script: Function_object.js'); writeHeaderToLog( SECTION + " "+ TITLE); function a_test_function(a,b,c) { return a + b + c; } f = a_test_function; new TestCase( SECTION, "f.name", 'a_test_function', f.name); new TestCase( SECTION, "f.length", 3, f.length); new TestCase( SECTION, "f.arity", 3, f.arity); new TestCase( SECTION, "f(2,3,4)", 9, f(2,3,4)); var fnName = (version() == 120) ? '' : 'anonymous'; new TestCase( SECTION, "(new Function()).name", fnName, (new Function()).name); new TestCase( SECTION, "(new Function()).toString()", 'function ' + fnName + '() {\n}', (new Function()).toString()); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/jstests.list0000644000175000017500000000073011545150464022573 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_2/function/ skip script Function_object.js # obsolete test skip script Number.js # obsolete test skip script String.js # obsolete test script definition-1.js skip script function-001-n.js # obsolete test skip script length.js # obsolete test script nesting-1.js script nesting.js script regexparg-1.js skip script regexparg-2-n.js # obsolete test skip script tostring-1.js # obsolete test skip script tostring-2.js # obsolete test mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/length.js0000644000175000017500000000625411545150464022025 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: 15.3.5.1.js ECMA Section: Function.length Description: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function. However, the language permits the function to be invoked with some other number of arguments. The behavior of a function when invoked on a number of arguments other than the number specified by its length property depends on the function. This checks the pre-ecma behavior Function.length. http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "function/length.js"; var VERSION = "ECMA_1"; var TITLE = "Function.length"; var BUGNUMBER="104204"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var f = new Function( "a","b", "c", "return f.length"); if ( version() <= 120 ) { new TestCase( SECTION, 'var f = new Function( "a","b", "c", "return f.length"); f()', 0, f() ); new TestCase( SECTION, 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)', 5, f(1,2,3,4,5) ); } else { new TestCase( SECTION, 'var f = new Function( "a","b", "c", "return f.length"); f()', 3, f() ); new TestCase( SECTION, 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)', 3, f(1,2,3,4,5) ); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/nesting-1.js0000644000175000017500000000464411545150464022352 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: nesting-1.js Reference: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122040 Description: Regression test for a nested function Author: christine@netscape.com Date: 15 June 1998 */ var SECTION = "function/nesting-1.js"; var VERSION = "JS_12"; startTest(); var TITLE = "Regression test for 122040"; writeHeaderToLog( SECTION + " "+ TITLE); function f(a) {function g(b) {return a+b;}; return g;}; f(7); new TestCase( SECTION, 'function f(a) {function g(b) {return a+b;}; return g;}; typeof f(7)', "function", typeof f(7) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/nesting.js0000644000175000017500000000524111545150464022206 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: nesting.js Description: 'This tests the nesting of functions' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'functions: nesting'; writeHeaderToLog('Executing script: nesting.js'); writeHeaderToLog( SECTION + " "+ TITLE); function outer_func(x) { var y = "outer"; new TestCase( SECTION, "outer:x ", 1111, x); new TestCase( SECTION, "outer:y ", 'outer', y); function inner_func(x) { var y = "inner"; new TestCase( SECTION, "inner:x ", 2222, x); new TestCase( SECTION, "inner:y ", 'inner', y); }; inner_func(2222); new TestCase( SECTION, "outer:x ", 1111, x); new TestCase( SECTION, "outer:y ", 'outer', y); } outer_func(1111); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/Number.js0000644000175000017500000000607711545150464021777 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: Number.js Description: 'This tests the function Number(Object)' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; var TITLE = 'functions: Number'; var BUGNUMBER="123435"; startTest(); writeHeaderToLog('Executing script: Number.js'); writeHeaderToLog( SECTION + " "+ TITLE); date = new Date(2200); new TestCase( SECTION, "Number(new Date(2200)) ", 2200, (Number(date))); new TestCase( SECTION, "Number(true) ", 1, (Number(true))); new TestCase( SECTION, "Number(false) ", 0, (Number(false))); new TestCase( SECTION, "Number('124') ", 124, (Number('124'))); new TestCase( SECTION, "Number('1.23') ", 1.23, (Number('1.23'))); new TestCase( SECTION, "Number({p:1}) ", NaN, (Number({p:1}))); new TestCase( SECTION, "Number(null) ", 0, (Number(null))); new TestCase( SECTION, "Number(-45) ", -45, (Number(-45))); // http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123435 // under js1.2, Number([1,2,3]) should return 3. new TestCase( SECTION, "Number([1,2,3]) ", 3, (Number([1,2,3]))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/regexparg-1.js0000644000175000017500000000616411545150464022666 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: regexparg-1.js Description: Regression test for http://scopus/bugsplat/show_bug.cgi?id=122787 Passing a regular expression as the first constructor argument fails Author: christine@netscape.com Date: 15 June 1998 */ var SECTION = "JS_1.2"; var VERSION = "JS_1.2"; startTest(); var TITLE = "The variable statement"; writeHeaderToLog( SECTION + " "+ TITLE); print("Note: Bug 61911 changed the behavior of typeof regexp in Gecko 1.9."); print("Prior to Gecko 1.9, typeof regexp returned 'function'."); print("However in Gecko 1.9 and later, typeof regexp will return 'object'."); function f(x) {return x;} x = f(/abc/); new TestCase( SECTION, "function f(x) {return x;}; f()", void 0, f() ); new TestCase( SECTION, "f(\"hi\")", "hi", f("hi") ); new TestCase( SECTION, "new f(/abc/) +''", "/abc/", new f(/abc/) +"" ); new TestCase( SECTION, "f(/abc/)+'')", "/abc/", f(/abc/) +''); new TestCase( SECTION, "typeof f(/abc/)", "object", typeof f(/abc/) ); new TestCase( SECTION, "typeof new f(/abc/)", "object", typeof new f(/abc/) ); new TestCase( SECTION, "x = new f(/abc/); x(\"hi\")", null, x("hi") ); // js> x() test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/regexparg-2-n.js0000644000175000017500000000470611545150464023122 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: regexparg-1.js Description: Regression test for http://scopus/bugsplat/show_bug.cgi?id=122787 Passing a regular expression as the first constructor argument fails Author: christine@netscape.com Date: 15 June 1998 */ var SECTION = "JS_1.2"; var VERSION = "JS_1.2"; startTest(); var TITLE = "The variable statement"; writeHeaderToLog( SECTION + " "+ TITLE); function f(x) {return x;} x = f(/abc/); DESCRIPTION = "function f(x) {return x;}; x = f(/abc/); x()"; EXPECTED = "error"; new TestCase( SECTION, "function f(x) {return x;}; x = f(/abc/); x()", "error", x() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/shell.js0000644000175000017500000000000011545150464021632 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/String.js0000644000175000017500000000543711545150464022014 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: String.js Description: 'This tests the function String(Object)' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'functions: String'; writeHeaderToLog('Executing script: String.js'); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "String(true) ", 'true', (String(true))); new TestCase( SECTION, "String(false) ", 'false', (String(false))); new TestCase( SECTION, "String(-124) ", '-124', (String(-124))); new TestCase( SECTION, "String(1.23) ", '1.23', (String(1.23))); new TestCase( SECTION, "String({p:1}) ", '{p:1}', (String({p:1}))); new TestCase( SECTION, "String(null) ", 'null', (String(null))); new TestCase( SECTION, "String([1,2,3]) ", '[1, 2, 3]', (String([1,2,3]))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/tostring-1.js0000644000175000017500000001021311545150464022541 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: tostring-1.js Section: Function.toString Description: Since the behavior of Function.toString() is implementation-dependent, toString tests for function are not in the ECMA suite. Currently, an attempt to parse the toString output for some functions and verify that the result is something reasonable. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "tostring-1"; var VERSION = "JS1_2"; startTest(); var TITLE = "Function.toString()"; writeHeaderToLog( SECTION + " "+ TITLE); var tab = " "; t1 = new TestFunction( "stub", "value", tab + "return value;" ); t2 = new TestFunction( "ToString", "object", tab+"return object + \"\";" ); t3 = new TestFunction( "Add", "a, b, c, d, e", tab +"var s = a + b + c + d + e;\n" + tab + "return s;" ); t4 = new TestFunction( "noop", "value" ); t5 = new TestFunction( "anonymous", "", tab+"return \"hello!\";" ); var f = new Function( "return \"hello!\""); new TestCase( SECTION, "stub.toString()", t1.valueOf(), stub.toString() ); new TestCase( SECTION, "ToString.toString()", t2.valueOf(), ToString.toString() ); new TestCase( SECTION, "Add.toString()", t3.valueOf(), Add.toString() ); new TestCase( SECTION, "noop.toString()", t4.toString(), noop.toString() ); new TestCase( SECTION, "f.toString()", t5.toString(), f.toString() ); test(); function noop( value ) { } function Add( a, b, c, d, e ) { var s = a + b + c + d + e; return s; } function stub( value ) { return value; } function ToString( object ) { return object + ""; } function ToBoolean( value ) { if ( value == 0 || value == NaN || value == false ) { return false; } else { return true; } } function TestFunction( name, args, body ) { if ( name == "anonymous" && version() == 120 ) { name = ""; } this.name = name; this.arguments = args.toString(); this.body = body; /* the format of Function.toString() in JavaScript 1.2 is: function name ( arguments ) { body } */ this.value = "function " + (name ? name : "" )+ "("+args+") {\n"+ (( body ) ? body +"\n" : "") + "}"; this.toString = new Function( "return this.value" ); this.valueOf = new Function( "return this.value" ); return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/function/tostring-2.js0000644000175000017500000001263611545150464022555 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: tostring-1.js Section: Function.toString Description: Since the behavior of Function.toString() is implementation-dependent, toString tests for function are not in the ECMA suite. Currently, an attempt to parse the toString output for some functions and verify that the result is something reasonable. This verifies http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99212 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "tostring-2"; var VERSION = "JS1_2"; var TITLE = "Function.toString()"; var BUGNUMBER="123444"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var tab = " "; var equals = new TestFunction( "Equals", "a, b", tab+ "return a == b;" ); function Equals (a, b) { return a == b; } var reallyequals = new TestFunction( "ReallyEquals", "a, b", ( version() <= 120 ) ? tab +"return a == b;" : tab +"return a === b;" ); function ReallyEquals( a, b ) { return a === b; } var doesntequal = new TestFunction( "DoesntEqual", "a, b", tab + "return a != b;" ); function DoesntEqual( a, b ) { return a != b; } var reallydoesntequal = new TestFunction( "ReallyDoesntEqual", "a, b", ( version() <= 120 ) ? tab +"return a != b;" : tab +"return a !== b;" ); function ReallyDoesntEqual( a, b ) { return a !== b; } var testor = new TestFunction( "TestOr", "a", tab+"if (a == null || a == void 0) {\n"+ tab +tab+"return 0;\n"+tab+"} else {\n"+tab+tab+"return a;\n"+tab+"}" ); function TestOr( a ) { if ( a == null || a == void 0 ) return 0; else return a; } var testand = new TestFunction( "TestAnd", "a", tab+"if (a != null && a != void 0) {\n"+ tab+tab+"return a;\n" + tab+ "} else {\n"+tab+tab+"return 0;\n"+tab+"}" ); function TestAnd( a ) { if ( a != null && a != void 0 ) return a; else return 0; } var or = new TestFunction( "Or", "a, b", tab + "return a | b;" ); function Or( a, b ) { return a | b; } var and = new TestFunction( "And", "a, b", tab + "return a & b;" ); function And( a, b ) { return a & b; } var xor = new TestFunction( "XOr", "a, b", tab + "return a ^ b;" ); function XOr( a, b ) { return a ^ b; } new TestCase( SECTION, "Equals.toString()", equals.valueOf(), Equals.toString() ); new TestCase( SECTION, "ReallyEquals.toString()", reallyequals.valueOf(), ReallyEquals.toString() ); new TestCase( SECTION, "DoesntEqual.toString()", doesntequal.valueOf(), DoesntEqual.toString() ); new TestCase( SECTION, "ReallyDoesntEqual.toString()", reallydoesntequal.valueOf(), ReallyDoesntEqual.toString() ); new TestCase( SECTION, "TestOr.toString()", testor.valueOf(), TestOr.toString() ); new TestCase( SECTION, "TestAnd.toString()", testand.valueOf(), TestAnd.toString() ); new TestCase( SECTION, "Or.toString()", or.valueOf(), Or.toString() ); new TestCase( SECTION, "And.toString()", and.valueOf(), And.toString() ); new TestCase( SECTION, "XOr.toString()", xor.valueOf(), XOr.toString() ); test(); function TestFunction( name, args, body ) { this.name = name; this.arguments = args.toString(); this.body = body; /* the format of Function.toString() in JavaScript 1.2 is: function name ( arguments ) { body } */ this.value = "function " + (name ? name : "anonymous" )+ "("+args+") {\n"+ (( body ) ? body +"\n" : "") + "}"; this.toString = new Function( "return this.value" ); this.valueOf = new Function( "return this.value" ); return this; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Objects/browser.js0000644000175000017500000000000011545150464021752 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Objects/jstests.list0000644000175000017500000000014011545150464022332 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_2/Objects/ skip script toString-001.js # obsolete test mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Objects/shell.js0000644000175000017500000000000011545150464021376 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/Objects/toString-001.js0000644000175000017500000000735611545150464022423 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: toString_1.js ECMA Section: Object.toString() Description: This checks the ToString value of Object objects under JavaScript 1.2. In JavaScript 1.2, Object.toString() Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "JS1_2"; var VERSION = "JS1_2"; startTest(); var TITLE = "Object.toString()"; writeHeaderToLog( SECTION + " "+ TITLE); var o = new Object(); new TestCase( SECTION, "var o = new Object(); o.toString()", "{}", o.toString() ); o = {}; new TestCase( SECTION, "o = {}; o.toString()", "{}", o.toString() ); o = { name:"object", length:0, value:"hello" } new TestCase( SECTION, "o = { name:\"object\", length:0, value:\"hello\" }; o.toString()", true, checkObjectToString(o.toString(), ['name:"object"', 'length:0', 'value:"hello"'])); o = { name:"object", length:0, value:"hello", toString:new Function( "return this.value+''" ) } new TestCase( SECTION, "o = { name:\"object\", length:0, value:\"hello\", "+ "toString:new Function( \"return this.value+''\" ) }; o.toString()", "hello", o.toString() ); test(); /** * checkObjectToString * * In JS1.2, Object.prototype.toString returns a representation of the * object's properties as a string. However, the order of the properties * in the resulting string is not specified. This function compares the * resulting string with an array of strings to make sure that the * resulting string is some permutation of the strings in the array. */ function checkObjectToString(s, a) { var m = /^\{(.*)\}$/(s); if (!m) return false; // should begin and end with curly brackets var a2 = m[1].split(", "); if (a.length != a2.length) return false; // should be same length a.sort(); a2.sort(); for (var i=0; i < a.length; i++) { if (a[i] != a2[i]) return false; // should have identical elements } return true; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/operator/browser.js0000644000175000017500000000000011545150464022214 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/operator/equality.js0000644000175000017500000000541611545150464022406 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: equality.js Description: 'This tests the operator ==' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'operator "=="'; writeHeaderToLog('Executing script: equality.js'); writeHeaderToLog( SECTION + " "+ TITLE); // the following two tests are incorrect //new TestCase( SECTION, "(new String('') == new String('')) ", // true, (new String('') == new String(''))); //new TestCase( SECTION, "(new Boolean(true) == new Boolean(true)) ", // true, (new Boolean(true) == new Boolean(true))); new TestCase( SECTION, "(new String('x') == 'x') ", false, (new String('x') == 'x')); new TestCase( SECTION, "('x' == new String('x')) ", false, ('x' == new String('x'))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/operator/jstests.list0000644000175000017500000000016611545150464022604 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_2/operator/ skip script equality.js # obsolete test script strictEquality.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/operator/shell.js0000644000175000017500000000000011545150464021640 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/operator/strictEquality.js0000644000175000017500000000662411545150464023601 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: strictEquality.js Description: 'This tests the operator ===' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'operator "==="'; writeHeaderToLog('Executing script: strictEquality.js'); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "('8' === 8) ", false, ('8' === 8)); new TestCase( SECTION, "(8 === 8) ", true, (8 === 8)); new TestCase( SECTION, "(8 === true) ", false, (8 === true)); new TestCase( SECTION, "(new String('') === new String('')) ", false, (new String('') === new String(''))); new TestCase( SECTION, "(new Boolean(true) === new Boolean(true))", false, (new Boolean(true) === new Boolean(true))); var anObject = { one:1 , two:2 }; new TestCase( SECTION, "(anObject === anObject) ", true, (anObject === anObject)); new TestCase( SECTION, "(anObject === { one:1 , two:2 }) ", false, (anObject === { one:1 , two:2 })); new TestCase( SECTION, "({ one:1 , two:2 } === anObject) ", false, ({ one:1 , two:2 } === anObject)); new TestCase( SECTION, "(null === null) ", true, (null === null)); new TestCase( SECTION, "(null === 0) ", false, (null === 0)); new TestCase( SECTION, "(true === !false) ", true, (true === !false)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/alphanumeric.js0000644000175000017500000001155311545150464022657 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: alphanumeric.js Description: 'Tests regular expressions with \w and \W special characters' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: \\w and \\W'; writeHeaderToLog('Executing script: alphanumeric.js'); writeHeaderToLog( SECTION + " " + TITLE); var non_alphanumeric = "~`!@#$%^&*()-+={[}]|\\:;'<,>./?\f\n\r\t\v " + '"'; var alphanumeric = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; // be sure all alphanumerics are matched by \w new TestCase ( SECTION, "'" + alphanumeric + "'.match(new RegExp('\\w+'))", String([alphanumeric]), String(alphanumeric.match(new RegExp('\\w+')))); // be sure all non-alphanumerics are matched by \W new TestCase ( SECTION, "'" + non_alphanumeric + "'.match(new RegExp('\\W+'))", String([non_alphanumeric]), String(non_alphanumeric.match(new RegExp('\\W+')))); // be sure all non-alphanumerics are not matched by \w new TestCase ( SECTION, "'" + non_alphanumeric + "'.match(new RegExp('\\w'))", null, non_alphanumeric.match(new RegExp('\\w'))); // be sure all alphanumerics are not matched by \W new TestCase ( SECTION, "'" + alphanumeric + "'.match(new RegExp('\\W'))", null, alphanumeric.match(new RegExp('\\W'))); var s = non_alphanumeric + alphanumeric; // be sure all alphanumerics are matched by \w new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\w+'))", String([alphanumeric]), String(s.match(new RegExp('\\w+')))); s = alphanumeric + non_alphanumeric; // be sure all non-alphanumerics are matched by \W new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\W+'))", String([non_alphanumeric]), String(s.match(new RegExp('\\W+')))); // be sure all alphanumerics are matched by \w (using literals) new TestCase ( SECTION, "'" + s + "'.match(/\w+/)", String([alphanumeric]), String(s.match(/\w+/))); s = alphanumeric + non_alphanumeric; // be sure all non-alphanumerics are matched by \W (using literals) new TestCase ( SECTION, "'" + s + "'.match(/\W+/)", String([non_alphanumeric]), String(s.match(/\W+/))); s = 'abcd*&^%$$'; // be sure the following test behaves consistently new TestCase ( SECTION, "'" + s + "'.match(/(\w+)...(\W+)/)", String([s , 'abcd' , '%$$']), String(s.match(/(\w+)...(\W+)/))); var i; // be sure all alphanumeric characters match individually for (i = 0; i < alphanumeric.length; ++i) { s = '#$' + alphanumeric[i] + '%^'; new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\w'))", String([alphanumeric[i]]), String(s.match(new RegExp('\\w')))); } // be sure all non_alphanumeric characters match individually for (i = 0; i < non_alphanumeric.length; ++i) { s = 'sd' + non_alphanumeric[i] + String((i+10) * (i+10) - 2 * (i+10)); new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\W'))", String([non_alphanumeric[i]]), String(s.match(new RegExp('\\W')))); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/asterisk.js0000644000175000017500000001053311545150464022031 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: asterisk.js Description: 'Tests regular expressions containing *' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: *'; writeHeaderToLog('Executing script: aterisk.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcddddefg'.match(new RegExp('d*')) new TestCase ( SECTION, "'abcddddefg'.match(new RegExp('d*'))", String([""]), String('abcddddefg'.match(new RegExp('d*')))); // 'abcddddefg'.match(new RegExp('cd*')) new TestCase ( SECTION, "'abcddddefg'.match(new RegExp('cd*'))", String(["cdddd"]), String('abcddddefg'.match(new RegExp('cd*')))); // 'abcdefg'.match(new RegExp('cx*d')) new TestCase ( SECTION, "'abcdefg'.match(new RegExp('cx*d'))", String(["cd"]), String('abcdefg'.match(new RegExp('cx*d')))); // 'xxxxxxx'.match(new RegExp('(x*)(x+)')) new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('(x*)(x+)'))", String(["xxxxxxx","xxxxxx","x"]), String('xxxxxxx'.match(new RegExp('(x*)(x+)')))); // '1234567890'.match(new RegExp('(\\d*)(\\d+)')) new TestCase ( SECTION, "'1234567890'.match(new RegExp('(\\d*)(\\d+)'))", String(["1234567890","123456789","0"]), String('1234567890'.match(new RegExp('(\\d*)(\\d+)')))); // '1234567890'.match(new RegExp('(\\d*)\\d(\\d+)')) new TestCase ( SECTION, "'1234567890'.match(new RegExp('(\\d*)\\d(\\d+)'))", String(["1234567890","12345678","0"]), String('1234567890'.match(new RegExp('(\\d*)\\d(\\d+)')))); // 'xxxxxxx'.match(new RegExp('(x+)(x*)')) new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('(x+)(x*)'))", String(["xxxxxxx","xxxxxxx",""]), String('xxxxxxx'.match(new RegExp('(x+)(x*)')))); // 'xxxxxxyyyyyy'.match(new RegExp('x*y+$')) new TestCase ( SECTION, "'xxxxxxyyyyyy'.match(new RegExp('x*y+$'))", String(["xxxxxxyyyyyy"]), String('xxxxxxyyyyyy'.match(new RegExp('x*y+$')))); // 'abcdef'.match(/[\d]*[\s]*bc./) new TestCase ( SECTION, "'abcdef'.match(/[\\d]*[\\s]*bc./)", String(["bcd"]), String('abcdef'.match(/[\d]*[\s]*bc./))); // 'abcdef'.match(/bc..[\d]*[\s]*/) new TestCase ( SECTION, "'abcdef'.match(/bc..[\\d]*[\\s]*/)", String(["bcde"]), String('abcdef'.match(/bc..[\d]*[\s]*/))); // 'a1b2c3'.match(/.*/) new TestCase ( SECTION, "'a1b2c3'.match(/.*/)", String(["a1b2c3"]), String('a1b2c3'.match(/.*/))); // 'a0.b2.c3'.match(/[xyz]*1/) new TestCase ( SECTION, "'a0.b2.c3'.match(/[xyz]*1/)", null, 'a0.b2.c3'.match(/[xyz]*1/)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/backslash.js0000644000175000017500000000646111545150464022144 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: backslash.js Description: 'Tests regular expressions containing \' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: \\'; writeHeaderToLog('Executing script: backslash.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcde'.match(new RegExp('\e')) new TestCase ( SECTION, "'abcde'.match(new RegExp('\e'))", String(["e"]), String('abcde'.match(new RegExp('\e')))); // 'ab\\cde'.match(new RegExp('\\\\')) new TestCase ( SECTION, "'ab\\cde'.match(new RegExp('\\\\'))", String(["\\"]), String('ab\\cde'.match(new RegExp('\\\\')))); // 'ab\\cde'.match(/\\/) (using literal) new TestCase ( SECTION, "'ab\\cde'.match(/\\\\/)", String(["\\"]), String('ab\\cde'.match(/\\/))); // 'before ^$*+?.()|{}[] after'.match(new RegExp('\^\$\*\+\?\.\(\)\|\{\}\[\]')) new TestCase ( SECTION, "'before ^$*+?.()|{}[] after'.match(new RegExp('\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]'))", String(["^$*+?.()|{}[]"]), String('before ^$*+?.()|{}[] after'.match(new RegExp('\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]')))); // 'before ^$*+?.()|{}[] after'.match(/\^\$\*\+\?\.\(\)\|\{\}\[\]/) (using literal) new TestCase ( SECTION, "'before ^$*+?.()|{}[] after'.match(/\\^\\$\\*\\+\\?\\.\\(\\)\\|\\{\\}\\[\\]/)", String(["^$*+?.()|{}[]"]), String('before ^$*+?.()|{}[] after'.match(/\^\$\*\+\?\.\(\)\|\{\}\[\]/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/backspace.js0000644000175000017500000000644311545150464022125 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: backspace.js Description: 'Tests regular expressions containing [\b]' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: [\b]'; writeHeaderToLog('Executing script: backspace.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abc\bdef'.match(new RegExp('.[\b].')) new TestCase ( SECTION, "'abc\bdef'.match(new RegExp('.[\\b].'))", String(["c\bd"]), String('abc\bdef'.match(new RegExp('.[\\b].')))); // 'abc\\bdef'.match(new RegExp('.[\b].')) new TestCase ( SECTION, "'abc\\bdef'.match(new RegExp('.[\\b].'))", null, 'abc\\bdef'.match(new RegExp('.[\\b].'))); // 'abc\b\b\bdef'.match(new RegExp('c[\b]{3}d')) new TestCase ( SECTION, "'abc\b\b\bdef'.match(new RegExp('c[\\b]{3}d'))", String(["c\b\b\bd"]), String('abc\b\b\bdef'.match(new RegExp('c[\\b]{3}d')))); // 'abc\bdef'.match(new RegExp('[^\\[\b\\]]+')) new TestCase ( SECTION, "'abc\bdef'.match(new RegExp('[^\\[\\b\\]]+'))", String(["abc"]), String('abc\bdef'.match(new RegExp('[^\\[\\b\\]]+')))); // 'abcdef'.match(new RegExp('[^\\[\b\\]]+')) new TestCase ( SECTION, "'abcdef'.match(new RegExp('[^\\[\\b\\]]+'))", String(["abcdef"]), String('abcdef'.match(new RegExp('[^\\[\\b\\]]+')))); // 'abcdef'.match(/[^\[\b\]]+/) new TestCase ( SECTION, "'abcdef'.match(/[^\\[\\b\\]]+/)", String(["abcdef"]), String('abcdef'.match(/[^\[\b\]]+/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/beginLine.js0000644000175000017500000000623611545150464022105 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: beginLine.js Description: 'Tests regular expressions containing ^' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: ^'; writeHeaderToLog('Executing script: beginLine.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcde'.match(new RegExp('^ab')) new TestCase ( SECTION, "'abcde'.match(new RegExp('^ab'))", String(["ab"]), String('abcde'.match(new RegExp('^ab')))); // 'ab\ncde'.match(new RegExp('^..^e')) new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('^..^e'))", null, 'ab\ncde'.match(new RegExp('^..^e'))); // 'yyyyy'.match(new RegExp('^xxx')) new TestCase ( SECTION, "'yyyyy'.match(new RegExp('^xxx'))", null, 'yyyyy'.match(new RegExp('^xxx'))); // '^^^x'.match(new RegExp('^\\^+')) new TestCase ( SECTION, "'^^^x'.match(new RegExp('^\\^+'))", String(['^^^']), String('^^^x'.match(new RegExp('^\\^+')))); // '^^^x'.match(/^\^+/) new TestCase ( SECTION, "'^^^x'.match(/^\\^+/)", String(['^^^']), String('^^^x'.match(/^\^+/))); RegExp.multiline = true; // 'abc\n123xyz'.match(new RegExp('^\d+')) new TestCase ( SECTION, "'abc\n123xyz'.match(new RegExp('^\\d+'))", String(['123']), String('abc\n123xyz'.match(new RegExp('^\\d+')))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/browser.js0000644000175000017500000000000011545150464021653 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/character_class.js0000644000175000017500000001124211545150464023323 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: character_class.js Description: 'Tests regular expressions containing []' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: []'; writeHeaderToLog('Executing script: character_class.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcde'.match(new RegExp('ab[ercst]de')) new TestCase ( SECTION, "'abcde'.match(new RegExp('ab[ercst]de'))", String(["abcde"]), String('abcde'.match(new RegExp('ab[ercst]de')))); // 'abcde'.match(new RegExp('ab[erst]de')) new TestCase ( SECTION, "'abcde'.match(new RegExp('ab[erst]de'))", null, 'abcde'.match(new RegExp('ab[erst]de'))); // 'abcdefghijkl'.match(new RegExp('[d-h]+')) new TestCase ( SECTION, "'abcdefghijkl'.match(new RegExp('[d-h]+'))", String(["defgh"]), String('abcdefghijkl'.match(new RegExp('[d-h]+')))); // 'abc6defghijkl'.match(new RegExp('[1234567].{2}')) new TestCase ( SECTION, "'abc6defghijkl'.match(new RegExp('[1234567].{2}'))", String(["6de"]), String('abc6defghijkl'.match(new RegExp('[1234567].{2}')))); // '\n\n\abc324234\n'.match(new RegExp('[a-c\d]+')) new TestCase ( SECTION, "'\n\n\abc324234\n'.match(new RegExp('[a-c\\d]+'))", String(["abc324234"]), String('\n\n\abc324234\n'.match(new RegExp('[a-c\\d]+')))); // 'abc'.match(new RegExp('ab[.]?c')) new TestCase ( SECTION, "'abc'.match(new RegExp('ab[.]?c'))", String(["abc"]), String('abc'.match(new RegExp('ab[.]?c')))); // 'abc'.match(new RegExp('a[b]c')) new TestCase ( SECTION, "'abc'.match(new RegExp('a[b]c'))", String(["abc"]), String('abc'.match(new RegExp('a[b]c')))); // 'a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]')) new TestCase ( SECTION, "'a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]'))", String(["def"]), String('a1b b2c c3d def f4g'.match(new RegExp('[a-z][^1-9][a-z]')))); // '123*&$abc'.match(new RegExp('[*&$]{3}')) new TestCase ( SECTION, "'123*&$abc'.match(new RegExp('[*&$]{3}'))", String(["*&$"]), String('123*&$abc'.match(new RegExp('[*&$]{3}')))); // 'abc'.match(new RegExp('a[^1-9]c')) new TestCase ( SECTION, "'abc'.match(new RegExp('a[^1-9]c'))", String(["abc"]), String('abc'.match(new RegExp('a[^1-9]c')))); // 'abc'.match(new RegExp('a[^b]c')) new TestCase ( SECTION, "'abc'.match(new RegExp('a[^b]c'))", null, 'abc'.match(new RegExp('a[^b]c'))); // 'abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}')) new TestCase ( SECTION, "'abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}'))", String(["%&*@"]), String('abc#$%def%&*@ghi)(*&'.match(new RegExp('[^a-z]{4}')))); // 'abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/) new TestCase ( SECTION, "'abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/)", String(["%&*@"]), String('abc#$%def%&*@ghi)(*&'.match(/[^a-z]{4}/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/compile.js0000644000175000017500000000657611545150464021650 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: compile.js Description: 'Tests regular expressions method compile' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: compile'; writeHeaderToLog('Executing script: compile.js'); writeHeaderToLog( SECTION + " "+ TITLE); var regularExpression = new RegExp(); regularExpression.compile("[0-9]{3}x[0-9]{4}","i"); new TestCase ( SECTION, "(compile '[0-9]{3}x[0-9]{4}','i')", String(["456X7890"]), String('234X456X7890'.match(regularExpression))); new TestCase ( SECTION, "source of (compile '[0-9]{3}x[0-9]{4}','i')", "[0-9]{3}x[0-9]{4}", regularExpression.source); new TestCase ( SECTION, "global of (compile '[0-9]{3}x[0-9]{4}','i')", false, regularExpression.global); new TestCase ( SECTION, "ignoreCase of (compile '[0-9]{3}x[0-9]{4}','i')", true, regularExpression.ignoreCase); regularExpression.compile("[0-9]{3}X[0-9]{3}","g"); new TestCase ( SECTION, "(compile '[0-9]{3}X[0-9]{3}','g')", String(["234X456"]), String('234X456X7890'.match(regularExpression))); new TestCase ( SECTION, "source of (compile '[0-9]{3}X[0-9]{3}','g')", "[0-9]{3}X[0-9]{3}", regularExpression.source); new TestCase ( SECTION, "global of (compile '[0-9]{3}X[0-9]{3}','g')", true, regularExpression.global); new TestCase ( SECTION, "ignoreCase of (compile '[0-9]{3}X[0-9]{3}','g')", false, regularExpression.ignoreCase); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/control_characters.js0000644000175000017500000000547311545150464024072 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: control_characters.js Description: 'Tests regular expressions containing .' Author: Nick Lerissa Date: April 8, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; var TITLE = 'RegExp: .'; var BUGNUMBER="123802"; startTest(); writeHeaderToLog('Executing script: control_characters.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'àOÐ ê:i¢Ø'.match(new RegExp('.+')) new TestCase ( SECTION, "'àOÐ ê:i¢Ø'.match(new RegExp('.+'))", String(['àOÐ ê:i¢Ø']), String('àOÐ ê:i¢Ø'.match(new RegExp('.+')))); // string1.match(new RegExp(string1)) var string1 = 'àOÐ ê:i¢Ø'; new TestCase ( SECTION, "string1 = " + string1 + " string1.match(string1)", String([string1]), String(string1.match(string1))); string1 = ""; for (var i = 0; i < 32; i++) string1 += String.fromCharCode(i); new TestCase ( SECTION, "string1 = " + string1 + " string1.match(string1)", String([string1]), String(string1.match(string1))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/digit.js0000644000175000017500000001025411545150464021304 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: digit.js Description: 'Tests regular expressions containing \d' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: \\d'; writeHeaderToLog('Executing script: digit.js'); writeHeaderToLog( SECTION + " "+ TITLE); var non_digits = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\f\n\r\t\v~`!@#$%^&*()-+={[}]|\\:;'<,>./? " + '"'; var digits = "1234567890"; // be sure all digits are matched by \d new TestCase ( SECTION, "'" + digits + "'.match(new RegExp('\\d+'))", String([digits]), String(digits.match(new RegExp('\\d+')))); // be sure all non-digits are matched by \D new TestCase ( SECTION, "'" + non_digits + "'.match(new RegExp('\\D+'))", String([non_digits]), String(non_digits.match(new RegExp('\\D+')))); // be sure all non-digits are not matched by \d new TestCase ( SECTION, "'" + non_digits + "'.match(new RegExp('\\d'))", null, non_digits.match(new RegExp('\\d'))); // be sure all digits are not matched by \D new TestCase ( SECTION, "'" + digits + "'.match(new RegExp('\\D'))", null, digits.match(new RegExp('\\D'))); var s = non_digits + digits; // be sure all digits are matched by \d new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\d+'))", String([digits]), String(s.match(new RegExp('\\d+')))); var s = digits + non_digits; // be sure all non-digits are matched by \D new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\D+'))", String([non_digits]), String(s.match(new RegExp('\\D+')))); var i; // be sure all digits match individually for (i = 0; i < digits.length; ++i) { s = 'ab' + digits[i] + 'cd'; new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\d'))", String([digits[i]]), String(s.match(new RegExp('\\d')))); new TestCase ( SECTION, "'" + s + "'.match(/\\d/)", String([digits[i]]), String(s.match(/\d/))); } // be sure all non_digits match individually for (i = 0; i < non_digits.length; ++i) { s = '12' + non_digits[i] + '34'; new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\D'))", String([non_digits[i]]), String(s.match(new RegExp('\\D')))); new TestCase ( SECTION, "'" + s + "'.match(/\\D/)", String([non_digits[i]]), String(s.match(/\D/))); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/dot.js0000644000175000017500000001034611545150464020774 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: dot.js Description: 'Tests regular expressions containing .' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: .'; writeHeaderToLog('Executing script: dot.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcde'.match(new RegExp('ab.de')) new TestCase ( SECTION, "'abcde'.match(new RegExp('ab.de'))", String(["abcde"]), String('abcde'.match(new RegExp('ab.de')))); // 'line 1\nline 2'.match(new RegExp('.+')) new TestCase ( SECTION, "'line 1\nline 2'.match(new RegExp('.+'))", String(["line 1"]), String('line 1\nline 2'.match(new RegExp('.+')))); // 'this is a test'.match(new RegExp('.*a.*')) new TestCase ( SECTION, "'this is a test'.match(new RegExp('.*a.*'))", String(["this is a test"]), String('this is a test'.match(new RegExp('.*a.*')))); // 'this is a *&^%$# test'.match(new RegExp('.+')) new TestCase ( SECTION, "'this is a *&^%$# test'.match(new RegExp('.+'))", String(["this is a *&^%$# test"]), String('this is a *&^%$# test'.match(new RegExp('.+')))); // '....'.match(new RegExp('.+')) new TestCase ( SECTION, "'....'.match(new RegExp('.+'))", String(["...."]), String('....'.match(new RegExp('.+')))); // 'abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+')) new TestCase ( SECTION, "'abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+'))", String(["abcdefghijklmnopqrstuvwxyz"]), String('abcdefghijklmnopqrstuvwxyz'.match(new RegExp('.+')))); // 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+')) new TestCase ( SECTION, "'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+'))", String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String('ABCDEFGHIJKLMNOPQRSTUVWXYZ'.match(new RegExp('.+')))); // '`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+')) new TestCase ( SECTION, "'`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+'))", String(["`1234567890-=~!@#$%^&*()_+"]), String('`1234567890-=~!@#$%^&*()_+'.match(new RegExp('.+')))); // '|\\[{]};:"\',<>.?/'.match(new RegExp('.+')) new TestCase ( SECTION, "'|\\[{]};:\"\',<>.?/'.match(new RegExp('.+'))", String(["|\\[{]};:\"\',<>.?/"]), String('|\\[{]};:\"\',<>.?/'.match(new RegExp('.+')))); // '|\\[{]};:"\',<>.?/'.match(/.+/) new TestCase ( SECTION, "'|\\[{]};:\"\',<>.?/'.match(/.+/)", String(["|\\[{]};:\"\',<>.?/"]), String('|\\[{]};:\"\',<>.?/'.match(/.+/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/endLine.js0000644000175000017500000000626411545150464021570 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: endLine.js Description: 'Tests regular expressions containing $' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: $'; writeHeaderToLog('Executing script: endLine.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcde'.match(new RegExp('de$')) new TestCase ( SECTION, "'abcde'.match(new RegExp('de$'))", String(["de"]), String('abcde'.match(new RegExp('de$')))); // 'ab\ncde'.match(new RegExp('..$e$')) new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('..$e$'))", null, 'ab\ncde'.match(new RegExp('..$e$'))); // 'yyyyy'.match(new RegExp('xxx$')) new TestCase ( SECTION, "'yyyyy'.match(new RegExp('xxx$'))", null, 'yyyyy'.match(new RegExp('xxx$'))); // 'a$$$'.match(new RegExp('\\$+$')) new TestCase ( SECTION, "'a$$$'.match(new RegExp('\\$+$'))", String(['$$$']), String('a$$$'.match(new RegExp('\\$+$')))); // 'a$$$'.match(/\$+$/) new TestCase ( SECTION, "'a$$$'.match(/\\$+$/)", String(['$$$']), String('a$$$'.match(/\$+$/))); RegExp.multiline = true; // 'abc\n123xyz890\nxyz'.match(new RegExp('\d+$')) new TestCase ( SECTION, "'abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))", String(['890']), String('abc\n123xyz890\nxyz'.match(new RegExp('\\d+$')))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/everything.js0000644000175000017500000000747111545150464022377 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: everything.js Description: 'Tests regular expressions' Author: Nick Lerissa Date: March 24, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp'; writeHeaderToLog('Executing script: everything.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'Sally and Fred are sure to come.'.match(/^[a-z\s]*/i) new TestCase ( SECTION, "'Sally and Fred are sure to come'.match(/^[a-z\\s]*/i)", String(["Sally and Fred are sure to come"]), String('Sally and Fred are sure to come'.match(/^[a-z\s]*/i))); // 'test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$')) new TestCase ( SECTION, "'test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$'))", String(["test123W+xyz","xyz"]), String('test123W+xyz'.match(new RegExp('^[a-z]*[0-9]+[A-Z]?.(123|xyz)$')))); // 'number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/) new TestCase ( SECTION, "'number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/)", String(["12365 number two 9898","12365","9898"]), String('number one 12365 number two 9898'.match(/(\d+)\D+(\d+)/))); var simpleSentence = /(\s?[^\!\?\.]+[\!\?\.])+/; // 'See Spot run.'.match(simpleSentence) new TestCase ( SECTION, "'See Spot run.'.match(simpleSentence)", String(["See Spot run.","See Spot run."]), String('See Spot run.'.match(simpleSentence))); // 'I like it. What's up? I said NO!'.match(simpleSentence) new TestCase ( SECTION, "'I like it. What's up? I said NO!'.match(simpleSentence)", String(["I like it. What's up? I said NO!",' I said NO!']), String('I like it. What\'s up? I said NO!'.match(simpleSentence))); // 'the quick brown fox jumped over the lazy dogs'.match(/((\w+)\s*)+/) new TestCase ( SECTION, "'the quick brown fox jumped over the lazy dogs'.match(/((\\w+)\\s*)+/)", String(['the quick brown fox jumped over the lazy dogs','dogs','dogs']),String('the quick brown fox jumped over the lazy dogs'.match(/((\w+)\s*)+/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/exec.js0000644000175000017500000000561111545150464021131 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: exec.js Description: 'Tests regular expressions exec compile' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: exec'; writeHeaderToLog('Executing script: exec.js'); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase ( SECTION, "/[0-9]{3}/.exec('23 2 34 678 9 09')", String(["678"]), String(/[0-9]{3}/.exec('23 2 34 678 9 09'))); new TestCase ( SECTION, "/3.{4}8/.exec('23 2 34 678 9 09')", String(["34 678"]), String(/3.{4}8/.exec('23 2 34 678 9 09'))); var re = new RegExp('3.{4}8'); new TestCase ( SECTION, "re.exec('23 2 34 678 9 09')", String(["34 678"]), String(re.exec('23 2 34 678 9 09'))); new TestCase ( SECTION, "(/3.{4}8/.exec('23 2 34 678 9 09').length", 1, (/3.{4}8/.exec('23 2 34 678 9 09')).length); re = new RegExp('3.{4}8'); new TestCase ( SECTION, "(re.exec('23 2 34 678 9 09').length", 1, (re.exec('23 2 34 678 9 09')).length); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/flags.js0000644000175000017500000000715211545150464021303 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: regexp.js Description: 'Tests regular expressions using flags "i" and "g"' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'regular expression flags with flags "i" and "g"'; writeHeaderToLog('Executing script: flags.js'); writeHeaderToLog( SECTION + " "+ TITLE); // testing optional flag 'i' new TestCase ( SECTION, "'aBCdEfGHijKLmno'.match(/fghijk/i)", String(["fGHijK"]), String('aBCdEfGHijKLmno'.match(/fghijk/i))); new TestCase ( SECTION, "'aBCdEfGHijKLmno'.match(new RegExp('fghijk','i'))", String(["fGHijK"]), String('aBCdEfGHijKLmno'.match(new RegExp("fghijk","i")))); // testing optional flag 'g' new TestCase ( SECTION, "'xa xb xc xd xe xf'.match(/x./g)", String(["xa","xb","xc","xd","xe","xf"]), String('xa xb xc xd xe xf'.match(/x./g))); new TestCase ( SECTION, "'xa xb xc xd xe xf'.match(new RegExp('x.','g'))", String(["xa","xb","xc","xd","xe","xf"]), String('xa xb xc xd xe xf'.match(new RegExp('x.','g')))); // testing optional flags 'g' and 'i' new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(/x./gi)", String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(/x./gi))); new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(new RegExp('x.','gi'))", String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(new RegExp('x.','gi')))); new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(/x./ig)", String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(/x./ig))); new TestCase ( SECTION, "'xa Xb xc xd Xe xf'.match(new RegExp('x.','ig'))", String(["xa","Xb","xc","xd","Xe","xf"]), String('xa Xb xc xd Xe xf'.match(new RegExp('x.','ig')))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/global.js0000644000175000017500000000732611545150464021452 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: global.js Description: 'Tests RegExp attribute global' Author: Nick Lerissa Date: March 13, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: global'; writeHeaderToLog('Executing script: global.js'); writeHeaderToLog( SECTION + " "+ TITLE); // /xyz/g.global new TestCase ( SECTION, "/xyz/g.global", true, /xyz/g.global); // /xyz/.global new TestCase ( SECTION, "/xyz/.global", false, /xyz/.global); // '123 456 789'.match(/\d+/g) new TestCase ( SECTION, "'123 456 789'.match(/\\d+/g)", String(["123","456","789"]), String('123 456 789'.match(/\d+/g))); // '123 456 789'.match(/(\d+)/g) new TestCase ( SECTION, "'123 456 789'.match(/(\\d+)/g)", String(["123","456","789"]), String('123 456 789'.match(/(\d+)/g))); // '123 456 789'.match(/\d+/) new TestCase ( SECTION, "'123 456 789'.match(/\\d+/)", String(["123"]), String('123 456 789'.match(/\d+/))); // (new RegExp('[a-z]','g')).global new TestCase ( SECTION, "(new RegExp('[a-z]','g')).global", true, (new RegExp('[a-z]','g')).global); // (new RegExp('[a-z]','i')).global new TestCase ( SECTION, "(new RegExp('[a-z]','i')).global", false, (new RegExp('[a-z]','i')).global); // '123 456 789'.match(new RegExp('\\d+','g')) new TestCase ( SECTION, "'123 456 789'.match(new RegExp('\\\\d+','g'))", String(["123","456","789"]), String('123 456 789'.match(new RegExp('\\d+','g')))); // '123 456 789'.match(new RegExp('(\\d+)','g')) new TestCase ( SECTION, "'123 456 789'.match(new RegExp('(\\\\d+)','g'))", String(["123","456","789"]), String('123 456 789'.match(new RegExp('(\\d+)','g')))); // '123 456 789'.match(new RegExp('\\d+','i')) new TestCase ( SECTION, "'123 456 789'.match(new RegExp('\\\\d+','i'))", String(["123"]), String('123 456 789'.match(new RegExp('\\d+','i')))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/hexadecimal.js0000644000175000017500000001060311545150464022446 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: hexadecimal.js Description: 'Tests regular expressions containing \ ' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: \x# (hex) '; writeHeaderToLog('Executing script: hexadecimal.js'); writeHeaderToLog( SECTION + " "+ TITLE); var testPattern = '\\x41\\x42\\x43\\x44\\x45\\x46\\x47\\x48\\x49\\x4A\\x4B\\x4C\\x4D\\x4E\\x4F\\x50\\x51\\x52\\x53\\x54\\x55\\x56\\x57\\x58\\x59\\x5A'; var testString = "12345ABCDEFGHIJKLMNOPQRSTUVWXYZ67890"; new TestCase ( SECTION, "'" + testString + "'.match(new RegExp('" + testPattern + "'))", String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String(testString.match(new RegExp(testPattern)))); testPattern = '\\x61\\x62\\x63\\x64\\x65\\x66\\x67\\x68\\x69\\x6A\\x6B\\x6C\\x6D\\x6E\\x6F\\x70\\x71\\x72\\x73\\x74\\x75\\x76\\x77\\x78\\x79\\x7A'; testString = "12345AabcdefghijklmnopqrstuvwxyzZ67890"; new TestCase ( SECTION, "'" + testString + "'.match(new RegExp('" + testPattern + "'))", String(["abcdefghijklmnopqrstuvwxyz"]), String(testString.match(new RegExp(testPattern)))); testPattern = '\\x20\\x21\\x22\\x23\\x24\\x25\\x26\\x27\\x28\\x29\\x2A\\x2B\\x2C\\x2D\\x2E\\x2F\\x30\\x31\\x32\\x33'; testString = "abc !\"#$%&'()*+,-./0123ZBC"; new TestCase ( SECTION, "'" + testString + "'.match(new RegExp('" + testPattern + "'))", String([" !\"#$%&'()*+,-./0123"]), String(testString.match(new RegExp(testPattern)))); testPattern = '\\x34\\x35\\x36\\x37\\x38\\x39\\x3A\\x3B\\x3C\\x3D\\x3E\\x3F\\x40'; testString = "123456789:;<=>?@ABC"; new TestCase ( SECTION, "'" + testString + "'.match(new RegExp('" + testPattern + "'))", String(["456789:;<=>?@"]), String(testString.match(new RegExp(testPattern)))); testPattern = '\\x7B\\x7C\\x7D\\x7E'; testString = "1234{|}~ABC"; new TestCase ( SECTION, "'" + testString + "'.match(new RegExp('" + testPattern + "'))", String(["{|}~"]), String(testString.match(new RegExp(testPattern)))); new TestCase ( SECTION, "'canthisbeFOUND'.match(new RegExp('[A-\\x5A]+'))", String(["FOUND"]), String('canthisbeFOUND'.match(new RegExp('[A-\\x5A]+')))); new TestCase ( SECTION, "'canthisbeFOUND'.match(new RegExp('[\\x61-\\x7A]+'))", String(["canthisbe"]), String('canthisbeFOUND'.match(new RegExp('[\\x61-\\x7A]+')))); new TestCase ( SECTION, "'canthisbeFOUND'.match(/[\\x61-\\x7A]+/)", String(["canthisbe"]), String('canthisbeFOUND'.match(/[\x61-\x7A]+/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/ignoreCase.js0000644000175000017500000001102111545150464022254 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: ignoreCase.js Description: 'Tests RegExp attribute ignoreCase' Author: Nick Lerissa Date: March 13, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: ignoreCase'; writeHeaderToLog('Executing script: ignoreCase.js'); writeHeaderToLog( SECTION + " "+ TITLE); // /xyz/i.ignoreCase new TestCase ( SECTION, "/xyz/i.ignoreCase", true, /xyz/i.ignoreCase); // /xyz/.ignoreCase new TestCase ( SECTION, "/xyz/.ignoreCase", false, /xyz/.ignoreCase); // 'ABC def ghi'.match(/[a-z]+/ig) new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/ig)", String(["ABC","def","ghi"]), String('ABC def ghi'.match(/[a-z]+/ig))); // 'ABC def ghi'.match(/[a-z]+/i) new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/i)", String(["ABC"]), String('ABC def ghi'.match(/[a-z]+/i))); // 'ABC def ghi'.match(/([a-z]+)/ig) new TestCase ( SECTION, "'ABC def ghi'.match(/([a-z]+)/ig)", String(["ABC","def","ghi"]), String('ABC def ghi'.match(/([a-z]+)/ig))); // 'ABC def ghi'.match(/([a-z]+)/i) new TestCase ( SECTION, "'ABC def ghi'.match(/([a-z]+)/i)", String(["ABC","ABC"]), String('ABC def ghi'.match(/([a-z]+)/i))); // 'ABC def ghi'.match(/[a-z]+/) new TestCase ( SECTION, "'ABC def ghi'.match(/[a-z]+/)", String(["def"]), String('ABC def ghi'.match(/[a-z]+/))); // (new RegExp('xyz','i')).ignoreCase new TestCase ( SECTION, "(new RegExp('xyz','i')).ignoreCase", true, (new RegExp('xyz','i')).ignoreCase); // (new RegExp('xyz')).ignoreCase new TestCase ( SECTION, "(new RegExp('xyz')).ignoreCase", false, (new RegExp('xyz')).ignoreCase); // 'ABC def ghi'.match(new RegExp('[a-z]+','ig')) new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+','ig'))", String(["ABC","def","ghi"]), String('ABC def ghi'.match(new RegExp('[a-z]+','ig')))); // 'ABC def ghi'.match(new RegExp('[a-z]+','i')) new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+','i'))", String(["ABC"]), String('ABC def ghi'.match(new RegExp('[a-z]+','i')))); // 'ABC def ghi'.match(new RegExp('([a-z]+)','ig')) new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('([a-z]+)','ig'))", String(["ABC","def","ghi"]), String('ABC def ghi'.match(new RegExp('([a-z]+)','ig')))); // 'ABC def ghi'.match(new RegExp('([a-z]+)','i')) new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('([a-z]+)','i'))", String(["ABC","ABC"]), String('ABC def ghi'.match(new RegExp('([a-z]+)','i')))); // 'ABC def ghi'.match(new RegExp('[a-z]+')) new TestCase ( SECTION, "'ABC def ghi'.match(new RegExp('[a-z]+'))", String(["def"]), String('ABC def ghi'.match(new RegExp('[a-z]+')))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/interval.js0000644000175000017500000001232611545150464022032 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: interval.js Description: 'Tests regular expressions containing {}' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: {}'; writeHeaderToLog('Executing script: interval.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c')) new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c'))", String(["bbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2}c')))); // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}')) new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}'))", null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8}'))); // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c')) new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c'))", String(["bbbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2,}c')))); // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c')) new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c'))", null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{8,}c'))); // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c')) new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c'))", String(["bbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{2,3}c')))); // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c')) new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c'))", null, 'aaabbbbcccddeeeefffff'.match(new RegExp('b{42,93}c'))); // 'aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c')) new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c'))", String(["bbbbc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('b{0,93}c')))); // 'aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c')) new TestCase ( SECTION, "'aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c'))", String(["bc"]), String('aaabbbbcccddeeeefffff'.match(new RegExp('bx{0,93}c')))); // 'weirwerdf'.match(new RegExp('.{0,93}')) new TestCase ( SECTION, "'weirwerdf'.match(new RegExp('.{0,93}'))", String(["weirwerdf"]), String('weirwerdf'.match(new RegExp('.{0,93}')))); // 'wqe456646dsff'.match(new RegExp('\d{1,}')) new TestCase ( SECTION, "'wqe456646dsff'.match(new RegExp('\\d{1,}'))", String(["456646"]), String('wqe456646dsff'.match(new RegExp('\\d{1,}')))); // '123123'.match(new RegExp('(123){1,}')) new TestCase ( SECTION, "'123123'.match(new RegExp('(123){1,}'))", String(["123123","123"]), String('123123'.match(new RegExp('(123){1,}')))); // '123123x123'.match(new RegExp('(123){1,}x\1')) new TestCase ( SECTION, "'123123x123'.match(new RegExp('(123){1,}x\\1'))", String(["123123x123","123"]), String('123123x123'.match(new RegExp('(123){1,}x\\1')))); // '123123x123'.match(/(123){1,}x\1/) new TestCase ( SECTION, "'123123x123'.match(/(123){1,}x\\1/)", String(["123123x123","123"]), String('123123x123'.match(/(123){1,}x\1/))); // 'xxxxxxx'.match(new RegExp('x{1,2}x{1,}')) new TestCase ( SECTION, "'xxxxxxx'.match(new RegExp('x{1,2}x{1,}'))", String(["xxxxxxx"]), String('xxxxxxx'.match(new RegExp('x{1,2}x{1,}')))); // 'xxxxxxx'.match(/x{1,2}x{1,}/) new TestCase ( SECTION, "'xxxxxxx'.match(/x{1,2}x{1,}/)", String(["xxxxxxx"]), String('xxxxxxx'.match(/x{1,2}x{1,}/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/jstests.list0000644000175000017500000000237211545150464022244 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_2/regexp/ script RegExp_dollar_number.js script RegExp_input.js script RegExp_input_as_array.js skip script RegExp_lastIndex.js # obsolete test script RegExp_lastMatch.js script RegExp_lastMatch_as_array.js script RegExp_lastParen.js script RegExp_lastParen_as_array.js script RegExp_leftContext.js script RegExp_leftContext_as_array.js script RegExp_multiline.js script RegExp_multiline_as_array.js script RegExp_object.js script RegExp_rightContext.js script RegExp_rightContext_as_array.js script alphanumeric.js script asterisk.js script backslash.js script backspace.js script beginLine.js script character_class.js script compile.js script control_characters.js script digit.js script dot.js script endLine.js script everything.js script exec.js script flags.js script global.js script hexadecimal.js script ignoreCase.js script interval.js script octal.js script parentheses.js script plus.js script question_mark.js script regress-6359.js script regress-9141.js script simple_form.js script source.js script special_characters.js script string_replace.js script string_search.js skip script string_split.js # obsolete test script test.js script toString.js script vertical_bar.js script whitespace.js script word_boundary.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/octal.js0000644000175000017500000001053011545150464021303 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: octal.js Description: 'Tests regular expressions containing \ ' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: \# (octal) '; writeHeaderToLog('Executing script: octal.js'); writeHeaderToLog( SECTION + " "+ TITLE); var testPattern = '\\101\\102\\103\\104\\105\\106\\107\\110\\111\\112\\113\\114\\115\\116\\117\\120\\121\\122\\123\\124\\125\\126\\127\\130\\131\\132'; var testString = "12345ABCDEFGHIJKLMNOPQRSTUVWXYZ67890"; new TestCase ( SECTION, "'" + testString + "'.match(new RegExp('" + testPattern + "'))", String(["ABCDEFGHIJKLMNOPQRSTUVWXYZ"]), String(testString.match(new RegExp(testPattern)))); testPattern = '\\141\\142\\143\\144\\145\\146\\147\\150\\151\\152\\153\\154\\155\\156\\157\\160\\161\\162\\163\\164\\165\\166\\167\\170\\171\\172'; testString = "12345AabcdefghijklmnopqrstuvwxyzZ67890"; new TestCase ( SECTION, "'" + testString + "'.match(new RegExp('" + testPattern + "'))", String(["abcdefghijklmnopqrstuvwxyz"]), String(testString.match(new RegExp(testPattern)))); testPattern = '\\40\\41\\42\\43\\44\\45\\46\\47\\50\\51\\52\\53\\54\\55\\56\\57\\60\\61\\62\\63'; testString = "abc !\"#$%&'()*+,-./0123ZBC"; new TestCase ( SECTION, "'" + testString + "'.match(new RegExp('" + testPattern + "'))", String([" !\"#$%&'()*+,-./0123"]), String(testString.match(new RegExp(testPattern)))); testPattern = '\\64\\65\\66\\67\\70\\71\\72\\73\\74\\75\\76\\77\\100'; testString = "123456789:;<=>?@ABC"; new TestCase ( SECTION, "'" + testString + "'.match(new RegExp('" + testPattern + "'))", String(["456789:;<=>?@"]), String(testString.match(new RegExp(testPattern)))); testPattern = '\\173\\174\\175\\176'; testString = "1234{|}~ABC"; new TestCase ( SECTION, "'" + testString + "'.match(new RegExp('" + testPattern + "'))", String(["{|}~"]), String(testString.match(new RegExp(testPattern)))); new TestCase ( SECTION, "'canthisbeFOUND'.match(new RegExp('[A-\\132]+'))", String(["FOUND"]), String('canthisbeFOUND'.match(new RegExp('[A-\\132]+')))); new TestCase ( SECTION, "'canthisbeFOUND'.match(new RegExp('[\\141-\\172]+'))", String(["canthisbe"]), String('canthisbeFOUND'.match(new RegExp('[\\141-\\172]+')))); new TestCase ( SECTION, "'canthisbeFOUND'.match(/[\\141-\\172]+/)", String(["canthisbe"]), String('canthisbeFOUND'.match(/[\141-\172]+/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/parentheses.js0000644000175000017500000001163011545150464022524 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: parentheses.js Description: 'Tests regular expressions containing ()' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: ()'; writeHeaderToLog('Executing script: parentheses.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abc'.match(new RegExp('(abc)')) new TestCase ( SECTION, "'abc'.match(new RegExp('(abc)'))", String(["abc","abc"]), String('abc'.match(new RegExp('(abc)')))); // 'abcdefg'.match(new RegExp('a(bc)d(ef)g')) new TestCase ( SECTION, "'abcdefg'.match(new RegExp('a(bc)d(ef)g'))", String(["abcdefg","bc","ef"]), String('abcdefg'.match(new RegExp('a(bc)d(ef)g')))); // 'abcdefg'.match(new RegExp('(.{3})(.{4})')) new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(.{3})(.{4})'))", String(["abcdefg","abc","defg"]), String('abcdefg'.match(new RegExp('(.{3})(.{4})')))); // 'aabcdaabcd'.match(new RegExp('(aa)bcd\1')) new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(aa)bcd\\1'))", String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(aa)bcd\\1')))); // 'aabcdaabcd'.match(new RegExp('(aa).+\1')) new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(aa).+\\1'))", String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(aa).+\\1')))); // 'aabcdaabcd'.match(new RegExp('(.{2}).+\1')) new TestCase ( SECTION, "'aabcdaabcd'.match(new RegExp('(.{2}).+\\1'))", String(["aabcdaa","aa"]), String('aabcdaabcd'.match(new RegExp('(.{2}).+\\1')))); // '123456123456'.match(new RegExp('(\d{3})(\d{3})\1\2')) new TestCase ( SECTION, "'123456123456'.match(new RegExp('(\\d{3})(\\d{3})\\1\\2'))", String(["123456123456","123","456"]), String('123456123456'.match(new RegExp('(\\d{3})(\\d{3})\\1\\2')))); // 'abcdefg'.match(new RegExp('a(..(..)..)')) new TestCase ( SECTION, "'abcdefg'.match(new RegExp('a(..(..)..)'))", String(["abcdefg","bcdefg","de"]), String('abcdefg'.match(new RegExp('a(..(..)..)')))); // 'abcdefg'.match(/a(..(..)..)/) new TestCase ( SECTION, "'abcdefg'.match(/a(..(..)..)/)", String(["abcdefg","bcdefg","de"]), String('abcdefg'.match(/a(..(..)..)/))); // 'xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))')) new TestCase ( SECTION, "'xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))'))", String(["abcdef","abc","bc","c","def","ef","f"]), String('xabcdefg'.match(new RegExp('(a(b(c)))(d(e(f)))')))); // 'xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\2\5')) new TestCase ( SECTION, "'xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\\2\\5'))", String(["abcdefbcef","abc","bc","c","def","ef","f"]), String('xabcdefbcefg'.match(new RegExp('(a(b(c)))(d(e(f)))\\2\\5')))); // 'abcd'.match(new RegExp('a(.?)b\1c\1d\1')) new TestCase ( SECTION, "'abcd'.match(new RegExp('a(.?)b\\1c\\1d\\1'))", String(["abcd",""]), String('abcd'.match(new RegExp('a(.?)b\\1c\\1d\\1')))); // 'abcd'.match(/a(.?)b\1c\1d\1/) new TestCase ( SECTION, "'abcd'.match(/a(.?)b\\1c\\1d\\1/)", String(["abcd",""]), String('abcd'.match(/a(.?)b\1c\1d\1/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/plus.js0000644000175000017500000000712411545150464021171 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: plus.js Description: 'Tests regular expressions containing +' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: +'; writeHeaderToLog('Executing script: plus.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcdddddefg'.match(new RegExp('d+')) new TestCase ( SECTION, "'abcdddddefg'.match(new RegExp('d+'))", String(["ddddd"]), String('abcdddddefg'.match(new RegExp('d+')))); // 'abcdefg'.match(new RegExp('o+')) new TestCase ( SECTION, "'abcdefg'.match(new RegExp('o+'))", null, 'abcdefg'.match(new RegExp('o+'))); // 'abcdefg'.match(new RegExp('d+')) new TestCase ( SECTION, "'abcdefg'.match(new RegExp('d+'))", String(['d']), String('abcdefg'.match(new RegExp('d+')))); // 'abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)')) new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)'))", String(["bbbbbbb","bbbbb","b","b"]), String('abbbbbbbc'.match(new RegExp('(b+)(b+)(b+)')))); // 'abbbbbbbc'.match(new RegExp('(b+)(b*)')) new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('(b+)(b*)'))", String(["bbbbbbb","bbbbbbb",""]), String('abbbbbbbc'.match(new RegExp('(b+)(b*)')))); // 'abbbbbbbc'.match(new RegExp('b*b+')) new TestCase ( SECTION, "'abbbbbbbc'.match(new RegExp('b*b+'))", String(['bbbbbbb']), String('abbbbbbbc'.match(new RegExp('b*b+')))); // 'abbbbbbbc'.match(/(b+)(b*)/) new TestCase ( SECTION, "'abbbbbbbc'.match(/(b+)(b*)/)", String(["bbbbbbb","bbbbbbb",""]), String('abbbbbbbc'.match(/(b+)(b*)/))); // 'abbbbbbbc'.match(new RegExp('b*b+')) new TestCase ( SECTION, "'abbbbbbbc'.match(/b*b+/)", String(['bbbbbbb']), String('abbbbbbbc'.match(/b*b+/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/question_mark.js0000644000175000017500000001017711545150464023071 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: question_mark.js Description: 'Tests regular expressions containing ?' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: ?'; writeHeaderToLog('Executing script: question_mark.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcdef'.match(new RegExp('cd?e')) new TestCase ( SECTION, "'abcdef'.match(new RegExp('cd?e'))", String(["cde"]), String('abcdef'.match(new RegExp('cd?e')))); // 'abcdef'.match(new RegExp('cdx?e')) new TestCase ( SECTION, "'abcdef'.match(new RegExp('cdx?e'))", String(["cde"]), String('abcdef'.match(new RegExp('cdx?e')))); // 'pqrstuvw'.match(new RegExp('o?pqrst')) new TestCase ( SECTION, "'pqrstuvw'.match(new RegExp('o?pqrst'))", String(["pqrst"]), String('pqrstuvw'.match(new RegExp('o?pqrst')))); // 'abcd'.match(new RegExp('x?y?z?')) new TestCase ( SECTION, "'abcd'.match(new RegExp('x?y?z?'))", String([""]), String('abcd'.match(new RegExp('x?y?z?')))); // 'abcd'.match(new RegExp('x?ay?bz?c')) new TestCase ( SECTION, "'abcd'.match(new RegExp('x?ay?bz?c'))", String(["abc"]), String('abcd'.match(new RegExp('x?ay?bz?c')))); // 'abcd'.match(/x?ay?bz?c/) new TestCase ( SECTION, "'abcd'.match(/x?ay?bz?c/)", String(["abc"]), String('abcd'.match(/x?ay?bz?c/))); // 'abbbbc'.match(new RegExp('b?b?b?b')) new TestCase ( SECTION, "'abbbbc'.match(new RegExp('b?b?b?b'))", String(["bbbb"]), String('abbbbc'.match(new RegExp('b?b?b?b')))); // '123az789'.match(new RegExp('ab?c?d?x?y?z')) new TestCase ( SECTION, "'123az789'.match(new RegExp('ab?c?d?x?y?z'))", String(["az"]), String('123az789'.match(new RegExp('ab?c?d?x?y?z')))); // '123az789'.match(/ab?c?d?x?y?z/) new TestCase ( SECTION, "'123az789'.match(/ab?c?d?x?y?z/)", String(["az"]), String('123az789'.match(/ab?c?d?x?y?z/))); // '?????'.match(new RegExp('\\??\\??\\??\\??\\??')) new TestCase ( SECTION, "'?????'.match(new RegExp('\\??\\??\\??\\??\\??'))", String(["?????"]), String('?????'.match(new RegExp('\\??\\??\\??\\??\\??')))); // 'test'.match(new RegExp('.?.?.?.?.?.?.?')) new TestCase ( SECTION, "'test'.match(new RegExp('.?.?.?.?.?.?.?'))", String(["test"]), String('test'.match(new RegExp('.?.?.?.?.?.?.?')))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_dollar_number.js0000644000175000017500000001075411545150464024310 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_dollar_number.js Description: 'Tests RegExps $1, ..., $9 properties' Author: Nick Lerissa Date: March 12, 1998 */ var SECTION = 'As described in Netscape doc "What\'s new in JavaScript 1.2"'; var VERSION = 'no version'; var TITLE = 'RegExp: $1, ..., $9'; var BUGNUMBER="123802"; startTest(); writeHeaderToLog('Executing script: RegExp_dollar_number.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$1", 'abcdefghi', RegExp.$1); // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$2", 'bcdefgh', RegExp.$2); // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$3", 'cdefg', RegExp.$3); // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$4", 'def', RegExp.$4); // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$5", 'e', RegExp.$5); // 'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6 new TestCase ( SECTION, "'abcdefghi'.match(/(a(b(c(d(e)f)g)h)i)/); RegExp.$6", '', RegExp.$6); var a_to_z = 'abcdefghijklmnopqrstuvwxyz'; var regexp1 = /(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/ // 'abcdefghijklmnopqrstuvwxyz'.match(/(a)b(c)d(e)f(g)h(i)j(k)l(m)n(o)p(q)r(s)t(u)v(w)x(y)z/); RegExp.$1 a_to_z.match(regexp1); new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$1", 'a', RegExp.$1); new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$2", 'c', RegExp.$2); new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$3", 'e', RegExp.$3); new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$4", 'g', RegExp.$4); new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$5", 'i', RegExp.$5); new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$6", 'k', RegExp.$6); new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$7", 'm', RegExp.$7); new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$8", 'o', RegExp.$8); new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$9", 'q', RegExp.$9); /* new TestCase ( SECTION, "'" + a_to_z + "'.match((a)b(c)....(y)z); RegExp.$10", 's', RegExp.$10); */ test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_input.js0000644000175000017500000000775311545150464022627 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_input.js Description: 'Tests RegExps input property' Author: Nick Lerissa Date: March 13, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: input'; writeHeaderToLog('Executing script: RegExp_input.js'); writeHeaderToLog( SECTION + " "+ TITLE); RegExp.input = "abcd12357efg"; // RegExp.input = "abcd12357efg"; RegExp.input RegExp.input = "abcd12357efg"; new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; RegExp.input", "abcd12357efg", RegExp.input); // RegExp.input = "abcd12357efg"; /\d+/.exec('2345') RegExp.input = "abcd12357efg"; new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec('2345')", String(["2345"]), String(/\d+/.exec('2345'))); // RegExp.input = "abcd12357efg"; /\d+/.exec() RegExp.input = "abcd12357efg"; new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.exec()", String(["12357"]), String(/\d+/.exec())); // RegExp.input = "abcd12357efg"; /[h-z]+/.exec() RegExp.input = "abcd12357efg"; new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.exec()", null, /[h-z]+/.exec()); // RegExp.input = "abcd12357efg"; /\d+/.test('2345') RegExp.input = "abcd12357efg"; new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test('2345')", true, /\d+/.test('2345')); // RegExp.input = "abcd12357efg"; /\d+/.test() RegExp.input = "abcd12357efg"; new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /\\d+/.test()", true, /\d+/.test()); // RegExp.input = "abcd12357efg"; (new RegExp('d+')).test() RegExp.input = "abcd12357efg"; new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('d+')).test()", true, (new RegExp('d+')).test()); // RegExp.input = "abcd12357efg"; /[h-z]+/.test() RegExp.input = "abcd12357efg"; new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; /[h-z]+/.test()", false, /[h-z]+/.test()); // RegExp.input = "abcd12357efg"; (new RegExp('[h-z]+')).test() RegExp.input = "abcd12357efg"; new TestCase ( SECTION, "RegExp.input = 'abcd12357efg'; (new RegExp('[h-z]+')).test()", false, (new RegExp('[h-z]+')).test()); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_input_as_array.js0000644000175000017500000001004211545150464024471 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_input_as_array.js Description: 'Tests RegExps $_ property (same tests as RegExp_input.js but using $_)' Author: Nick Lerissa Date: March 13, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: input'; writeHeaderToLog('Executing script: RegExp_input.js'); writeHeaderToLog( SECTION + " "+ TITLE); RegExp['$_'] = "abcd12357efg"; // RegExp['$_'] = "abcd12357efg"; RegExp['$_'] RegExp['$_'] = "abcd12357efg"; new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; RegExp['$_']", "abcd12357efg", RegExp['$_']); // RegExp['$_'] = "abcd12357efg"; /\d+/.exec('2345') RegExp['$_'] = "abcd12357efg"; new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec('2345')", String(["2345"]), String(/\d+/.exec('2345'))); // RegExp['$_'] = "abcd12357efg"; /\d+/.exec() RegExp['$_'] = "abcd12357efg"; new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.exec()", String(["12357"]), String(/\d+/.exec())); // RegExp['$_'] = "abcd12357efg"; /[h-z]+/.exec() RegExp['$_'] = "abcd12357efg"; new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.exec()", null, /[h-z]+/.exec()); // RegExp['$_'] = "abcd12357efg"; /\d+/.test('2345') RegExp['$_'] = "abcd12357efg"; new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test('2345')", true, /\d+/.test('2345')); // RegExp['$_'] = "abcd12357efg"; /\d+/.test() RegExp['$_'] = "abcd12357efg"; new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /\\d+/.test()", true, /\d+/.test()); // RegExp['$_'] = "abcd12357efg"; /[h-z]+/.test() RegExp['$_'] = "abcd12357efg"; new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; /[h-z]+/.test()", false, /[h-z]+/.test()); // RegExp['$_'] = "abcd12357efg"; (new RegExp('\d+')).test() RegExp['$_'] = "abcd12357efg"; new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('\d+')).test()", true, (new RegExp('\d+')).test()); // RegExp['$_'] = "abcd12357efg"; (new RegExp('[h-z]+')).test() RegExp['$_'] = "abcd12357efg"; new TestCase ( SECTION, "RegExp['$_'] = 'abcd12357efg'; (new RegExp('[h-z]+')).test()", false, (new RegExp('[h-z]+')).test()); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_lastIndex.js0000644000175000017500000000573211545150464023416 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_lastIndex.js Description: 'Tests RegExps lastIndex property' Author: Nick Lerissa Date: March 17, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; var TITLE = 'RegExp: lastIndex'; var BUGNUMBER="123802"; startTest(); writeHeaderToLog('Executing script: RegExp_lastIndex.js'); writeHeaderToLog( SECTION + " "+ TITLE); // re=/x./g; re.lastIndex=4; re.exec('xyabcdxa'); re=/x./g; re.lastIndex=4; new TestCase ( SECTION, "re=/x./g; re.lastIndex=4; re.exec('xyabcdxa')", '["xa"]', String(re.exec('xyabcdxa'))); // re.lastIndex new TestCase ( SECTION, "re.lastIndex", 8, re.lastIndex); // re.exec('xyabcdef'); new TestCase ( SECTION, "re.exec('xyabcdef')", null, re.exec('xyabcdef')); // re.lastIndex new TestCase ( SECTION, "re.lastIndex", 0, re.lastIndex); // re.exec('xyabcdef'); new TestCase ( SECTION, "re.exec('xyabcdef')", '["xy"]', String(re.exec('xyabcdef'))); // re.lastIndex=30; re.exec('123xaxbxc456'); re.lastIndex=30; new TestCase ( SECTION, "re.lastIndex=30; re.exec('123xaxbxc456')", null, re.exec('123xaxbxc456')); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_lastMatch.js0000644000175000017500000000644211545150464023402 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_lastMatch.js Description: 'Tests RegExps lastMatch property' Author: Nick Lerissa Date: March 12, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: lastMatch'; writeHeaderToLog('Executing script: RegExp_lastMatch.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'foo'.match(/foo/); RegExp.lastMatch 'foo'.match(/foo/); new TestCase ( SECTION, "'foo'.match(/foo/); RegExp.lastMatch", 'foo', RegExp.lastMatch); // 'foo'.match(new RegExp('foo')); RegExp.lastMatch 'foo'.match(new RegExp('foo')); new TestCase ( SECTION, "'foo'.match(new RegExp('foo')); RegExp.lastMatch", 'foo', RegExp.lastMatch); // 'xxx'.match(/bar/); RegExp.lastMatch 'xxx'.match(/bar/); new TestCase ( SECTION, "'xxx'.match(/bar/); RegExp.lastMatch", 'foo', RegExp.lastMatch); // 'xxx'.match(/$/); RegExp.lastMatch 'xxx'.match(/$/); new TestCase ( SECTION, "'xxx'.match(/$/); RegExp.lastMatch", '', RegExp.lastMatch); // 'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch 'abcdefg'.match(/^..(cd)[a-z]+/); new TestCase ( SECTION, "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp.lastMatch", 'abcdefg', RegExp.lastMatch); // 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); RegExp.lastMatch 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); new TestCase ( SECTION, "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp.lastMatch", 'abcdefgabcdefg', RegExp.lastMatch); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_lastMatch_as_array.js0000644000175000017500000000641711545150464025265 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_lastMatch_as_array.js Description: 'Tests RegExps $& property (same tests as RegExp_lastMatch.js but using $&)' Author: Nick Lerissa Date: March 13, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: $&'; writeHeaderToLog('Executing script: RegExp_lastMatch_as_array.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'foo'.match(/foo/); RegExp['$&'] 'foo'.match(/foo/); new TestCase ( SECTION, "'foo'.match(/foo/); RegExp['$&']", 'foo', RegExp['$&']); // 'foo'.match(new RegExp('foo')); RegExp['$&'] 'foo'.match(new RegExp('foo')); new TestCase ( SECTION, "'foo'.match(new RegExp('foo')); RegExp['$&']", 'foo', RegExp['$&']); // 'xxx'.match(/bar/); RegExp['$&'] 'xxx'.match(/bar/); new TestCase ( SECTION, "'xxx'.match(/bar/); RegExp['$&']", 'foo', RegExp['$&']); // 'xxx'.match(/$/); RegExp['$&'] 'xxx'.match(/$/); new TestCase ( SECTION, "'xxx'.match(/$/); RegExp['$&']", '', RegExp['$&']); // 'abcdefg'.match(/^..(cd)[a-z]+/); RegExp['$&'] 'abcdefg'.match(/^..(cd)[a-z]+/); new TestCase ( SECTION, "'abcdefg'.match(/^..(cd)[a-z]+/); RegExp['$&']", 'abcdefg', RegExp['$&']); // 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); RegExp['$&'] 'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\1/); new TestCase ( SECTION, "'abcdefgabcdefg'.match(/(a(b(c(d)e)f)g)\\1/); RegExp['$&']", 'abcdefgabcdefg', RegExp['$&']); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_lastParen.js0000644000175000017500000000754111545150464023414 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_lastParen.js Description: 'Tests RegExps lastParen property' Author: Nick Lerissa Date: March 12, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: lastParen'; writeHeaderToLog('Executing script: RegExp_lastParen.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcd'.match(/(abc)d/); RegExp.lastParen 'abcd'.match(/(abc)d/); new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp.lastParen", 'abc', RegExp.lastParen); // 'abcd'.match(new RegExp('(abc)d')); RegExp.lastParen 'abcd'.match(new RegExp('(abc)d')); new TestCase ( SECTION, "'abcd'.match(new RegExp('(abc)d')); RegExp.lastParen", 'abc', RegExp.lastParen); // 'abcd'.match(/(bcd)e/); RegExp.lastParen 'abcd'.match(/(bcd)e/); new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp.lastParen", 'abc', RegExp.lastParen); // 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp.lastParen 'abcdefg'.match(/(a(b(c(d)e)f)g)/); new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp.lastParen", 'd', RegExp.lastParen); // 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp.lastParen 'abcdefg'.match(/(a(b)c)(d(e)f)/); new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp.lastParen", 'e', RegExp.lastParen); // 'abcdefg'.match(/(^)abc/); RegExp.lastParen 'abcdefg'.match(/(^)abc/); new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp.lastParen", '', RegExp.lastParen); // 'abcdefg'.match(/(^a)bc/); RegExp.lastParen 'abcdefg'.match(/(^a)bc/); new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp.lastParen", 'a', RegExp.lastParen); // 'abcdefg'.match(new RegExp('(^a)bc')); RegExp.lastParen 'abcdefg'.match(new RegExp('(^a)bc')); new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp.lastParen", 'a', RegExp.lastParen); // 'abcdefg'.match(/bc/); RegExp.lastParen 'abcdefg'.match(/bc/); new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp.lastParen", '', RegExp.lastParen); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_lastParen_as_array.js0000644000175000017500000000751411545150464025275 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_lastParen_as_array.js Description: 'Tests RegExps $+ property (same tests as RegExp_lastParen.js but using $+)' Author: Nick Lerissa Date: March 13, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: $+'; writeHeaderToLog('Executing script: RegExp_lastParen_as_array.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcd'.match(/(abc)d/); RegExp['$+'] 'abcd'.match(/(abc)d/); new TestCase ( SECTION, "'abcd'.match(/(abc)d/); RegExp['$+']", 'abc', RegExp['$+']); // 'abcd'.match(/(bcd)e/); RegExp['$+'] 'abcd'.match(/(bcd)e/); new TestCase ( SECTION, "'abcd'.match(/(bcd)e/); RegExp['$+']", 'abc', RegExp['$+']); // 'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+'] 'abcdefg'.match(/(a(b(c(d)e)f)g)/); new TestCase ( SECTION, "'abcdefg'.match(/(a(b(c(d)e)f)g)/); RegExp['$+']", 'd', RegExp['$+']); // 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+'] 'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(a(b(c(d)e)f)g)')); RegExp['$+']", 'd', RegExp['$+']); // 'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+'] 'abcdefg'.match(/(a(b)c)(d(e)f)/); new TestCase ( SECTION, "'abcdefg'.match(/(a(b)c)(d(e)f)/); RegExp['$+']", 'e', RegExp['$+']); // 'abcdefg'.match(/(^)abc/); RegExp['$+'] 'abcdefg'.match(/(^)abc/); new TestCase ( SECTION, "'abcdefg'.match(/(^)abc/); RegExp['$+']", '', RegExp['$+']); // 'abcdefg'.match(/(^a)bc/); RegExp['$+'] 'abcdefg'.match(/(^a)bc/); new TestCase ( SECTION, "'abcdefg'.match(/(^a)bc/); RegExp['$+']", 'a', RegExp['$+']); // 'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+'] 'abcdefg'.match(new RegExp('(^a)bc')); new TestCase ( SECTION, "'abcdefg'.match(new RegExp('(^a)bc')); RegExp['$+']", 'a', RegExp['$+']); // 'abcdefg'.match(/bc/); RegExp['$+'] 'abcdefg'.match(/bc/); new TestCase ( SECTION, "'abcdefg'.match(/bc/); RegExp['$+']", '', RegExp['$+']); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_leftContext.js0000644000175000017500000000671711545150464023766 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_leftContext.js Description: 'Tests RegExps leftContext property' Author: Nick Lerissa Date: March 12, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: leftContext'; writeHeaderToLog('Executing script: RegExp_leftContext.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abc123xyz'.match(/123/); RegExp.leftContext 'abc123xyz'.match(/123/); new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp.leftContext", 'abc', RegExp.leftContext); // 'abc123xyz'.match(/456/); RegExp.leftContext 'abc123xyz'.match(/456/); new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp.leftContext", 'abc', RegExp.leftContext); // 'abc123xyz'.match(/abc123xyz/); RegExp.leftContext 'abc123xyz'.match(/abc123xyz/); new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp.leftContext", '', RegExp.leftContext); // 'xxxx'.match(/$/); RegExp.leftContext 'xxxx'.match(/$/); new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp.leftContext", 'xxxx', RegExp.leftContext); // 'test'.match(/^/); RegExp.leftContext 'test'.match(/^/); new TestCase ( SECTION, "'test'.match(/^/); RegExp.leftContext", '', RegExp.leftContext); // 'xxxx'.match(new RegExp('$')); RegExp.leftContext 'xxxx'.match(new RegExp('$')); new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp.leftContext", 'xxxx', RegExp.leftContext); // 'test'.match(new RegExp('^')); RegExp.leftContext 'test'.match(new RegExp('^')); new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp.leftContext", '', RegExp.leftContext); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_leftContext_as_array.js0000644000175000017500000000661511545150464025644 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_leftContext_as_array.js Description: 'Tests RegExps leftContext property (same tests as RegExp_leftContext.js but using $`)' Author: Nick Lerissa Date: March 12, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: $`'; writeHeaderToLog('Executing script: RegExp_leftContext_as_array.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abc123xyz'.match(/123/); RegExp['$`'] 'abc123xyz'.match(/123/); new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp['$`']", 'abc', RegExp['$`']); // 'abc123xyz'.match(/456/); RegExp['$`'] 'abc123xyz'.match(/456/); new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp['$`']", 'abc', RegExp['$`']); // 'abc123xyz'.match(/abc123xyz/); RegExp['$`'] 'abc123xyz'.match(/abc123xyz/); new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp['$`']", '', RegExp['$`']); // 'xxxx'.match(/$/); RegExp['$`'] 'xxxx'.match(/$/); new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp['$`']", 'xxxx', RegExp['$`']); // 'test'.match(/^/); RegExp['$`'] 'test'.match(/^/); new TestCase ( SECTION, "'test'.match(/^/); RegExp['$`']", '', RegExp['$`']); // 'xxxx'.match(new RegExp('$')); RegExp['$`'] 'xxxx'.match(new RegExp('$')); new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp['$`']", 'xxxx', RegExp['$`']); // 'test'.match(new RegExp('^')); RegExp['$`'] 'test'.match(new RegExp('^')); new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp['$`']", '', RegExp['$`']); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_multiline.js0000644000175000017500000001336411545150464023465 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_multiline.js Description: 'Tests RegExps multiline property' Author: Nick Lerissa Date: March 12, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: multiline'; writeHeaderToLog('Executing script: RegExp_multiline.js'); writeHeaderToLog( SECTION + " "+ TITLE); // First we do a series of tests with RegExp.multiline set to false (default value) // Following this we do the same tests with RegExp.multiline set true(**). // RegExp.multiline new TestCase ( SECTION, "RegExp.multiline", false, RegExp.multiline); // (multiline == false) '123\n456'.match(/^4../) new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/^4../)", null, '123\n456'.match(/^4../)); // (multiline == false) 'a11\na22\na23\na24'.match(/^a../g) new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/^a../g)", String(['a11']), String('a11\na22\na23\na24'.match(/^a../g))); // (multiline == false) 'a11\na22'.match(/^.+^./) new TestCase ( SECTION, "(multiline == false) 'a11\na22'.match(/^.+^./)", null, 'a11\na22'.match(/^.+^./)); // (multiline == false) '123\n456'.match(/.3$/) new TestCase ( SECTION, "(multiline == false) '123\\n456'.match(/.3$/)", null, '123\n456'.match(/.3$/)); // (multiline == false) 'a11\na22\na23\na24'.match(/a..$/g) new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(/a..$/g)", String(['a24']), String('a11\na22\na23\na24'.match(/a..$/g))); // (multiline == false) 'abc\ndef'.match(/c$...$/) new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(/c$...$/)", null, 'abc\ndef'.match(/c$...$/)); // (multiline == false) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) new TestCase ( SECTION, "(multiline == false) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))", String(['a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g')))); // (multiline == false) 'abc\ndef'.match(new RegExp('c$...$')) new TestCase ( SECTION, "(multiline == false) 'abc\ndef'.match(new RegExp('c$...$'))", null, 'abc\ndef'.match(new RegExp('c$...$'))); // **Now we do the tests with RegExp.multiline set to true // RegExp.multiline = true; RegExp.multiline RegExp.multiline = true; new TestCase ( SECTION, "RegExp.multiline = true; RegExp.multiline", true, RegExp.multiline); // (multiline == true) '123\n456'.match(/^4../) new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/^4../)", String(['456']), String('123\n456'.match(/^4../))); // (multiline == true) 'a11\na22\na23\na24'.match(/^a../g) new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/^a../g)", String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/^a../g))); // (multiline == true) 'a11\na22'.match(/^.+^./) //new TestCase ( SECTION, "(multiline == true) 'a11\na22'.match(/^.+^./)", // String(['a11\na']), String('a11\na22'.match(/^.+^./))); // (multiline == true) '123\n456'.match(/.3$/) new TestCase ( SECTION, "(multiline == true) '123\\n456'.match(/.3$/)", String(['23']), String('123\n456'.match(/.3$/))); // (multiline == true) 'a11\na22\na23\na24'.match(/a..$/g) new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(/a..$/g)", String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/a..$/g))); // (multiline == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) new TestCase ( SECTION, "(multiline == true) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))", String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g')))); // (multiline == true) 'abc\ndef'.match(/c$....$/) //new TestCase ( SECTION, "(multiline == true) 'abc\ndef'.match(/c$.+$/)", // 'c\ndef', String('abc\ndef'.match(/c$.+$/))); RegExp.multiline = false; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_multiline_as_array.js0000644000175000017500000001323511545150464025343 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_multiline_as_array.js Description: 'Tests RegExps $* property (same tests as RegExp_multiline.js but using $*)' Author: Nick Lerissa Date: March 13, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: $*'; writeHeaderToLog('Executing script: RegExp_multiline_as_array.js'); writeHeaderToLog( SECTION + " "+ TITLE); // First we do a series of tests with RegExp['$*'] set to false (default value) // Following this we do the same tests with RegExp['$*'] set true(**). // RegExp['$*'] new TestCase ( SECTION, "RegExp['$*']", false, RegExp['$*']); // (['$*'] == false) '123\n456'.match(/^4../) new TestCase ( SECTION, "(['$*'] == false) '123\\n456'.match(/^4../)", null, '123\n456'.match(/^4../)); // (['$*'] == false) 'a11\na22\na23\na24'.match(/^a../g) new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(/^a../g)", String(['a11']), String('a11\na22\na23\na24'.match(/^a../g))); // (['$*'] == false) 'a11\na22'.match(/^.+^./) new TestCase ( SECTION, "(['$*'] == false) 'a11\na22'.match(/^.+^./)", null, 'a11\na22'.match(/^.+^./)); // (['$*'] == false) '123\n456'.match(/.3$/) new TestCase ( SECTION, "(['$*'] == false) '123\\n456'.match(/.3$/)", null, '123\n456'.match(/.3$/)); // (['$*'] == false) 'a11\na22\na23\na24'.match(/a..$/g) new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(/a..$/g)", String(['a24']), String('a11\na22\na23\na24'.match(/a..$/g))); // (['$*'] == false) 'abc\ndef'.match(/c$...$/) new TestCase ( SECTION, "(['$*'] == false) 'abc\ndef'.match(/c$...$/)", null, 'abc\ndef'.match(/c$...$/)); // (['$*'] == false) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) new TestCase ( SECTION, "(['$*'] == false) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))", String(['a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g')))); // (['$*'] == false) 'abc\ndef'.match(new RegExp('c$...$')) new TestCase ( SECTION, "(['$*'] == false) 'abc\ndef'.match(new RegExp('c$...$'))", null, 'abc\ndef'.match(new RegExp('c$...$'))); // **Now we do the tests with RegExp['$*'] set to true // RegExp['$*'] = true; RegExp['$*'] RegExp['$*'] = true; new TestCase ( SECTION, "RegExp['$*'] = true; RegExp['$*']", true, RegExp['$*']); // (['$*'] == true) '123\n456'.match(/^4../) new TestCase ( SECTION, "(['$*'] == true) '123\\n456'.match(/^4../)", String(['456']), String('123\n456'.match(/^4../))); // (['$*'] == true) 'a11\na22\na23\na24'.match(/^a../g) new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(/^a../g)", String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/^a../g))); // (['$*'] == true) 'a11\na22'.match(/^.+^./) //new TestCase ( SECTION, "(['$*'] == true) 'a11\na22'.match(/^.+^./)", // String(['a11\na']), String('a11\na22'.match(/^.+^./))); // (['$*'] == true) '123\n456'.match(/.3$/) new TestCase ( SECTION, "(['$*'] == true) '123\\n456'.match(/.3$/)", String(['23']), String('123\n456'.match(/.3$/))); // (['$*'] == true) 'a11\na22\na23\na24'.match(/a..$/g) new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(/a..$/g)", String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(/a..$/g))); // (['$*'] == true) 'a11\na22\na23\na24'.match(new RegExp('a..$','g')) new TestCase ( SECTION, "(['$*'] == true) 'a11\\na22\\na23\\na24'.match(new RegExp('a..$','g'))", String(['a11','a22','a23','a24']), String('a11\na22\na23\na24'.match(new RegExp('a..$','g')))); // (['$*'] == true) 'abc\ndef'.match(/c$....$/) //new TestCase ( SECTION, "(['$*'] == true) 'abc\ndef'.match(/c$.+$/)", // 'c\ndef', String('abc\ndef'.match(/c$.+$/))); RegExp['$*'] = false; test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_object.js0000644000175000017500000000722211545150464022725 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_object.js Description: 'Tests regular expressions creating RexExp Objects' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: object'; writeHeaderToLog('Executing script: RegExp_object.js'); writeHeaderToLog( SECTION + " "+ TITLE); var SSN_pattern = new RegExp("\\d{3}-\\d{2}-\\d{4}"); // testing SSN pattern new TestCase ( SECTION, "'Test SSN is 123-34-4567'.match(SSN_pattern))", String(["123-34-4567"]), String('Test SSN is 123-34-4567'.match(SSN_pattern))); // testing SSN pattern new TestCase ( SECTION, "'Test SSN is 123-34-4567'.match(SSN_pattern))", String(["123-34-4567"]), String('Test SSN is 123-34-4567'.match(SSN_pattern))); var PHONE_pattern = new RegExp("\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})"); // testing PHONE pattern new TestCase ( SECTION, "'Our phone number is (408)345-2345.'.match(PHONE_pattern))", String(["(408)345-2345","408","345","2345"]), String('Our phone number is (408)345-2345.'.match(PHONE_pattern))); // testing PHONE pattern new TestCase ( SECTION, "'The phone number is 408-345-2345!'.match(PHONE_pattern))", String(["408-345-2345","408","345","2345"]), String('The phone number is 408-345-2345!'.match(PHONE_pattern))); // testing PHONE pattern new TestCase ( SECTION, "String(PHONE_pattern.toString())", "/\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})/", String(PHONE_pattern.toString())); // testing conversion to String new TestCase ( SECTION, "PHONE_pattern + ' is the string'", "/\\(?(\\d{3})\\)?-?(\\d{3})-(\\d{4})/ is the string",PHONE_pattern + ' is the string'); // testing conversion to int new TestCase ( SECTION, "SSN_pattern - 8", NaN,SSN_pattern - 8); var testPattern = new RegExp("(\\d+)45(\\d+)90"); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_rightContext.js0000644000175000017500000000675011545150464024146 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_rightContext.js Description: 'Tests RegExps rightContext property' Author: Nick Lerissa Date: March 12, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: rightContext'; writeHeaderToLog('Executing script: RegExp_rightContext.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abc123xyz'.match(/123/); RegExp.rightContext 'abc123xyz'.match(/123/); new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp.rightContext", 'xyz', RegExp.rightContext); // 'abc123xyz'.match(/456/); RegExp.rightContext 'abc123xyz'.match(/456/); new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp.rightContext", 'xyz', RegExp.rightContext); // 'abc123xyz'.match(/abc123xyz/); RegExp.rightContext 'abc123xyz'.match(/abc123xyz/); new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp.rightContext", '', RegExp.rightContext); // 'xxxx'.match(/$/); RegExp.rightContext 'xxxx'.match(/$/); new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp.rightContext", '', RegExp.rightContext); // 'test'.match(/^/); RegExp.rightContext 'test'.match(/^/); new TestCase ( SECTION, "'test'.match(/^/); RegExp.rightContext", 'test', RegExp.rightContext); // 'xxxx'.match(new RegExp('$')); RegExp.rightContext 'xxxx'.match(new RegExp('$')); new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp.rightContext", '', RegExp.rightContext); // 'test'.match(new RegExp('^')); RegExp.rightContext 'test'.match(new RegExp('^')); new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp.rightContext", 'test', RegExp.rightContext); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/RegExp_rightContext_as_array.js0000644000175000017500000000662511545150464026030 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: RegExp_rightContext_as_array.js Description: 'Tests RegExps $\' property (same tests as RegExp_rightContext.js but using $\)' Author: Nick Lerissa Date: March 12, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: $\''; writeHeaderToLog('Executing script: RegExp_rightContext.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abc123xyz'.match(/123/); RegExp['$\''] 'abc123xyz'.match(/123/); new TestCase ( SECTION, "'abc123xyz'.match(/123/); RegExp['$\'']", 'xyz', RegExp['$\'']); // 'abc123xyz'.match(/456/); RegExp['$\''] 'abc123xyz'.match(/456/); new TestCase ( SECTION, "'abc123xyz'.match(/456/); RegExp['$\'']", 'xyz', RegExp['$\'']); // 'abc123xyz'.match(/abc123xyz/); RegExp['$\''] 'abc123xyz'.match(/abc123xyz/); new TestCase ( SECTION, "'abc123xyz'.match(/abc123xyz/); RegExp['$\'']", '', RegExp['$\'']); // 'xxxx'.match(/$/); RegExp['$\''] 'xxxx'.match(/$/); new TestCase ( SECTION, "'xxxx'.match(/$/); RegExp['$\'']", '', RegExp['$\'']); // 'test'.match(/^/); RegExp['$\''] 'test'.match(/^/); new TestCase ( SECTION, "'test'.match(/^/); RegExp['$\'']", 'test', RegExp['$\'']); // 'xxxx'.match(new RegExp('$')); RegExp['$\''] 'xxxx'.match(new RegExp('$')); new TestCase ( SECTION, "'xxxx'.match(new RegExp('$')); RegExp['$\'']", '', RegExp['$\'']); // 'test'.match(new RegExp('^')); RegExp['$\''] 'test'.match(new RegExp('^')); new TestCase ( SECTION, "'test'.match(new RegExp('^')); RegExp['$\'']", 'test', RegExp['$\'']); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/regress-6359.js0000644000175000017500000000647011545150464022267 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: regress-6359.js * Reference: ** replace with bugzilla URL or document reference ** * Description: ** replace with description of test ** * Author: ** replace with your e-mail address ** */ var SECTION = "js1_2"; // provide a document reference (ie, ECMA section) var VERSION = "ECMA_2"; // Version of JavaScript or ECMA var TITLE = "Regression test for bugzilla # 6359"; // Provide ECMA section title or a description var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=6359"; // Provide URL to bugsplat or bugzilla report startTest(); // leave this alone /* * Calls to AddTestCase here. AddTestCase is a function that is defined * in shell.js and takes three arguments: * - a string representation of what is being tested * - the expected result * - the actual result * * For example, a test might look like this: * * var zip = /[\d]{5}$/; * * AddTestCase( * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test * "02134", // expected result * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result * */ AddTestCase( '/(a*)b\1+/("baaac").length', 2, /(a*)b\1+/("baaac").length ); AddTestCase( '/(a*)b\1+/("baaac")[0]', "b", /(a*)b\1+/("baaac")[0]); AddTestCase( '/(a*)b\1+/("baaac")[1]', "", /(a*)b\1+/("baaac")[1]); test(); // leave this alone. this executes the test cases and // displays results. mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/regress-9141.js0000644000175000017500000000733511545150464022260 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: regress-9141.js * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=9141"; * Description: * From waldemar@netscape.com: * * The following page crashes the system: * * * * * * * * */ var SECTION = "js1_2"; // provide a document reference (ie, ECMA section) var VERSION = "ECMA_2"; // Version of JavaScript or ECMA var TITLE = "Regression test for bugzilla # 9141"; // Provide ECMA section title or a description var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=9141"; // Provide URL to bugsplat or bugzilla report startTest(); // leave this alone /* * Calls to AddTestCase here. AddTestCase is a function that is defined * in shell.js and takes three arguments: * - a string representation of what is being tested * - the expected result * - the actual result * * For example, a test might look like this: * * var zip = /[\d]{5}$/; * * AddTestCase( * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test * "02134", // expected result * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result * */ var s = "x"; for (var i = 0; i != 13; i++) s += s; var a = /(?:xx|x)*/(s); var b = /(xx|x)*/(s); AddTestCase( "var s = 'x'; for (var i = 0; i != 13; i++) s += s; " + "a = /(?:xx|x)*/(s); a.length", 1, a.length ); AddTestCase( "var b = /(xx|x)*/(s); b.length", 2, b.length ); test(); // leave this alone. this executes the test cases and // displays results. mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/shell.js0000644000175000017500000000000011545150464021277 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/simple_form.js0000644000175000017500000000634711545150464022530 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: simple_form.js Description: 'Tests regular expressions using simple form: re(...)' Author: Nick Lerissa Date: March 19, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: simple form'; writeHeaderToLog('Executing script: simple_form.js'); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase ( SECTION, "/[0-9]{3}/('23 2 34 678 9 09')", String(["678"]), String(/[0-9]{3}/('23 2 34 678 9 09'))); new TestCase ( SECTION, "/3.{4}8/('23 2 34 678 9 09')", String(["34 678"]), String(/3.{4}8/('23 2 34 678 9 09'))); new TestCase ( SECTION, "(/3.{4}8/('23 2 34 678 9 09').length", 1, (/3.{4}8/('23 2 34 678 9 09')).length); var re = /[0-9]{3}/; new TestCase ( SECTION, "re('23 2 34 678 9 09')", String(["678"]), String(re('23 2 34 678 9 09'))); re = /3.{4}8/; new TestCase ( SECTION, "re('23 2 34 678 9 09')", String(["34 678"]), String(re('23 2 34 678 9 09'))); new TestCase ( SECTION, "/3.{4}8/('23 2 34 678 9 09')", String(["34 678"]), String(/3.{4}8/('23 2 34 678 9 09'))); re =/3.{4}8/; new TestCase ( SECTION, "(re('23 2 34 678 9 09').length", 1, (re('23 2 34 678 9 09')).length); new TestCase ( SECTION, "(/3.{4}8/('23 2 34 678 9 09').length", 1, (/3.{4}8/('23 2 34 678 9 09')).length); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/source.js0000644000175000017500000000622311545150464021505 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: source.js Description: 'Tests RegExp attribute source' Author: Nick Lerissa Date: March 13, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: source'; writeHeaderToLog('Executing script: source.js'); writeHeaderToLog( SECTION + " "+ TITLE); // /xyz/g.source new TestCase ( SECTION, "/xyz/g.source", "xyz", /xyz/g.source); // /xyz/.source new TestCase ( SECTION, "/xyz/.source", "xyz", /xyz/.source); // /abc\\def/.source new TestCase ( SECTION, "/abc\\\\def/.source", "abc\\\\def", /abc\\def/.source); // /abc[\b]def/.source new TestCase ( SECTION, "/abc[\\b]def/.source", "abc[\\b]def", /abc[\b]def/.source); // (new RegExp('xyz')).source new TestCase ( SECTION, "(new RegExp('xyz')).source", "xyz", (new RegExp('xyz')).source); // (new RegExp('xyz','g')).source new TestCase ( SECTION, "(new RegExp('xyz','g')).source", "xyz", (new RegExp('xyz','g')).source); // (new RegExp('abc\\\\def')).source new TestCase ( SECTION, "(new RegExp('abc\\\\\\\\def')).source", "abc\\\\def", (new RegExp('abc\\\\def')).source); // (new RegExp('abc[\\b]def')).source new TestCase ( SECTION, "(new RegExp('abc[\\\\b]def')).source", "abc[\\b]def", (new RegExp('abc[\\b]def')).source); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/special_characters.js0000644000175000017500000001563611545150464024034 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: special_characters.js Description: 'Tests regular expressions containing special characters' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: special_charaters'; writeHeaderToLog('Executing script: special_characters.js'); writeHeaderToLog( SECTION + " "+ TITLE); // testing backslash '\' new TestCase ( SECTION, "'^abcdefghi'.match(/\^abc/)", String(["^abc"]), String('^abcdefghi'.match(/\^abc/))); // testing beginning of line '^' new TestCase ( SECTION, "'abcdefghi'.match(/^abc/)", String(["abc"]), String('abcdefghi'.match(/^abc/))); // testing end of line '$' new TestCase ( SECTION, "'abcdefghi'.match(/fghi$/)", String(["ghi"]), String('abcdefghi'.match(/ghi$/))); // testing repeat '*' new TestCase ( SECTION, "'eeeefghi'.match(/e*/)", String(["eeee"]), String('eeeefghi'.match(/e*/))); // testing repeat 1 or more times '+' new TestCase ( SECTION, "'abcdeeeefghi'.match(/e+/)", String(["eeee"]), String('abcdeeeefghi'.match(/e+/))); // testing repeat 0 or 1 time '?' new TestCase ( SECTION, "'abcdefghi'.match(/abc?de/)", String(["abcde"]), String('abcdefghi'.match(/abc?de/))); // testing any character '.' new TestCase ( SECTION, "'abcdefghi'.match(/c.e/)", String(["cde"]), String('abcdefghi'.match(/c.e/))); // testing remembering () new TestCase ( SECTION, "'abcewirjskjdabciewjsdf'.match(/(abc).+\\1'/)", String(["abcewirjskjdabc","abc"]), String('abcewirjskjdabciewjsdf'.match(/(abc).+\1/))); // testing or match '|' new TestCase ( SECTION, "'abcdefghi'.match(/xyz|def/)", String(["def"]), String('abcdefghi'.match(/xyz|def/))); // testing repeat n {n} new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{3}/)", String(["eee"]), String('abcdeeeefghi'.match(/e{3}/))); // testing min repeat n {n,} new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{3,}/)", String(["eeee"]), String('abcdeeeefghi'.match(/e{3,}/))); // testing min/max repeat {min, max} new TestCase ( SECTION, "'abcdeeeefghi'.match(/e{2,8}/)", String(["eeee"]), String('abcdeeeefghi'.match(/e{2,8}/))); // testing any in set [abc...] new TestCase ( SECTION, "'abcdefghi'.match(/cd[xey]fgh/)", String(["cdefgh"]), String('abcdefghi'.match(/cd[xey]fgh/))); // testing any in set [a-z] new TestCase ( SECTION, "'netscape inc'.match(/t[r-v]ca/)", String(["tsca"]), String('netscape inc'.match(/t[r-v]ca/))); // testing any not in set [^abc...] new TestCase ( SECTION, "'abcdefghi'.match(/cd[^xy]fgh/)", String(["cdefgh"]), String('abcdefghi'.match(/cd[^xy]fgh/))); // testing any not in set [^a-z] new TestCase ( SECTION, "'netscape inc'.match(/t[^a-c]ca/)", String(["tsca"]), String('netscape inc'.match(/t[^a-c]ca/))); // testing backspace [\b] new TestCase ( SECTION, "'this is b\ba test'.match(/is b[\b]a test/)", String(["is b\ba test"]), String('this is b\ba test'.match(/is b[\b]a test/))); // testing word boundary \b new TestCase ( SECTION, "'today is now - day is not now'.match(/\bday.*now/)", String(["day is not now"]), String('today is now - day is not now'.match(/\bday.*now/))); // control characters??? // testing any digit \d new TestCase ( SECTION, "'a dog - 1 dog'.match(/\d dog/)", String(["1 dog"]), String('a dog - 1 dog'.match(/\d dog/))); // testing any non digit \d new TestCase ( SECTION, "'a dog - 1 dog'.match(/\D dog/)", String(["a dog"]), String('a dog - 1 dog'.match(/\D dog/))); // testing form feed '\f' new TestCase ( SECTION, "'a b a\fb'.match(/a\fb/)", String(["a\fb"]), String('a b a\fb'.match(/a\fb/))); // testing line feed '\n' new TestCase ( SECTION, "'a b a\nb'.match(/a\nb/)", String(["a\nb"]), String('a b a\nb'.match(/a\nb/))); // testing carriage return '\r' new TestCase ( SECTION, "'a b a\rb'.match(/a\rb/)", String(["a\rb"]), String('a b a\rb'.match(/a\rb/))); // testing whitespace '\s' new TestCase ( SECTION, "'xa\f\n\r\t\vbz'.match(/a\s+b/)", String(["a\f\n\r\t\vb"]), String('xa\f\n\r\t\vbz'.match(/a\s+b/))); // testing non whitespace '\S' new TestCase ( SECTION, "'a\tb a b a-b'.match(/a\Sb/)", String(["a-b"]), String('a\tb a b a-b'.match(/a\Sb/))); // testing tab '\t' new TestCase ( SECTION, "'a\t\tb a b'.match(/a\t{2}/)", String(["a\t\t"]), String('a\t\tb a b'.match(/a\t{2}/))); // testing vertical tab '\v' new TestCase ( SECTION, "'a\v\vb a b'.match(/a\v{2}/)", String(["a\v\v"]), String('a\v\vb a b'.match(/a\v{2}/))); // testing alphnumeric characters '\w' new TestCase ( SECTION, "'%AZaz09_$'.match(/\w+/)", String(["AZaz09_"]), String('%AZaz09_$'.match(/\w+/))); // testing non alphnumeric characters '\W' new TestCase ( SECTION, "'azx$%#@*4534'.match(/\W+/)", String(["$%#@*"]), String('azx$%#@*4534'.match(/\W+/))); // testing back references '\' new TestCase ( SECTION, "'test'.match(/(t)es\\1/)", String(["test","t"]), String('test'.match(/(t)es\1/))); // testing hex excaping with '\' new TestCase ( SECTION, "'abcdef'.match(/\x63\x64/)", String(["cd"]), String('abcdef'.match(/\x63\x64/))); // testing oct excaping with '\' new TestCase ( SECTION, "'abcdef'.match(/\\143\\144/)", String(["cd"]), String('abcdef'.match(/\143\144/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/string_replace.js0000644000175000017500000001230411545150464023203 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: string_replace.js Description: 'Tests the replace method on Strings using regular expressions' Author: Nick Lerissa Date: March 11, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'String: replace'; writeHeaderToLog('Executing script: string_replace.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'adddb'.replace(/ddd/,"XX") new TestCase ( SECTION, "'adddb'.replace(/ddd/,'XX')", "aXXb", 'adddb'.replace(/ddd/,'XX')); // 'adddb'.replace(/eee/,"XX") new TestCase ( SECTION, "'adddb'.replace(/eee/,'XX')", 'adddb', 'adddb'.replace(/eee/,'XX')); // '34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**') new TestCase ( SECTION, "'34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**')", "34 56 ** 12", '34 56 78b 12'.replace(new RegExp('[0-9]+b'),'**')); // '34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX') new TestCase ( SECTION, "'34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX')", "34 56 78b 12", '34 56 78b 12'.replace(new RegExp('[0-9]+c'),'XX')); // 'original'.replace(new RegExp(),'XX') new TestCase ( SECTION, "'original'.replace(new RegExp(),'XX')", "XXoriginal", 'original'.replace(new RegExp(),'XX')); // 'qwe ert x\t\n 345654AB'.replace(new RegExp('x\s*\d+(..)$'),'****') new TestCase ( SECTION, "'qwe ert x\t\n 345654AB'.replace(new RegExp('x\\s*\\d+(..)$'),'****')", "qwe ert ****", 'qwe ert x\t\n 345654AB'.replace(new RegExp('x\\s*\\d+(..)$'),'****')); /* * Test replacement over ropes. The char to rope node ratio must be sufficiently * high for the special-case code to be tested. */ var stringA = "abcdef"; var stringB = "ghijk"; var stringC = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz"; stringC += stringC; stringC += stringC; stringC[0]; /* flatten stringC */ var stringD = "lmn"; new TestCase ( SECTION, "(stringA + stringB + stringC).replace('aa', '')", stringA + stringB + stringC, (stringA + stringB + stringC).replace('aa', '')); new TestCase ( SECTION, "(stringA + stringB + stringC).replace('abc', 'AA')", "AAdefghijk" + stringC, (stringA + stringB + stringC).replace('abc', 'AA')); new TestCase ( SECTION, "(stringA + stringB + stringC).replace('def', 'AA')", "abcAAghijk" + stringC, (stringA + stringB + stringC).replace('def', 'AA')); new TestCase ( SECTION, "(stringA + stringB + stringC).replace('efg', 'AA')", "abcdAAhijk" + stringC, (stringA + stringB + stringC).replace('efg', 'AA')); new TestCase ( SECTION, "(stringA + stringB + stringC).replace('fgh', 'AA')", "abcdeAAijk" + stringC, (stringA + stringB + stringC).replace('fgh', 'AA')); new TestCase ( SECTION, "(stringA + stringB + stringC).replace('ghi', 'AA')", "abcdefAAjk" + stringC, (stringA + stringB + stringC).replace('ghi', 'AA')); new TestCase ( SECTION, "(stringC + stringD).replace('lmn', 'AA')", stringC + "AA", (stringC + stringD).replace('lmn', 'AA')); new TestCase ( SECTION, "(stringC + stringD).replace('lmno', 'AA')", stringC + stringD, (stringC + stringD).replace('lmno', 'AA')); new TestCase ( SECTION, "(stringC + stringD).replace('mn', 'AA')", stringC + "lAA", (stringC + stringD).replace('mn', 'AA')); new TestCase ( SECTION, "(stringC + stringD).replace('n', 'AA')", stringC + "lmAA", (stringC + stringD).replace('n', 'AA')); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/string_search.js0000644000175000017500000000635311545150464023044 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: string_search.js Description: 'Tests the search method on Strings using regular expressions' Author: Nick Lerissa Date: March 12, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'String: search'; writeHeaderToLog('Executing script: string_search.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abcdefg'.search(/d/) new TestCase ( SECTION, "'abcdefg'.search(/d/)", 3, 'abcdefg'.search(/d/)); // 'abcdefg'.search(/x/) new TestCase ( SECTION, "'abcdefg'.search(/x/)", -1, 'abcdefg'.search(/x/)); // 'abcdefg123456hijklmn'.search(/\d+/) new TestCase ( SECTION, "'abcdefg123456hijklmn'.search(/\d+/)", 7, 'abcdefg123456hijklmn'.search(/\d+/)); // 'abcdefg123456hijklmn'.search(new RegExp()) new TestCase ( SECTION, "'abcdefg123456hijklmn'.search(new RegExp())", 0, 'abcdefg123456hijklmn'.search(new RegExp())); // 'abc'.search(new RegExp('$')) new TestCase ( SECTION, "'abc'.search(new RegExp('$'))", 3, 'abc'.search(new RegExp('$'))); // 'abc'.search(new RegExp('^')) new TestCase ( SECTION, "'abc'.search(new RegExp('^'))", 0, 'abc'.search(new RegExp('^'))); // 'abc1'.search(/.\d/) new TestCase ( SECTION, "'abc1'.search(/.\d/)", 2, 'abc1'.search(/.\d/)); // 'abc1'.search(/\d{2}/) new TestCase ( SECTION, "'abc1'.search(/\d{2}/)", -1, 'abc1'.search(/\d{2}/)); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/string_split.js0000644000175000017500000000720711545150464022731 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: string_split.js Description: 'Tests the split method on Strings using regular expressions' Author: Nick Lerissa Date: March 11, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'String: split'; writeHeaderToLog('Executing script: string_split.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'a b c de f'.split(/\s/) new TestCase ( SECTION, "'a b c de f'.split(/\s/)", String(["a","b","c","de","f"]), String('a b c de f'.split(/\s/))); // 'a b c de f'.split(/\s/,3) new TestCase ( SECTION, "'a b c de f'.split(/\s/,3)", String(["a","b","c"]), String('a b c de f'.split(/\s/,3))); // 'a b c de f'.split(/X/) new TestCase ( SECTION, "'a b c de f'.split(/X/)", String(["a b c de f"]), String('a b c de f'.split(/X/))); // 'dfe23iu 34 =+65--'.split(/\d+/) new TestCase ( SECTION, "'dfe23iu 34 =+65--'.split(/\d+/)", String(["dfe","iu "," =+","--"]), String('dfe23iu 34 =+65--'.split(/\d+/))); // 'dfe23iu 34 =+65--'.split(new RegExp('\d+')) new TestCase ( SECTION, "'dfe23iu 34 =+65--'.split(new RegExp('\\d+'))", String(["dfe","iu "," =+","--"]), String('dfe23iu 34 =+65--'.split(new RegExp('\\d+')))); // 'abc'.split(/[a-z]/) new TestCase ( SECTION, "'abc'.split(/[a-z]/)", String(["","",""]), String('abc'.split(/[a-z]/))); // 'abc'.split(/[a-z]/) new TestCase ( SECTION, "'abc'.split(/[a-z]/)", String(["","",""]), String('abc'.split(/[a-z]/))); // 'abc'.split(new RegExp('[a-z]')) new TestCase ( SECTION, "'abc'.split(new RegExp('[a-z]'))", String(["","",""]), String('abc'.split(new RegExp('[a-z]')))); // 'abc'.split(new RegExp('[a-z]')) new TestCase ( SECTION, "'abc'.split(new RegExp('[a-z]'))", String(["","",""]), String('abc'.split(new RegExp('[a-z]')))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/test.js0000644000175000017500000000635611545150464021173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: test.js Description: 'Tests regular expressions method compile' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: test'; writeHeaderToLog('Executing script: test.js'); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase ( SECTION, "/[0-9]{3}/.test('23 2 34 678 9 09')", true, /[0-9]{3}/.test('23 2 34 678 9 09')); new TestCase ( SECTION, "/[0-9]{3}/.test('23 2 34 78 9 09')", false, /[0-9]{3}/.test('23 2 34 78 9 09')); new TestCase ( SECTION, "/\w+ \w+ \w+/.test('do a test')", true, /\w+ \w+ \w+/.test("do a test")); new TestCase ( SECTION, "/\w+ \w+ \w+/.test('a test')", false, /\w+ \w+ \w+/.test("a test")); new TestCase ( SECTION, "(new RegExp('[0-9]{3}')).test('23 2 34 678 9 09')", true, (new RegExp('[0-9]{3}')).test('23 2 34 678 9 09')); new TestCase ( SECTION, "(new RegExp('[0-9]{3}')).test('23 2 34 78 9 09')", false, (new RegExp('[0-9]{3}')).test('23 2 34 78 9 09')); new TestCase ( SECTION, "(new RegExp('\\\\w+ \\\\w+ \\\\w+')).test('do a test')", true, (new RegExp('\\w+ \\w+ \\w+')).test("do a test")); new TestCase ( SECTION, "(new RegExp('\\\\w+ \\\\w+ \\\\w+')).test('a test')", false, (new RegExp('\\w+ \\w+ \\w+')).test("a test")); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/toString.js0000644000175000017500000000550511545150464022020 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: toString.js Description: 'Tests RegExp method toString' Author: Nick Lerissa Date: March 13, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: toString'; writeHeaderToLog('Executing script: toString.js'); writeHeaderToLog( SECTION + " "+ TITLE); /* * var re = new RegExp(); re.toString() For what to expect, * see http://bugzilla.mozilla.org/show_bug.cgi?id=225343#c7 */ var re = new RegExp(); new TestCase ( SECTION, "var re = new RegExp(); re.toString()", '/(?:)/', re.toString()); // re = /.+/; re.toString(); re = /.+/; new TestCase ( SECTION, "re = /.+/; re.toString()", '/.+/', re.toString()); // re = /test/gi; re.toString() re = /test/gi; new TestCase ( SECTION, "re = /test/gi; re.toString()", '/test/gi', re.toString()); // re = /test2/ig; re.toString() re = /test2/ig; new TestCase ( SECTION, "re = /test2/ig; re.toString()", '/test2/gi', re.toString()); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/vertical_bar.js0000644000175000017500000001034211545150464022637 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: vertical_bar.js Description: 'Tests regular expressions containing |' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: |'; writeHeaderToLog('Executing script: vertical_bar.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'abc'.match(new RegExp('xyz|abc')) new TestCase ( SECTION, "'abc'.match(new RegExp('xyz|abc'))", String(["abc"]), String('abc'.match(new RegExp('xyz|abc')))); // 'this is a test'.match(new RegExp('quiz|exam|test|homework')) new TestCase ( SECTION, "'this is a test'.match(new RegExp('quiz|exam|test|homework'))", String(["test"]), String('this is a test'.match(new RegExp('quiz|exam|test|homework')))); // 'abc'.match(new RegExp('xyz|...')) new TestCase ( SECTION, "'abc'.match(new RegExp('xyz|...'))", String(["abc"]), String('abc'.match(new RegExp('xyz|...')))); // 'abc'.match(new RegExp('(.)..|abc')) new TestCase ( SECTION, "'abc'.match(new RegExp('(.)..|abc'))", String(["abc","a"]), String('abc'.match(new RegExp('(.)..|abc')))); // 'color: grey'.match(new RegExp('.+: gr(a|e)y')) new TestCase ( SECTION, "'color: grey'.match(new RegExp('.+: gr(a|e)y'))", String(["color: grey","e"]), String('color: grey'.match(new RegExp('.+: gr(a|e)y')))); // 'no match'.match(new RegExp('red|white|blue')) new TestCase ( SECTION, "'no match'.match(new RegExp('red|white|blue'))", null, 'no match'.match(new RegExp('red|white|blue'))); // 'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)')) new TestCase ( SECTION, "'Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)'))", String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(new RegExp('(Rob)|(Bob)|(Robert)|(Bobby)')))); // 'abcdef'.match(new RegExp('abc|bcd|cde|def')) new TestCase ( SECTION, "'abcdef'.match(new RegExp('abc|bcd|cde|def'))", String(["abc"]), String('abcdef'.match(new RegExp('abc|bcd|cde|def')))); // 'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/) new TestCase ( SECTION, "'Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/)", String(["Bob",undefined,"Bob", undefined, undefined]), String('Hi Bob'.match(/(Rob)|(Bob)|(Robert)|(Bobby)/))); // 'abcdef'.match(/abc|bcd|cde|def/) new TestCase ( SECTION, "'abcdef'.match(/abc|bcd|cde|def/)", String(["abc"]), String('abcdef'.match(/abc|bcd|cde|def/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/whitespace.js0000644000175000017500000001114711545150464022342 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: whitespace.js Description: 'Tests regular expressions containing \f\n\r\t\v\s\S\ ' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: \\f\\n\\r\\t\\v\\s\\S '; writeHeaderToLog('Executing script: whitespace.js'); writeHeaderToLog( SECTION + " "+ TITLE); var non_whitespace = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~`!@#$%^&*()-+={[}]|\\:;'<,>./?1234567890" + '"'; var whitespace = "\f\n\r\t\v "; // be sure all whitespace is matched by \s new TestCase ( SECTION, "'" + whitespace + "'.match(new RegExp('\\s+'))", String([whitespace]), String(whitespace.match(new RegExp('\\s+')))); // be sure all non-whitespace is matched by \S new TestCase ( SECTION, "'" + non_whitespace + "'.match(new RegExp('\\S+'))", String([non_whitespace]), String(non_whitespace.match(new RegExp('\\S+')))); // be sure all non-whitespace is not matched by \s new TestCase ( SECTION, "'" + non_whitespace + "'.match(new RegExp('\\s'))", null, non_whitespace.match(new RegExp('\\s'))); // be sure all whitespace is not matched by \S new TestCase ( SECTION, "'" + whitespace + "'.match(new RegExp('\\S'))", null, whitespace.match(new RegExp('\\S'))); var s = non_whitespace + whitespace; // be sure all digits are matched by \s new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\s+'))", String([whitespace]), String(s.match(new RegExp('\\s+')))); s = whitespace + non_whitespace; // be sure all non-whitespace are matched by \S new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\S+'))", String([non_whitespace]), String(s.match(new RegExp('\\S+')))); // '1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+')) new TestCase ( SECTION, "'1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+'))", String(["find me"]), String('1233345find me345'.match(new RegExp('[a-z\\s][a-z\\s]+')))); var i; // be sure all whitespace characters match individually for (i = 0; i < whitespace.length; ++i) { s = 'ab' + whitespace[i] + 'cd'; new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\\\s'))", String([whitespace[i]]), String(s.match(new RegExp('\\s')))); new TestCase ( SECTION, "'" + s + "'.match(/\s/)", String([whitespace[i]]), String(s.match(/\s/))); } // be sure all non_whitespace characters match individually for (i = 0; i < non_whitespace.length; ++i) { s = ' ' + non_whitespace[i] + ' '; new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\\\S'))", String([non_whitespace[i]]), String(s.match(new RegExp('\\S')))); new TestCase ( SECTION, "'" + s + "'.match(/\S/)", String([non_whitespace[i]]), String(s.match(/\S/))); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regexp/word_boundary.js0000644000175000017500000001051211545150464023057 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: word_boundary.js Description: 'Tests regular expressions containing \b and \B' Author: Nick Lerissa Date: March 10, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'RegExp: \\b and \\B'; writeHeaderToLog('Executing script: word_boundary.js'); writeHeaderToLog( SECTION + " "+ TITLE); // 'cowboy boyish boy'.match(new RegExp('\bboy\b')) new TestCase ( SECTION, "'cowboy boyish boy'.match(new RegExp('\\bboy\\b'))", String(["boy"]), String('cowboy boyish boy'.match(new RegExp('\\bboy\\b')))); var boundary_characters = "\f\n\r\t\v~`!@#$%^&*()-+={[}]|\\:;'<,>./? " + '"'; var non_boundary_characters = '1234567890_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; var s = ''; var i; // testing whether all boundary characters are matched when they should be for (i = 0; i < boundary_characters.length; ++i) { s = '123ab' + boundary_characters.charAt(i) + '123c' + boundary_characters.charAt(i); new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\b123[a-z]\\b'))", String(["123c"]), String(s.match(new RegExp('\\b123[a-z]\\b')))); } // testing whether all non-boundary characters are matched when they should be for (i = 0; i < non_boundary_characters.length; ++i) { s = '123ab' + non_boundary_characters.charAt(i) + '123c' + non_boundary_characters.charAt(i); new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\B123[a-z]\\B'))", String(["123c"]), String(s.match(new RegExp('\\B123[a-z]\\B')))); } s = ''; // testing whether all boundary characters are not matched when they should not be for (i = 0; i < boundary_characters.length; ++i) { s += boundary_characters[i] + "a" + i + "b"; } s += "xa1111bx"; new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\Ba\\d+b\\B'))", String(["a1111b"]), String(s.match(new RegExp('\\Ba\\d+b\\B')))); new TestCase ( SECTION, "'" + s + "'.match(/\\Ba\\d+b\\B/)", String(["a1111b"]), String(s.match(/\Ba\d+b\B/))); s = ''; // testing whether all non-boundary characters are not matched when they should not be for (i = 0; i < non_boundary_characters.length; ++i) { s += non_boundary_characters[i] + "a" + i + "b"; } s += "(a1111b)"; new TestCase ( SECTION, "'" + s + "'.match(new RegExp('\\ba\\d+b\\b'))", String(["a1111b"]), String(s.match(new RegExp('\\ba\\d+b\\b')))); new TestCase ( SECTION, "'" + s + "'.match(/\\ba\\d+b\\b/)", String(["a1111b"]), String(s.match(/\ba\d+b\b/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regress/browser.js0000644000175000017500000000000011545150464022033 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regress/jstests.list0000644000175000017500000000014411545150464022417 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_2/regress/ script regress-144834.js script regress-7703.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regress/regress-144834.js0000644000175000017500000000513311545150464022603 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * bzbarsky@mit.edu, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 05 July 2002 * SUMMARY: Testing local var having same name as switch label inside function * * The code below crashed while compiling in JS1.1 or JS1.2 * See http://bugzilla.mozilla.org/show_bug.cgi?id=144834 * */ //----------------------------------------------------------------------------- var BUGNUMBER = 144834; var summary = 'Local var having same name as switch label inside function'; print(BUGNUMBER); print(summary); function RedrawSched() { var MinBound; switch (i) { case MinBound : } } /* * Also try eval scope - */ var s = ''; s += 'function RedrawSched()'; s += '{'; s += ' var MinBound;'; s += ''; s += ' switch (i)'; s += ' {'; s += ' case MinBound :'; s += ' }'; s += '}'; eval(s); AddTestCase('Do not crash', 'No Crash', 'No Crash'); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regress/regress-7703.js0000644000175000017500000000725311545150464022441 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: regress-7703.js * Reference: "http://bugzilla.mozilla.org/show_bug.cgi?id=7703"; * Description: See the text of the bugnumber above */ var SECTION = "js1_2"; // provide a document reference (ie, ECMA section) var VERSION = "JS1_2"; // Version of JavaScript or ECMA var TITLE = "Regression test for bugzilla # 7703"; // Provide ECMA section title or a description var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7703"; // Provide URL to bugsplat or bugzilla report startTest(); // leave this alone /* * Calls to AddTestCase here. AddTestCase is a function that is defined * in shell.js and takes three arguments: * - a string representation of what is being tested * - the expected result * - the actual result * * For example, a test might look like this: * * var zip = /[\d]{5}$/; * * AddTestCase( * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test * "02134", // expected result * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result * */ types = []; function inspect(object) { for (prop in object) { var x = object[prop]; types[types.length] = (typeof x); } } var o = {a: 1, b: 2}; inspect(o); AddTestCase( "inspect(o),length", 2, types.length ); AddTestCase( "inspect(o)[0]", "number", types[0] ); AddTestCase( "inspect(o)[1]", "number", types[1] ); types_2 = []; function inspect_again(object) { for (prop in object) { types_2[types_2.length] = (typeof object[prop]); } } inspect_again(o); AddTestCase( "inspect_again(o),length", 2, types.length ); AddTestCase( "inspect_again(o)[0]", "number", types[0] ); AddTestCase( "inspect_again(o)[1]", "number", types[1] ); test(); // leave this alone. this executes the test cases and // displays results. mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/regress/shell.js0000644000175000017500000000000011545150464021457 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/statements/break.js0000644000175000017500000000722411545150464022170 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: break.js Description: 'Tests the break statement' Author: Nick Lerissa Date: March 18, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'statements: break'; writeHeaderToLog("Executing script: break.js"); writeHeaderToLog( SECTION + " "+ TITLE); var i,j; for (i = 0; i < 1000; i++) { if (i == 100) break; } // 'breaking out of "for" loop' new TestCase ( SECTION, 'breaking out of "for" loop', 100, i); j = 2000; out1: for (i = 0; i < 1000; i++) { if (i == 100) { out2: for (j = 0; j < 1000; j++) { if (j == 500) break out1; } j = 2001; } j = 2002; } // 'breaking out of a "for" loop with a "label"' new TestCase ( SECTION, 'breaking out of a "for" loop with a "label"', 500, j); i = 0; while (i < 1000) { if (i == 100) break; i++; } // 'breaking out of a "while" loop' new TestCase ( SECTION, 'breaking out of a "while" loop', 100, i ); j = 2000; i = 0; out3: while (i < 1000) { if (i == 100) { j = 0; out4: while (j < 1000) { if (j == 500) break out3; j++; } j = 2001; } j = 2002; i++; } // 'breaking out of a "while" loop with a "label"' new TestCase ( SECTION, 'breaking out of a "while" loop with a "label"', 500, j); i = 0; do { if (i == 100) break; i++; } while (i < 1000); // 'breaking out of a "do" loop' new TestCase ( SECTION, 'breaking out of a "do" loop', 100, i ); j = 2000; i = 0; out5: do { if (i == 100) { j = 0; out6: do { if (j == 500) break out5; j++; }while (j < 1000); j = 2001; } j = 2002; i++; }while (i < 1000); // 'breaking out of a "do" loop with a "label"' new TestCase ( SECTION, 'breaking out of a "do" loop with a "label"', 500, j); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/statements/browser.js0000644000175000017500000000000011545150464022550 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/statements/continue.js0000644000175000017500000000734311545150464022732 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: continue.js Description: 'Tests the continue statement' Author: Nick Lerissa Date: March 18, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'statements: continue'; writeHeaderToLog("Executing script: continue.js"); writeHeaderToLog( SECTION + " "+ TITLE); var i,j; j = 0; for (i = 0; i < 200; i++) { if (i == 100) continue; j++; } // '"continue" in a "for" loop' new TestCase ( SECTION, '"continue" in "for" loop', 199, j); j = 0; out1: for (i = 0; i < 1000; i++) { if (i == 100) { out2: for (var k = 0; k < 1000; k++) { if (k == 500) continue out1; } j = 3000; } j++; } // '"continue" in a "for" loop with a "label"' new TestCase ( SECTION, '"continue" in "for" loop with a "label"', 999, j); i = 0; j = 1; while (i != j) { i++; if (i == 100) continue; j++; } // '"continue" in a "while" loop' new TestCase ( SECTION, '"continue" in a "while" loop', 100, j ); j = 0; i = 0; out3: while (i < 1000) { if (i == 100) { var k = 0; out4: while (k < 1000) { if (k == 500) { i++; continue out3; } k++; } j = 3000; } j++; i++; } // '"continue" in a "while" loop with a "label"' new TestCase ( SECTION, '"continue" in a "while" loop with a "label"', 999, j); i = 0; j = 1; do { i++; if (i == 100) continue; j++; } while (i != j); // '"continue" in a "do" loop' new TestCase ( SECTION, '"continue" in a "do" loop', 100, j ); j = 0; i = 0; out5: do { if (i == 100) { var k = 0; out6: do { if (k == 500) { i++; continue out5; } k++; }while (k < 1000); j = 3000; } j++; i++; }while (i < 1000); // '"continue" in a "do" loop with a "label"' new TestCase ( SECTION, '"continue" in a "do" loop with a "label"', 999, j); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/statements/do_while.js0000644000175000017500000000460711545150464022700 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: do_while.js Description: 'This tests the new do_while loop' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'statements: do_while'; writeHeaderToLog('Executing script: do_while.js'); writeHeaderToLog( SECTION + " "+ TITLE); var done = false; var x = 0; do { if (x++ == 3) done = true; } while (!done); new TestCase( SECTION, "do_while ", 4, x); //load('d:/javascript/tests/output/statements/do_while.js') test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/statements/jstests.list0000644000175000017500000000022011545150464023127 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_2/statements/ script break.js script continue.js script do_while.js script switch.js script switch2.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/statements/shell.js0000644000175000017500000000000011545150464022174 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/statements/switch.js0000644000175000017500000000655011545150464022406 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: switch.js Description: 'Tests the switch statement' http://scopus.mcom.com/bugsplat/show_bug.cgi?id=323696 Author: Nick Lerissa Date: March 19, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; var TITLE = 'statements: switch'; var BUGNUMBER="323696"; startTest(); writeHeaderToLog("Executing script: switch.js"); writeHeaderToLog( SECTION + " "+ TITLE); var var1 = "match string"; var match1 = false; var match2 = false; var match3 = false; switch (var1) { case "match string": match1 = true; case "bad string 1": match2 = true; break; case "bad string 2": match3 = true; } new TestCase ( SECTION, 'switch statement', true, match1); new TestCase ( SECTION, 'switch statement', true, match2); new TestCase ( SECTION, 'switch statement', false, match3); var var2 = 3; var match1 = false; var match2 = false; var match3 = false; var match4 = false; var match5 = false; switch (var2) { case 1: /* switch (var1) { case "foo": match1 = true; break; case 3: match2 = true; break; }*/ match3 = true; break; case 2: match4 = true; break; case 3: match5 = true; break; } new TestCase ( SECTION, 'switch statement', false, match1); new TestCase ( SECTION, 'switch statement', false, match2); new TestCase ( SECTION, 'switch statement', false, match3); new TestCase ( SECTION, 'switch statement', false, match4); new TestCase ( SECTION, 'switch statement', true, match5); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/statements/switch2.js0000644000175000017500000001077211545150464022471 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: switch2.js Description: 'Tests the switch statement' http://scopus.mcom.com/bugsplat/show_bug.cgi?id=323696 Author: Norris Boyd Date: July 31, 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; var TITLE = 'statements: switch'; var BUGNUMBER="323626"; startTest(); writeHeaderToLog("Executing script: switch2.js"); writeHeaderToLog( SECTION + " "+ TITLE); // test defaults not at the end; regression test for a bug that // nearly made it into 4.06 function f0(i) { switch(i) { default: case "a": case "b": return "ab*" case "c": return "c"; case "d": return "d"; } return ""; } new TestCase(SECTION, 'switch statement', f0("a"), "ab*"); new TestCase(SECTION, 'switch statement', f0("b"), "ab*"); new TestCase(SECTION, 'switch statement', f0("*"), "ab*"); new TestCase(SECTION, 'switch statement', f0("c"), "c"); new TestCase(SECTION, 'switch statement', f0("d"), "d"); function f1(i) { switch(i) { case "a": case "b": default: return "ab*" case "c": return "c"; case "d": return "d"; } return ""; } new TestCase(SECTION, 'switch statement', f1("a"), "ab*"); new TestCase(SECTION, 'switch statement', f1("b"), "ab*"); new TestCase(SECTION, 'switch statement', f1("*"), "ab*"); new TestCase(SECTION, 'switch statement', f1("c"), "c"); new TestCase(SECTION, 'switch statement', f1("d"), "d"); // Switch on integer; will use TABLESWITCH opcode in C engine function f2(i) { switch (i) { case 0: case 1: return 1; case 2: return 2; } // with no default, control will fall through return 3; } new TestCase(SECTION, 'switch statement', f2(0), 1); new TestCase(SECTION, 'switch statement', f2(1), 1); new TestCase(SECTION, 'switch statement', f2(2), 2); new TestCase(SECTION, 'switch statement', f2(3), 3); // empty switch: make sure expression is evaluated var se = 0; switch (se = 1) { } new TestCase(SECTION, 'switch statement', se, 1); // only default se = 0; switch (se) { default: se = 1; } new TestCase(SECTION, 'switch statement', se, 1); // in loop, break should only break out of switch se = 0; for (var i=0; i < 2; i++) { switch (i) { case 0: case 1: break; } se = 1; } new TestCase(SECTION, 'switch statement', se, 1); // test "fall through" se = 0; i = 0; switch (i) { case 0: se++; /* fall through */ case 1: se++; break; } new TestCase(SECTION, 'switch statement', se, 2); print("hi"); test(); // Needed: tests for evaluation time of case expressions. // This issue was under debate at ECMA, so postponing for now. mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/String/browser.js0000644000175000017500000000000011545150464021627 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/String/charCodeAt.js0000644000175000017500000000617511545150464022164 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: charCodeAt.js Description: 'This tests new String object method: charCodeAt' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'String:charCodeAt'; writeHeaderToLog('Executing script: charCodeAt.js'); writeHeaderToLog( SECTION + " "+ TITLE); var aString = new String("tEs5"); new TestCase( SECTION, "aString.charCodeAt(-2)", NaN, aString.charCodeAt(-2)); new TestCase( SECTION, "aString.charCodeAt(-1)", NaN, aString.charCodeAt(-1)); new TestCase( SECTION, "aString.charCodeAt( 0)", 116, aString.charCodeAt( 0)); new TestCase( SECTION, "aString.charCodeAt( 1)", 69, aString.charCodeAt( 1)); new TestCase( SECTION, "aString.charCodeAt( 2)", 115, aString.charCodeAt( 2)); new TestCase( SECTION, "aString.charCodeAt( 3)", 53, aString.charCodeAt( 3)); new TestCase( SECTION, "aString.charCodeAt( 4)", NaN, aString.charCodeAt( 4)); new TestCase( SECTION, "aString.charCodeAt( 5)", NaN, aString.charCodeAt( 5)); new TestCase( SECTION, "aString.charCodeAt( Infinity)", NaN, aString.charCodeAt( Infinity)); new TestCase( SECTION, "aString.charCodeAt(-Infinity)", NaN, aString.charCodeAt(-Infinity)); //new TestCase( SECTION, "aString.charCodeAt( )", 116, aString.charCodeAt( )); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/String/concat.js0000644000175000017500000001017111545150464021425 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: concat.js Description: 'This tests the new String object method: concat' Author: NickLerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'String:concat'; writeHeaderToLog('Executing script: concat.js'); writeHeaderToLog( SECTION + " "+ TITLE); var aString = new String("test string"); var bString = new String(" another "); new TestCase( SECTION, "aString.concat(' more')", "test string more", aString.concat(' more').toString()); new TestCase( SECTION, "aString.concat(bString)", "test string another ", aString.concat(bString).toString()); new TestCase( SECTION, "aString ", "test string", aString.toString()); new TestCase( SECTION, "bString ", " another ", bString.toString()); new TestCase( SECTION, "aString.concat(345) ", "test string345", aString.concat(345).toString()); new TestCase( SECTION, "aString.concat(true) ", "test stringtrue", aString.concat(true).toString()); new TestCase( SECTION, "aString.concat(null) ", "test stringnull", aString.concat(null).toString()); new TestCase( SECTION, "aString.concat([]) ", "test string[]", aString.concat([]).toString()); new TestCase( SECTION, "aString.concat([1,2,3])", "test string[1, 2, 3]", aString.concat([1,2,3]).toString()); new TestCase( SECTION, "'abcde'.concat(' more')", "abcde more", 'abcde'.concat(' more').toString()); new TestCase( SECTION, "'abcde'.concat(bString)", "abcde another ", 'abcde'.concat(bString).toString()); new TestCase( SECTION, "'abcde' ", "abcde", 'abcde'); new TestCase( SECTION, "'abcde'.concat(345) ", "abcde345", 'abcde'.concat(345).toString()); new TestCase( SECTION, "'abcde'.concat(true) ", "abcdetrue", 'abcde'.concat(true).toString()); new TestCase( SECTION, "'abcde'.concat(null) ", "abcdenull", 'abcde'.concat(null).toString()); new TestCase( SECTION, "'abcde'.concat([]) ", "abcde[]", 'abcde'.concat([]).toString()); new TestCase( SECTION, "'abcde'.concat([1,2,3])", "abcde[1, 2, 3]", 'abcde'.concat([1,2,3]).toString()); //what should this do: new TestCase( SECTION, "'abcde'.concat() ", "abcde", 'abcde'.concat().toString()); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/String/jstests.list0000644000175000017500000000021611545150464022213 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_2/String/ script charCodeAt.js skip script concat.js # obsolete test script match.js script slice.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/String/match.js0000644000175000017500000000473411545150464021262 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: match.js Description: 'This tests the new String object method: match' Author: NickLerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'String:match'; writeHeaderToLog('Executing script: match.js'); writeHeaderToLog( SECTION + " "+ TITLE); var aString = new String("this is a test string"); new TestCase( SECTION, "aString.match(/is.*test/) ", String(["is is a test"]), String(aString.match(/is.*test/))); new TestCase( SECTION, "aString.match(/s.*s/) ", String(["s is a test s"]), String(aString.match(/s.*s/))); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/String/shell.js0000644000175000017500000000000011545150464021253 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/String/slice.js0000644000175000017500000001014311545150464021254 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** Filename: slice.js Description: 'This tests the String object method: slice' Author: Nick Lerissa Date: Fri Feb 13 09:58:28 PST 1998 */ var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"'; var VERSION = 'no version'; startTest(); var TITLE = 'String.slice'; writeHeaderToLog('Executing script: slice.js'); writeHeaderToLog( SECTION + " "+ TITLE); var a = new String("abcdefghijklmnopqrstuvwxyz1234567890"); var b = new String("this is a test string"); exhaustiveStringSliceTest("exhaustive String.slice test 1", a); exhaustiveStringSliceTest("exhaustive String.slice test 2", b); test(); function myStringSlice(a, from, to) { var from2 = from; var to2 = to; var returnString = new String(""); var i; if (from2 < 0) from2 = a.length + from; if (to2 < 0) to2 = a.length + to; if ((to2 > from2)&&(to2 > 0)&&(from2 < a.length)) { if (from2 < 0) from2 = 0; if (to2 > a.length) to2 = a.length; for (i = from2; i < to2; ++i) returnString += a.charAt(i); } return returnString; } // This function tests the slice command on a String // passed in. The arguments passed into slice range in // value from -5 to the length of the array + 4. Every // combination of the two arguments is tested. The expected // result of the slice(...) method is calculated and // compared to the actual result from the slice(...) method. // If the Strings are not similar false is returned. function exhaustiveStringSliceTest(testname, a) { var x = 0; var y = 0; var errorMessage; var reason = ""; var passed = true; for (x = -(2 + a.length); x <= (2 + a.length); x++) for (y = (2 + a.length); y >= -(2 + a.length); y--) { var b = a.slice(x,y); var c = myStringSlice(a,x,y); if (String(b) != String(c)) { errorMessage = "ERROR: 'TEST FAILED' ERROR: 'TEST FAILED' ERROR: 'TEST FAILED'\n" + " test: " + "a.slice(" + x + "," + y + ")\n" + " a: " + String(a) + "\n" + " actual result: " + String(b) + "\n" + " expected result: " + String(c) + "\n"; writeHeaderToLog(errorMessage); reason = reason + errorMessage; passed = false; } } var testCase = new TestCase(SECTION, testname, true, passed); if (passed == false) testCase.reason = reason; return testCase; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/version120/boolean-001.js0000644000175000017500000000515711545150464022545 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: boolean-001.js * Description: * * In JavaScript 1.2, new Boolean(false) evaluates to false. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "boolean-001.js"; var VERSION = "JS1_2"; startTest(); var TITLE = "new Boolean(false) should evaluate to false"; writeHeaderToLog( SECTION + " "+ TITLE); BooleanTest( "new Boolean(true)", new Boolean(true), true ); BooleanTest( "new Boolean(false)", new Boolean(false), false ); BooleanTest( "true", true, true ); BooleanTest( "false", false, false ); test(); function BooleanTest( string, object, expect ) { if ( object ) { result = true; } else { result = false; } new TestCase( SECTION, string, expect, result ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/version120/browser.js0000644000175000017500000000336411545150464022311 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/version120/jstests.list0000644000175000017500000000021711545150464022656 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_2/version120/ skip script boolean-001.js # obsolete test skip script regress-99663.js # obsolete test mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_2/version120/regress-99663.js0000644000175000017500000000743611545150464023002 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * brendan@mozilla.org, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 99663; var summary = 'Regression test for Bugzilla bug 99663'; /* * This testcase expects error messages containing * the phrase 'read-only' or something similar - */ var READONLY = /read\s*-?\s*only/; var READONLY_TRUE = 'a "read-only" error'; var READONLY_FALSE = 'Error: '; var FAILURE = 'NO ERROR WAS GENERATED!'; var status = ''; var actual = ''; var expect= ''; var statusitems = []; var expectedvalues = []; var actualvalues = []; /* * These MUST be compiled in JS1.2 or less for the test to work - see above */ function f1() { with (it) { for (rdonly in this); } } function f2() { for (it.rdonly in this); } function f3(s) { for (it[s] in this); } /* * Begin testing by capturing actual vs. expected values. * Initialize to FAILURE; this will get reset if all goes well - */ actual = FAILURE; try { f1(); } catch(e) { actual = readOnly(e.message); } expect= READONLY_TRUE; status = 'Section 1 of test - got ' + actual; addThis(); actual = FAILURE; try { f2(); } catch(e) { actual = readOnly(e.message); } expect= READONLY_TRUE; status = 'Section 2 of test - got ' + actual; addThis(); actual = FAILURE; try { f3('rdonly'); } catch(e) { actual = readOnly(e.message); } expect= READONLY_TRUE; status = 'Section 3 of test - got ' + actual; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function readOnly(msg) { if (msg.match(READONLY)) return READONLY_TRUE; return READONLY_FALSE + msg; } function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { print ('Bug Number ' + bug); print ('STATUS: ' + summary); for (var i=0; i parseInt(123,"hi") 123 js> parseInt(123, "blah") 123 js> s js: s is not defined js> s = new Script undefined; js> s = new Script() undefined; js> s.getJSClass js> s.getJSClass = Object.prototype.toString function toString() { [native code] } js> s.getJSClass() [object Script] js> s.compile( "return 3+4" ) js: JavaScript exception: javax.javascript.EvaluatorException: " s.compile( "3+4" ) 3 + 4; js> typeof s function js> s() Jit failure! invalid opcode: 1 Jit Pass1 Failure! javax/javascript/gen/c13 initScript (Ljavax/javascript/Scriptable;)V An internal JIT error has occurred. Please report this with .class jit-bugs@itools.symantec.com 7 js> s.compile("3+4") 3 + 4; js> s() Jit failure! invalid opcode: 1 Jit Pass1 Failure! javax/javascript/gen/c17 initScript (Ljavax/javascript/Scriptable;)V An internal JIT error has occurred. Please report this with .class jit-bugs@itools.symantec.com 7 js> quit() C:\src\ns_priv\js\tests\ecma>shell C:\src\ns_priv\js\tests\ecma>java -classpath c:\cafe\java\JavaScope; :\src\ns_priv\js\tests javax.javascript.examples.Shell Symantec Java! JustInTime Compiler Version 210.054 for JDK 1.1.2 Copyright (C) 1996-97 Symantec Corporation js> s = new Script("3+4") 3 + 4; js> s() 7 js> s2 = new Script(); undefined; js> s.compile( "3+4") 3 + 4; js> s() Jit failure! invalid opcode: 1 Jit Pass1 Failure! javax/javascript/gen/c7 initScript (Ljavax/javascript/Scriptable;)V An internal JIT error has occurred. Please report this with .class jit-bugs@itools.symantec.com 7 js> quit() Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "script-001"; var VERSION = "JS1_3"; var TITLE = "NativeScript"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); new TestCase( SECTION, "var s = new Script(); typeof s", "Script not supported, test skipped.", "Script not supported, test skipped." ); } else { var s = new Script(); s.getJSClass = Object.prototype.toString; new TestCase( SECTION, "var s = new Script(); typeof s", "function", typeof s ); new TestCase( SECTION, "s.getJSClass()", "[object Script]", s.getJSClass() ); } test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/extensions/shell.js0000644000175000017500000000000011545150464022205 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/browser.js0000644000175000017500000000000011545150464022024 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/jstests.list0000644000175000017500000000035311545150464022412 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_3/inherit/ script proto_1.js script proto_10.js script proto_11.js script proto_12.js script proto_3.js script proto_4.js script proto_6.js script proto_7.js script proto_8.js script proto_9.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/proto_1.js0000644000175000017500000001111111545150464021731 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: proto_1.js Section: Description: new PrototypeObject This tests Object Hierarchy and Inheritance, as described in the document Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 15:19:34 on http://devedge.netscape.com/. Current URL: http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm This tests the syntax ObjectName.prototype = new PrototypeObject using the Employee example in the document referenced above. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "proto_1"; var VERSION = "JS1_3"; var TITLE = "new PrototypeObject"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function Employee () { this.name = ""; this.dept = "general"; } function Manager () { this.reports = []; } Manager.prototype = new Employee(); function WorkerBee () { this.projects = new Array(); } WorkerBee.prototype = new Employee(); function SalesPerson () { this.dept = "sales"; this.quota = 100; } SalesPerson.prototype = new WorkerBee(); function Engineer () { this.dept = "engineering"; this.machine = ""; } Engineer.prototype = new WorkerBee(); var jim = new Employee(); new TestCase( SECTION, "jim = new Employee(); jim.name", "", jim.name ); new TestCase( SECTION, "jim = new Employee(); jim.dept", "general", jim.dept ); var sally = new Manager(); new TestCase( SECTION, "sally = new Manager(); sally.name", "", sally.name ); new TestCase( SECTION, "sally = new Manager(); sally.dept", "general", sally.dept ); new TestCase( SECTION, "sally = new Manager(); sally.reports.length", 0, sally.reports.length ); new TestCase( SECTION, "sally = new Manager(); typeof sally.reports", "object", typeof sally.reports ); var fred = new SalesPerson(); new TestCase( SECTION, "fred = new SalesPerson(); fred.name", "", fred.name ); new TestCase( SECTION, "fred = new SalesPerson(); fred.dept", "sales", fred.dept ); new TestCase( SECTION, "fred = new SalesPerson(); fred.quota", 100, fred.quota ); new TestCase( SECTION, "fred = new SalesPerson(); fred.projects.length", 0, fred.projects.length ); var jane = new Engineer(); new TestCase( SECTION, "jane = new Engineer(); jane.name", "", jane.name ); new TestCase( SECTION, "jane = new Engineer(); jane.dept", "engineering", jane.dept ); new TestCase( SECTION, "jane = new Engineer(); jane.projects.length", 0, jane.projects.length ); new TestCase( SECTION, "jane = new Engineer(); jane.machine", "", jane.machine ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/proto_10.js0000644000175000017500000000773011545150464022025 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: proto_10.js Section: Description: Determining Instance Relationships This tests Object Hierarchy and Inheritance, as described in the document Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 15:19:34 on http://devedge.netscape.com/. Current URL: http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm This tests the syntax ObjectName.prototype = new PrototypeObject using the Employee example in the document referenced above. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "proto_10"; var VERSION = "JS1_3"; var TITLE = "Determining Instance Relationships"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function InstanceOf( object, constructor ) { return object instanceof constructor; } function Employee ( name, dept ) { this.name = name || ""; this.dept = dept || "general"; } function Manager () { this.reports = []; } Manager.prototype = new Employee(); function WorkerBee ( name, dept, projs ) { this.base = Employee; this.base( name, dept) this.projects = projs || new Array(); } WorkerBee.prototype = new Employee(); function SalesPerson () { this.dept = "sales"; this.quota = 100; } SalesPerson.prototype = new WorkerBee(); function Engineer ( name, projs, machine ) { this.base = WorkerBee; this.base( name, "engineering", projs ) this.machine = machine || ""; } Engineer.prototype = new WorkerBee(); var pat = new Engineer(); new TestCase( SECTION, "InstanceOf( pat, Engineer )", true, InstanceOf( pat, Engineer ) ); new TestCase( SECTION, "InstanceOf( pat, WorkerBee )", true, InstanceOf( pat, WorkerBee ) ); new TestCase( SECTION, "InstanceOf( pat, Employee )", true, InstanceOf( pat, Employee ) ); new TestCase( SECTION, "InstanceOf( pat, Object )", true, InstanceOf( pat, Object ) ); new TestCase( SECTION, "InstanceOf( pat, SalesPerson )", false, InstanceOf ( pat, SalesPerson ) ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/proto_11.js0000644000175000017500000000720211545150464022020 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: proto_11.js Section: Description: Global Information in Constructors This tests Object Hierarchy and Inheritance, as described in the document Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 15:19:34 on http://devedge.netscape.com/. Current URL: http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm This tests the syntax ObjectName.prototype = new PrototypeObject using the Employee example in the document referenced above. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "proto_11"; var VERSION = "JS1_3"; var TITLE = "Global Information in Constructors"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var idCounter = 1; function Employee ( name, dept ) { this.name = name || ""; this.dept = dept || "general"; this.id = idCounter++; } function Manager () { this.reports = []; } Manager.prototype = new Employee(); function WorkerBee ( name, dept, projs ) { this.base = Employee; this.base( name, dept) this.projects = projs || new Array(); } WorkerBee.prototype = new Employee(); function SalesPerson () { this.dept = "sales"; this.quota = 100; } SalesPerson.prototype = new WorkerBee(); function Engineer ( name, projs, machine ) { this.base = WorkerBee; this.base( name, "engineering", projs ) this.machine = machine || ""; } Engineer.prototype = new WorkerBee(); var pat = new Employee( "Toonces, Pat", "Tech Pubs" ) var terry = new Employee( "O'Sherry Terry", "Marketing" ); var les = new Engineer( "Morris, Les", new Array("JavaScript"), "indy" ); new TestCase( SECTION, "pat.id", 5, pat.id ); new TestCase( SECTION, "terry.id", 6, terry.id ); new TestCase( SECTION, "les.id", 7, les.id ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/proto_12.js0000644000175000017500000001012011545150464022012 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: proto_12.js Section: Description: new PrototypeObject This tests Object Hierarchy and Inheritance, as described in the document Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 15:19:34 on http://devedge.netscape.com/. Current URL: http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm No Multiple Inheritance Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "proto_12"; var VERSION = "JS1_3"; var TITLE = "No Multiple Inheritance"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function Employee ( name, dept ) { this.name = name || ""; this.dept = dept || "general"; this.id = idCounter++; } function Manager () { this.reports = []; } Manager.prototype = new Employee(); function WorkerBee ( name, dept, projs ) { this.base = Employee; this.base( name, dept) this.projects = projs || new Array(); } WorkerBee.prototype = new Employee(); function SalesPerson () { this.dept = "sales"; this.quota = 100; } SalesPerson.prototype = new WorkerBee(); function Hobbyist( hobby ) { this.hobby = hobby || "yodeling"; } function Engineer ( name, projs, machine, hobby ) { this.base1 = WorkerBee; this.base1( name, "engineering", projs ) this.base2 = Hobbyist; this.base2( hobby ); this.projects = projs || new Array(); this.machine = machine || ""; } Engineer.prototype = new WorkerBee(); var idCounter = 1; var les = new Engineer( "Morris, Les", new Array("JavaScript"), "indy" ); Hobbyist.prototype.equipment = [ "horn", "mountain", "goat" ]; new TestCase( SECTION, "les.name", "Morris, Les", les.name ); new TestCase( SECTION, "les.dept", "engineering", les.dept ); Array.prototype.getClass = Object.prototype.toString; new TestCase( SECTION, "les.projects.getClass()", "[object Array]", les.projects.getClass() ); new TestCase( SECTION, "les.projects[0]", "JavaScript", les.projects[0] ); new TestCase( SECTION, "les.machine", "indy", les.machine ); new TestCase( SECTION, "les.hobby", "yodeling", les.hobby ); new TestCase( SECTION, "les.equpment", void 0, les.equipment ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/proto_3.js0000644000175000017500000000645011545150464021745 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: proto_3.js Section: Description: Adding properties to an instance This tests Object Hierarchy and Inheritance, as described in the document Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 15:19:34 on http://devedge.netscape.com/. Current URL: http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm This tests the syntax ObjectName.prototype = new PrototypeObject using the Employee example in the document referenced above. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "proto_3"; var VERSION = "JS1_3"; var TITLE = "Adding properties to an Instance"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function Employee () { this.name = ""; this.dept = "general"; } function Manager () { this.reports = []; } Manager.prototype = new Employee(); function WorkerBee () { this.projects = new Array(); } WorkerBee.prototype = new Employee(); function SalesPerson () { this.dept = "sales"; this.quota = 100; } SalesPerson.prototype = new WorkerBee(); function Engineer () { this.dept = "engineering"; this.machine = ""; } Engineer.prototype = new WorkerBee(); var jim = new Employee(); var pat = new Employee(); jim.bonus = 300; new TestCase( SECTION, "jim = new Employee(); jim.bonus = 300; jim.bonus", 300, jim.bonus ); new TestCase( SECTION, "pat = new Employee(); pat.bonus", void 0, pat.bonus ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/proto_4.js0000644000175000017500000001110611545150464021740 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: proto_4.js Section: Description: new PrototypeObject This tests Object Hierarchy and Inheritance, as described in the document Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 15:19:34 on http://devedge.netscape.com/. Current URL: http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm This tests the syntax ObjectName.prototype = new PrototypeObject using the Employee example in the document referenced above. If you add a property to an object in the prototype chain, instances of objects that derive from that prototype should inherit that property, even if they were instatiated after the property was added to the prototype object. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "proto_3"; var VERSION = "JS1_3"; var TITLE = "Adding properties to the prototype"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function Employee () { this.name = ""; this.dept = "general"; } function Manager () { this.reports = []; } Manager.prototype = new Employee(); function WorkerBee () { this.projects = new Array(); } WorkerBee.prototype = new Employee(); function SalesPerson () { this.dept = "sales"; this.quota = 100; } SalesPerson.prototype = new WorkerBee(); function Engineer () { this.dept = "engineering"; this.machine = ""; } Engineer.prototype = new WorkerBee(); var jim = new Employee(); var terry = new Engineer(); var sean = new SalesPerson(); var wally = new Manager(); Employee.prototype.specialty = "none"; var pat = new Employee(); var leslie = new Engineer(); var bubbles = new SalesPerson(); var furry = new Manager(); Engineer.prototype.specialty = "code"; var chris = new Engineer(); new TestCase( SECTION, "jim = new Employee(); jim.specialty", "none", jim.specialty ); new TestCase( SECTION, "terry = new Engineer(); terry.specialty", "code", terry.specialty ); new TestCase( SECTION, "sean = new SalesPerson(); sean.specialty", "none", sean.specialty ); new TestCase( SECTION, "wally = new Manager(); wally.specialty", "none", wally.specialty ); new TestCase( SECTION, "furry = new Manager(); furry.specialty", "none", furry.specialty ); new TestCase( SECTION, "pat = new Employee(); pat.specialty", "none", pat.specialty ); new TestCase( SECTION, "leslie = new Engineer(); leslie.specialty", "code", leslie.specialty ); new TestCase( SECTION, "bubbles = new SalesPerson(); bubbles.specialty", "none", bubbles.specialty ); new TestCase( SECTION, "chris = new Employee(); chris.specialty", "code", chris.specialty ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/proto_6.js0000644000175000017500000001111511545150464021742 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: proto_6.js Section: Description: Logical OR || in constructors This tests Object Hierarchy and Inheritance, as described in the document Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 15:19:34 on http://devedge.netscape.com/. Current URL: http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm This tests the syntax ObjectName.prototype = new PrototypeObject using the Employee example in the document referenced above. This tests the logical OR opererator || syntax in constructors. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "proto_6"; var VERSION = "JS1_3"; var TITLE = "Logical OR || in constructors"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function Employee ( name, dept ) { this.name = name || ""; this.dept = dept || "general"; } function Manager () { this.reports = []; } Manager.prototype = new Employee(); function WorkerBee ( name, dept, projs ) { this.base = Employee; this.base( name, dept) this.projects = projs || new Array(); } WorkerBee.prototype = new Employee(); function SalesPerson () { this.dept = "sales"; this.quota = 100; } SalesPerson.prototype = new WorkerBee(); function Engineer ( name, projs, machine ) { this.base = WorkerBee; this.base( name, "engineering", projs ) this.machine = machine || ""; } Engineer.prototype = new WorkerBee(); var pat = new Engineer( "Toonces, Pat", ["SpiderMonkey", "Rhino"], "indy" ); var les = new WorkerBee( "Morris, Les", "Training", ["Hippo"] ) var terry = new Employee( "Boomberi, Terry", "Marketing" ); // Pat, the Engineer new TestCase( SECTION, "pat.name", "Toonces, Pat", pat.name ); new TestCase( SECTION, "pat.dept", "engineering", pat.dept ); new TestCase( SECTION, "pat.projects.length", 2, pat.projects.length ); new TestCase( SECTION, "pat.projects[0]", "SpiderMonkey", pat.projects[0] ); new TestCase( SECTION, "pat.projects[1]", "Rhino", pat.projects[1] ); new TestCase( SECTION, "pat.machine", "indy", pat.machine ); // Les, the WorkerBee new TestCase( SECTION, "les.name", "Morris, Les", les.name ); new TestCase( SECTION, "les.dept", "Training", les.dept ); new TestCase( SECTION, "les.projects.length", 1, les.projects.length ); new TestCase( SECTION, "les.projects[0]", "Hippo", les.projects[0] ); // Terry, the Employee new TestCase( SECTION, "terry.name", "Boomberi, Terry", terry.name ); new TestCase( SECTION, "terry.dept", "Marketing", terry.dept ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/proto_7.js0000644000175000017500000000744011545150464021751 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: proto_7.js Section: Description: Adding Properties to the Prototype Object This tests Object Hierarchy and Inheritance, as described in the document Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 15:19:34 on http://devedge.netscape.com/. Current URL: http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm This tests the syntax ObjectName.prototype = new PrototypeObject using the Employee example in the document referenced above. This tests Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "proto_6"; var VERSION = "JS1_3"; var TITLE = "Adding properties to the Prototype Object"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function Employee ( name, dept ) { this.name = name || ""; this.dept = dept || "general"; } function WorkerBee ( name, dept, projs ) { this.base = Employee; this.base( name, dept) this.projects = projs || new Array(); } WorkerBee.prototype = new Employee(); function Engineer ( name, projs, machine ) { this.base = WorkerBee; this.base( name, "engineering", projs ) this.machine = machine || ""; } // Engineer.prototype = new WorkerBee(); var pat = new Engineer( "Toonces, Pat", ["SpiderMonkey", "Rhino"], "indy" ); Employee.prototype.specialty = "none"; // Pat, the Engineer new TestCase( SECTION, "pat.name", "Toonces, Pat", pat.name ); new TestCase( SECTION, "pat.dept", "engineering", pat.dept ); new TestCase( SECTION, "pat.projects.length", 2, pat.projects.length ); new TestCase( SECTION, "pat.projects[0]", "SpiderMonkey", pat.projects[0] ); new TestCase( SECTION, "pat.projects[1]", "Rhino", pat.projects[1] ); new TestCase( SECTION, "pat.machine", "indy", pat.machine ); new TestCase( SECTION, "pat.specialty", void 0, pat.specialty ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/proto_8.js0000644000175000017500000000741611545150464021755 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: proto_8.js Section: Description: Adding Properties to the Prototype Object This tests Object Hierarchy and Inheritance, as described in the document Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 15:19:34 on http://devedge.netscape.com/. Current URL: http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm This tests the syntax ObjectName.prototype = new PrototypeObject using the Employee example in the document referenced above. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "proto_8"; var VERSION = "JS1_3"; var TITLE = "Adding Properties to the Prototype Object"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function Employee ( name, dept ) { this.name = name || ""; this.dept = dept || "general"; } function WorkerBee ( name, dept, projs ) { this.base = Employee; this.base( name, dept) this.projects = projs || new Array(); } WorkerBee.prototype = new Employee(); function Engineer ( name, projs, machine ) { this.base = WorkerBee; this.base( name, "engineering", projs ) this.machine = machine || ""; } Engineer.prototype = new WorkerBee(); var pat = new Engineer( "Toonces, Pat", ["SpiderMonkey", "Rhino"], "indy" ); Employee.prototype.specialty = "none"; // Pat, the Engineer new TestCase( SECTION, "pat.name", "Toonces, Pat", pat.name ); new TestCase( SECTION, "pat.dept", "engineering", pat.dept ); new TestCase( SECTION, "pat.projects.length", 2, pat.projects.length ); new TestCase( SECTION, "pat.projects[0]", "SpiderMonkey", pat.projects[0] ); new TestCase( SECTION, "pat.projects[1]", "Rhino", pat.projects[1] ); new TestCase( SECTION, "pat.machine", "indy", pat.machine ); new TestCase( SECTION, "pat.specialty", "none", pat.specialty ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/proto_9.js0000644000175000017500000000645511545150464021760 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: proto_9.js Section: Description: Local versus Inherited Values This tests Object Hierarchy and Inheritance, as described in the document Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97 15:19:34 on http://devedge.netscape.com/. Current URL: http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm This tests the syntax ObjectName.prototype = new PrototypeObject using the Employee example in the document referenced above. This tests Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "proto_9"; var VERSION = "JS1_3"; var TITLE = "Local versus Inherited Values"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function Employee ( name, dept ) { this.name = name || ""; this.dept = dept || "general"; } function WorkerBee ( name, dept, projs ) { this.projects = new Array(); } WorkerBee.prototype = new Employee(); var pat = new WorkerBee() Employee.prototype.specialty = "none"; Employee.prototype.name = "Unknown"; Array.prototype.getClass = Object.prototype.toString; // Pat, the WorkerBee new TestCase( SECTION, "pat.name", "", pat.name ); new TestCase( SECTION, "pat.dept", "general", pat.dept ); new TestCase( SECTION, "pat.projects.getClass", "[object Array]", pat.projects.getClass() ); new TestCase( SECTION, "pat.projects.length", 0, pat.projects.length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/inherit/shell.js0000644000175000017500000000000011545150464021450 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/misc/browser.js0000644000175000017500000000000011545150464021315 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/misc/jstests.list0000644000175000017500000000000011545150464021670 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/misc/shell.js0000644000175000017500000000000011545150464020741 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/regress/browser.js0000644000175000017500000000000011545150464022034 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/regress/delete-001.js0000644000175000017500000000520311545150464022123 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: delete-001.js Section: regress Description: Regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=108736 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "JS1_2"; var VERSION = "JS1_2"; var TITLE = "The variable statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // delete all properties of the global object // per ecma, this does not affect variables in the global object declared // with var or functions for ( p in this ) { delete p; } var result =""; for ( p in this ) { result += String( p ); } // not too picky here... just want to make sure we didn't crash or something new TestCase( SECTION, "delete all properties of the global object", "PASSED", result == "" ? "FAILED" : "PASSED" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/regress/function-001-n.js0000644000175000017500000000535311545150464022747 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: boolean-001.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 * * eval("function f(){}function g(){}") at top level is an error for JS1.2 * and above (missing ; between named function expressions), but declares f * and g as functions below 1.2. * * Fails to produce error regardless of version: * js> version(100) * 120 * js> eval("function f(){}function g(){}") * js> version(120); * 100 * js> eval("function f(){}function g(){}") * js> * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "function-001.js"; var VERSION = "JS_1.3"; var TITLE = "functions not separated by semicolons are errors in version 120 and higher"; var BUGNUMBER="10278"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "eval(\"function f(){}function g(){}\")", "error", eval("function f(){}function g(){}") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/regress/function-002.js0000644000175000017500000000505511545150464022514 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: function-002.js Section: Description: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=249579 function definitions in conditional statements should be allowed. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "function-002"; var VERSION = "JS1_3"; var TITLE = "Regression test for 249579"; var BUGNUMBER="249579"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "0?function(){}:0", 0, 0?function(){}:0 ); bar = true; foo = bar ? function () { return true; } : function() { return false; }; new TestCase( SECTION, "bar = true; foo = bar ? function () { return true; } : function() { return false; }; foo()", true, foo() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/regress/in-001.js0000644000175000017500000000441011545150464021266 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: in-001.js Section: Description: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=196109 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "in-001"; var VERSION = "JS1_3"; var TITLE = "Regression test for 196109"; var BUGNUMBER="196109"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); o = {}; o.foo = 'sil'; new TestCase( SECTION, "\"foo\" in o", true, "foo" in o ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/regress/jstests.list0000644000175000017500000000030611545150464022420 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_3/regress/ script delete-001.js skip script function-001-n.js # obsolete test script function-002.js script in-001.js script new-001.js script switch-001.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/regress/new-001.js0000644000175000017500000000614611545150464021461 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: new-001.js Section: Description: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=76103 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "new-001"; var VERSION = "JS1_3"; var TITLE = "new-001"; var BUGNUMBER="31567"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function Test_One (x) { this.v = x+1; return x*2 } function Test_Two( x, y ) { this.v = x; return y; } new TestCase( SECTION, "Test_One(18)", 36, Test_One(18) ); new TestCase( SECTION, "new Test_One(18)", "[object Object]", new Test_One(18) +"" ); new TestCase( SECTION, "new Test_One(18).v", 19, new Test_One(18).v ); new TestCase( SECTION, "Test_Two(2,7)", 7, Test_Two(2,7) ); new TestCase( SECTION, "new Test_Two(2,7)", "[object Object]", new Test_Two(2,7) +"" ); new TestCase( SECTION, "new Test_Two(2,7).v", 2, new Test_Two(2,7).v ); new TestCase( SECTION, "new (Function)(\"x\", \"return x+3\")(5,6)", 8, new (Function)("x","return x+3")(5,6) ); new TestCase( SECTION, "new new Test_Two(String, 2).v(0123)", "83", new new Test_Two(String, 2).v(0123) +""); new TestCase( SECTION, "new new Test_Two(String, 2).v(0123).length", 2, new new Test_Two(String, 2).v(0123).length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/regress/shell.js0000644000175000017500000000000011545150464021460 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/regress/switch-001.js0000644000175000017500000000527511545150464022173 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: switch-001.js Section: Description: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315767 Verify that switches do not use strict equality in versions of JavaScript < 1.4. It's now been decided that we won't put in version switches, so all switches will be ECMA. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "switch-001"; var VERSION = "JS1_3"; var TITLE = "switch-001"; var BUGNUMBER="315767"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); result = "fail: did not enter switch"; switch (true) { case 1: result = "fail: version 130 should force strict equality"; break; case true: result = "pass"; break; default: result = "fail: evaluated default statement"; } new TestCase( SECTION, "switch / case should use strict equality in version of JS < 1.4", "pass", result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/Script/browser.js0000644000175000017500000000000011545150464021626 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/Script/delete-001.js0000644000175000017500000000520311545150464021715 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: delete-001.js Section: regress Description: Regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=108736 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "JS1_2"; var VERSION = "JS1_2"; var TITLE = "The variable statement"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); // delete all properties of the global object // per ecma, this does not affect variables in the global object declared // with var or functions for ( p in this ) { delete p; } var result =""; for ( p in this ) { result += String( p ); } // not too picky here... just want to make sure we didn't crash or something new TestCase( SECTION, "delete all properties of the global object", "PASSED", result == "" ? "FAILED" : "PASSED" ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/Script/function-001-n.js0000644000175000017500000000535311545150464022541 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: boolean-001.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=99232 * * eval("function f(){}function g(){}") at top level is an error for JS1.2 * and above (missing ; between named function expressions), but declares f * and g as functions below 1.2. * * Fails to produce error regardless of version: * js> version(100) * 120 * js> eval("function f(){}function g(){}") * js> version(120); * 100 * js> eval("function f(){}function g(){}") * js> * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "function-001.js"; var VERSION = "JS_1.3"; var TITLE = "functions not separated by semicolons are errors in version 120 and higher"; var BUGNUMBER="10278"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "eval(\"function f(){}function g(){}\")", "error", eval("function f(){}function g(){}") ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/Script/function-002.js0000644000175000017500000000505511545150464022306 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: function-002.js Section: Description: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=249579 function definitions in conditional statements should be allowed. Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "function-002"; var VERSION = "JS1_3"; var TITLE = "Regression test for 249579"; var BUGNUMBER="249579"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "0?function(){}:0", 0, 0?function(){}:0 ); bar = true; foo = bar ? function () { return true; } : function() { return false; }; new TestCase( SECTION, "bar = true; foo = bar ? function () { return true; } : function() { return false; }; foo()", true, foo() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/Script/in-001.js0000644000175000017500000000440711545150464021066 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: in-001.js Section: Description: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=196109 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "in-001"; var VERSION = "JS1_3"; var TITLE = "Regression test for 196109"; var BUGNUMBER="196109"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); o = {}; o.foo = 'sil'; new TestCase( SECTION, "\"foo\" in o", true, "foo" in o ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/Script/jstests.list0000644000175000017500000000030511545150464022211 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_3/Script/ script delete-001.js skip script function-001-n.js # obsolete test script function-002.js script in-001.js script new-001.js script switch-001.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/Script/new-001.js0000644000175000017500000000614611545150464021253 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: new-001.js Section: Description: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=76103 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "new-001"; var VERSION = "JS1_3"; var TITLE = "new-001"; var BUGNUMBER="31567"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function Test_One (x) { this.v = x+1; return x*2 } function Test_Two( x, y ) { this.v = x; return y; } new TestCase( SECTION, "Test_One(18)", 36, Test_One(18) ); new TestCase( SECTION, "new Test_One(18)", "[object Object]", new Test_One(18) +"" ); new TestCase( SECTION, "new Test_One(18).v", 19, new Test_One(18).v ); new TestCase( SECTION, "Test_Two(2,7)", 7, Test_Two(2,7) ); new TestCase( SECTION, "new Test_Two(2,7)", "[object Object]", new Test_Two(2,7) +"" ); new TestCase( SECTION, "new Test_Two(2,7).v", 2, new Test_Two(2,7).v ); new TestCase( SECTION, "new (Function)(\"x\", \"return x+3\")(5,6)", 8, new (Function)("x","return x+3")(5,6) ); new TestCase( SECTION, "new new Test_Two(String, 2).v(0123)", "83", new new Test_Two(String, 2).v(0123) +""); new TestCase( SECTION, "new new Test_Two(String, 2).v(0123).length", 2, new new Test_Two(String, 2).v(0123).length ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/Script/shell.js0000644000175000017500000000000011545150464021252 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_3/Script/switch-001.js0000644000175000017500000000515711545150464021764 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** File Name: switch-001.js Section: Description: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=315767 Verify that switches do not use strict equality in versions of JavaScript < 1.4 Author: christine@netscape.com Date: 12 november 1997 */ var SECTION = "switch-001"; var VERSION = "JS1_3"; var TITLE = "switch-001"; var BUGNUMBER="315767"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); result = "fail: did not enter switch"; switch (true) { case 1: result = "fail: for backwards compatibility, version 130 use strict equality"; break; case true: result = "pass"; break; default: result = "fail: evaluated default statement"; } new TestCase( SECTION, "switch / case should use strict equality in version of JS < 1.4", "pass", result ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Eval/browser.js0000644000175000017500000000000011545150464021252 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Eval/eval-001.js0000644000175000017500000000627111545150464021034 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: eval-001.js * Original Description: (SEE REVISED DESCRIPTION FURTHER BELOW) * * The global eval function may not be accessed indirectly and then called. * This feature will continue to work in JavaScript 1.3 but will result in an * error in JavaScript 1.4. This restriction is also in place for the With and * Closure constructors. * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451 * * Author: christine@netscape.com * Date: 11 August 1998 * * * REVISION: 05 February 2001 * Author: pschwartau@netscape.com * * Indirect eval IS NOT ILLEGAL per ECMA3!!! See * * http://bugzilla.mozilla.org/show_bug.cgi?id=38512 * * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 ------- * ECMA-262 Edition 3 doesn't require implementations to throw EvalError, * see the short, section-less Chapter 16. It does say an implementation that * doesn't throw EvalError must allow assignment to eval and indirect calls * of the evalnative method. * */ var SECTION = "eval-001.js"; var VERSION = "JS1_4"; var TITLE = "Calling eval indirectly should NOT fail in version 140"; var BUGNUMBER="38512"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var MY_EVAL = eval; var RESULT = ""; var EXPECT = "abcdefg"; MY_EVAL( "RESULT = EXPECT" ); new TestCase( SECTION, "Call eval indirectly", EXPECT, RESULT ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Eval/eval-002.js0000644000175000017500000000635611545150464021041 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: eval-002.js * Description: (SEE REVISED DESCRIPTION FURTHER BELOW) * * The global eval function may not be accessed indirectly and then called. * This feature will continue to work in JavaScript 1.3 but will result in an * error in JavaScript 1.4. This restriction is also in place for the With and * Closure constructors. * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451 * * Author: christine@netscape.com * Date: 11 August 1998 * * * REVISION: 05 February 2001 * Author: pschwartau@netscape.com * * Indirect eval IS NOT ILLEGAL per ECMA3!!! See * * http://bugzilla.mozilla.org/show_bug.cgi?id=38512 * * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 ------- * ECMA-262 Edition 3 doesn't require implementations to throw EvalError, * see the short, section-less Chapter 16. It does say an implementation that * doesn't throw EvalError must allow assignment to eval and indirect calls * of the evalnative method. * */ var SECTION = "eval-002.js"; var VERSION = "JS1_4"; var TITLE = "Calling eval indirectly should NOT fail in version 140"; var BUGNUMBER="38512"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var MY_EVAL = eval; var RESULT = ""; var EXPECT = 1 + "testString" EvalTest(); test(); function EvalTest() { MY_EVAL( "RESULT = EXPECT" ); new TestCase( SECTION, "Call eval indirectly", EXPECT, RESULT ); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Eval/eval-003.js0000644000175000017500000000666011545150464021040 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: eval-003.js * Description: (SEE REVISED DESCRIPTION FURTHER BELOW) * * The global eval function may not be accessed indirectly and then called. * This feature will continue to work in JavaScript 1.3 but will result in an * error in JavaScript 1.4. This restriction is also in place for the With and * Closure constructors. * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324451 * * Author: christine@netscape.com * Date: 11 August 1998 * * * REVISION: 05 February 2001 * Author: pschwartau@netscape.com * * Indirect eval IS NOT ILLEGAL per ECMA3!!! See * * http://bugzilla.mozilla.org/show_bug.cgi?id=38512 * * ------- Additional Comments From Brendan Eich 2001-01-30 17:12 ------- * ECMA-262 Edition 3 doesn't require implementations to throw EvalError, * see the short, section-less Chapter 16. It does say an implementation that * doesn't throw EvalError must allow assignment to eval and indirect calls * of the evalnative method. * */ var SECTION = "eval-003.js"; var VERSION = "JS1_4"; var TITLE = "Calling eval indirectly should NOT fail in version 140"; var BUGNUMBER="38512"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var MY_EVAL = eval; var RESULT = ""; var EXPECT= ""; var h = function f(x,y){var g = function(z){return Math.exp(z);}; return g(x+y);}; new EvalTest(); test(); function EvalTest() { with( this ) { MY_EVAL( "RESULT = h(-1, 1)" ); EXPECT = 1; //The base e to the power (-1 + 1), i.e. the power 0, equals 1 .... new TestCase( SECTION, "Call eval indirectly", EXPECT, RESULT ); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Eval/jstests.list0000644000175000017500000000020311545150464021632 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_4/Eval/ script eval-001.js script eval-002.js script eval-003.js script regress-531682.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Eval/regress-531682.js0000644000175000017500000000167711545150464022034 0ustar chr1schr1s/* -*- Mode: java; tab-width:8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ */ //----------------------------------------------------------------------------- var BUGNUMBER = 531682; var summary = 'Checking proper wrapping of scope in eval(source, scope)'; var actual; var expect; //----------------------------------------------------------------------------- var x = 0; test(); //----------------------------------------------------------------------------- function scope1() { eval('var x = 1;'); return function() { return x; } } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); // The scope chain in eval should be just scope1() and the global object. actual = eval('x', scope1()); expect = 0; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Eval/shell.js0000644000175000017500000000000011545150464020676 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Functions/browser.js0000644000175000017500000000000011545150464022333 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Functions/function-001.js0000644000175000017500000000757111545150464023017 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: function-001.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=324455 * * Earlier versions of JavaScript supported access to the arguments property * of the function object. This property held the arguments to the function. * function f() { * return f.arguments[0]; // deprecated * } * var x = f(3); // x will be 3 * * This feature is not a part of the final ECMA standard. Instead, scripts * should simply use just "arguments": * * function f() { * return arguments[0]; // okay * } * * var x = f(3); // x will be 3 * * Again, this feature was motivated by performance concerns. Access to the * arguments property is not threadsafe, which is of particular concern in * server environments. Also, the compiler can generate better code for * functions because it can tell when the arguments are being accessed only by * name and avoid setting up the arguments object. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "function-001.js"; var VERSION = "JS1_4"; var TITLE = "Accessing the arguments property of a function object"; var BUGNUMBER="324455"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "return function.arguments", "P", TestFunction_2("P", "A","S","S")[0] +""); new TestCase( SECTION, "return arguments", "P", TestFunction_1( "P", "A", "S", "S" )[0] +""); new TestCase( SECTION, "return arguments when function contains an arguments property", "PASS", TestFunction_3( "P", "A", "S", "S" ) +""); new TestCase( SECTION, "return function.arguments when function contains an arguments property", "PASS", TestFunction_4( "F", "A", "I", "L" ) +""); test(); function TestFunction_1( a, b, c, d, e ) { return arguments; } function TestFunction_2( a, b, c, d, e ) { return TestFunction_2.arguments; } function TestFunction_3( a, b, c, d, e ) { var arguments = "PASS"; return arguments; } function TestFunction_4( a, b, c, d, e ) { var arguments = "PASS"; return TestFunction_4.arguments; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Functions/jstests.list0000644000175000017500000000011511545150464022715 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_4/Functions/ script function-001.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Functions/shell.js0000644000175000017500000000000011545150464021757 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Regress/browser.js0000644000175000017500000000000011545150464021775 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Regress/date-001-n.js0000644000175000017500000000510111545150464021767 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: date-001-n.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=299903 * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "date-001-n.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 299903"; var BUGNUMBER="299903"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); function MyDate() { this.foo = "bar"; } MyDate.prototype = new Date(); DESCRIPTION = "function MyDate() { this.foo = \"bar\"; }; MyDate.prototype = new Date(); new MyDate().toString()"; EXPECTED = "error"; new TestCase( SECTION, "function MyDate() { this.foo = \"bar\"; }; "+ "MyDate.prototype = new Date(); " + "new MyDate().toString()", "error", new MyDate().toString() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Regress/function-001.js0000644000175000017500000000555511545150464022461 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: function-001.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=325843 * js> function f(a){var a,b;} * * causes an an assert on a null 'sprop' in the 'Variables' function in * jsparse.c This will crash non-debug build. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "function-001.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 325843"; var BUGNUMBER="3258435"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); eval("function f1 (a){ var a,b; }"); function f2( a ) { var a, b; }; new TestCase( SECTION, "eval(\"function f1 (a){ var a,b; }\"); "+ "function f2( a ) { var a, b; }; typeof f1", "function", typeof f1 ); // force a function decompilation new TestCase( SECTION, "typeof f1.toString()", "string", typeof f1.toString() ); new TestCase( SECTION, "typeof f2", "function", typeof f2 ); // force a function decompilation new TestCase( SECTION, "typeof f2.toString()", "string", typeof f2.toString() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Regress/function-002.js0000644000175000017500000001021111545150464022443 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: function-002.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=330462 * js> function f(a){var a,b;} * * causes an an assert on a null 'sprop' in the 'Variables' function in * jsparse.c This will crash non-debug build. * * Author: christine@netscape.com * Date: 11 August 1998 * REVISED: 04 February 2001 * (changed the comma expressions from trivial to non-trivial) * Author: pschwartau@netscape.com * * Brendan: "The test seemed to require something that ECMA does not * guarantee, and that JS1.4 didn't either. For example, given * * dec2 = "function f2(){1,2}"; * * the engine is free to decompile a function object compiled from this source, * via Function.prototype.toString(), into some other string that compiles to * an equivalent function. The engine now eliminates the useless comma expression * 1,2, giving function f2(){}. This should be legal by the testsuite's lights." * */ var SECTION = "function-002.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 325843"; var BUGNUMBER="330462"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); dec1 = "function f1(x,y){++x, --y}"; dec2 = "function f2(){var y; f1(1,2); y=new Date(); print(y.toString())}"; eval(dec1); eval(dec2); new TestCase( SECTION, "typeof f1", "function", typeof f1 ); // force a function decompilation new TestCase( SECTION, "f1.toString() == dec1", true, StripSpaces(f1.toString()) == StripSpaces(dec1)); new TestCase( SECTION, "typeof f2", "function", typeof f2 ); // force a function decompilation new TestCase( SECTION, "f2.toString() == dec2", true, StripSpaces(f2.toString().replace(/new Date\(\)/g, 'new Date')) == StripSpaces(dec2.replace(/new Date\(\)/g, 'new Date'))); test(); function StripSpaces( s ) { var strippedString = ""; for ( var currentChar = 0; currentChar < s.length; currentChar++ ) { if (!IsWhiteSpace(s.charAt(currentChar))) { strippedString += s.charAt(currentChar); } } return strippedString; } function IsWhiteSpace( string ) { var cc = string.charCodeAt(0); switch (cc) { case (0x0009): case (0x000B): case (0x000C): case (0x0020): case (0x000A): case (0x000D): case ( 59 ): // let's strip out semicolons, too return true; break; default: return false; } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Regress/function-003.js0000644000175000017500000000564411545150464022462 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: function-003.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104766 * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "toString-001.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 104766"; var BUGNUMBER="310514"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); new TestCase( SECTION, "StripSpaces(Array.prototype.concat.toString()).substring(0,17)", "functionconcat(){", StripSpaces(Array.prototype.concat.toString()).substring(0,17)); test(); function StripSpaces( s ) { for ( var currentChar = 0, strippedString=""; currentChar < s.length; currentChar++ ) { if (!IsWhiteSpace(s.charAt(currentChar))) { strippedString += s.charAt(currentChar); } } return strippedString; } function IsWhiteSpace( string ) { var cc = string.charCodeAt(0); switch (cc) { case (0x0009): case (0x000B): case (0x000C): case (0x0020): case (0x000A): case (0x000D): case ( 59 ): // let's strip out semicolons, too return true; break; default: return false; } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Regress/function-004-n.js0000644000175000017500000000467011545150464022714 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: function-004.js * Description: * * http://scopus.mcom.com/bugsplat/show_bug.cgi?id=310502 * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "funtion-004-n.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 310502"; var BUGNUMBER="310502"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var o = {}; o.call = Function.prototype.call; DESCRIPTION = "var o = {}; o.call = Function.prototype.call; o.call()"; EXPECTED = "error"; new TestCase( SECTION, "var o = {}; o.call = Function.prototype.call; o.call()", "error", o.call() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Regress/jstests.list0000644000175000017500000000032711545150464022364 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_4/Regress/ script date-001-n.js script function-001.js script function-002.js script function-003.js script function-004-n.js script regress-7224.js script toString-001-n.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Regress/regress-7224.js0000644000175000017500000000642411545150464022400 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: regress-7224.js * Reference: js1_2 * Description: Remove support for the arg * Author: ** replace with your e-mail address ** */ var SECTION = "regress"; // provide a document reference (ie, ECMA section) var VERSION = "JS1_4"; // Version of JavaScript or ECMA var TITLE = "Regression test for bugzilla #7224"; // Provide ECMA section title or a description var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=7224"; // Provide URL to bugsplat or bugzilla report startTest(); // leave this alone /* * Calls to AddTestCase here. AddTestCase is a function that is defined * in shell.js and takes three arguments: * - a string representation of what is being tested * - the expected result * - the actual result * * For example, a test might look like this: * * var zip = /[\d]{5}$/; * * AddTestCase( * "zip = /[\d]{5}$/; \"PO Box 12345 Boston, MA 02134\".match(zip)", // description of the test * "02134", // expected result * "PO Box 12345 Boston, MA 02134".match(zip) ); // actual result * */ var f = new Function( "return arguments.caller" ); var o = {}; o.foo = f; o.foo("a", "b", "c"); AddTestCase( "var f = new Function( 'return arguments.caller' ); f()", undefined, f() ); AddTestCase( "var o = {}; o.foo = f; o.foo('a')", undefined, o.foo('a') ); test(); // leave this alone. this executes the test cases and // displays results. mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Regress/shell.js0000644000175000017500000000000011545150464021421 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_4/Regress/toString-001-n.js0000644000175000017500000000472311545150464022674 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /** * File Name: toString-001-n.js * Description: * * Function.prototype.toString is not generic. * * Author: christine@netscape.com * Date: 11 August 1998 */ var SECTION = "toString-001.js"; var VERSION = "JS1_4"; var TITLE = "Regression test case for 310514"; var BUGNUMBER="310514"; startTest(); writeHeaderToLog( SECTION + " "+ TITLE); var o = {}; o.toString = Function.prototype.toString; DESCRIPTION = "var o = {}; o.toString = Function.prototype.toString; o.toString();"; EXPECTED = "error"; new TestCase( SECTION, "var o = {}; o.toString = Function.prototype.toString; o.toString();", "error", o.toString() ); test(); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/11.1.4.js0000644000175000017500000000566211545150464020524 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): David "liorean" Andersson * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 260106; var summary = 'Elisons in Array literals should not be enumed'; var actual = ''; var expect = ''; var status; var prop; var array; printBugNumber(BUGNUMBER); printStatus (summary); status = summary + ' ' + inSection(1) + ' [,1] '; array = [,1]; actual = ''; expect = '1'; for (prop in array) { if (prop != 'length') { actual += prop; } } reportCompare(expect, actual, status); status = summary + ' ' + inSection(2) + ' [,,1] '; array = [,,1]; actual = ''; expect = '2'; for (prop in array) { if (prop != 'length') { actual += prop; } } reportCompare(expect, actual, status); status = summary + ' ' + inSection(3) + ' [1,] '; array = [1,]; actual = ''; expect = '0'; for (prop in array) { if (prop != 'length') { actual += prop; } } reportCompare(expect, actual, status); status = summary + ' ' + inSection(4) + ' [1,,] '; array = [1,,]; actual = ''; expect = '0'; for (prop in array) { if (prop != 'length') { actual += prop; } } reportCompare(expect, actual, status); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/array-001.js0000644000175000017500000000676311545150464021421 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * igor@icesoft.no, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * Date: 24 September 2001 * * SUMMARY: Truncating arrays that have decimal property names. * From correspondence with Igor Bukanov : */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = '(none)'; var summary = 'Truncating arrays that have decimal property names'; var BIG_INDEX = 4294967290; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var arr = Array(BIG_INDEX); arr[BIG_INDEX - 1] = 'a'; arr[BIG_INDEX - 10000] = 'b'; arr[BIG_INDEX - 0.5] = 'c'; // not an array index - but a valid property name // Truncate the array - arr.length = BIG_INDEX - 5000; // Enumerate its properties with for..in var s = ''; for (var i in arr) { s += arr[i]; } /* * We expect s == 'cb' or 'bc' (EcmaScript does not fix the order). * Note 'c' is included: for..in includes ALL enumerable properties, * not just array-index properties. The bug was: Rhino gave s == ''. */ status = inSection(1); actual = sortThis(s); expect = 'bc'; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function sortThis(str) { var chars = str.split(''); chars = chars.sort(); return chars.join(''); } function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); for (var i=0; i var arr = new Array(0xFFFFFFFF) * js> arr.length * 4294967295 * * js> var arr = new Array(0x100000000) * RangeError: invalid array length * * * We'll try the largest possible array first, then a couple others. * We're just testing that we don't crash on Array.sort(). * * Try to be good about memory by nulling each array variable after it is * used. This will tell the garbage collector the memory is no longer needed. * * As of 2002-08-13, the JS shell runs out of memory no matter what we do, * when trying to sort such large arrays. * * We only want to test that we don't CRASH on the sort. So it will be OK * if we get the JS "out of memory" error. Note this terminates the test * with exit code 3. Therefore we put * * |expectExitCode(3);| * * The only problem will arise if the JS shell ever DOES have enough memory * to do the sort. Then this test will terminate with the normal exit code 0 * and fail. * * Right now, I can't see any other way to do this, because "out of memory" * is not a catchable error: it cannot be trapped with try...catch. * * * FURTHER HEADACHE: Rhino can't seem to handle the largest array: it hangs. * So we skip this case in Rhino. Here is correspondence with Igor Bukanov. * He explains that Rhino isn't actually hanging; it's doing the huge sort: * * Philip Schwartau wrote: * * > Hi, * > * > I'm getting a graceful OOM message on trying to sort certain large * > arrays. But if the array is too big, Rhino simply hangs. Note that ECMA * > allows array lengths to be anything less than Math.pow(2,32), so the * > arrays I'm sorting are legal. * > * > Note below, I'm getting an instantaneous OOM error on arr.sort() for LEN * > = Math.pow(2, 30). So shouldn't I also get one for every LEN between * > that and Math.pow(2, 32)? For some reason, I start to hang with 100% CPU * > as LEN hits, say, Math.pow(2, 31) and higher. SpiderMonkey gives OOM * > messages for all of these. Should I file a bug on this? * * Igor Bukanov wrote: * * This is due to different sorting algorithm Rhino uses when sorting * arrays with length > Integer.MAX_VALUE. If length can fit Java int, * Rhino first copies internal spare array to a temporary buffer, and then * sorts it, otherwise it sorts array directly. In case of very spare * arrays, that Array(big_number) generates, it is rather inefficient and * generates OutOfMemory if length fits int. It may be worth in your case * to optimize sorting to take into account array spareness, but then it * would be a good idea to file a bug about ineficient sorting of spare * arrays both in case of Rhino and SpiderMonkey as SM always uses a * temporary buffer. * */ //----------------------------------------------------------------------------- var BUGNUMBER = 157652; var summary = "Testing that Array.sort() doesn't crash on very large arrays"; var expect = 'No Crash'; var actual = 'No Crash'; printBugNumber(BUGNUMBER); printStatus(summary); expectExitCode(0); expectExitCode(5); var IN_RHINO = inRhino(); try { if (!IN_RHINO) { var a1=Array(0xFFFFFFFF); a1.sort(); a1 = null; } var a2 = Array(0x40000000); a2.sort(); a2=null; var a3=Array(0x10000000/4); a3.sort(); a3=null; } catch(ex) { // handle changed 1.9 branch behavior. see bug 422348 expect = 'InternalError: allocation size overflow'; actual = ex + ''; } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-178722.js0000644000175000017500000001143011545150464022212 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 06 November 2002 * SUMMARY: arr.sort() should not output |undefined| when |arr| is empty * See http://bugzilla.mozilla.org/show_bug.cgi?id=178722 * * ECMA-262 Ed.3: 15.4.4.11 Array.prototype.sort (comparefn) * * 1. Call the [[Get]] method of this object with argument "length". * 2. Call ToUint32(Result(1)). * 3. Perform an implementation-dependent sequence of calls to the [[Get]], * [[Put]], and [[Delete]] methods of this object, etc. etc. * 4. Return this object. * * * Note that sort() is done in-place on |arr|. In other words, sort() is a * "destructive" method rather than a "functional" method. The return value * of |arr.sort()| and |arr| are the same object. * * If |arr| is an empty array, the return value of |arr.sort()| should be * an empty array, not the value |undefined| as was occurring in bug 178722. * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 178722; var summary = 'arr.sort() should not output |undefined| when |arr| is empty'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var arr; // create empty array or pseudo-array objects in various ways var arr1 = Array(); var arr2 = new Array(); var arr3 = []; var arr4 = [1]; arr4.pop(); status = inSection(1); arr = arr1.sort(); actual = arr instanceof Array && arr.length === 0 && arr === arr1; expect = true; addThis(); status = inSection(2); arr = arr2.sort(); actual = arr instanceof Array && arr.length === 0 && arr === arr2; expect = true; addThis(); status = inSection(3); arr = arr3.sort(); actual = arr instanceof Array && arr.length === 0 && arr === arr3; expect = true; addThis(); status = inSection(4); arr = arr4.sort(); actual = arr instanceof Array && arr.length === 0 && arr === arr4; expect = true; addThis(); // now do the same thing, with non-default sorting: function g() {return 1;} status = inSection('1a'); arr = arr1.sort(g); actual = arr instanceof Array && arr.length === 0 && arr === arr1; expect = true; addThis(); status = inSection('2a'); arr = arr2.sort(g); actual = arr instanceof Array && arr.length === 0 && arr === arr2; expect = true; addThis(); status = inSection('3a'); arr = arr3.sort(g); actual = arr instanceof Array && arr.length === 0 && arr === arr3; expect = true; addThis(); status = inSection('4a'); arr = arr4.sort(g); actual = arr instanceof Array && arr.length === 0 && arr === arr4; expect = true; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 255555; var summary = 'Array.prototype.sort(comparefn) never passes undefined to comparefn'; var actual = 'not undefined'; var expect = 'not undefined'; printBugNumber(BUGNUMBER); printStatus (summary); function comparefn(a,b) { if (typeof a == 'undefined') { actual = 'undefined'; return 1; } if (typeof b == 'undefined') { actual = 'undefined'; return -1; } return a - b; } var arry = [ 1, 2, undefined ].sort(comparefn) reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-299644.js0000644000175000017500000000450711545150464022230 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): mozilla@florian.loitsch.com * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 299644; var summary = 'Arrays with holes'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); actual = (new Array(10).concat()).length; expect = 10; reportCompare(expect, actual, '(new Array(10).concat()).length == 10'); var a = new Array(10); actual = true; expect = true; for (var p in a) { actual = false; break; } reportCompare(expect, actual, 'Array holes are not enumerable'); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-300858.js0000644000175000017500000000422511545150464022213 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 300858; var summary = 'Do not crash when sorting array with holes'; var actual = 'No Crash'; var expect = 'No Crash'; var arry = []; arry[6] = 'six'; arry[8] = 'eight'; arry[9] = 'nine'; arry[13] = 'thirteen'; arry[14] = 'fourteen'; arry[21] = 'twentyone'; arry.sort(); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-310351.js0000644000175000017500000000553211545150464022202 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Seno.Aiko@gmail.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 310351; var summary = 'Convert host "list" objects to arrays'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var nodeList = []; if (typeof document != 'undefined') { nodeList = document.getElementsByTagName('*'); } else { printStatus('test using dummy array since no document available'); } var array = Array.prototype.slice.call(nodeList, 0); expect = 'Array'; actual = array.constructor.name; // nodeList is live and may change var saveLength = nodeList.length; reportCompare(expect, actual, summary + ': constructor test'); expect = saveLength; actual = array.length; reportCompare(expect, actual, summary + ': length test'); expect = true; actual = true; for (var i = 0; i < saveLength; i++) { if (array[i] != nodeList[i]) { actual = false; summary += ' Comparison failed: array[' + i + ']=' + array[i] + ', nodeList[' + i + ']=' + nodeList[i]; break; } } reportCompare(expect, actual, summary + ': identical elements test'); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-311515.js0000644000175000017500000000420411545150464022200 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 311515; var summary = 'Array.sort should skip holes and undefined during sort'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var a = [, 1, , 2, undefined]; actual = a.sort().toString(); expect = '1,2,,,'; reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-313153.js0000644000175000017500000000423211545150464022201 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 313153; var summary = 'generic native method dispatcher extra actual arguments'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); expect = '1,2,3'; actual = (function (){return Array.concat.apply([], arguments)})(1,2,3).toString(); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-315509-01.js0000644000175000017500000000434711545150464022435 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): moz_bug_r_a4 * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 315509; var summary = 'Array.prototype.unshift on Arrays with holes'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var a = [0,1,2,3,4]; delete a[1]; expect = '0,,2,3,4'; actual = a.toString(); reportCompare(expect, actual, summary); a.unshift('a','b'); expect = 'a,b,0,,2,3,4'; actual = a.toString(); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-330812.js0000644000175000017500000000466111545150464022210 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 330812; var summary = 'Making Array(1<<29).sort() less problematic'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); expectExitCode(0); expectExitCode(3); printStatus('This test passes if the browser does not hang or crash'); printStatus('This test expects exit code 0 or 3 to indicate out of memory'); try { var result = Array(1 << 29).sort(); } catch(ex) { // handle changed 1.9 branch behavior. see bug 422348 expect = 'InternalError: allocation size overflow'; actual = ex + ''; } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-345961.js0000644000175000017500000000475611545150464022230 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 345961; var summary = 'Array.prototype.shift should preserve holes'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = false; var array = new Array(2); array.shift(); actual = array.hasOwnProperty(0); reportCompare(expect, actual, summary); array=Array(1); array.shift(1); actual = array.hasOwnProperty(1); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-348810.js0000644000175000017500000000450711545150464022216 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 348810; var summary = 'Do not crash when sorting an array of holes'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var a = Array(1); a.sort(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-350256-01.js0000644000175000017500000000536011545150464022427 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Bertrand Le Roy * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 350256; var summary = 'Array.apply maximum arguments: 2^16'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(Math.pow(2, 16)); //----------------------------------------------------------------------------- function test(length) { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var a = new Array(); a[length - 2] = 'length-2'; a[length - 1] = 'length-1'; var b = Array.apply(null, a); expect = length + ',length-2,length-1'; actual = b.length + "," + b[length - 2] + "," + b[length - 1]; reportCompare(expect, actual, summary); function f() { return arguments.length + "," + arguments[length - 2] + "," + arguments[length - 1]; } expect = length + ',length-2,length-1'; actual = f.apply(null, a); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-350256-02.js0000644000175000017500000000537611545150464022437 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Bertrand Le Roy * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 350256; var summary = 'Array.apply maximum arguments: 2^19 - 1024'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(Math.pow(2, 19) - 1024); //----------------------------------------------------------------------------- function test(length) { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var a = new Array(); a[length - 2] = 'length-2'; a[length - 1] = 'length-1'; var b = Array.apply(null, a); expect = length + ',length-2,length-1'; actual = b.length + "," + b[length - 2] + "," + b[length - 1]; reportCompare(expect, actual, summary); function f() { return arguments.length + "," + arguments[length - 2] + "," + arguments[length - 1]; } expect = length + ',length-2,length-1'; actual = f.apply(null, a); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-350256-03.js0000644000175000017500000000564411545150464022436 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Bertrand Le Roy * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 350256; var summary = 'Array.apply maximum arguments: 2^19-1024'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(Math.pow(2, 19)-1024); //----------------------------------------------------------------------------- function test(length) { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { var a = new Array(); a[length - 2] = 'length-2'; a[length - 1] = 'length-1'; var b = Array.apply(null, a); expect = length + ',length-2,length-1'; actual = b.length + "," + b[length - 2] + "," + b[length - 1]; reportCompare(expect, actual, summary); function f() { return arguments.length + "," + arguments[length - 2] + "," + arguments[length - 1]; } expect = length + ',length-2,length-1'; actual = f.apply(null, a); } catch(ex) { expect = 'InternalError: script stack space quota is exhausted'; actual = ex + ''; print(actual); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-360681-01.js0000644000175000017500000000457711545150464022443 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 360681; var summary = 'Regression from bug 224128'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'No Crash'; var a = Array(3); a[0] = 1; a[1] = 2; a.sort(function () { gc(); return 1; }); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-360681-02.js0000644000175000017500000000630611545150464022434 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 360681; var summary = 'Regression from bug 224128'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'No Crash'; var N = 1000; // Make an array with a hole at the end var a = Array(N); for (i = 0; i < N - 1; ++i) a[i] = 1; // array_sort due for array with N elements with allocates a temporary vector // with 2*N. Lets create strings that on 32 and 64 bit CPU cause allocation // of the same amount of memory + 1 word for their char arrays. After we GC // strings with a reasonable malloc implementation that memory will be most // likely reused in array_sort for the temporary vector. Then the bug causes // accessing the one-beyond-the-aloocation word and re-interpretation of // 0xFFF0FFF0 as GC thing. var str1 = Array(2*(2*N + 1) + 1).join(String.fromCharCode(0xFFF0)); var str2 = Array(4*(2*N + 1) + 1).join(String.fromCharCode(0xFFF0)); gc(); str1 = str2 = null; gc(); var firstCall = true; a.sort(function (a, b) { if (firstCall) { firstCall = false; gc(); } return a - b; }); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-364104.js0000644000175000017500000001032611545150464022204 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Jeff Walden . * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = "364104"; var summary = "Array.prototype.indexOf, Array.prototype.lastIndexOf issues " + "with the optional second fromIndex argument"; var actual, expect; printBugNumber(BUGNUMBER); printStatus(summary); /************** * BEGIN TEST * **************/ var failed = false; try { // indexOf if ([2].indexOf(2) != 0) throw "indexOf: not finding 2!?"; if ([2].indexOf(2, 0) != 0) throw "indexOf: not interpreting explicit second argument 0!"; if ([2].indexOf(2, 1) != -1) throw "indexOf: ignoring second argument with value equal to array length!"; if ([2].indexOf(2, 2) != -1) throw "indexOf: ignoring second argument greater than array length!"; if ([2].indexOf(2, 17) != -1) throw "indexOf: ignoring large second argument!"; if ([2].indexOf(2, -5) != 0) throw "indexOf: calculated fromIndex < 0, should search entire array!"; if ([2, 3].indexOf(2, -1) != -1) throw "indexOf: not handling index == (-1 + 2), element 2 correctly!"; if ([2, 3].indexOf(3, -1) != 1) throw "indexOf: not handling index == (-1 + 2), element 3 correctly!"; // lastIndexOf if ([2].lastIndexOf(2) != 0) throw "lastIndexOf: not finding 2!?"; if ([2].lastIndexOf(2, 1) != 0) throw "lastIndexOf: not interpreting explicit second argument 1!?"; if ([2].lastIndexOf(2, 17) != 0) throw "lastIndexOf: should have searched entire array!"; if ([2].lastIndexOf(2, -5) != -1) throw "lastIndexOf: -5 + 1 < 0, so array shouldn't be searched!"; if ([2].lastIndexOf(2, -2) != -1) throw "lastIndexOf: -2 + 1 < 0, so array shouldn't be searched!"; if ([2, 3].lastIndexOf(2, -1) != 0) throw "lastIndexOf: not handling index == (-1 + 2), element 2 correctly!"; if ([2, 3].lastIndexOf(3, -1) != 1) throw "lastIndexOf: not handling index == (-1 + 2), element 3 correctly!"; if ([2, 3].lastIndexOf(2, -2) != 0) throw "lastIndexOf: not handling index == (-2 + 2), element 2 correctly!"; if ([2, 3].lastIndexOf(3, -2) != -1) throw "lastIndexOf: not handling index == (-2 + 2), element 3 correctly!"; if ([2, 3].lastIndexOf(2, -3) != -1) throw "lastIndexOf: calculated fromIndex < 0, shouldn't search array for 2!"; if ([2, 3].lastIndexOf(3, -3) != -1) throw "lastIndexOf: calculated fromIndex < 0, shouldn't search array for 3!"; } catch (e) { failed = e; } expect = false; actual = failed; reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-422286.js0000644000175000017500000000463211545150464022215 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Mike Shaver * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 422286; var summary = 'Array slice when array\'s length is assigned'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); Array(10000).slice(1); a = Array(1); a.length = 10000; a.slice(1); a = Array(1); a.length = 10000; a.slice(-1); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-424954.js0000644000175000017500000000141111545150464022211 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* * Any copyright is dedicated to the Public Domain. * http://creativecommons.org/licenses/publicdomain/ * Contributor: Bob Clary */ //----------------------------------------------------------------------------- var BUGNUMBER = 424954; var summary = 'Do not crash with [].concat(null)'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); [].concat(null); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-451483.js0000644000175000017500000000463411545150464022220 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Garrett Smith * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 451483; var summary = '[].splice.call(0) == []'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = true; var result = [].splice.call(0); print('[].splice.call(0) = ' + result); actual = result instanceof Array && result.length == 0; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-451906.js0000644000175000017500000000453511545150464022220 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Steve Roussey * Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 451906; var summary = 'Index array by numeric string'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 1; var s=[1,2,3]; actual = s['0']; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-456845.js0000644000175000017500000000532211545150464022222 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Dorus Peelen * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 456845; var summary = 'JIT: popArrs[a].pop is not a function'; var actual = 'No Error'; var expect = 'No Error'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); jit(true); try { var chars = '0123456789abcdef'; var size = 1000; var mult = 100; var arr = []; var lsize = size; while (lsize--) { arr.push(chars); } var popArrs = []; for (var i=0; i * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 99120; var summary = 'sort() should not be O(N^2) on sorted data'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var data = {X:[], Y:[]}; for (var size = 5000; size <= 15000; size += 1000) { data.X.push(size); data.Y.push(testSort(size)); gc(); } var order = BigO(data); var msg = ''; for (var p = 0; p < data.X.length; p++) { msg += '(' + data.X[p] + ', ' + data.Y[p] + '); '; } printStatus(msg); printStatus('Order: ' + order); reportCompare(true, order < 2 , 'BigO ' + order + ' < 2'); function testSort(size) { var arry = new Array(size); for (var i = 0; i < size; i++) { arry[i] = i; } var start = new Date(); arry.sort(compareFn); var stop = new Date(); return stop - start; } function compareFn(a, b) { return a - b; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/regress-99120-02.js0000644000175000017500000000524011545150464022345 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Phil Schwartau * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 99120; var summary = 'sort() should not be O(N^2) on nearly sorted data'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var data = {X:[], Y:[]}; for (var size = 5000; size <= 15000; size += 1000) { data.X.push(size); data.Y.push(testSort(size)); gc(); } var order = BigO(data); var msg = ''; for (var p = 0; p < data.X.length; p++) { msg += '(' + data.X[p] + ', ' + data.Y[p] + '); '; } printStatus(msg); printStatus('Order: ' + order); reportCompare(true, order < 2 , 'BigO ' + order + ' < 2'); function testSort(size) { var arry = new Array(size); for (var i = 0; i < size; i++) { arry[i] = i + ''; } var start = new Date(); arry.sort(); var stop = new Date(); return stop - start; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Array/shell.js0000644000175000017500000000000011545150464021066 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Date/browser.js0000644000175000017500000000000011545150464021241 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Date/jstests.list0000644000175000017500000000035411545150464021630 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_5/Date/ script regress-188211.js script regress-301738-01.js script regress-301738-02.js script regress-309925-01.js script regress-309925-02.js script regress-346027.js script regress-346363.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Date/regress-188211.js0000644000175000017500000000455411545150464022014 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Phil Schwartau * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 188211; var summary = 'Date.prototype.toLocaleString() error on future dates'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var dt; dt = new Date(208e10); printStatus(dt+''); expect = true; actual = dt.toLocaleString().indexOf('2035') >= 0; reportCompare(expect, actual, summary + ': new Date(208e10)'); dt = new Date(209e10); printStatus(dt+''); expect = true; actual = dt.toLocaleString().indexOf('2036') >= 0; reportCompare(expect, actual, summary + ': new Date(209e10)'); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Date/regress-301738-01.js0000644000175000017500000001047111545150464022226 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 301738; var summary = 'Date parse compatibilty with MSIE'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); /* Case 1. The input string contains an English month name. The form of the string can be month f l, or f month l, or f l month which each evaluate to the same date. If f and l are both greater than or equal to 70, or both less than 70, the date is invalid. The year is taken to be the greater of the values f, l. If the year is greater than or equal to 70 and less than 100, it is considered to be the number of years after 1900. */ var month = 'January'; var f; var l; f = l = 0; expect = true; actual = isNaN(new Date(month + ' ' + f + ' ' + l)); reportCompare(expect, actual, 'January 0 0 is invalid'); actual = isNaN(new Date(f + ' ' + l + ' ' + month)); reportCompare(expect, actual, '0 0 January is invalid'); actual = isNaN(new Date(f + ' ' + month + ' ' + l)); reportCompare(expect, actual, '0 January 0 is invalid'); f = l = 70; actual = isNaN(new Date(month + ' ' + f + ' ' + l)); reportCompare(expect, actual, 'January 70 70 is invalid'); actual = isNaN(new Date(f + ' ' + l + ' ' + month)); reportCompare(expect, actual, '70 70 January is invalid'); actual = isNaN(new Date(f + ' ' + month + ' ' + l)); reportCompare(expect, actual, '70 January 70 is invalid'); f = 100; l = 15; // year, month, day expect = new Date(f, 0, l).toString(); actual = new Date(month + ' ' + f + ' ' + l).toString(); reportCompare(expect, actual, 'month f l'); actual = new Date(f + ' ' + l + ' ' + month).toString(); reportCompare(expect, actual, 'f l month'); actual = new Date(f + ' ' + month + ' ' + l).toString(); reportCompare(expect, actual, 'f month l'); f = 80; l = 15; // year, month, day expect = (new Date(f, 0, l)).toString(); actual = (new Date(month + ' ' + f + ' ' + l)).toString(); reportCompare(expect, actual, 'month f l'); actual = (new Date(f + ' ' + l + ' ' + month)).toString(); reportCompare(expect, actual, 'f l month'); actual = (new Date(f + ' ' + month + ' ' + l)).toString(); reportCompare(expect, actual, 'f month l'); f = 2040; l = 15; // year, month, day expect = (new Date(f, 0, l)).toString(); actual = (new Date(month + ' ' + f + ' ' + l)).toString(); reportCompare(expect, actual, 'month f l'); actual = (new Date(f + ' ' + l + ' ' + month)).toString(); reportCompare(expect, actual, 'f l month'); actual = (new Date(f + ' ' + month + ' ' + l)).toString(); reportCompare(expect, actual, 'f month l'); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Date/regress-301738-02.js0000644000175000017500000001045611545150464022232 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 301738; var summary = 'Date parse compatibilty with MSIE'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); /* Case 2. The input string is of the form "f/m/l" where f, m and l are integers, e.g. 7/16/45. Adjust the mon, mday and year values to achieve 100% MSIE compatibility. a. If 0 <= f < 70, f/m/l is interpreted as month/day/year. i. If year < 100, it is the number of years after 1900 ii. If year >= 100, it is the number of years after 0. b. If 70 <= f < 100 i. If m < 70, f/m/l is interpreted as year/month/day where year is the number of years after 1900. ii. If m >= 70, the date is invalid. c. If f >= 100 i. If m < 70, f/m/l is interpreted as year/month/day where year is the number of years after 0. ii. If m >= 70, the date is invalid. */ var f; var m; var l; function newDate(f, m, l) { return new Date(f + '/' + m + '/' + l); } function newDesc(f, m, l) { return f + '/' + m + '/' + l; } // 2.a.i f = 0; m = 0; l = 0; expect = (new Date(l, f-1, m)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); f = 0; m = 0; l = 100; expect = (new Date(l, f-1, m)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); // 2.a.ii f = 0; m = 24; l = 100; expect = (new Date(l, f-1, m)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); f = 0; m = 24; l = 2100; expect = (new Date(l, f-1, m)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); // 2.b.i f = 70; m = 24; l = 100; expect = (new Date(f, m-1, l)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); f = 99; m = 12; l = 1; expect = (new Date(f, m-1, l)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); // 2.b.ii. f = 99; m = 70; l = 1; expect = true; actual = isNaN(newDate(f, m, l)); reportCompare(expect, actual, newDesc(f, m, l) + ' is an invalid date'); // 2.c.i f = 100; m = 12; l = 1; expect = (new Date(f, m-1, l)).toDateString(); actual = newDate(f, m, l).toDateString(); reportCompare(expect, actual, newDesc(f, m, l)); // 2.c.ii f = 100; m = 70; l = 1; expect = true; actual = isNaN(newDate(f, m, l)); reportCompare(expect, actual, newDesc(f, m, l) + ' is an invalid date'); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Date/regress-309925-01.js0000644000175000017500000000413111545150464022230 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 309925; var summary = 'Correctly parse Date strings with HH:MM'; var actual = new Date('Sep 24, 11:58 105') + ''; var expect = new Date('Sep 24, 11:58:00 105') + ''; printBugNumber(BUGNUMBER); printStatus (summary); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Date/regress-309925-02.js0000644000175000017500000000416511545150464022240 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 309925; var summary = 'Correctly parse Date strings with HH:MM(comment)'; var actual = new Date('Sep 24, 11:58(comment) 105') + ''; var expect = new Date('Sep 24, 11:58:00 (comment) 105') + ''; printBugNumber(BUGNUMBER); printStatus (summary); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Date/regress-346027.js0000644000175000017500000000452411545150464022012 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Feng Qian * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 346027; var summary = 'Date.prototype.setFullYear()'; var actual = ''; var expect = true; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var d = new Date(); d.setFullYear(); actual = isNaN(d.getFullYear()); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Date/regress-346363.js0000644000175000017500000000454211545150464022015 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 346363; var summary = 'Date.prototype.setFullYear()'; var actual = ''; var expect = true; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var d = new Date(); d.setFullYear(); d.setFullYear(2006); actual = d.getFullYear() == 2006; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Date/shell.js0000644000175000017500000000000011545150464020665 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/browser.js0000644000175000017500000000000011545150464023213 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/jstests.list0000644000175000017500000000334111545150464023601 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_5/decompilation/ script regress-344120.js script regress-346892.js script regress-346902.js script regress-346904.js script regress-346915.js skip script regress-349484.js # obsolete test script regress-349489.js script regress-349491.js script regress-349596.js script regress-349650.js script regress-349663.js script regress-350242.js script regress-350263.js script regress-350271.js script regress-350666.js script regress-350670.js script regress-351104.js script regress-351219.js skip script regress-351336.js # obsolete test script regress-351597.js script regress-351625.js skip script regress-351626.js # obsolete test script regress-351693.js script regress-351705.js script regress-351793.js script regress-352013.js script regress-352022.js script regress-352073.js script regress-352202.js script regress-352312.js script regress-352360.js script regress-352375.js script regress-352453.js script regress-352649.js script regress-352873-01.js script regress-352873-02.js script regress-353000.js script regress-353120.js script regress-353146.js skip script regress-354878.js # obsolete test script regress-354910.js script regress-356083.js script regress-371692.js skip script regress-373678.js # obsolete test script regress-375639.js script regress-375882.js script regress-376564.js script regress-383721.js script regress-406555.js skip script regress-437288-02.js # obsolete test script regress-443071-01.js script regress-456964-01.js script regress-457093-01.js script regress-457824.js script regress-460116-01.js script regress-460116-02.js script regress-460116-03.js script regress-460501.js script regress-460870.js script regress-461108.js script regress-461110.js script regress-461111.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-344120.js0000644000175000017500000000452511545150464023755 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): timeless * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 344120; var summary = 'function to source with numeric labels'; var actual = ''; var expect; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'function () { x = {1:1};}'; actual = ''+function (){x={1:1}} compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-346892.js0000644000175000017500000000453511545150464024000 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 346892; var summary = 'decompilation of new Function("3")'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'function anonymous() {\n}'; actual = (new Function("3")) + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-346902.js0000644000175000017500000000547211545150464023771 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 346902; var summary = 'uneval expressions with object literals'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; expect = 'function () {\n' + ' ({}[alert(5)]);\n' + '}'; try { f = eval('(function () { 1 ? {}[alert(5)] : 0; })'); actual = f + ''; compareSource(expect, actual, summary); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary); } expect = 'function () {\n' + ' [alert(5)];\n' + '}'; try { f = eval('(function () { {}[alert(5)]; })'); actual = f + ''; compareSource(expect, actual, summary); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary); } exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-346904.js0000644000175000017500000000756011545150464023773 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 346904; var summary = 'uneval expressions with double negation, negation decrement'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; // - -- expect = 'function () {\n' + ' return - --x;\n' + '}'; try { f = eval('(function () { return - --x; })'); actual = f + ''; compareSource(expect, actual, summary); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary); } // - - expect = 'function () {\n' + ' return - - x;\n' + '}'; try { f = eval('(function () { return - - x; })'); actual = f + ''; compareSource(expect, actual, summary); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary); } // --- expect = 'SyntaxError'; try { f = eval('(function () { return ---x; })'); actual = f + ''; compareSource(expect, actual, summary); } catch(ex) { actual = ex.name; reportCompare(expect, actual, summary); } // + ++ expect = 'function () {\n' + ' return + ++x;\n' + '}'; try { f = eval('(function () { return + ++x; })'); actual = f + ''; compareSource(expect, actual, summary); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary); } // + + expect = 'function () {\n' + ' return + + x;\n' + '}'; try { f = eval('(function () { return + + x; })'); actual = f + ''; compareSource(expect, actual, summary); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary); } // +++ expect = 'SyntaxError'; try { f = eval('(function () { return +++x; })'); actual = f + ''; } catch(ex) { actual = ex.name; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-346915.js0000644000175000017500000000456611545150464024000 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 346915; var summary = 'Optimize decompilation of delete expressions'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { delete 3; }; expect = 'function () {\n}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-349484.js0000644000175000017500000000522211545150464023772 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 349484; var summary = 'Incorrect decompilation of import/export statements'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'function () {\n export x;\n alert(5);\n}'; var f = function() { export x; alert(5); }; actual = f.toString(); print(f.toString()); compareSource(expect, actual, summary); expect = 'function () {\n import o.x;\n alert(5);\n}'; f = function () { import o.x; alert(5); } actual = f.toString(); print(f.toString()); compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-349489.js0000644000175000017500000000514711545150464024005 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 349489; var summary = 'Incorrect decompilation of labeled useless statements'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'function () {\nL:\n 3;\n}'; var f = function() { L: 3; }; actual = f.toString(); print(f.toString()); compareSource(expect, actual, summary); expect = 'function () {\nL:\n 3;\n alert(5);\n}'; f = function() { L: 3; alert(5); } actual = f.toString(); print(f.toString()); compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-349491.js0000644000175000017500000000556611545150464024003 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 349491; var summary = 'Incorrect decompilation due to assign to const'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var a; a = function () { const z = 3; g = 7; g = z += 1; return g }; expect = a(); actual = (eval('(' + a + ')'))(); reportCompare(expect, actual, summary); a = function () { const z = 3; return z += 2 }; expect = a(); actual = (eval('(' + a + ')'))(); reportCompare(expect, actual, summary); expect = 'function () {\n const z = 3;\n}'; a = function () { const z = 3; z = 4; } actual = a.toString(); compareSource(expect, actual, summary); expect = 'function () {\n const z = 3;\n}'; a = function () { const z = 3; 4; } actual = a.toString(); compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-349596.js0000644000175000017500000000457611545150464024011 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 349596; var summary = 'decompilation of labeled if(0)...'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function() { L: if (0) return 5 } expect = 'function () {\n L: {\n }\n}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-349650.js0000644000175000017500000000473511545150464023775 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 349650; var summary = 'Number getting parens replaces last character of identifier in decompilation of array comprehension'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { [5[7] for (y in window)]; } expect = 'function () {\n [(5)[7] for (y in window)];\n}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-349663.js0000644000175000017500000000465111545150464023776 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 349663; var summary = 'decompilation of Function with const *='; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f, g; f = function() { const h; for(null; h *= ""; null) ; } g = eval('(' + f + ')'); expect = f + ''; actual = g + ''; print(f); compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-350242.js0000644000175000017500000000502411545150464023752 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 350242; var summary = 'decompilation of delete 0x11.x'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function () { delete 0x11.x } expect = 'function () {\n delete (17).x;\n}'; actual = f + ''; compareSource(expect, actual, summary); f = function () { delete (17).x } expect = 'function () {\n delete (17).x;\n}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-350263.js0000644000175000017500000000457111545150464023763 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 350263; var summary = 'decompilation of labeled if(1);'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function () { L: if(1); } expect = 'function () {\n L: {\n }\n}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-350271.js0000644000175000017500000000463211545150464023760 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 350271; var summary = 'decompilation if (0x10.(a))'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function () { if(0x10.(a)) { h(); } } expect = 'function () {\n if ((16).(a)) {\n h();\n }\n}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-350666.js0000644000175000017500000000565611545150464023777 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 350666; var summary = 'decompilation for (;; delete expr)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function () { for(;; delete y.(x)) { } } actual = f + ''; expect = 'function () {\n for (;; y.(x), true) {\n }\n}'; compareSource(expect, actual, summary); try { eval('(' + expect + ')'); actual = 'No Error'; } catch(ex) { actual = ex + ''; } expect = 'No Error'; reportCompare(expect, actual, summary); f = function () { for(;; delete (y+x)) { } } actual = f + ''; expect = 'function () {\n for (;; y + x, true) {\n }\n}'; compareSource(expect, actual, summary); try { eval('(' + expect + ')'); actual = 'No Error'; } catch(ex) { actual = ex + ''; } expect = 'No Error'; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-350670.js0000644000175000017500000000507511545150464023765 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 350670; var summary = 'decompilation of (for(z() in x)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { for(z() in x) { } } expect = 'function () {\n for (z() in x) {\n }\n}'; actual = f + ''; compareSource(expect, actual, summary); f = function() { for(z(12345678) in x) { } } expect = 'function () {\n for (z(12345678) in x) {\n }\n}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-351104.js0000644000175000017500000000464611545150464023761 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351104; var summary = 'decompilation of for with ternary as initializer'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function () { for((0 ? 2 : ({})); ; ) { } } expect = 'function () {\n for ({};;) {\n }\n}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-351219.js0000644000175000017500000000514311545150464023761 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351219; var summary = 'Decompilation of immutable infinity, NaN'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function () { return 2e308 }; expect = 'function () { return 1 / 0; }'; actual = f + ''; compareSource(expect, actual, summary + ' decompile Infinity as 1/0'); f = function () { var NaN = 1 % 0; return NaN }; expect = 'function () { var NaN = 0 / 0; return NaN; }'; actual = f + ''; compareSource(expect, actual, summary + ': decompile NaN as 0/0'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-351336.js0000644000175000017500000000465011545150464023763 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351336; var summary = 'decompilation of for initialization containing for'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function () { for (("p" in a); 0;) { } } expect = 'function () {\n for (("p" in a); 0;) {\n }\n}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-351597.js0000644000175000017500000000462411545150464023775 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351597; var summary = 'decompilation of new expression with extra parens'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { new ((x=a))(y) } expect = 'function () {\n new (x = a)(y);\n}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-351625.js0000644000175000017500000000457611545150464023773 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351625; var summary = 'decompilation of object literal'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { ({a:b, c:3}); } expect = 'function () {\n ({a:b, c:3});\n}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-351626.js0000644000175000017500000000464611545150464023772 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351626; var summary = 'decompilation of if(lamda)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function () { if (function () {}) { g(); } } actual = f + ''; expect = 'function () {\n if (function () {}) {\n g();\n }\n}'; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-351693.js0000644000175000017500000000462211545150464023770 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351693; var summary = 'decompilation of ternary with parenthesized constant condition'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { (0) ? x : y } actual = f + ''; expect = 'function () {\n y;\n}'; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-351705.js0000644000175000017500000000461011545150464023757 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351705; var summary = 'decompilation of new unary expression'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { new (-y); x } actual = f + ''; expect = 'function () {\n new (- y);\n x;\n}'; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-351793.js0000644000175000017500000000462711545150464023776 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351793; var summary = 'decompilation of double parenthesized object literal'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { (({a:b, c:3})); } actual = f + ''; expect = 'function () {\n ({a:b, c:3});\n}'; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-352013.js0000644000175000017500000000615211545150464023753 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352013; var summary = 'decompilation of new parenthetic expressions'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f, g, h; var x = Function; var z = 'actual += arguments[0];'; var w = 42; f = function() { new (x(z))(w) } expect = 'function() { new (x(z))(w); }'; actual = f + ''; compareSource(expect, actual, summary); g = function () { new x(z)(w); } expect = 'function () { (new x(z))(w); }'; actual = g + ''; compareSource(expect, actual, summary); expect = '4242'; actual = ''; f(); g(); reportCompare(expect, actual, summary); h = function () { new (x(y)(z)); } expect = 'function () { new (x(y)(z)); }'; actual = h + ''; compareSource(expect, actual, summary); h = function () { new (x(y).z); } expect = 'function () { new (x(y).z); }'; actual = h + ''; compareSource(expect, actual, summary); h = function () { new x(y).z; } expect = 'function () { (new x(y)).z; }'; actual = h + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-352022.js0000644000175000017500000000460611545150464023755 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352022; var summary = 'decompilation old, bad bug dropping parenthesis'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function (){a[b] = (c, d)} actual = f + ''; expect = 'function () {\n a[b] = (c, d);\n}'; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-352073.js0000644000175000017500000000504511545150464023761 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352073; var summary = 'decompilation of function expressions'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { (function x() { }); return x; } expect = 'function() { return x; }'; actual = f + ''; compareSource(expect, actual, summary); f = function() { (function(){} | x) } expect = 'function() { (function(){} | x); } '; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-352202.js0000644000175000017500000000462111545150464023752 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352202; var summary = 'decompilation of for ((~x)["y"] in z)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { for ((~x)["y"] in z) { } } expect = 'function() { for ((~x).y in z) { } }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-352312.js0000644000175000017500000000500711545150464023753 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352312; var summary = 'decompilation of |new| with unary expression'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { new (-2) } expect = 'function() { new (-2); }'; actual = f + ''; compareSource(expect, actual, summary); var f; f = function (){(new x)(y)} expect = 'function (){(new x)(y);}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-352360.js0000644000175000017500000000511311545150464023754 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352360; var summary = 'Decompilation of negative 0'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function() { return -0 }; expect = 'function() { return -0; }'; actual = f + ''; compareSource(expect, actual, summary); expect = -Infinity; actual = 8 / f(); reportCompare(expect, actual, summary + ': 8 / f()'); expect = -Infinity; actual = 8 / eval('(' + f + ')')(); reportCompare(expect, actual, summary + ': 8 / eval("" + f)()'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-352375.js0000644000175000017500000000461011545150464023763 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352375; var summary = 'decompilation of for (4..x in [])'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function() { for (4..x in []) { } } actual = f + ''; expect = 'function() { for ((4).x in []) { } } '; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-352453.js0000644000175000017500000000457311545150464023770 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352453; var summary = 'Decompilation of function() { (eval)(x)-- }'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function() { (eval)(x)-- }; expect = 'function() { eval(x)--; }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-352649.js0000644000175000017500000000462611545150464023776 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352649; var summary = 'decompilation of RegExp literal after |if| block'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { if (x) { } (/a/gi.z); } expect = 'function() { if (x) { } /a/gi.z; }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-352873-01.js0000644000175000017500000000507511545150464024212 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352873; var summary = 'decompilation of nested |try...catch| with |with|'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { try { with({}) { try { } finally { return; } } } finally { } } expect = 'function() { try { with({}) { try { } finally { return; } } } finally { } }'; actual = f + ''; compareSource(expect, actual, summary); expect = actual = 'No Crash'; f(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-352873-02.js0000644000175000017500000000506511545150464024212 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352873; var summary = 'decompilation of nested |try...catch| with |with|'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function(){ try { try { } finally { return; } } finally { with({}) { } }} expect = 'function(){ try { try { } finally { return; } } finally { with({}) { } }}'; actual = f + ''; compareSource(expect, actual, summary); expect = actual = 'No Crash'; f(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-353000.js0000644000175000017500000000463311545150464023752 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 353000; var summary = 'decompilation of RegExp literal after catch block'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { try{}catch(e){} (/g/.x) } expect = 'function() { try{}catch(e){} /g/.x; }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-353120.js0000644000175000017500000000460111545150464023750 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 353120; var summary = 'decompilation of (new x)[y]++'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function() { return (new x)[y]++ } expect = 'function() { return (new x)[y]++; }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-353146.js0000644000175000017500000000506211545150464023762 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 353146; var summary = 'Decompilation of new expressions revisited'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function () { return new (p(2))[1]; }; expect = 'function() { return new (p(2)[1]); }'; actual = f + ''; compareSource(expect, actual, summary); f = function () { return new p(2)[1]; }; expect = 'function () { return (new p(2))[1]; }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-354878.js0000644000175000017500000000464411545150464024004 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 354878; var summary = 'decompilation of |if(0) { LABEL: const x;}|'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function () { if(0) { L: const x; } return x; } expect = 'function () { if(0) { L: const x; } return x; }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-354910.js0000644000175000017500000000461011545150464023760 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 354910; var summary = 'decompilation of (delete r(s)).t = a;'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function () { (delete r(s)).t = a; } expect = 'function () { (r(s), true).t = a; }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-356083.js0000644000175000017500000000503411545150464023764 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 356083; var summary = 'decompilation for (function () {return {set this(v) {}};}) '; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function() { return { set this(v) { } }; } ; expect = 'function() { return { set this(v) { } }; }'; actual = f + ''; compareSource(expect, actual, summary); expect = "({ set ''(v) {} })"; actual = uneval({ set ''(v) {} }); compareSource(expect, actual, expect); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-371692.js0000644000175000017500000000457511545150464024000 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Biju * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 371692; var summary = 'Keep extra parentheses in conditional tests'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function (){ if((i=1)){ a=2; } }; expect = 'function (){ if((i=1)){ a=2; } }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-373678.js0000644000175000017500000000472411545150464024002 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 373678; var summary = 'Missing quotes around string in decompilation, with for..in and do..while '; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function() { do {for(a.b in []) { } } while("c\\d"); }; expect = 'function() { do {for(a.b in []) { } } while("c\\\\d"); }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-375639.js0000644000175000017500000000521111545150464023771 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375639; var summary = 'Uneval|Decompilation of string containing null character'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); print('normalize \\x00 to \\0 to hide 1.8.1 vs 1.9.0 ' + 'branch differences.'); expect = '"a\\' + '0b"'; actual = uneval('a\0b').replace(/\\x00/g, '\\0'); reportCompare(expect, actual, summary + ': 1'); expect = 'function () { return "a\\0b"; }'; actual = ((function () { return "a\0b"; }) + '').replace(/\\x00/g, '\\0');; compareSource(expect, actual, summary + ': 2'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-375882.js0000644000175000017500000000512111545150464023771 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375882; var summary = 'Decompilation of switch with case 0/0'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function() { switch(a) { case 0/0: a; case 1/0: b; case -1/0: c; case -0: d; } }; expect = 'function ( ) { switch ( a ) { case 0 / 0 : a ; case 1 / 0 : b ; ' + 'case 1 / - 0 : c ; case - 0 : d ; default : ; } } '; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-376564.js0000644000175000017500000000476611545150464024005 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 376564; var summary = 'Decompilation of new (eval())'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function() { new (eval()) }; expect = 'function() { new (eval()); }'; actual = f + ''; compareSource(expect, actual, summary); f = function() { new (g()) }; expect = 'function() { new (g()); }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-383721.js0000644000175000017500000000472511545150464023771 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): timeless * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 383721; var summary = 'decompiling Tabs'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function () {return "\t"}; expect = 'function () {return "\\t";}'; actual = f + ''; compareSource(expect, actual, summary + ': toString'); expect = '(' + expect + ')'; actual = uneval(f); compareSource(expect, actual, summary + ': uneval'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-406555.js0000644000175000017500000000503411545150464023764 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 406555; var summary = 'decompiler should not depend on JS_C_STRINGS_ARE_UTF8'; var actual; var expect; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = (function() {return "\uD800\uD800";}); var g = uneval(f); var h = eval(g); expect = "\uD800\uD800"; actual = h(); reportCompare(expect, actual, summary + ': h() == \\uD800\\uD800'); expect = g; actual = uneval(h); reportCompare(expect, actual, summary + ': g == uneval(h)'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-437288-02.js0000644000175000017500000000462111545150464024213 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Gary Kwong * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 437288; var summary = 'for loop turning into a while loop'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f() { const x = 1; for (x in null); } expect = 'function f() { const x = 1; for (x in null) {} }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-443071-01.js0000644000175000017500000000450411545150464024175 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 443071; var summary = 'Do not assert: top != 0 with for (;;[]=[])'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); print(function() { for (;;[]=[]) { } }); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-456964-01.js0000644000175000017500000000517711545150464024223 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Michael Roovers * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 456964; var summary = 'Infinite loop decompling function'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function Test() { var object = { abc: 1, def: 2}; var o = ''; for (var i in object) o += i + ' = ' + object[i] + '\n'; return o; } print(Test); expect = 'function Test ( ) { var object = { abc : 1 , def : 2 } ; var o = ""; for ( var i in object ) { o += i + " = " + object [ i ] + "\\ n "; } return o ; }'; actual = Test + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-457093-01.js0000644000175000017500000000511011545150464024200 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Mathieu Fenniak * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 457093; var summary = 'Do not assert: newtop <= oldtop, decompiling function'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function Test(object) { for (var i in object) { try { } catch(E) {} } } var x = Test.toString(); print(x); expect = 'function Test ( object ) { for ( var i in object ) { try { } catch ( E ) { } } }'; actual = Test + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-457824.js0000644000175000017500000000465411545150464024000 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 457824; var summary = 'decompilation of new a(b).c'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'function() { (new a(b)).c; }'; var g = (function() { new a(b).c }); actual = g + ''; compareSource(expect, actual, summary); actual = g + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-460116-01.js0000644000175000017500000000465711545150464024205 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 460116; var summary = 'Condition propagation folding constants'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = (function (){if(typeof(false||undef))throw "fail"}); expect = 'function (){if(typeof(false||undef)) {throw "fail";}}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-460116-02.js0000644000175000017500000000464311545150464024201 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 460116; var summary = 'Condition propagation folding constants'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = (function (){if((false&&foo)===(true||bar));}); expect = 'function (){if((false&&foo)===(true||bar)) {}}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-460116-03.js0000644000175000017500000000467411545150464024206 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 460116; var summary = 'Condition propagation folding constants'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = (function (){if((baz&&false&&foo)===(bletch||true||bar));}); expect = 'function (){if((baz&&false&&foo)===(bletch||true||bar)){}}'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-460501.js0000644000175000017500000000510711545150464023754 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 460501; var summary = 'Decompilation of constant folding with && and valueOf, eval'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = (function() { if ((1 && w.valueOf())) {} }); expect = 'function() { if (w.valueOf()) {} }'; actual = f + ''; compareSource(expect, actual, summary); var f = (function() { if ((1 && w.eval())) {} }); expect = 'function() { if (w.eval()) {} }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-460870.js0000644000175000017500000000463611545150464023773 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman. * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 460870; var summary = 'Decompilation of (function() { if (a || 1 || 2) { } })'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'function ( ) { if ( a || true ) { } }'; var f = (function() { if (a || 1 || 2) { } }); actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-461108.js0000644000175000017500000000465711545150464023771 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 461108; var summary = 'Decompilation of for (i = 0; a = as[i]; ++i)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = (function() {for (i = 0; attr = attrs[i]; ++i) {} }); expect = 'function() {for (i = 0; attr = attrs[i]; ++i) {} }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-461110.js0000644000175000017500000000455511545150464023757 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 461110; var summary = 'Decompilation of a += b = 3'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = (function() { a += b = 3 }); expect = 'function() { a += b = 3; }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/regress-461111.js0000644000175000017500000000455611545150464023761 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 461111; var summary = 'Decompilation of if (a,b)'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = (function() { if(a, b) { } }); expect = 'function() { if(a, b) { } }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/decompilation/shell.js0000644000175000017500000000000211545150464022641 0ustar chr1schr1s mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Error/browser.js0000644000175000017500000000000011545150464021455 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Error/jstests.list0000644000175000017500000000017511545150464022045 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_5/Error/ script regress-354246.js script regress-412324.js script regress-465377.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Error/regress-354246.js0000644000175000017500000000465211545150464022232 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 354246; var summary = 'calling Error constructor with object with bad toString'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '13'; actual += '1'; try { new Error({toString: function() { x.y } }); } catch(e) { } actual += '3'; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Error/regress-412324.js0000644000175000017500000000410011545150464022206 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 412324; var summary = 'Allow function Error(){} for the love of Pete'; var actual = 'No Error'; var expect = 'No Error'; printBugNumber(BUGNUMBER); printStatus (summary); function Error() {} reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Error/regress-465377.js0000644000175000017500000000747311545150464022246 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 465377; var summary = 'instanceof relations between Error objects'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'No Exception'; try { var list = [ "Error", "InternalError", "EvalError", "RangeError", "ReferenceError", "SyntaxError", "TypeError", "URIError" ]; var instances = []; for (var i = 0; i != list.length; ++i) { var name = list[i]; var constructor = this[name]; var tmp = constructor.name; if (tmp !== name) throw "Bad value for "+name+".name: "+uneval(tmp); instances[i] = new constructor(); } for (var i = 0; i != instances.length; ++i) { var instance = instances[i]; var name = instance.name; var constructor = instance.constructor; if (constructor !== this[name]) throw "Bad value of (new "+name+").constructor: "+uneval(tmp); var tmp = constructor.name; if (tmp !== name) throw "Bad value for constructor.name: "+uneval(tmp); if (!(instance instanceof Object)) throw "Bad instanceof Object for "+name; if (!(instance instanceof Error)) throw "Bad instanceof Error for "+name; if (!(instance instanceof constructor)) throw "Bad instanceof constructor for "+name; if (instance instanceof Function) throw "Bad instanceof Function for "+name; for (var j = 1; j != instances.length; ++j) { if (i != j && instance instanceof instances[j].constructor) { throw "Unexpected (new "+name+") instanceof "+ instances[j].name; } } } print("OK"); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Error/shell.js0000644000175000017500000000000011545150464021101 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/browser.js0000644000175000017500000000000011545150464022505 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/catchguard-002-n.js0000644000175000017500000000437711545150464023706 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Ginda rginda@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ DESCRIPTION = "var in catch clause should have caused an error."; EXPECTED = "error"; var expect; var actual; test(); function test() { enterFunc ("test"); var EXCEPTION_DATA = "String exception"; var e; printStatus ("Catchguard var declaration negative test."); try { throw EXCEPTION_DATA; } catch (var e) { actual = e + ''; } reportCompare(expect, actual, DESCRIPTION); exitFunc ("test"); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/catchguard-003-n.js0000644000175000017500000000456511545150464023706 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is Mozilla Communicator client code, released * March 31, 1998. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Rob Ginda rginda@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ DESCRIPTION = "Illegally constructed catchguard should have thrown an exception."; EXPECTED = "error"; var expect; var actual; test(); function test() { enterFunc ("test"); var EXCEPTION_DATA = "String exception"; var e; printStatus ("Catchguard syntax negative test #2."); try { throw EXCEPTION_DATA; } catch (e) { actual = e + ': 1'; } catch (e) /* two non-guarded catch statements should generate an error */ { actual = e + ': 2'; } reportCompare(expect, actual, DESCRIPTION); exitFunc ("test"); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/errstack-001.js0000644000175000017500000001532311545150464023154 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2002 * the Initial Developer. All Rights Reserved. * * Contributor(s): * brendan@mozilla.org, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 28 Feb 2002 * SUMMARY: Testing that Error.stack distinguishes between: * * A) top-level calls: myFunc(); * B) no-name function calls: function() { myFunc();} () * * The stack frame for A) should begin with '@' * The stack frame for B) should begin with '()' * * This behavior was coded by Brendan during his fix for bug 127136. * See http://bugzilla.mozilla.org/show_bug.cgi?id=127136#c13 * * Note: our function getStackFrames(err) orders the array of stack frames * so that the 0th element will correspond to the highest frame, i.e. will * correspond to a line in top-level code. The 1st element will correspond * to the function that is called first, and so on... * * NOTE: At present Rhino does not have an Error.stack property. It is an * ECMA extension, see http://bugzilla.mozilla.org/show_bug.cgi?id=123177 */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = '(none)'; var summary = 'Testing Error.stack'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var myErr = ''; var stackFrames = ''; function A(x,y) { return B(x+1,y+1); } function B(x,z) { return C(x+1,z+1); } function C(x,y) { return D(x+1,y+1); } function D(x,z) { try { throw new Error('meep!'); } catch (e) { return e; } } myErr = A(44,13); stackFrames = getStackFrames(myErr); status = inSection(1); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); status = inSection(2); actual = stackFrames[1].substring(0,9); expect = 'A(44,13)@'; addThis(); status = inSection(3); actual = stackFrames[2].substring(0,9); expect = 'B(45,14)@'; addThis(); status = inSection(4); actual = stackFrames[3].substring(0,9); expect = 'C(46,15)@'; addThis(); status = inSection(5); actual = stackFrames[4].substring(0,9); expect = 'D(47,16)@'; addThis(); myErr = A('44:foo','13:bar'); stackFrames = getStackFrames(myErr); status = inSection(6); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); status = inSection(7); actual = stackFrames[1].substring(0,21); expect = 'A("44:foo","13:bar")@'; addThis(); status = inSection(8); actual = stackFrames[2].substring(0,23); expect = 'B("44:foo1","13:bar1")@'; addThis(); status = inSection(9); actual = stackFrames[3].substring(0,25); expect = 'C("44:foo11","13:bar11")@'; addThis(); status = inSection(10); actual = stackFrames[4].substring(0,27); expect = 'D("44:foo111","13:bar111")@';; addThis(); /* * Make the first frame occur in a function with an empty name - */ myErr = function() { return A(44,13); } (); stackFrames = getStackFrames(myErr); status = inSection(11); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); status = inSection(12); actual = stackFrames[1].substring(0,3); expect = '()@'; addThis(); status = inSection(13); actual = stackFrames[2].substring(0,9); expect = 'A(44,13)@'; addThis(); // etc. for the rest of the frames as above /* * Make the first frame occur in a function with name 'anonymous' - */ var f = Function('return A(44,13);'); myErr = f(); stackFrames = getStackFrames(myErr); status = inSection(14); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); status = inSection(15); actual = stackFrames[1].substring(0,12); expect = 'anonymous()@'; addThis(); status = inSection(16); actual = stackFrames[2].substring(0,9); expect = 'A(44,13)@'; addThis(); // etc. for the rest of the frames as above /* * Make a user-defined error via the Error() function - */ var message = 'Hi there!'; var fileName = 'file name'; var lineNumber = 0; myErr = Error(message, fileName, lineNumber); stackFrames = getStackFrames(myErr); status = inSection(17); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); /* * Now use the |new| keyword. Re-use the same params - */ myErr = new Error(message, fileName, lineNumber); stackFrames = getStackFrames(myErr); status = inSection(18); actual = stackFrames[0].substring(0,1); expect = '@'; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- /* * Split the string |err.stack| along its '\n' delimiter. * As of 2002-02-28 |err.stack| ends with the delimiter, so * the resulting array has an empty string as its last element. * * Pop that useless element off before doing anything. * Then reverse the array, for convenience of indexing - */ function getStackFrames(err) { var arr = err.stack.split('\n'); arr.pop(); return arr.reverse(); } function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i0. The bug was filed because we * were getting i===0; i.e. |i| did not retain the value it had at the * location of the error. * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 121658; var msg = '"Too much recursion" errors should be safely caught by try...catch'; var TEST_PASSED = 'i retained the value it had at location of error'; var TEST_FAILED = 'i did NOT retain this value'; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; var i; function f() { ++i; // try...catch should catch the "too much recursion" error to ensue try { f(); } catch(e) { } } i=0; f(); status = inSection(1); actual = (i>0); expect = true; addThis(); // Now try in function scope - function g() { f(); } i=0; g(); status = inSection(2); actual = (i>0); expect = true; addThis(); // Now try in eval scope - var sEval = 'function h(){++i; try{h();} catch(e){}}; i=0; h();'; eval(sEval); status = inSection(3); actual = (i>0); expect = true; addThis(); // Try in eval scope and mix functions up - sEval = 'function a(){++i; try{h();} catch(e){}}; i=0; a();'; eval(sEval); status = inSection(4); actual = (i>0); expect = true; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = formatThis(actual); expectedvalues[UBound] = formatThis(expect); UBound++; } function formatThis(bool) { return bool? TEST_PASSED : TEST_FAILED; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(msg); for (var i=0; i * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 232182; var summary = 'Display non-ascii characters in JS exceptions'; var actual = ''; var expect = 'no error'; printBugNumber(BUGNUMBER); printStatus (summary); /* * This test accesses an undefined Unicode symbol. If the code has not been * compiled with JS_C_STRINGS_ARE_UTF8, the thrown error truncates Unicode * characters to bytes. Accessing \u0440\u0441, therefore, results in a * message talking about an undefined variable 'AB' (\x41\x42). */ var utf8Enabled = false; try { \u0441\u0442; } catch (e) { utf8Enabled = (e.message.charAt (0) == '\u0441'); } // Run the tests only if UTF-8 is enabled printStatus('UTF-8 is ' + (utf8Enabled?'':'not ') + 'enabled'); if (!utf8Enabled) { reportCompare('Not run', 'Not run', 'utf8 is not enabled'); } else { status = summary + ': Throw Error with Unicode message'; expect = 'test \u0440\u0441'; try { throw Error (expect); } catch (e) { actual = e.message; } reportCompare(expect, actual, status); var inShell = (typeof stringsAreUTF8 == "function"); if (!inShell) { inShell = (typeof stringsAreUtf8 == "function"); if (inShell) { this.stringsAreUTF8 = stringsAreUtf8; this.testUTF8 = testUtf8; } } if (inShell && stringsAreUTF8()) { status = summary + ': UTF-8 test: bad UTF-08 sequence'; expect = 'Error'; actual = 'No error!'; try { testUTF8(1); } catch (e) { actual = 'Error'; } reportCompare(expect, actual, status); status = summary + ': UTF-8 character too big to fit into Unicode surrogate pairs'; expect = 'Error'; actual = 'No error!'; try { testUTF8(2); } catch (e) { actual = 'Error'; } reportCompare(expect, actual, status); status = summary + ': bad Unicode surrogate character'; expect = 'Error'; actual = 'No error!'; try { testUTF8(3); } catch (e) { actual = 'Error'; } reportCompare(expect, actual, status); } if (inShell) { status = summary + ': conversion target buffer overrun'; expect = 'Error'; actual = 'No error!'; try { testUTF8(4); } catch (e) { actual = 'Error'; } reportCompare(expect, actual, status); } } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/regress-257751.js0000644000175000017500000000621311545150464023260 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Henrik Gemal * Erik Fabert * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 257751; var summary = 'RegExp Syntax Errors should have lineNumber and fileName'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var status; var re; status = summary + ' ' + inSection(1) + ' RegExp("\\\\") '; try { expect = 'Pass'; re = RegExp('\\'); } catch(e) { if (e.fileName && e.lineNumber) { actual = 'Pass'; } else { actual = 'Fail'; } } reportCompare(expect, actual, status); status = summary + ' ' + inSection(2) + ' RegExp(")") '; try { expect = 'Pass'; re = RegExp(')'); } catch(e) { if (e.fileName && e.lineNumber) { actual = 'Pass'; } else { actual = 'Fail'; } } reportCompare(expect, actual, status); status = summary + ' ' + inSection(3) + ' /\\\\/ '; try { expect = 'Pass'; re = eval('/\\/'); } catch(e) { if (e.fileName && e.lineNumber) { actual = 'Pass'; } else { actual = 'Fail'; } } reportCompare(expect, actual, status); status = summary + ' ' + inSection(4) + ' /)/ '; try { expect = 'Pass'; re = eval('/)/'); } catch(e) { if (e.fileName && e.lineNumber) { actual = 'Pass'; } else { actual = 'Fail'; } } reportCompare(expect, actual, status); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/regress-273931.js0000644000175000017500000000540011545150464023253 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * Bob Clary * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 273931; var summary = 'Pop scope chain in exception handling'; var actual = ''; var expect = 'ReferenceError'; printBugNumber(BUGNUMBER); printStatus (summary); status = summary + ' ' + inSection(1) + ' '; try { with ({foo:"bar"}) throw 42; } catch (e) { try { printStatus(foo); } catch(ee) { actual = ee.name; } } reportCompare(expect, actual, status); status = summary + ' ' + inSection(2) + ' '; try { with ({foo:"bar"}) eval("throw 42"); } catch (e) { try { printStatus(foo); } catch(ee) { actual = ee.name; } } reportCompare(expect, actual, status); status = summary + ' ' + inSection(3) + ' '; try { var s = "throw 42"; with ({foo:"bar"}) eval(s); } catch (e) { try { printStatus(foo); } catch(ee) { actual = ee.name; } } reportCompare(expect, actual, status); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/regress-315147.js0000644000175000017500000000442011545150464023250 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Michael Daumling * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 315147; var summary = 'Error JSMSG_UNDEFINED_PROP should be JSEXN_REFERENCEERR'; var actual = ''; var expect = 'ReferenceError'; printBugNumber(BUGNUMBER); printStatus (summary); if (!options().match(/strict/)) { options('strict'); } if (!options().match(/werror/)) { options('werror'); } var o = {}; try { o.foo; actual = 'no error'; } catch(ex) { actual = ex.name; } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/regress-332472.js0000644000175000017500000000440511545150464023253 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Wladimir Palant * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 332472; var summary = 'new RegExp() ignores string boundaries when throwing exceptions'; var actual = ''; var expect = 'SyntaxError: invalid quantifier'; printBugNumber(BUGNUMBER); printStatus (summary); var str1 = "?asdf\nAnd you really shouldn't see this!"; var str2 = str1.substr(0, 5); try { new RegExp(str2); } catch(ex) { printStatus(ex); actual = ex + ''; } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/regress-333728.js0000644000175000017500000000563511545150464023266 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Andreas * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 333728; var summary = 'Throw ReferenceErrors for typeof(...undef)'; var actual = ''; var expect = 'ReferenceError'; printBugNumber(BUGNUMBER); printStatus (summary); try { actual = typeof (0, undef); } catch(ex) { actual = ex.name; } reportCompare(expect, actual, summary + ': typeof (0, undef)'); try { actual = typeof (0 || undef); } catch(ex) { actual = ex.name; } reportCompare(expect, actual, summary + ': typeof (0 || undef)'); try { actual = typeof (1 && undef); } catch(ex) { actual = ex.name; } reportCompare(expect, actual, summary + ': typeof (1 && undef)'); /* try { actual = typeof (0 ? 0 : undef); } catch(ex) { actual = ex.name; } reportCompare(expect, actual, summary + ': typeof (0 ? 0 : undef)'); */ /* try { actual = typeof (1 ? undef : 0); } catch(ex) { actual = ex.name; } reportCompare(expect, actual, summary + ': typeof (1 ? undef : 0)'); */ try { actual = typeof (!this ? 0 : undef); } catch(ex) { actual = ex.name; } reportCompare(expect, actual, summary + ': typeof (!this ? 0 : undef)'); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/regress-342359.js0000644000175000017500000000453711545150464023266 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Joey Minta * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 342359; var summary = 'Overriding ReferenceError should stick'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); // work around bug 376957 var SavedReferenceError = ReferenceError; try { ReferenceError = 5; } catch(ex) { } try { foo.blitz; } catch(ex) { print(ex + ''); } if (SavedReferenceError == ReferenceError) { actual = expect = 'Test ignored due to bug 376957'; } else { expect = 5; actual = ReferenceError; } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/regress-347674.js0000644000175000017500000000530611545150464023266 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Jeff Walden . * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jeff Walden * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = "347674"; var summary = "ReferenceError thrown when accessing exception bound in a " + "catch block in a try block within that catch block"; var actual, expect; printBugNumber(BUGNUMBER); printStatus(summary); /************** * BEGIN TEST * **************/ var failed = false; function foo() { try { throw "32.9"; } catch (e) { try { var errorCode = /^(\d+)\s+.*$/.exec(e)[1]; } catch (e2) { void("*** internal error: e == " + e + ", e2 == " + e2); throw e2; } } } try { try { foo(); } catch (ex) { if (!(ex instanceof TypeError)) throw "Wrong value thrown!\n" + " expected: a TypeError ('32.9' doesn't match the regexp)\n" + " actual: " + ex; } } catch (e) { failed = e; } expect = false; actual = failed; reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/regress-350650-n.js0000644000175000017500000000457111545150464023510 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): a-higuti * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 350650; var summary = 'js reports "uncaught exception'; var actual = 'Error'; var expect = 'Error'; expectExitCode(3); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function exc() { this.toString = function() { return "EXC"; } } throw new exc(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/regress-350837.js0000644000175000017500000000471511545150464023264 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 350837; var summary = 'clear cx->throwing in finally'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'F'; function f() { actual = "F"; } try { try { throw 1; } finally { f.call(this); } } catch(ex) { reportCompare(1, ex, summary); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Exceptions/shell.js0000644000175000017500000000000011545150464022131 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Expressions/browser.js0000644000175000017500000000000011545150464022706 0ustar chr1schr1smozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Expressions/jstests.list0000644000175000017500000000031211545150464023267 0ustar chr1schr1surl-prefix ../../jsreftest.html?test=js1_5/Expressions/ script regress-192288.js script regress-394673.js script regress-96526-argsub.js script regress-96526-delelem.js script regress-96526-noargsub.js mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/Expressions/regress-192288.js0000644000175000017500000000631311545150464023465 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Netscape Communications Corp. * Portions created by the Initial Developer are Copyright (C) 2003 * the Initial Developer. All Rights Reserved. * * Contributor(s): * igor@icesoft.no, pschwartau@netscape.com * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * * Date: 07 February 2003 * SUMMARY: Testing 0/0 inside functions * * See http://bugzilla.mozilla.org/show_bug.cgi?id=192288 * */ //----------------------------------------------------------------------------- var UBound = 0; var BUGNUMBER = 192288; var summary = 'Testing 0/0 inside functions '; var status = ''; var statusitems = []; var actual = ''; var actualvalues = []; var expect= ''; var expectedvalues = []; function f() { return 0/0; } status = inSection(1); actual = isNaN(f()); expect = true; addThis(); status = inSection(2); actual = isNaN(f.apply(this)); expect = true; addThis(); status = inSection(3); actual = isNaN(eval("f.apply(this)")); expect = true; addThis(); status = inSection(4); actual = isNaN(Function('return 0/0;')()); expect = true; addThis(); status = inSection(5); actual = isNaN(eval("Function('return 0/0;')()")); expect = true; addThis(); //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function addThis() { statusitems[UBound] = status; actualvalues[UBound] = actual; expectedvalues[UBound] = expect; UBound++; } function test() { enterFunc('test'); printBugNumber(BUGNUMBER); printStatus(summary); for (var i=0; i'); window.addEventListener("load", init, false); } else { reportCompare(expect, actual, summary); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-328443.js0000644000175000017500000000452411545150464023336 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 328443; var summary = 'Uncatchable exception with |new (G.call) (F);| when F proto is null'; var actual = ''; var expect = 'Exception caught'; printBugNumber(BUGNUMBER); printStatus (summary); var F = (function(){}); F.__proto__ = null; var G = (function(){}); var z; z = "uncatchable exception!!!"; try { new (G.call) (F); actual = "No exception"; } catch (er) { actual = "Exception caught"; printStatus("Exception was caught: " + er); } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-328556.js0000644000175000017500000000421511545150464023340 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 328556; var summary = 'Do not Assert: growth == (size_t)-1 || (nchars + 1) * sizeof(jschar) == growth, in jsarray.c'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); var D = []; D.foo = D; uneval(D); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-330569.js0000644000175000017500000000733711545150464023345 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): antonglv * Andreas * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 330569; var summary = 'RegExp - throw InternalError on too complex regular expressions'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var s; expect = 'InternalError: regular expression too complex'; s = '' + '\n' + '\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n' + '\n' + '\n'; if (!options().match(/relimit/)) { options('relimit'); } try { //.exec(s); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': //.exec(s)'); function testre( re, n ) { for ( var i= 0; i <= n; ++i ) { re.test( Array( i+1 ).join() ); } } try { testre( /(?:,*)*x/, 22 ); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': testre( /(?:,*)*x/, 22 )'); try { testre( /(?:,|,)*x/, 22 ); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': testre( /(?:,|,)*x/, 22 )'); try { testre( /(?:,|,|,|,|,)*x/, 10 ); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': testre( /(?:,|,|,|,|,)*x/, 10 )'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-333541.js0000644000175000017500000000662411545150464023334 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Biju * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 333541; var summary = '1..toSource()'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); function a(){ return 1..toSource(); } try { expect = 'function a() {\n return (1).toSource();\n}'; actual = a.toString(); compareSource(expect, actual, summary + ': 1'); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary + ': 1'); } try { expect = 'function a() {return (1).toSource();}'; actual = a.toSource(); compareSource(expect, actual, summary + ': 2'); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary + ': 2'); } expect = a; actual = a.valueOf(); reportCompare(expect, actual, summary + ': 3'); try { expect = 'function a() {\n return (1).toSource();\n}'; actual = "" + a; compareSource(expect, actual, summary + ': 4'); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary + ': 4'); } function b(){ x=1..toSource(); x=1['a']; x=1..a; x=1['"a"']; x=1["'a'"]; x=1['1']; x=1["#"]; } try { expect = "function b() {\n x = (1).toSource();\n" + " x = (1).a;\n" + " x = (1).a;\n" + " x = (1)['\"a\"'];\n" + " x = (1)[\'\\'a\\''];\n" + " x = (1)['1'];\n" + " x = (1)['#'];\n" + "}"; actual = "" + b; // fudge the actual to match a['1'] ~ a[1]. // see https://bugzilla.mozilla.org/show_bug.cgi?id=452369 actual = actual.replace(/\(1\)\[1\];/, "(1)['1'];"); compareSource(expect, actual, summary + ': 5'); } catch(ex) { actual = ex + ''; reportCompare(expect, actual, summary + ': 5'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-335700.js0000644000175000017500000000653311545150464023332 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Charles Verdon * Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 335700; var summary = 'Object Construction with getter closures should be O(N)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); test('Object', Object); test('ObjectWithFunction', ObjectWithFunction); test('ObjectWithGetter', ObjectWithGetter); function test(desc, ctor) { var start = 00000; var stop = 40000; var incr = (stop - start)/10; desc = summary + ': ' + desc; var data = {X:[], Y:[]}; for (var i = start; i <= stop; i += incr) { data.X.push(i); data.Y.push(runStart(ctor, i)); gc(); } var order = BigO(data); var msg = ''; for (var p = 0; p < data.X.length; p++) { msg += '(' + data.X[p] + ', ' + data.Y[p] + '); '; } print(msg); reportCompare(true, order < 2, desc + ': BigO ' + order + ' < 2'); } function ObjectWithFunction() { var m_var = null; this.init = function(p_var) { m_var = p_var; } this.getVar = function() { return m_var; } this.setVar = function(v) { m_var = v; } } function ObjectWithGetter() { var m_var = null; this.init = function(p_var) { m_var = p_var; } this.Var getter = function() { return m_var; } this.Var setter = function(v) { m_var = v; } } function runStart(ctor, limit) { var arr = []; var start = Date.now(); for (var i=0; i < limit; i++) { var obj = new ctor(); obj.Var = 42; arr.push(obj); } var end = Date.now(); var diff = end - start; return diff; } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-336409-1.js0000644000175000017500000000521411545150464023472 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Georgi Guninski * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 336409; var summary = 'Integer overflow in js_obj_toSource'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); expectExitCode(0); expectExitCode(5); function createString(n) { var l = n*1024*1024; var r = 'r'; while (r.length < l) { r = r + r; } return r; } try { var n = 64; printStatus('Creating ' + n + 'MB string'); var r = createString(n); printStatus('Done. length = ' + r.length); printStatus('Creating object'); var o = {f1: r, f2: r, f3: r,f4: r,f5: r, f6: r, f7: r, f8: r,f9: r}; printStatus('object.toSource()'); var rr = o.toSource(); printStatus('Done.'); } catch(ex) { expect = 'InternalError: allocation size overflow'; actual = ex + ''; print(actual); } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-336409-2.js0000644000175000017500000000526411545150464023500 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Georgi Guninski * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 336409; var summary = 'Integer overflow in js_obj_toSource'; var actual = 'No Crash'; var expect = /(No Crash|InternalError: script stack space quota is exhausted|InternalError: allocation size overflow)/; printBugNumber(BUGNUMBER); printStatus (summary); expectExitCode(0); expectExitCode(5); function createString(n) { var l = n*1024*1024; var r = 'r'; while (r.length < l) { r = r + r; } return r; } try { var n = 128; printStatus('Creating ' + n + 'MB string'); var r = createString(n); printStatus('Done. length = ' + r.length); printStatus('Creating object'); var o = {f1: r, f2: r, f3: r,f4: r,f5: r, f6: r, f7: r, f8: r,f9: r}; printStatus('object.toSource()'); var rr = o.toSource(); printStatus('Done.'); } catch(ex) { actual = ex + ''; print(actual); } reportMatch(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-336410-1.js0000644000175000017500000000515511545150464023466 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Georgi Guninski * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 336410; var summary = 'Integer overflow in array_toSource'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); expectExitCode(0); expectExitCode(5); function createString(n) { var l = n*1024*1024; var r = 'r'; while (r.length < l) { r = r + r; } return r; } try { var n = 64; printStatus('Creating ' + n + 'M length string'); var r = createString(n); printStatus('Done. length = ' + r.length); printStatus('Creating array'); var o=[r, r, r, r, r, r, r, r, r]; printStatus('object.toSource()'); var rr = o.toSource(); printStatus('Done.'); } catch(ex) { expect = 'InternalError: allocation size overflow'; actual = ex + ''; print(actual); } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-336410-2.js0000644000175000017500000000522511545150464023465 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Georgi Guninski * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 336410; var summary = 'Integer overflow in array_toSource'; var actual = 'No Crash'; var expect = /(No Crash|InternalError: script stack space quota is exhausted|InternalError: allocation size overflow)/; printBugNumber(BUGNUMBER); printStatus (summary); expectExitCode(0); expectExitCode(5); function createString(n) { var l = n*1024*1024; var r = 'r'; while (r.length < l) { r = r + r; } return r; } try { var n = 128; printStatus('Creating ' + n + 'M length string'); var r = createString(n); printStatus('Done. length = ' + r.length); printStatus('Creating array'); var o=[r, r, r, r, r, r, r, r, r]; printStatus('object.toSource()'); var rr = o.toSource(); printStatus('Done.'); } catch(ex) { actual = ex + ''; print(actual); } reportMatch(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-338804-01.js0000644000175000017500000000606111545150464023554 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): shutdown * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 338804; var summary = 'GC hazards in constructor functions'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); printStatus ('Uses Intel Assembly'); // reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-338804-02.js0000644000175000017500000000607411545150464023561 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): shutdown * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 338804; var summary = 'GC hazards in constructor functions'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); printStatus ('Uses Intel Assembly'); // reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-338804-03.js0000644000175000017500000000443611545150464023562 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): shutdown * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 338804; var summary = 'GC hazards in constructor functions'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); if (typeof Script != 'undefined') { Script({ toString: fillHeap }); } RegExp({ toString: fillHeap }); function fillHeap() { if (typeof gc == 'function') gc(); var x = 1, tmp; for (var i = 0; i != 50000; ++i) { tmp = x / 3; } } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-339685.js0000644000175000017500000000430011545150464023340 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 339685; var summary = 'Setting __proto__ null should not affect __iterator__'; var actual = ''; var expect = 'No Error'; printBugNumber(BUGNUMBER); printStatus (summary); var d = { a:2, b:3 }; d.__proto__ = null; try { for (var p in d) ; actual = 'No Error'; } catch(e) { actual = e + ''; } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-341956-01.js0000644000175000017500000000626211545150464023561 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 341956; var summary = 'GC Hazards in jsarray.c - unshift'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var N = 0xFFFFFFFF; var a = []; a[N - 1] = 1; a.__defineGetter__(N - 1, function() { var tmp = []; tmp[N - 2] = 0; if (typeof gc == 'function') gc(); for (var i = 0; i != 50000; ++i) { var tmp = 1 / 3; tmp /= 10; } for (var i = 0; i != 1000; ++i) { // Make string with 11 characters that would take // (11 + 1) * 2 bytes or sizeof(JSAtom) so eventually // malloc will ovewrite just freed atoms. var tmp2 = Array(12).join(' '); } return 10; }); // The following always-throw getter is to stop unshift from doing // 2^32 iterations. var toStop = "stringToStop"; a[N - 3] = 0; a.__defineGetter__(N - 3, function() { throw toStop; }); var good = false; try { a.unshift(1); } catch (e) { if (e === toStop) good = true; } expect = true; actual = good; reportCompare(expect, actual, summary); print('Done'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-341956-02.js0000644000175000017500000000566111545150464023564 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 341956; var summary = 'GC Hazards in jsarray.c - pop'; var actual = ''; var expect = 'GETTER RESULT'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var N = 0xFFFFFFFF; var a = []; a[N - 1] = 0; var expected = "GETTER RESULT"; a.__defineGetter__(N - 1, function() { delete a[N - 1]; var tmp = []; tmp[N - 2] = 1; if (typeof gc == 'function') gc(); for (var i = 0; i != 50000; ++i) { var tmp = 1 / 3; tmp /= 10; } for (var i = 0; i != 1000; ++i) { // Make string with 11 characters that would take // (11 + 1) * 2 bytes or sizeof(JSAtom) so eventually // malloc will ovewrite just freed atoms. var tmp2 = Array(12).join(' '); } return expected; }); actual = a.pop(); reportCompare(expect, actual, summary); print('Done'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-341956-03.js0000644000175000017500000000636511545150464023567 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 341956; var summary = 'GC Hazards in jsarray.c - reverse'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var N = 0xFFFFFFFF; var a = []; a[N - 1] = 0; var expected = "GETTER RESULT"; a.__defineGetter__(N - 1, function() { delete a[N - 1]; var tmp = []; tmp[N - 2] = 1; if (typeof gc == 'function') gc(); for (var i = 0; i != 50000; ++i) { var tmp = 1 / 3; tmp /= 10; } for (var i = 0; i != 1000; ++i) { // Make string with 11 characters that would take // (11 + 1) * 2 bytes or sizeof(JSAtom) so eventually // malloc will ovewrite just freed atoms. var tmp2 = Array(12).join(' '); } return expected; }); // The following always-throw getter is to stop unshift from doing // 2^32 iterations. var toStop = "stringToStop"; a[N - 3] = 0; a.__defineGetter__(N - 3, function() { throw toStop; }); var good = false; try { a.reverse(); } catch (e) { if (e === toStop) good = true; } expect = true; actual = good; reportCompare(expect, actual, summary); print('Done'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-342960.js0000644000175000017500000000553411545150464023340 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Georgi Guninski * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 342960; var summary = 'Do not crash on large string toSource'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expectExitCode(0); expectExitCode(5); try { function v() { var meg=""; var r=""; var i; print("don't interrupt the script. let it go."); for(i=0;i<1024*1024;i++) meg += "v"; for(i=0;i<1024/8;i++) r += meg; var o={f1: r, f2: r, f3: r,f4: r,f5: r, f6: r, f7: r, f8: r,f9: r}; print('done obj'); var rr=r.toSource(); print('done toSource()'); } v(); } catch(ex) { expect = 'InternalError: script stack space quota is exhausted'; actual = ex + ''; print(actual); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-345967.js0000644000175000017500000000640611545150464023351 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 345967; var summary = 'Yet another unrooted atom in jsarray.c'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expectExitCode(0); expectExitCode(3); print('This test will probably run out of memory'); print('This test really should only fail on 64 bit machines'); var JSVAL_INT_MAX = (1 << 30) - 1; var a = new Array(JSVAL_INT_MAX + 2); a[JSVAL_INT_MAX] = 0; a[JSVAL_INT_MAX + 1] = 1; a.__defineGetter__(JSVAL_INT_MAX, function() { return 0; }); a.__defineSetter__(JSVAL_INT_MAX, function(value) { delete a[JSVAL_INT_MAX + 1]; var tmp = []; tmp[JSVAL_INT_MAX + 2] = 2; if (typeof gc == 'function') gc(); for (var i = 0; i != 50000; ++i) { var tmp = 1 / 3; tmp /= 10; } for (var i = 0; i != 1000; ++i) { // Make string with 11 characters that would take // (11 + 1) * 2 bytes or sizeof(JSAtom) so eventually // malloc will ovewrite just freed atoms. var tmp2 = Array(12).join(' '); } }); a.shift(); expect = 0; actual = a[JSVAL_INT_MAX]; if (expect !== actual) print("BAD"); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-346494-01.js0000644000175000017500000001106711545150464023562 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 346494; var summary = 'various try...catch tests'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var pfx = "(function (x) {try {throw x}", cg1 = " catch (e if e === 42) {var v = 'catch guard 1 ' + e; actual += v + ','; print(v);}" cg2 = " catch (e if e === 43) {var v = 'catch guard 2 ' + e; actual += v + ','; print(v);}" cat = " catch (e) {var v = 'catch all ' + e; actual += v + ','; print(v);}" fin = " finally{var v = 'fin'; actual += v + ','; print(v)}", end = "})"; var exphash = { pfx: "(function (y) { var result = ''; y = y + ',';", cg1: "result += (y === '42,') ? ('catch guard 1 ' + y):'';", cg2: "result += (y === '43,') ? ('catch guard 2 ' + y):'';", cat: "result += /catch guard/.test(result) ? '': ('catch all ' + y);", fin: "result += 'fin,';", end: "return result;})" }; var src = [ pfx + fin + end, pfx + cat + end, pfx + cat + fin + end, pfx + cg1 + end, pfx + cg1 + fin + end, pfx + cg1 + cat + end, pfx + cg1 + cat + fin + end, pfx + cg1 + cg2 + end, pfx + cg1 + cg2 + fin + end, pfx + cg1 + cg2 + cat + end, pfx + cg1 + cg2 + cat + fin + end, ]; var expsrc = [ exphash.pfx + exphash.fin + exphash.end, exphash.pfx + exphash.cat + exphash.end, exphash.pfx + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1 + exphash.end, exphash.pfx + exphash.cg1 + exphash.fin + exphash.end, exphash.pfx + exphash.cg1 + exphash.cat + exphash.end, exphash.pfx + exphash.cg1 + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1 + exphash.cg2 + exphash.end, exphash.pfx + exphash.cg1 + exphash.cg2 + exphash.fin + exphash.end, exphash.pfx + exphash.cg1 + exphash.cg2 + exphash.cat + exphash.end, exphash.pfx + exphash.cg1 + exphash.cg2 + exphash.cat + exphash.fin + exphash.end, ]; for (var i in src) { print("\n=== " + src[i]); var f = eval(src[i]); print(src[i]); var exp = eval(expsrc[i]); // dis(f); print('decompiling: ' + f); actual = ''; try { expect = exp(42); f(42) } catch (e) { print('tried f(42), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(43); f(43) } catch (e) { print('tried f(43), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(44); f(44) } catch (e) { print('tried f(44), caught ' + e) } reportCompare(expect, actual, summary); } exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-346494.js0000644000175000017500000000657711545150464023356 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 346494; var summary = 'try-catch-finally scope'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function g() { try { throw "foo"; } catch(e if e == "bar") { } catch(e if e == "baz") { } finally { } } expect = "foo"; try { g(); actual = 'No Exception'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); expect = 'function g() {\n' + ' try {\n' + ' throw "foo";\n' + ' } catch (e if e == "bar") {\n' + ' } catch (e if e == "baz") {\n' + ' } finally {\n' + ' }\n' + '}'; actual = g + ''; reportCompare(expect, actual, summary); function h() { try { throw "foo"; } catch(e if e == "bar") { } catch(e) { } finally { } } expect = "No Exception"; try { h(); actual = 'No Exception'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); expect = 'function h() {\n' + ' try {\n' + ' throw "foo";\n' + ' } catch (e if e == "bar") {\n' + ' } catch (e) {\n' + ' } finally {\n' + ' }\n' + '}'; actual = h + ''; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-347306-02.js0000644000175000017500000000525111545150464023552 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2005 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 347306; var summary = 'toSource should not be O(N**2)'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); var data = {X:[], Y:[]}; for (var size = 1000; size <= 10000; size += 1000) { data.X.push(size); data.Y.push(testSource(size)); } var order = BigO(data); var msg = ''; for (var p = 0; p < data.X.length; p++) { msg += '(' + data.X[p] + ', ' + data.Y[p] + '); '; } printStatus(msg); printStatus('Order: ' + order); reportCompare(true, order < 2, 'BigO ' + order + ' < 2'); function testSource(n) { var funtext = ""; for (var i=0; i 41) ? ('catch all ' + y):'';", fin: " result += 'fin,';", end: "return result;})" }; var src = [ pfx + fin + end, pfx + cat + end, pfx + cat + fin + end, pfx + cg1a + end, pfx + cg1a + fin + end, pfx + cg1a + cat + end, pfx + cg1a + cat + fin + end, pfx + cg1a + cg2 + end, pfx + cg1a + cg2 + fin + end, pfx + cg1a + cg2 + cat + end, pfx + cg1a + cg2 + cat + fin + end, pfx + cg1b + end, pfx + cg1b + fin + end, pfx + cg1b + cat + end, pfx + cg1b + cat + fin + end, pfx + cg1b + cg2 + end, pfx + cg1b + cg2 + fin + end, pfx + cg1b + cg2 + cat + end, pfx + cg1b + cg2 + cat + fin + end, ]; var expsrc = [ exphash.pfx + exphash.fin + exphash.end, exphash.pfx + exphash.cat + exphash.end, exphash.pfx + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1a + exphash.end, exphash.pfx + exphash.cg1a + exphash.fin + exphash.end, exphash.pfx + exphash.cg1a + exphash.cat + exphash.end, exphash.pfx + exphash.cg1a + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.end, exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.fin + exphash.end, exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.cat + exphash.end, exphash.pfx + exphash.cg1a + exphash.cg2 + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1b + exphash.end, exphash.pfx + exphash.cg1b + exphash.fin + exphash.end, exphash.pfx + exphash.cg1b + exphash.cat + exphash.end, exphash.pfx + exphash.cg1b + exphash.cat + exphash.fin + exphash.end, exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.end, exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.fin + exphash.end, exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.cat + exphash.end, exphash.pfx + exphash.cg1b + exphash.cg2 + exphash.cat + exphash.fin + exphash.end, ]; for (var i in src) { print("\n=== " + i + ": " + src[i]); var f = eval(src[i]); var exp = eval(expsrc[i]); // dis(f); print('decompiling: ' + f); //print('decompiling exp: ' + exp); actual = ''; try { expect = exp(41); f(41) } catch (e) { print('tried f(41), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(42); f(42) } catch (e) { print('tried f(42), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(43); f(43) } catch (e) { print('tried f(43), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(44); f(44) } catch (e) { print('tried f(44), caught ' + e) } reportCompare(expect, actual, summary); actual = ''; try { expect = exp(45); f(45) } catch (e) { print('tried f(44), caught ' + e) } reportCompare(expect, actual, summary); } exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-350531.js0000644000175000017500000001470411545150464023330 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 350531; var summary = 'exhaustively test parenthesization of binary operator subsets'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); // Translated from permcomb.py, found at // http://biotech.embl-ebi.ac.uk:8400/sw/common/share/python/examples/dstruct/classics/permcomb.py // by searching for "permcomb.py". // // This shows bugs, gaps, and verbosities in JS compared to Python: // 1. Lack of range([start, ] end[, step]). // 2. ![] => false, indeed ! => false. // 3. Missing append or push for strings (if append, then we'd want append for // arrays too). // 4. Missing slice operator syntax s[i:j]. // 5. Lack of + for array concatenation. String.prototype.push = function (str) { return this + str; }; function permute(list) { if (!list.length) // shuffle any sequence return [list]; // empty sequence var res = []; for (var i = 0, n = list.length; i < n; i++) { // delete current node var rest = list.slice(0, i).concat(list.slice(i+1)); for each (var x in permute(rest)) // permute the others res.push(list.slice(i, i+1).concat(x)); // add node at front } return res; } function subset(list, size) { if (size == 0 || !list.length) // order matters here return [list.slice(0, 0)]; // an empty sequence var result = []; for (var i = 0, n = list.length; i < n; i++) { var pick = list.slice(i, i+1); // sequence slice var rest = list.slice(0, i).concat(list.slice(i+1)); // keep [:i] part for each (var x in subset(rest, size-1)) result.push(pick.concat(x)); } return result; } function combo(list, size) { if (size == 0 || !list.length) // order doesn't matter return [list.slice(0, 0)]; // xyz == yzx var result = []; for (var i = 0, n = (list.length - size) + 1; i < n; i++) { // iff enough left var pick = list.slice(i, i+1); var rest = list.slice(i+1); // drop [:i] part for each (var x in combo(rest, size - 1)) result.push(pick.concat(x)); } return result; } // Generate all subsets of distinct binary operators and join them from left // to right, parenthesizing minimally. Decompile, recompile, compress spaces // and compare to test correct parenthesization. // load("permcomb.js"); var bops = [ ["=", "|=", "^=", "&=", "<<=", ">>=", ">>>=", "+=", "-=", "*=", "/=", "%="], ["||"], ["&&"], ["|"], ["^"], ["&"], ["==", "!=", "===", "!=="], ["<", "<=", ">=", ">", "in", "instanceof"], ["<<", ">>", ">>>"], ["+", "-"], ["*", "/", "%"], ]; var prec = {}; var aops = []; for (var i = 0; i < bops.length; i++) { for (var j = 0; j < bops[i].length; j++) { var k = bops[i][j]; prec[k] = i; aops.push(k); } } // Theoretically all subsets of size 2 should be enough to test, but in case // there's some large-scale bug, try up to 5 (or higher? The cost in memory is // factorially explosive). next_subset: for (i = 2; i < 5; i++) { var sets = subset(aops, i); gc(); for each (var set in sets) { //print('for each set in sets: ' + (uneval(set)) ); var src = "(function () {"; for (j in set) { var op = set[j], op2 = set[j-1]; // Precedence 0 is for assignment ops, which are right- // associative, so don't force left associativity using // parentheses. if (prec[op] && prec[op] < prec[op2]) src += "("; } src += "x "; for (j in set) { var op = set[j], op2 = set[j+1]; // Parenthesize only if not right-associative (precedence 0) and // the next op is higher precedence than current. var term = (prec[op] && prec[op] < prec[op2]) ? " x)" : " x"; src += op + term; if (j < set.length - 1) src += " "; } src += ";})"; try { var ref = uneval(eval(src)).replace(/\s+/g, ' '); if (ref != src) { actual += "BROKEN! input: " + src + " output: " + ref + " "; print("BROKEN! input: " + src + " output: " + ref); break next_subset; } } catch (e) {} } } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-351102-01.js0000644000175000017500000000471111545150464023536 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351102; var summary = 'try/catch-guard/finally GC issues'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function () { try { throw new Error('bad'); } catch (e if (e = null, gc(), false)) { } catch (e) { // e is dangling now } }; f(); reportCompare(expect, actual, summary + ': 1'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-351102-02.js0000644000175000017500000000504211545150464023535 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351102; var summary = 'try/catch-guard/finally GC issues'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; f = function () { var a = null; try { a(); } catch (e) { } return false; }; try { throw 1; } catch (e if f()) { } catch (e if e == 1) { print("GOOD"); } catch (e) { print("BAD: "+e); } reportCompare(expect, actual, summary + ': 2'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-351102-06.js0000644000175000017500000000456411545150464023551 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351102; var summary = 'try/catch-guard/finally GC issues'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f; try { try { null.a } catch(e if (e = null, gc())) { } } catch(ex) { } reportCompare(expect, actual, summary + ': 6'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-351448.js0000644000175000017500000000757211545150464023345 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351448; var summary = 'RegExp - throw InternalError on too complex regular expressions'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var strings = [ "/.X(.+)+X/.exec('bbbbXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+X/.exec('bbbbXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+XX/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+XX/.exec('bbbbXcXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+[X]/.exec('bbbbXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+[X]/.exec('bbbbXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+[X][X]/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.X(.+)+[X][X]/.exec('bbbbXcXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.XX(.+)+X/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.XX(.+)+X/.exec('bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.XX(.+)+X/.exec('bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.XX(.+)+[X]/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.XX(.+)+[X]/.exec('bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X](.+)+[X]/.exec('bbbbXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X](.+)+[X]/.exec('bbbbXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X](.+)+[X][X]/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X](.+)+[X][X]/.exec('bbbbXcXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X][X](.+)+[X]/.exec('bbbbXXXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')", "/.[X][X](.+)+[X]/.exec('bbbbXXcXaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')" ]; expect = 'InternalError: regular expression too complex'; if (!options().match(/relimit/)) { options('relimit'); } for (var i = 0; i < strings.length; i++) { try { eval(strings[i]); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': ' + strings[i]); } exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-351463-01.js0000644000175000017500000001427011545150464023551 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351463; var summary = 'Treat hyphens as not special adjacent to CharacterClassEscapes in character classes'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var r; var s = 'a0- z'; r = '([\\d-\\s]+)'; expect = ['0- ', '0- '] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\s-\\d]+)'; expect = ['0- ', '0- '] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\D-\\s]+)'; expect = ['a', 'a'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\s-\\D]+)'; expect = ['a', 'a'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\d-\\S]+)'; expect = ['a0-', 'a0-'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\S-\\d]+)'; expect = ['a0-', 'a0-'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\D-\\S]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\S-\\D]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); // -- r = '([\\w-\\s]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\s-\\w]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\W-\\s]+)'; expect = ['- ', '- '] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\s-\\W]+)'; expect = ['- ', '- '] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\w-\\S]+)'; expect = ['a0-', 'a0-'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\S-\\w]+)'; expect = ['a0-', 'a0-'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\W-\\S]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); r = '([\\S-\\W]+)'; expect = ['a0- z', 'a0- z'] + ''; actual = null; try { actual = new RegExp(r).exec(s) + ''; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': /' + r + '/.exec("' + s + '")'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-351973.js0000644000175000017500000000537611545150464023350 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 351973; var summary = 'GC hazard with unrooted ids in Object.toSource'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function removeAllProperties(o) { for (var prop in o) delete o[prop]; for (var i = 0; i != 50*1000; ++i) { var tmp = Math.sqrt(i+0.2); tmp = 0; } if (typeof gc == "function") gc(); } function run_test() { var o = {}; o.first = { toSource: function() { removeAllProperties(o); } }; for (var i = 0; i != 10; ++i) { o[Math.sqrt(i + 0.1)] = 1; } return o.toSource(); } print(run_test()); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-352261.js0000644000175000017500000000547711545150464023341 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352261; var summary = 'Decompilation should preserve right associativity'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var g, h; g = function(a,b,c) { return a - (b + c) } expect = 'function(a,b,c) { return a - (b + c); }'; actual = g + ''; compareSource(expect, actual, summary); h = eval(uneval(g)); expect = g(1, 10, 100); actual = h(1, 10, 100); reportCompare(expect, actual, summary); var p, q; p = function (a,b,c) { return a + (b - c) } expect = 'function (a,b,c) { return a + (b - c);}'; actual = p + ''; compareSource(expect, actual, summary); q = eval(uneval(p)); expect = p(3, "4", "5"); actual = q(3, "4", "5"); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-352281.js0000644000175000017500000000500711545150464023330 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352281; var summary = 'decompilation of |while| and function declaration'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f, g; f = function() { { while(0) function t() { } } } expect = 'function() { while(0) { function t() { } }}'; actual = f + ''; compareSource(expect, actual, summary); g = eval(uneval(actual)); actual = g + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-352291.js0000644000175000017500000000477711545150464023346 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352291; var summary = 'disassembly of regular expression'; var actual = ''; var expect = 'TypeError: /g/g is not a function'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof dis != 'function') { actual = expect = 'disassembly not supported, test skipped.'; } else { try { dis(/g/g) } catch(ex) { actual = ex + ''; } } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-352372.js0000644000175000017500000000554411545150464023337 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352372; var summary = 'Do not assert eval("setter/*...")'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'ReferenceError: setter is not defined'; try { eval("setter/*\n*/;"); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, 'eval("setter/*\n*/;")'); try { eval("setter/*\n*/g"); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, 'eval("setter/*\n*/g")'); try { eval("setter/*\n*/ ;"); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, 'eval("setter/*\n*/ ;")'); try { eval("setter/*\n*/ g"); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, 'eval("setter/*\n*/ g")'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-352604.js0000644000175000017500000000462511545150464023334 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Brian Crowder * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 352604; var summary = 'Do not assert: !OBJ_GET_PROTO(cx, ctor)'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f() {} delete Function; var g = function () {}; expect = f.__proto__; actual = g.__proto__; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-353214.js0000644000175000017500000000472711545150464023335 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 353214; var summary = 'decompilation of |function() { (function ([x]) { })(); eval("return 3;") }|'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function() { (function ([x]) { })(); eval('return 3;') } expect = 'function() { (function ([x]) { }()); eval("return 3;"); }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-354297.js0000644000175000017500000000460111545150464023340 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 354297; var summary = 'getter/setter can be on index'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); print('This test requires GC_MARK_DEBUG'); var o = {}; o.__defineGetter__(1, Math.sin); gc() reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-354541-01.js0000644000175000017500000000477511545150464023562 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Reto Laemmler * Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 354541; var summary = 'Regression to standard class constructors in case labels'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary + ': top level'); String.prototype.trim = function() { print('hallo'); }; const S = String; const Sp = String.prototype; expect = 'No Error'; actual = 'No Error'; if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); } else { var s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; print(String === S); print(String.prototype === Sp); "".trim();'); s(); } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-354541-02.js0000644000175000017500000000541011545150464023546 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Reto Laemmler * Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 354541; var summary = 'Regression to standard class constructors in case labels'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary + ': in function'); String.prototype.trim = function() { print('hallo'); }; const S = String; const Sp = String.prototype; expect = 'No Error'; actual = 'No Error'; if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); } else { var s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; print(String === S); print(String.prototype === Sp); "".trim();'); s(); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-354541-03.js0000644000175000017500000000624011545150464023551 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Reto Laemmler * Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 354541; var summary = 'Regression to standard class constructors in case labels'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary + ': top level'); String.prototype.trim = function() { print('hallo'); }; String.prototype.trim = function() { return 'hallo'; }; const S = String; const Sp = String.prototype; expect = 'hallo'; var expectStringInvariant = true var actualStringInvariant; var expectStringPrototypeInvariant = true; var actualStringPrototypeInvariant; if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); reportCompare("Script not defined, Test skipped.", "Script not defined, Test skipped.", summary); } else { var s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; actualStringInvariant = (String === S); actualStringPrototypeInvariant = (String.prototype === Sp); actual = "".trim();'); try { s(); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, 'trim() returned'); reportCompare(expectStringInvariant, actualStringInvariant, 'String invariant'); reportCompare(expectStringPrototypeInvariant, actualStringPrototypeInvariant, 'String.prototype invariant'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-354541-04.js0000644000175000017500000000660111545150464023553 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Reto Laemmler * Brendan Eich * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 354541; var summary = 'Regression to standard class constructors in case labels'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary + ': in function'); String.prototype.trim = function() { return 'hallo'; }; const S = String; const Sp = String.prototype; expect = 'hallo'; var expectStringInvariant = true; var actualStringInvariant; var expectStringPrototypeInvariant = true; var actualStringPrototypeInvariant; if (typeof Script == 'undefined') { print('Test skipped. Script is not defined'); reportCompare("Script not defined, Test skipped.", "Script not defined, Test skipped.", summary); } else { s = Script('var tmp = function(o) { switch(o) { case String: case 1: return ""; } }; actualStringInvariant = (String === S); actualStringPrototypeInvariant = (String.prototype === Sp); actual = "".trim();'); try { s(); } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, 'trim() returned'); reportCompare(expectStringInvariant, actualStringInvariant, 'String invariant'); reportCompare(expectStringPrototypeInvariant, actualStringPrototypeInvariant, 'String.prototype invariant'); } exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-355339.js0000644000175000017500000000470311545150464023341 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 355339; var summary = 'Do not assert: sprop->setter != js_watch_set'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'No Crash'; o = {}; o.watch("j", function(a,b,c) { print("*",a,b,c) }); o.unwatch("j"); o.watch("j", function(a,b,c) { print("*",a,b,c) }); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-355497.js0000644000175000017500000000556211545150464023352 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * Seno Aiko * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 355497; var summary = 'Do not overflow stack with Array.slice, getter'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'InternalError: too much recursion'; try { var a = { length: 1 }; a.__defineGetter__(0, [].slice); a[0]; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 1'); try { var b = { length: 1 }; b.__defineGetter__(0, function () { return Array.slice(b);}); b[0]; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 2'); try { var c = []; c.__defineSetter__(0, c.unshift); c[0] = 1; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 3'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-355622.js0000644000175000017500000000456711545150464023344 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 355622; var summary = 'Do not assert: overwriting'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { (function() { export arguments })(); } catch(ex) { print(ex + ''); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-355655.js0000644000175000017500000000512311545150464023337 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): shutdown * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 355655; var summary = 'running script can be recompiled'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); } else { expect = 'TypeError: cannot compile over a script that is currently executing'; actual = ''; try { t='1';s=Script('s.compile(t);print(t);');s(); } catch(ex) { actual = ex + ''; } } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-355736.js0000644000175000017500000000533611545150464023345 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 355736; var summary = 'Decompilation of "[reserved]" has extra quotes'; var actual = ''; var expect = ''; var f; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); f = function() { [implements] = q; }; expect = 'function() { [implements] = q; }'; actual = f + ''; compareSource(expect, actual, summary + ': 1'); f = function() { return { get implements() { } } }; expect = 'function() { return { get implements() { } }; }'; actual = f + ''; compareSource(expect, actual, summary + ': 2'); f = function() { [goto] = a }; expect = 'function() { [goto] = a; }'; actual = f + ''; compareSource(expect, actual, summary + ': 3'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-355820.js0000644000175000017500000000456611545150464023343 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Gavin Sharp * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 355820; var summary = 'Remove non-standard Script object'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); print('This test will fail in gecko prior to 1.9'); expect = 'undefined'; actual = typeof Script; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-355982.js0000644000175000017500000000476311545150464023353 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): shutdown * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 355982; var summary = 'Script("") should not fail'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'No Error'; actual = 'No Error'; try { if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); } else { Script(''); } } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-356402.js0000644000175000017500000000430511545150464023327 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 356402; var summary = 'Do not assert: slot < fp->nvars'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); } else { (function() { new Script('for(var x in x) { }')(); })(); } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-358594-01.js0000644000175000017500000000466411545150464023573 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 358594; var summary = 'Do not crash on uneval(this).'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); // don't crash|assert function f() { } f.__proto__ = this; Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true }); uneval(this); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-358594-02.js0000644000175000017500000000427211545150464023567 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 358594; var summary = 'Do not crash on uneval(this).'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); // don't crash|assert function f() { } f.__proto__ = this; Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true }); uneval(this); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-358594-03.js0000644000175000017500000000466611545150464023577 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 358594; var summary = 'Do not crash on uneval(this).'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); // don't crash|assert f = function () { }; f.__proto__ = this; Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true }); uneval(this); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-358594-04.js0000644000175000017500000000427511545150464023574 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 358594; var summary = 'Do not crash on uneval(this).'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); // don't crash|assert f = function () { }; f.__proto__ = this; Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true }); uneval(this); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-358594-05.js0000644000175000017500000000466711545150464023602 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 358594; var summary = 'Do not crash on uneval(this).'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); // don't crash|assert f = function () { }; f.hhhhhhhhh = this; Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true }); uneval(this); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-358594-06.js0000644000175000017500000000427511545150464023576 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 358594; var summary = 'Do not crash on uneval(this).'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); // don't crash|assert f = function () { }; f.hhhhhhhhh = this; Object.defineProperty(this, "m", { set: f, enumerable: true, configurable: true }); uneval(this); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-359024.js0000644000175000017500000000507111545150464023333 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Georgi Guninski * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 359024; var summary = 'Do not crash with Script...'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof Script == 'undefined') { print(expect = actual = 'Test skipped. Script object required.'); } else { var scri=new Script(" var s=new Date(); var a=0; for(var i=0;i<1024*1024;i++) {a=i } var e=new Date(); print('time2='+(e-s)/1000);"); scri.compile(); scri.exec(); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-361346.js0000644000175000017500000000430611545150464023333 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 361346; var summary = 'Crash with setter, watch, GC'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'No Crash'; Object.defineProperty(this, "x", { set: new Function, enumerable: true, configurable: true }); this.watch('x', function(){}); gc(); x = {}; reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-361360.js0000644000175000017500000000463511545150464023334 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 361360; var summary = 'Do not assert: !caller || caller->pc involving setter and watch'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'No Crash'; this.__defineSetter__('x', eval); this.watch('x', function(){}); x = 3; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-361552.js0000644000175000017500000000435011545150464023331 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 361552; var summary = 'Crash with setter, watch, Script'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'No Crash'; if (typeof Script == 'undefined') { print('Test skipped. Script not defined.'); } else { this.__defineSetter__('x', gc); this.watch('x', new Script('')); x = 3; } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-361558.js0000644000175000017500000000420411545150464023335 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 361558; var summary = 'Do not assert: sprop->setter != js_watch_set'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); expect = actual = 'No Crash'; ({}.__proto__.watch('x', print)); ({}.watch('x', print)); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-361571.js0000644000175000017500000000516211545150464023334 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 361571; var summary = 'Do not assert: fp->scopeChain == parent'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { o = {}; o.__defineSetter__('y', eval); o.watch('y', function () { return "";}); o.y = 1; } catch(ex) { printStatus('Note eval can no longer be called directly'); expect = 'EvalError: function eval must be called directly, and not by way of a function of another name'; actual = ex + ''; } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-361856.js0000644000175000017500000000464211545150464023344 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): shutdown * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 361856; var summary = 'Do not assert: overwriting @ js_AddScopeProperty'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function testit() { var obj = {}; obj.watch("foo", function(){}); delete obj.foo; obj = null; gc(); } testit(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-361964.js0000644000175000017500000000534311545150464023343 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): moz_bug_r_a4 * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 361964; var summary = 'Crash [@ MarkGCThingChildren] involving watch and setter'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var doc; if (typeof document == 'undefined') { doc = {}; } else { doc = document; } if (typeof alert == 'undefined') { alert = print; } // Crash: doc.watch("title", function(a,b,c,d) { return { toString : function() { alert(1); } }; }); doc.title = "xxx"; // No crash: doc.watch("title", function() { return { toString : function() { alert(1); } }; }); doc.title = "xxx"; reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-363258.js0000644000175000017500000000516311545150464023341 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 363258; var summary = 'Timer resolution'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var start = 0; var stop = 0; var i; var limit = 0; var incr = 10; var resolution = 5; while (stop - start == 0) { limit += incr; start = Date.now(); for (i = 0; i < limit; i++) {} stop = Date.now(); } print('limit=' + limit + ', resolution=' + resolution + ', time=' + (stop - start)); expect = true; actual = (stop - start <= resolution); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-363988.js0000644000175000017500000000541011545150464023346 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2006 * the Initial Developer. All Rights Reserved. * * Contributor(s): Hein Roehrig * Daniel Veditz * Erik Fabert * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 363988; var summary = 'Do not crash at JS_GetPrivate with large script'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function crash() { var town = new Array; for (var i = 0; i < 0x4001; ++i) { var si = String(i); town[i] = [ si, "x" + si, "y" + si, "z" + si ]; } return "town=" + uneval(town) + ";function f() {}"; } if (typeof document != "undefined") { // this is required to reproduce the crash. document.write("'); window.addEventListener('load', crash, false); } else { reportCompare(expect, actual, summary); } exitFunc ('test'); } function crash() { gDelayTestDriverEnd = false; reportCompare(expect, actual, summary); jsTestDriverEnd(); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-369696-01.js0000755000175000017500000000456011545150464023576 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 369696; var summary = 'Do not assert: map->depth > 0" in js_LeaveSharpObject'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); q = []; q.__defineGetter__("0", q.toString); q[2] = q; q.toSource(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-369696-02.js0000755000175000017500000000557611545150464023607 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 369696; var summary = 'Do not assert: map->depth > 0" in js_LeaveSharpObject'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function fun() {} n = fun.prototype; n.__defineGetter__("prototype", n.toSource); p = n.__lookupGetter__("prototype"); n = p; assertEq(n, Object.prototype.toSource); assertEq(p, Object.prototype.toSource); n["prototype"] = [n]; n = p; assertEq(n, Object.prototype.toSource); assertEq(p, Object.prototype.toSource); p2 = n["prototype"]; assertEq(Array.isArray(p2), true); assertEq(p2[0], Object.prototype.toSource); n = p2; assertEq(n.toString, Array.prototype.toString); n.__defineGetter__("0", n.toString); n = p; assertEq(n, Object.prototype.toSource); n.call(this); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-369696-03.js0000755000175000017500000000520711545150464023577 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 369696; var summary = 'Do not assert: map->depth > 0" in js_LeaveSharpObject'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var x = [[[ { toSource: function() { gc(); }}]]]; var a = []; a[0] = a; a.toSource = a.toString; Array.prototype.toSource.call(a); //cx->sharpObjectMap.depth == -2 (function() { var tmp = []; for (var i = 0; i != 30*1000; ++i) { var tmp2 = []; tmp.push(tmp2); tmp2.toSource(); } })(); gc(); x.toSource(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-371636.js0000644000175000017500000000566011545150464023342 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 371636; var summary = 'Numeric sort performance'; var actual = false; var expect = '(tint/tstr < 3)=true'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function testint(power) { var N = 1 << power; var a = new Array(N); for (var i = 0; i != N; ++i) a[i] = (N-1) & (0x9E3779B9 * i); var now = Date.now; var t = now(); a.sort(); return now() - t; } function teststr(power) { var N = 1 << power; var a = new Array(N); for (var i = 0; i != N; ++i) a[i] = String((N-1) & (0x9E3779B9 * i)); var now = Date.now; var t = now(); a.sort(); return now() - t; } var tint = testint(18); var tstr = teststr(18); print('int: ' + tint, 'str: ' + tstr, 'int/str: ' + (tint/tstr).toFixed(2)); actual = '(tint/tstr < 3)=' + (tint/tstr < 3); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-372309.js0000644000175000017500000000534211545150464023335 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Eli Friedman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 372309; var summary = 'Root new array objects'; var actual = 'No Crash'; var expect = 'No Crash'; function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var width = 600; var height = 600; var img1canvas = document.createElement("canvas"); var img2canvas = document.createElement("canvas"); img1canvas.width = img2canvas.width = width; img1canvas.height = img2canvas.height = height; img1canvas.getContext("2d").getImageData(0, 0, width, height).data; img2canvas.getContext("2d").getImageData(0, 0, width, height).data; reportCompare(expect, actual, summary); gDelayTestDriverEnd = false; jsTestDriverEnd(); exitFunc ('test'); } if (typeof window != 'undefined') { // delay test driver end gDelayTestDriverEnd = true; window.addEventListener("load", test, false); } else { reportCompare(expect, actual, summary); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-374589.js0000644000175000017500000000505111545150464023346 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 374589; var summary = 'Do not assert decompiling try { } catch(x if true) { } ' + 'catch(y) { } finally { this.a.b; }'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = function () { try { } catch(x if true) { } catch(y) { } finally { this.a.b; } }; expect = 'function () { try { } catch(x if true) { } catch(y) { } ' + 'finally { this.a.b; } }'; actual = f + ''; compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-375183.js0000644000175000017500000000534311545150464023341 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375183; var summary = '__noSuchMethod__ should not allocate beyond fp->script->depth'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var obj = { get __noSuchMethod__() { print("Executed"); return new Object(); }}; try { obj.x(); } catch(ex) { } reportCompare(expect, actual, summary + ':1'); obj = { __noSuchMethod__: {} }; try { obj.x(); } catch(ex) { } reportCompare(expect, actual, summary + ':2'); obj = { } obj.__noSuchMethod__ = {}; try { obj.x(); } catch(ex) { } reportCompare(expect, actual, summary + ':3'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-375344.js0000644000175000017500000000470511545150464023341 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): James Justin Harrell * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375344; var summary = 'accessing prototype of DOM objects should throw catchable error'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); if (typeof HTMLElement != 'undefined') { expect = /Exception... "Illegal operation on WrappedNative prototype object"/; try { print(HTMLElement.prototype.nodeName ); } catch(ex) { actual = ex + ''; print(actual); } reportMatch(expect, actual, summary); } else { expect = actual = 'Test can only run in a Gecko 1.9 browser or later.'; print(actual); reportCompare(expect, actual, summary); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-375801.js0000644000175000017500000000525711545150464023342 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 375801; var summary = 'uneval should use "(void 0)" instead of "undefined"'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '({a: (void 0)})' actual = uneval({a: undefined}) compareSource(expect, actual, summary + ': uneval'); expect = 'function() {({a: undefined});}'; actual = (function() {({a: undefined});}).toString(); compareSource(expect, actual, summary + ': toString'); expect = '(function () {({a: undefined});})'; actual = (function () {({a: undefined});}).toSource(); compareSource(expect, actual, summary + ': toSource'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-376052.js0000644000175000017500000000611111545150464023327 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): George Kangas * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 376052; var summary = 'javascript.options.anonfunfix to allow function (){} expressions'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof window != 'undefined') { print('Test skipped. anonfunfix not configurable in browser.'); reportCompare(expect, actual, summary); } else { expect = 'No Error'; try { eval('function () {1;}'); actual = 'No Error'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 1'); options('anonfunfix'); expect = 'No Error'; try { eval('(function () {1;})'); actual = 'No Error'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 2'); expect = 'SyntaxError: syntax error'; try { eval('function () {1;}'); actual = 'No Error'; } catch(ex) { actual = ex + ''; } reportCompare(expect, actual, summary + ': 3'); } exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-379523.js0000644000175000017500000000507111545150464023341 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 379523; var summary = 'Decompilation of sharp declaration'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var f = (function () { return #1=[a]; }); expect = '(function () { return #1=[a]; })'; actual = f.toSource(); compareSource(expect, actual, summary + ': 1'); f = (function () { return #1={a:b}; }); expect = '(function () { return #1={a:b}; })'; actual = f.toSource(); compareSource(expect, actual, summary + ': 1'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-380581.js0000644000175000017500000000455111545150464023337 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 380581; var summary = 'Incorrect uneval with setter in object literal'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '(function() { })'; actual = uneval(eval("(function() { })")); compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-380889.js0000644000175000017500000000464211545150464023353 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 380889; var summary = 'Source disassembler assumes SRC_SWITCH has jump table'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function f(i) { switch(i){ case 1: case xyzzy: } } if (typeof dis != 'undefined') { dis(f); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-381211.js0000644000175000017500000000450211545150464023322 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 381211; var summary = 'uneval with getter'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = '( { get x() {} } )'; actual = uneval({get x(){}}); compareSource(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-381304.js0000644000175000017500000000642711545150464023335 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Biju * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 381304; var summary = 'getter/setter with keywords'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); var obj; print('1'); obj = { set inn(value) {this.for = value;}, get inn() {return this.for;} }; expect = '({get inn() { return this.for; }, set inn(value) { this.for = value; } })'; actual = obj.toSource(); compareSource(expect, actual, summary + ': 1'); print('2'); obj = { set in(value) {this.for = value;}, get in() {return this.for;} }; expect = '({ get in() { return this.for; }, set in(value) { this.for = value; } })'; actual = obj.toSource(); compareSource(expect, actual, summary + ': 2'); print('3'); obj = { set inn(value) {this.for = value;}, get in() {return this.for;} }; expect = '({ set inn(value) { this.for = value; }, get in() { return this.for; } })'; actual = obj.toSource(); compareSource(expect, actual, summary + ': 4'); print('4'); obj = { set in(value) {this.for = value;}, get inn() {return this.for;} }; expect = ' ({ set in(value) { this.for = value; }, get inn() { return this.for; } })'; actual = obj.toSource(); compareSource(expect, actual, summary + ': 5'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-384680.js0000644000175000017500000000475311545150464023347 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 384680; var summary = 'Round-trip change in decompilation with paren useless expression'; var actual = ''; var expect = ''; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); expect = 'function() {}'; var f = (function() { (3); }); actual = f + ''; compareSource(expect, actual, summary + ': f'); var g = eval('(' + f + ')'); actual = g + ''; compareSource(expect, actual, summary + ': g'); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-385134.js0000644000175000017500000000502011545150464023326 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 385134; var summary = 'Do not crash with setter, watch, uneval'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof this.__defineSetter__ != 'undefined' && typeof this.watch != 'undefined' && typeof uneval != 'undefined') { this.__defineSetter__(0, function(){}); this.watch(0, function(){}); uneval(this); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-385393-02.js0000644000175000017500000000453611545150464023567 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 385393; var summary = 'Regression test for bug 385393'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); try { (4).__lookupGetter__("w"); } catch(ex) { } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-385393-09.js0000644000175000017500000000417111545150464023571 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 385393; var summary = 'Regression test for bug 385393'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); eval("this.__defineSetter__('x', gc); this.watch('x', [].slice); x = 1;"); reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-390597.js0000644000175000017500000000515111545150464023344 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): shutdown * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 390597; var summary = 'watch point + eval-as-setter allows access to dead JSStackFrame'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function exploit() { try { var obj = this, args = null; obj.__defineSetter__("evil", eval); obj.watch("evil", function() { return "args = arguments;"; }); obj.evil = null; eval("print(args[0]);"); } catch(ex) { print('Caught ' + ex); } } exploit(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-390598.js0000755000175000017500000000464611545150464023360 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): shutdown * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 390598; var summary = 'array_length_setter is exploitable'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); function exploit() { var fun = function () {}; fun.__proto__ = []; fun.length = 0x50505050 >> 1; fun(); } exploit(); reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-394967.js0000644000175000017500000000500211545150464023344 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 394967; var summary = 'Do not assert: !JSVAL_IS_PRIMITIVE(vp[1])'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof evalcx == 'undefined') { print('Skipping. This test requires evalcx.'); } else { var sandbox = evalcx(""); try { evalcx("(1)()", sandbox); } catch(ex) { } } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-396326.js0000644000175000017500000000561311545150464023343 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Seno Aiko * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 396326; var summary = 'Do not assert trying to disassemble get(var|arg) prop'; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof dis == 'undefined') { print('disassembly not supported. test skipped.'); reportCompare(expect, actual, summary); } else { function f1() { var v; return v.prop }; dis(f1); reportCompare(expect, actual, summary + ': function f1() { var v; return v.prop };'); function f2(arg) { return arg.prop }; dis(f2); reportCompare(expect, actual, summary + ': function f2(arg) { return arg.prop };'); function f3() { return this.prop }; dis(f3); reportCompare(expect, actual, summary + ': function f3() { return this.prop };'); } exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-406572.js0000644000175000017500000000504511545150464023335 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 406572; var summary = 'JSOP_CLOSURE unconditionally replaces properties of the variable object - Browser only'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); if (typeof window != 'undefined') { try { expect = 'TypeError: redeclaration of const document'; var d = document; d.writeln(uneval(document)); document = 1; d.writeln(uneval(document)); if (1) function document() { return 1; } d.writeln(uneval(document)); } catch(ex) { actual = ex + ''; print(actual); } } else { expect = actual = 'Test can only run in a Gecko 1.9 browser or later.'; print(actual); } reportCompare(expect, actual, summary); mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-407019.js0000644000175000017500000000502311545150464023326 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): Jesse Ruderman * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 407019; var summary = 'Do not assert: !JS_IsExceptionPending(cx) - Browser only'; var actual = ''; var expect = ''; printBugNumber(BUGNUMBER); printStatus (summary); if (typeof window != 'undefined' && typeof window.Option == 'function' && '__proto__' in window.Option) { try { expect = /Illegal operation on WrappedNative prototype object/; window.Option("u", window.Option.__proto__); for (p in document) { } actual = 'No Error'; } catch(ex) { actual = ex + ''; } reportMatch(expect, actual, summary); } else { expect = actual = 'Test can only run in a Gecko 1.9 browser or later.'; print(actual); reportCompare(expect, actual, summary); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-407501.js0000644000175000017500000000475511545150464023335 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2007 * the Initial Developer. All Rights Reserved. * * Contributor(s): Igor Bukanov * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 407501; var summary = 'JSOP_NEWINIT lacks SAVE_SP_AND_PC '; var actual = 'No Crash'; var expect = 'No Crash'; //----------------------------------------------------------------------------- test(); //----------------------------------------------------------------------------- function test() { enterFunc ('test'); printBugNumber(BUGNUMBER); printStatus (summary); if (typeof gczeal == 'function') { gczeal(2); } var a = [[[[[[[0]]]]]]]; if (uneval(a).length == 0) throw "Unexpected result"; if (typeof gczeal == 'function') { gczeal(0); } reportCompare(expect, actual, summary); exitFunc ('test'); } mozjs-1.8.5-1.0.0+dfsg/js/src/tests/js1_5/extensions/regress-407720.js0000644000175000017500000000536111545150464023332 0ustar chr1schr1s/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is JavaScript Engine testing utilities. * * The Initial Developer of the Original Code is * Mozilla Foundation. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor(s): moz_bug_r_a4 * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ //----------------------------------------------------------------------------- var BUGNUMBER = 407720; var summary = 'js_FindClassObject causes crashes with getter/setter - Browser only'; var actual = 'No Crash'; var expect = 'No Crash'; printBugNumber(BUGNUMBER); printStatus (summary); // stop the test after 60 seconds var start = new Date(); if (typeof document != 'undefined') { // delay test driver end gDelayTestDriverEnd = true; document.write('