This command worked in my gamepad mapper:
localStorage.setItem("gamepad_configuration", JSON.stringify(config_data));
The only thing that stands out is the capitalized 'Window'. If I go to the console and type "Window.localStorage" it shows undefined, if I type "window.localStorage" it shows a length zero object. If that's not the issue, it might be hard to debug without seeing the code.