TamperMonkey & ViolnetMonkey implementation of unsafeWindow is different. In your example code, if you don't need to use any of the GM functions ...
The unsafeWindow object provides access to the window object of the page that Tampermonkey is running on, rather than the window object of the Tampermonkey ...