For some reason, in Chromium-based and Firefox-based browsers, the conversion of a function into a string works differently, so when we try to get the index of 'native code' we get different results. The best approach would be, of course, to use regex or to somehow parse it other way, but it feels like that is unnecessary, because the result of nativeOpen.toString().indexOf('native code') is always either 19 for Chrome or 23 for Firefox:
// nativeOpen.toString() in Chromium-based browsers
function open() { [native code] }
// nativeOpen.toString() in Firefox-based browsers
function open() {
[native code]
}
For some reason, in Chromium-based and Firefox-based browsers, the conversion of a function into a string works differently, so when we try to get the index of
'native code'
we get different results. The best approach would be, of course, to use regex or to somehow parse it other way, but it feels like that is unnecessary, because the result ofnativeOpen.toString().indexOf('native code')
is always either 19 for Chrome or 23 for Firefox: