Perform instanceof check and return the downcasted File object. This is necessary since methods may reside in the File.prototype object and scripts can dynamically alter prototype chains. This method ensures type safety by verifying that the object is actually a File instance before casting. <p
(Scriptable obj)
| 380 | * @throws RuntimeException if the object is null or not an instance of File |
| 381 | */ |
| 382 | private static File checkInstance(Scriptable obj) { |
| 383 | if (obj == null || !(obj instanceof File)) { |
| 384 | throw Context.reportRuntimeError("called on incompatible object"); |
| 385 | } |
| 386 | return (File) obj; |
| 387 | } |
| 388 | |
| 389 | /** |
| 390 | * The filename associated with this File object. May be empty string if using standard |
no test coverage detected