src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java

Print this page

        

*** 24,34 **** --- 24,36 ---- */ package jdk.nashorn.internal.objects; import static jdk.nashorn.internal.runtime.ECMAErrors.typeError; + import java.nio.ByteBuffer; + import jdk.nashorn.internal.objects.annotations.Attribute; import jdk.nashorn.internal.objects.annotations.Constructor; import jdk.nashorn.internal.objects.annotations.Function; import jdk.nashorn.internal.objects.annotations.Getter; import jdk.nashorn.internal.objects.annotations.ScriptClass;
*** 99,109 **** if (!newObj) { throw typeError("constructor.requires.new", "ArrayBuffer"); } if (args.length == 0) { ! throw new RuntimeException("missing length argument"); } return new NativeArrayBuffer(JSType.toInt32(args[0])); } --- 101,113 ---- if (!newObj) { throw typeError("constructor.requires.new", "ArrayBuffer"); } if (args.length == 0) { ! //For ES6 rev28+ we should throw a TypeError here. None of the other runtimes ! //currently do it, though, so I have chosen to not implement that for now. ! return new NativeArrayBuffer(0); } return new NativeArrayBuffer(JSType.toInt32(args[0])); }