promise and framePromise may be the same object so I think you should not use the promise here if it is the same as framePromise as it used already for writeData(...)