Commit Graph

33 Commits

Author SHA1 Message Date
Nick Lockwood fa0b45c58b Replaced RCTSparseArray with NSDictionary
Reviewed By: jspahrsummers

Differential Revision: D2651920

fb-gh-sync-id: 953e2ea33abfc7a3a553da95b13e9ab2bccc5a1c
2015-11-14 10:28:28 -08:00
Pieter De Baets 215872c2eb Provide log source to handler
Reviewed By: majak

Differential Revision: D2615567

fb-gh-sync-id: a245813220436f2d83ae2ae28bde916cecb3f416
2015-11-11 06:44:30 -08:00
Pieter De Baets c1ae4780ce Fix crash in RCTLog
Reviewed By: tadeuzagallo

Differential Revision: D2625795

fb-gh-sync-id: 6983a2dc9259fa1777c05011c2752e9520aa26cd
2015-11-06 06:36:29 -08:00
Pieter De Baets d9b4c57e12 Remove log level 'log' from JS
Summary: Log level 'log' from JS should be equivalent to 'info'. Also added knowledge of 'trace' log level in RCTLog.

public

Reviewed By: vjeux

Differential Revision: D2615500

fb-gh-sync-id: 7a02f49bf7953c1a075741c21e984470c44b5551
2015-11-05 12:51:41 -08:00
Pieter De Baets 31b5b0ac01 Create RCTFatal for reporting fatal React events
Summary: public

Add RCTFatal for reporting fatal runtime conditions. This centralizes failure handling to one function and allows you to customize how they should be handled. RCTFatal will be logged to the console and as a redbox and will also be triggered by fatal exceptions coming from RCTExceptionsManager.

Note that there is no RCTLogFatal, since just logging the fatal condition does not allow us to handle it consistently.

Reviewed By: nicklockwood

Differential Revision: D2615490

fb-gh-sync-id: 7d8e134419e10a8fb549297054ad955db3f6bee0
2015-11-05 12:51:27 -08:00
Nick Lockwood c5b990f65f Added lightweight generic annotations
Summary: public

Added lightweight genarics annotations to make the code more readable and help the compiler catch bugs.

Fixed some type bugs and improved bridge validation in a few places.

Reviewed By: javache

Differential Revision: D2600189

fb-gh-sync-id: f81e22f2cdc107bf8d0b15deec6d5b83aacc5b56
2015-11-03 14:49:30 -08:00
Pieter De Baets 44c651037a Disable RCTLog completely in production
Reviewed By: @nicklockwood

Differential Revision: D2521718

fb-gh-sync-id: f06c9af3906ae8cebca0d318fc2b0e2d03671220
2015-10-13 07:31:25 -07:00
Justin Spahr-Summers 0ff3a421c9 Actually define RCTSetLogThreshold()
Summary: This function was declared, but never defined, so calling it would crash your application.

I also took this opportunity to ensure that the logging threshold is given a default value upon initialization, not just the first time `RCTGetLogThreshold()` is called.

@​public

Reviewed By: @tadeuzagallo

Differential Revision: D2475622
2015-09-28 04:23:26 -07:00
Param Aggarwal b998e5a7b7 Use getters and setters
Summary: As per discussion in #2423 - possible fix for crash. (cc: @​javache)

Please share feedback regarding the PR, we are going to be using this diff in production to see if it fixes the crashes we are seeing.

