Unbreak console reassignment on iOS7

Summary:
public
Unbreaks console assignment on iOS7 introduced in #3322

Reviewed By: alexeylang

Differential Revision: D2759689

fb-gh-sync-id: 28cccfdf1123245732fa5ba0337ee8d7bb43c822
This commit is contained in:
David Aurelio 2015-12-15 07:45:41 -08:00 committed by facebook-github-bot-6
parent 9f48c004ba
commit 4cb04315e7
1 changed files with 8 additions and 2 deletions

View File

@ -474,8 +474,14 @@
trace: getNativeLogFunction(LOG_LEVELS.trace),
table: consoleTablePolyfill
};
descriptor.value = console;
Object.defineProperty(global, 'console', descriptor);
// don't reassign to the original descriptor. breaks on ios7
Object.defineProperty(global, 'console', {
value: console,
configurable: descriptor ? descriptor.configurable : true,
enumerable: descriptor ? descriptor.enumerable : true,
writable: descriptor ? descriptor.writable : true,
});
// If available, also call the original `console` method since that is
// sometimes useful. Ex: on OS X, this will let you see rich output in