         ((symbolp x) (format "{objid:%S}" (symbol-name x)))
         ((espresso--js-handle-p x)
 
-         ;; Check that the handle hasn't expired
-         (unless (eq (espresso--js-handle-process x)
-                     (inferior-moz-process))
+         (when (espresso--js-handle-expired-p x)
            (error "Stale JS handle"))
 
          (format "{objid:%s}" (espresso--js-handle-id x)))

        (espresso--js-wait-for-eval-prompt)

      ;; Otherwise, tell Mozilla to enter the interactor mode
      (insert "repl.pushInteractor('espresso')")
      (comint-send-input nil t)
      (espresso--wait-for-matching-output
       (inferior-moz-process) espresso--js-repl-prompt-regexp 1))

                                      (espresso--optimize-arglist function))
                              function)
                           ,@(espresso--optimize-arglist body)))

                    (js-new (function &rest body)
                            `(espresso--js-new
                              ,(if (consp function)
