| 53 | } |
| 54 | |
| 55 | static bool cancelByTimeoutId(JSContext *cx, unsigned argc, JS::Value *vp) { |
| 56 | JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
| 57 | double timeoutID = args.get(0).toNumber(); |
| 58 | |
| 59 | args.rval().setUndefined(); |
| 60 | |
| 61 | // Retrieve the AsyncHandle by `timeoutID` |
| 62 | AsyncHandle *handle = AsyncHandle::fromId((uint32_t)timeoutID); |
| 63 | if (!handle) return true; // does nothing on invalid timeoutID |
| 64 | |
| 65 | // Cancel this job on the Python event-loop |
| 66 | handle->cancel(); |
| 67 | handle->removeRef(); |
| 68 | |
| 69 | return true; |
| 70 | } |
| 71 | |
| 72 | static bool timerHasRef(JSContext *cx, unsigned argc, JS::Value *vp) { |
| 73 | JS::CallArgs args = JS::CallArgsFromVp(argc, vp); |
no test coverage detected