To run R:

  1. Let result be the result of firing an event named beforeunload.
  2. Let result be the result of firing an event named "error".
  3. Let result be the result of firing an event named name.