- if ( window.crypto ) {
- window.crypto = undefined;
- }
- if ( window.msCrypto ) {
- window.msCrypto = undefined;
- }
+ delete window.crypto;
+ delete window.msCrypto;
+ // Assert that the above actually worked. If we use the wrong method
+ // of stubbing, JavaScript silently continues and we need to know that
+ // it was the wrong method. As of writing, assigning undefined is
+ // ineffective as the window property for Crypto is read-only.
+ // However, deleting does work. (T203275)
+ assert.strictEqual( window.crypto || window.msCrypto, undefined, 'fallback is active' );