A page checks that a browser function is native by printing it. Function.prototype.toString returns the source of a function written in JavaScript and function name() { [native code] } for one built into the browser. A spoof that replaced a getter has to hide that difference, and the usual way of hiding it lasts exactly one realm. A page then checks the objects that functions return, because a stand-in object fails a brand check three ways at once.

The first check: Function toString and native code

Every getter a fingerprint is read from has a native implementation. Take the one behind navigator.userAgent:

const get = Object.getOwnPropertyDescriptor(Navigator.prototype, 'userAgent').get
Function.prototype.toString.call(get)
// "function get userAgent() { [native code] }"

If a script has replaced that getter with its own function, the same call prints the script's code. So a spoofing script also replaces Function.prototype.toString, with a version that checks a list of its own functions and answers [native code] for them. Then it has to make the new toString print as native too, because the next probe is toString.call(toString).

That holds up in the page. It does not hold up anywhere else.

Every profile is drawn from one real computer, not from separate listsIn Mosaic: Machines that exist. GPU, screen, CPU and fonts from one real device. Free covers 3 profiles with no card, and Pro is $25 a month for any number of them.

How it works: Machines that exist

The second check: ask from a fresh realm

An iframe is a new realm: its own globals, its own Function.prototype, its own toString. A page can make one in a line and borrow its toString:

const f = document.createElement('iframe')
document.documentElement.appendChild(f)
f.contentWindow.Function.prototype.toString.call(
  Object.getOwnPropertyDescriptor(Navigator.prototype, 'userAgent').get)

The iframe's toString has never heard of the spoof's list. It sees an ordinary script function and prints its body.

We measured this on ourselves, in the JavaScript fallback layer we wrote for a stock Chromium, the path our own engine replaces. Its toString answered from a WeakMap of our own functions. On one profile, that four-line probe made thirty-three replaced functions across Navigator, Screen, canvas, WebGL, audio and client rects print their real source.

The repair was to stop substituting functions. Each replacement became a JavaScript Proxy whose target is the real native function. V8 prints a proxy over a native function as native code, in any realm, without anything being shared between realms, and the target's name, length and own property names come along. One function had to be the exception: Function.prototype.toString itself, installed as a proxy over the real toString, recursed until the stack ran out. On one bot-check page that meant four Maximum call stack size exceeded errors, their detection script dead, and a verdict box that never filled in. Bisecting on a stock Chrome with only our script injected pinned it to the proxy's target, not its trap or its name handling. The target is now a method shorthand, which, like the real one, has no prototype property.

The third check: is the object what it says it is

Functions are half of it. The other half is what they return. Chrome hands back platform objects with an internal brand, and a page can test that brand three ways:

const r = document.body.getClientRects()
Object.prototype.toString.call(r)   // "[object DOMRectList]"
r instanceof DOMRectList            // true
Object.keys(r)                      // own enumerable keys: a real list has only indices

That same layer's old getClientRects returned a plain Array with an item function hung on it. It said [object Array], failed instanceof, and carried an own enumerable property no DOMRectList has. getBattery resolved with an object literal holding eleven own keys, where a real BatteryManager has none because its values sit on prototype getters. enumerateDevices built plain objects instead of MediaDeviceInfo. Each one failed all three tests together.

The fix in each case was to keep the platform's own object. The rect list became a Proxy over the real DOMRectList. The battery numbers moved onto BatteryManager.prototype, so the object stayed the engine's. The device list became a filter over the engine's own list. There is a detail in the first one that catches people: the indexed getters and length are brand-checked too, so the proxy has to pass the real list, not itself, as the receiver in Reflect.get. Passed the proxy, Chrome throws Illegal invocation.

The rule we took from it: if the engine already produces the object, change what it says, not what it is.

Why the engine is the place to do it

Every check above asks whether something is the browser's own. A value changed inside the browser passes by construction. On Tesseract Chrome, Mosaic's own Chromium, navigator.userAgent is still Chromium's getter. It returns a different string because the browser's own code behind it was changed, so toString prints native code in every realm, the returned objects carry their real brands, and an iframe asks the same code and gets the same answer. That is why Mosaic's engine has no fingerprint script: one in the page on top of a change inside the engine would bring back exactly the functions these checks are written to find.

CreepJS runs these tests across dozens of prototypes, and what its prototype page reports maps each failure name to the test that produced it. The longer argument, with the realms a page can open besides an iframe, is in why we change fingerprints inside the engine, and what a CreepJS lie is explains why a stock Chrome scores none.