(fixes #2423)
Closes https://github.com/facebook/react-native/pull/2494

Reviewed By: @javache

Differential Revision: D2433515

Pulled By: @nicklockwood
2015-09-13 11:10:29 -07:00
Nick Lockwood 7bf157c92c Fix assertion when modules are accessed early on in bridge startup 2015-08-26 10:01:29 -08:00
Nick Lockwood 88e0bbc469 Ran Convert > To Modern Objective C Syntax 2015-08-25 01:08:49 -08:00
Nick Lockwood 2cd02d94ff Converted RCTRedBox to a bridge module 2015-08-21 02:53:55 -07:00
Jing Chen cc96962e3d [react-native] Revert D2346396 to bring back JS stack traces 2015-08-19 18:07:15 -07:00
Nick Lockwood 8d1e02b8bd Convert alloc/init to new to please linter 2015-08-17 08:46:00 -07:00
Nick Lockwood decf35c271 Fixed log prefixes to provide more context for prop binding errors 2015-08-14 08:01:34 -08:00
Tadeu Zagallo 6cd0709bc0 [ReactNative] Parellelise bridge startup
Summary:
Parallelise the bridge startup so we don't keep waiting for the source to load.
2015-08-07 06:48:30 -08:00
Nick Lockwood 95b9dd3a88 Added support for method argument nullability
Summary:
This diff adds support for enforcing nullability in the arguments for exported methods.

We previously supported use of the nullable/nonnull attributes on method arguments, but didn't do anything to ensure that they were respected.

Now, if an argument is marked as nonnull, and a null value is sent for that argument, it will display a redbox.

In future, nonnull will be assumed by default, but for now we assume that un-annotated arguments can be null (to avoid breaking existing code).
2015-07-29 05:50:27 -08:00
Alex Kotliarskyi d1b14ef062 [React Native] Log to ASL
Summary:
By default we were just writing all log messages to stderr. This also
adds support for [Apple System Log](https://developer.apple.com/library/ios/documentation/System/Conceptual/ManPages_iPhoneOS/man3/asl_log.3.html) that
can be viewed using standard tools.
2015-07-13 09:52:16 -08:00
Nick Lockwood 650fc9de4c Increased warning levels to -Wall -Wextra, and fixed Xcode 7 beta issues
Summary:
@public

I've increased the warning levels in the OSS frameworks, which caught a bunch of minor issues. I also fixed some new errors in Xcode 7 relating to designated initializers and TLS security.

Test Plan:
* Test the sample apps and make sure they still work.
* Run tests.
2015-06-15 07:52:50 -08:00
Spencer Ahrens 781b17fd0f [ReactNative] include stack in native redboxes
Summary:
@public

Include stack traces in native redboxes (e.g. from RCTLogError).  It's not trivial to get the file names and line numbers for every frame of the stack, but we can get the first one which is nice.

Test Plan: {F22548418}
2015-06-12 15:48:20 -08:00
Spencer Ahrens 492e29a091 [ReactNative] backout orange box
Summary:
@public

This probably needs more thought - might want to differentiate between console.error and reportError.

Test Plan: console.error and reportError no longer redbox.  invariant and RCTLogError still do.
2015-06-11 10:39:59 -08:00
Spencer Ahrens 68bb3a7e71 [ReactNative] orange box
Summary:
@public

There have been multiple instances of confusion about whether a redbox means the
developer did something they shouldn't but things will keep working, or if
something went horribly wrong and the app will crash in prod.  This diff
introduces an orange background color to the redbox for `console.error` and
`RCTLogError` to indicate that something bad happened, but that the app will
continue working.

Test Plan:
see orange error for geo permissions:

{F22541375}
2015-06-09 14:53:29 -08:00
Tadeu Zagallo 9062bda79b [ReactNative] Add RCTAssertThread and restrict -[UIManager addUIBlock:] to _shadowQueue
Summary:
@public

Add `RCTAssertThread` to `RCTAssert.h` for convenience when checking the current/queue,
it accepts either a `NSString *`, `NSThread *` or `dispatch_queue_t` as the object to be checked

Also add a check to `-[RCTUIManager addUIBlock:]` - There was a discussion on github (https://github.com/facebook/react-native/issues/1365)
due to the weird behavior caused by calling it from a different thread/queue (it might be added after `batchDidComplete` has been called
and will just be dispatched on the next call from JS to objc)

Test Plan:
Change `-[RCTAnimationExperimentalManager methodQueue]` to return `dispatch_get_main_queue()` and run the 2048 example,
it should dispatch with a helpful message (screenshot on the comments)
2015-05-25 05:23:27 -08:00
Nick Lockwood ee898c24c7 Removed debug code from release builds 2015-04-21 09:47:21 -08:00
Nick Lockwood 8e15a0d5e7 Added RCT_DEBUG 2015-04-21 05:24:10 -08:00
Tadeu Zagallo fb1fa12e89 [ReactNative] Better profiling API + Fix overlaping events 2015-04-20 04:57:28 -08:00
Nick Lockwood 0b21df4a34 Improved logging and dev menu 2015-04-19 12:56:22 -08:00
Nick Lockwood 26fd24dc50 Cleanup 2015-04-11 14:19:49 -08:00
Alex Kotliarskyi 7cd732d0e7 [ReactNative] Pipe logs to server window 2015-04-10 12:09:10 -08:00
Nick Lockwood bf4868edda Added non-class-scanning-based approach fror registering js methods 2015-04-08 05:45:20 -08:00
Nick Lockwood 80cd687e95 Refactored RCTLog and added facility to prepend extra data to the log message 2015-04-07 07:35:57 -08:00
Alex Akers 7a97043a3e [React Kit] Remove embarrassing TODOs 2015-03-26 10:33:05 -08:00
Tadeu Zagallo 20291a02df [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00