I'm modding firefox and I'm looking for a way to modify the date.toLocaleString JavaScript method behavior on FireFox.
It is a "Chameleon" mod to spoof the return value. I want to add an extra argument if none was passed:
e.g
var date = new Date();
date.toLocaleString(); // "6/28/2016, 6:16:18 PM"
date.toLocateString("ar-TN"); // "٢٨/٦/٢٠١٦ ٦:١٦:١٨ م"
I'd like to get the second result from the first call (normally used by websites when fingerprinting), given the locale without changing the whole browser's locale, just the JS.
I have already tried JavaScript approaches (overriding the function, proxy pattern, you name it..) but couldn't get a clean implementation (that can be removed from the DOM without problem) and patching the underlying C++ code without success (didn't dig too much on that honestly).
Can you point me to an appropriate approach, and/or a specific patch location ?