Please unit test this function in app_window_test.js