function bring_promise_to_current_realm(promise) {
        return new Promise(promise.then.bind(promise));
    }
Make a copy of a Promise in the current realm.

@param {Promise} promise the given promise that may be from a different
                         realm
@returns {Promise}

An arbitrary promise provided by the caller may have originated
in another frame that have since navigated away, rendering the
frame's document inactive. Such a promise cannot be used with
`await` or Promise.resolve(), as microtasks associated with it
may be prevented from being run. See `issue
5319<https://github.com/whatwg/html/issues/5319>`_ for a
particular case.

In functions we define here, there is an expectation from the caller
that the promise is from the current realm, that can always be used with
`await`, etc. We therefore create a new promise in this realm that
inherit the value and status from the given promise.