I'm trying to debug a Chrome extension that uses chrome.runtime.getPlatformInfo()
to choose which codepath to execute depending on the OS. Functionality is different depending on the operating system (this is not something I agree with, but I do not control the extension's development). While I could try to replace each instance in the source code, returning false data instead of actually calling the browser-provided function, I find such a solution inelegant and prone to human error.
I'm doing my testing on a computer running macOS. I want the extension to think I'm running ChromeOS (where the returned object has the "os"
property set to "cros"
). How would I go about spoofing the returned object to have the properties set to my desired values?
I've tried searching for command line startup flags, but I couldn't find one for this purpose. I tried using the User-Agent flag, but as one may expect, that only affects the User-Agent header and not the data returned from chrome.runtime.getPlatformInfo()
.