cjohansen/Sinon.JS — pull request #96 by keithamus (2012-03-15 22:49:29+00:00)
Title: Restore global methods properly, fixes #94

When useFakeTimers() is called, stubGlobal() will assign "hadOwnProperty"
to the stubbed method, which is set to true if the global object had the
direct property of the method.

Then, when restore() is called, instead of setting global[method] back,
it will check the "hadOwnProperty" var -- and if false -- will delete
global[method], deferring said method back into the prototype chain