patch DOM APIs to intercept calls to them