From 4cb04315e7de835b52cbdc2ae3072ddaadb9283b Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Tue, 15 Dec 2015 07:45:41 -0800 Subject: [PATCH] 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 --- .../react-packager/src/Resolver/polyfills/console.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packager/react-packager/src/Resolver/polyfills/console.js b/packager/react-packager/src/Resolver/polyfills/console.js index 6aa485508..a8e5a72f4 100644 --- a/packager/react-packager/src/Resolver/polyfills/console.js +++ b/packager/react-packager/src/Resolver/polyfills/console.js @@ -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