see 10.5.8 [[Get]] (P, Receiver)
(String name, Scriptable start)
| 364 | * [[Get]] (P, Receiver)</a> |
| 365 | */ |
| 366 | @Override |
| 367 | public Object get(String name, Scriptable start) { |
| 368 | /* |
| 369 | * 1. Assert: IsPropertyKey(P) is true. |
| 370 | * 2. Let handler be O.[[ProxyHandler]]. |
| 371 | * 3. If handler is null, throw a TypeError exception. |
| 372 | * 4. Assert: Type(handler) is Object. |
| 373 | * 5. Let target be O.[[ProxyTarget]]. |
| 374 | * 6. Let trap be ? GetMethod(handler, "get"). |
| 375 | * 7. If trap is undefined, then |
| 376 | * a. Return ? target.[[Get]](P, Receiver). |
| 377 | * 8. Let trapResult be ? Call(trap, handler, « target, P, Receiver »). |
| 378 | * 9. Let targetDesc be ? target.[[GetOwnProperty]](P). |
| 379 | * 10. If targetDesc is not undefined and targetDesc.[[Configurable]] is false, then |
| 380 | * a. If IsDataDescriptor(targetDesc) is true and targetDesc.[[Writable]] is false, then |
| 381 | * i. If SameValue(trapResult, targetDesc.[[Value]]) is false, throw a TypeError exception. |
| 382 | * b. If IsAccessorDescriptor(targetDesc) is true and targetDesc.[[Get]] is undefined, then |
| 383 | * i. If trapResult is not undefined, throw a TypeError exception. |
| 384 | * 11. Return trapResult. |
| 385 | */ |
| 386 | ScriptableObject target = getTargetThrowIfRevoked(); |
| 387 | |
| 388 | Function trap = getTrap(TRAP_GET); |
| 389 | if (trap != null) { |
| 390 | Object trapResult = callTrap(trap, new Object[] {target, name, start}); |
| 391 | |
| 392 | DescriptorInfo targetDesc = target.getOwnPropertyDescriptor(Context.getContext(), name); |
| 393 | if (targetDesc != null && targetDesc.isConfigurable(false)) { |
| 394 | if (targetDesc.isDataDescriptor() && targetDesc.isWritable(false)) { |
| 395 | if (!Objects.equals(trapResult, targetDesc.value)) { |
| 396 | throw ScriptRuntime.typeError( |
| 397 | "proxy get has to return the same value as the plain call"); |
| 398 | } |
| 399 | } |
| 400 | if (targetDesc.isAccessorDescriptor() && Undefined.isUndefined(targetDesc.getter)) { |
| 401 | if (!Undefined.isUndefined(trapResult)) { |
| 402 | throw ScriptRuntime.typeError( |
| 403 | "proxy get has to return the same value as the plain call"); |
| 404 | } |
| 405 | } |
| 406 | } |
| 407 | return trapResult; |
| 408 | } |
| 409 | |
| 410 | if (start == this) { |
| 411 | start = target; |
| 412 | } |
| 413 | return target.get(name, start); |
| 414 | } |
| 415 | |
| 416 | /** |
| 417 | * see <a |
nothing calls this directly
no test coverage detected