Commit Graph

22 Commits

Author SHA1 Message Date
Pritesh Nandgaonkar
c87a581747 Fixes the swizzling crash (#1943)
Summary:
This fixes the issue mentioned in https://github.com/facebook/flipper/issues/1940

## Changelog

Pull Request resolved: https://github.com/facebook/flipper/pull/1943

Test Plan: User confirmed

Reviewed By: mweststrate

Differential Revision: D26577560

Pulled By: priteshrnandgaonkar

fbshipit-source-id: dec4e34dcec4a3b3c20c11f0f2dc748fe2698693
2021-02-22 05:53:05 -08:00
Pritesh Nandgaonkar
98b74c4f49 Fixes a crash caused by network swizzling in FlipperKit (#1810)
Summary:
This PR fixes the crash mentioned [here](https://github.com/facebook/flipper/issues/1674#issuecomment-754402609) in the https://github.com/facebook/flipper/issues/1674 .  The issue was that logging `NSLog(@"%@", [self valueForKey:@"_methodDescription"]);` in the swizzled network delegate class used to cause a crash. The cause of this was the nil `methodDescription.types` sent to `class_addMethod`.

In the following change we do not add a method to the class which doesn't implement the selector, we will anyway listen for those events from the base NSURLSession class. Removing the `class_addMethod`, fixes both the issue mentioned
 [here](https://github.com/facebook/flipper/issues/1674#issuecomment-754402609) in https://github.com/facebook/flipper/issues/1674.

This PR also fixes an issue where no network calls where logged in Flipper when the iOS version was 14, the reason was that the URLSessionResume task was not properly swizzled for 14.

## Changelog

- Do not add a runtime method to the delegate which doesn't implement a responder
- Fix swizzling logic of the URLSession task resume method for ios 14

Pull Request resolved: https://github.com/facebook/flipper/pull/1810

Test Plan:
- I ran the sample app and checked that the network calls are logged.
- I copy pasted the changes in RN project and verified that the  issues mentioned in https://github.com/facebook/flipper/issues/1674 doesn't happen and also verified that the network calls being hit from JS and Native code gets logged in Flipper. Verified with IsolatedSwizzles.zip mentioned over [here](https://github.com/facebook/flipper/issues/1674#issuecomment-754726174). Also verified by copy pasting the code in the fresh  RN project.

Reviewed By: fabiomassimo

Differential Revision: D25801510

Pulled By: mweststrate

fbshipit-source-id: 53ef574696d2abbdbfc2b6d94769327cdfa8aa2b
2021-01-07 05:27:41 -08:00
Scott Kyle
fb223671a7 Add macOS support
Summary: This adds macOS compatibility to Flipper client along with some of the standard plugins.

Reviewed By: jknoxville

Differential Revision: D24644439

fbshipit-source-id: dc15636a6ac1bf684fa1c89735f51f0e97667b62
2020-11-06 13:22:54 -08:00
generatedunixname89002005325676
2e1a2e9f89 Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D24158208

fbshipit-source-id: 4a1c1d7958881774a6c23d0d3b1cb390b641f8f4
2020-10-07 04:22:06 -07:00
Christos Botsikas
86e48b2140 Fix network plugin for ios14+ (#1543)
Summary:
Changelog: [iOS][Network] Network plugin now supports iOS 14

Network plugin stopped working for iOS 14 as reported in https://github.com/facebook/flipper/issues/1534.
The fix is based on the origin Flex network observer, as seen in https://github.com/FLEXTool/FLEX/pull/451

- NetworkPlugin supports iOS 14+

Pull Request resolved: https://github.com/facebook/flipper/pull/1543

Test Plan: Verified manually that before this fix the network plugin broken on iOS 14, and after it, it initializes correctly.

Reviewed By: passy

Differential Revision: D24136401

Pulled By: mweststrate

fbshipit-source-id: 87e0e0fa4bc927d082387d937390b1e728125753
2020-10-06 11:21:59 -07:00
Michel Weststrate
1a8566c988 Make sure images are rendered
Summary: iOS counterpart for D23370743

Reviewed By: jknoxville

Differential Revision: D23397044

fbshipit-source-id: b38113615ef8c14b26700ec638b173061c75cd7e
2020-09-02 05:13:07 -07:00
Mark Tolmacs
e44c7f4062 Fix IOS crash in Network Plugin due to incorrect processing of data U… (#978)
Summary:
Fix IOS crash in Network Plugin due to incorrect processing of data URLs (https://github.com/facebook/flipper/issues/974)

Fix https://github.com/facebook/flipper/issues/974 by skipping response processing in FlipperKitNetworkPlugin.mm if the response is not an instance of NSHTTPURLResponse, which data URLs are not. My assumption is that data URLs are not the ones Flipper Network Plugin users are interested in, given the type of information being extracted in the didObserveResponse method which are only present in NSHTTPURLReponse types.

## Changelog
Fix IOS crash in Network Plugin due to unchecked casting of data URLs
Pull Request resolved: https://github.com/facebook/flipper/pull/978

Test Plan:
1. `npx react-native init issue974 --version react-native@0.62.1`
2. `cd issue974/ios/Pods/FlipperKit/iOS/Plugins/`
3. `curl -L https://patch-diff.githubusercontent.com/raw/facebook/flipper/pull/978.patch | git apply -v -p3`
4.  `cd ../../../../../`
5. `curl -L https://github.com/facebook/flipper/files/4434063/rn-data-uri-test.patch.txt | git apply -v
react-native run-ios`
6. Verify that the app does not crash the IOS app with
```
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'-[NSURLResponse allHeaderFields]: unrecognized selector sent to instance <memaddr>'
```

#### The React Native app patch used to verify the PR working and resolving the issue https://github.com/facebook/flipper/issues/974
[rn-data-uri-test.patch.txt](https://github.com/facebook/flipper/files/4434063/rn-data-uri-test.patch.txt)

Reviewed By: mweststrate

Differential Revision: D20861168

Pulled By: cekkaewnumchai

fbshipit-source-id: bae960650ecc0efbb8ae4641aba4c62c74f06bf0
2020-04-08 03:08:58 -07:00
Pritesh Nandgaonkar
972277b031 Fix warnings of FlipperKit in iOS
Summary:
This diff fixes the warnings raised from FlipperKit. Also this diff updates the deployement target of FlipperKit  to iOS 10. Even wilde assumes the min deployment OS version to be iOS 10. In layout plugin we use [UIAccessibiltyTraiTabBar](https://developer.apple.com/documentation/uikit/uiaccessibility/uiaccessibilitytraits/1648592-tabbar), which assumes iOS 10 and above.

Partially fixes https://github.com/facebook/flipper/issues/803

Still there are some warnings which are coming from the dependencies outside of Flipper.

Reviewed By: passy

Differential Revision: D19941558

fbshipit-source-id: 31809fedb9aa297bc318b5af72e29e8444f0142f
2020-02-18 12:47:21 -08:00
Pritesh Nandgaonkar
e8b20d5b15 Run CLANGFORMAT on plugins
Summary:
This diff runs CLANGFORMAT lint on plugins. I have added CLANGFORMAT as the lint engined for objc files in xplat/sonar. Right now the iOS folder is not formatted according to CLANGFORMAT.

Ran `arc lint -a --paths-cmd "find ./iOS/Plugins -type f" --verbose`

Reviewed By: passy

Differential Revision: D19942173

fbshipit-source-id: 8b975b0a344df073b02d69cd1f9ee5629af2799d
2020-02-17 10:49:18 -08:00
Andres Suarez
54ebb44dda Tidy up Flipper license headers [2/2]
Reviewed By: passy

Differential Revision: D17863710

fbshipit-source-id: 5b249bdd1c06d3a526b250b035b797d0c8e796eb
2019-10-11 13:46:45 -07:00
Andres Suarez
0675dd924d Tidy up Flipper license headers [1/2]
Reviewed By: passy

Differential Revision: D17863711

fbshipit-source-id: 259dc77826fb803ff1b88c88529d7f679d3b74d8
2019-10-11 13:46:45 -07:00
LAgagggggg
0ba47d9a71 Fix crash of iOS FlipperNetworkPlugin (#563)
Summary:
Flipper's network plugin may cause crash on a frequency of about one time per 1~2 days(I think it depends on how many network request we send).
![IMG_3095](https://user-images.githubusercontent.com/24563710/65739973-cc540080-e119-11e9-9e6e-e4a925ecc63c.JPG)

  I assume the crash is caused by part of the code of HTTPParser is not thread-safe, and invoke it asynchronously may cause double-free crash. So I manually ask for HTTPBody synchronously, make the HTTPParser parse the request and cache them in advance, before any possible asynchronous invoking.

## Changelog
  Fix potential crash cause by network plugin.
Pull Request resolved: https://github.com/facebook/flipper/pull/563

Test Plan:
1. Run our App with Flipper integrated
2. Make sure FlipperNetworkPlugin is active
3. It may take days to reproduce the crash

Reviewed By: passy

Differential Revision: D17739327

Pulled By: priteshrnandgaonkar

fbshipit-source-id: e814145c346bd2da1d2f5f87b6a2f7e200f0bf2d
2019-10-04 05:38:05 -07:00
Andres Suarez
c4c5d453c2 Fix license headers
Reviewed By: scottrice

Differential Revision: D17673481

fbshipit-source-id: 1794e0a6e92e6894b5634b24c6e7910847616261
2019-09-30 15:10:17 -07:00
Aditya Kumar
620383bae3 Add virtual destructor to class with virtual functions but non-virtual destructor
Reviewed By: jdthomas

Differential Revision: D16954508

fbshipit-source-id: 958118843687145c1147ac5beeb2857b21332702
2019-08-22 11:41:26 -07:00
Anatolii Shevchenko
e874e032c6 Remove ; from method implementation definition
Summary: Removing excessive semicolon ";" symbol from method implementation definition.

Reviewed By: adamjernst

Differential Revision: D16912006

fbshipit-source-id: 9c3e778a107e8fd0055f40a95ea9ca58d461e1c5
2019-08-21 15:49:04 -07:00
suyimo
eb4de1f3b7 Add protect when save task (#466)
Summary:
Bugfix

Add protect when save task

If local cache resource are valid, we don't create a Task .So here are crash.
Pull Request resolved: https://github.com/facebook/flipper/pull/466

Reviewed By: passy

Differential Revision: D15851816

Pulled By: priteshrnandgaonkar

fbshipit-source-id: 753b3c5c9a6ed4c703c934a89e45fa30df99068c
2019-06-18 03:56:56 -07:00
Rain ⁣
aa649ff48f standardize C-like MIT copyright headers throughout fbsource
Summary:
`/*` is the standard throughout open source code. For example, Firefox uses single /*: https://hg.mozilla.org/mozilla-central/file/21d22b2f541258d3d1cf96c7ba5ad73e96e616b5/gfx/ipc/CompositorWidgetVsyncObserver.cpp#l3

In addition, Rust considers `/**` to be a doc comment (similar to Javadoc) and having such a comment at the beginning of the file causes `rustc` to barf.

Note that some JavaScript tooling requires `/**`. This is OK since JavaScript files were not covered by the linter in the first place, but it would be good to have that tooling fixed too.

Reviewed By: zertosh

Differential Revision: D15640366

fbshipit-source-id: b4ed4599071516364d6109720750d6a43304c089
2019-06-06 19:40:28 -07:00
Pascal Hartig
bbee7a3357 Update iOS license headers (and more)
Summary: Add the affiliates bit that the linter is checking for.

Reviewed By: jknoxville

Differential Revision: D15164826

fbshipit-source-id: 500ffe89ec0c2fd3acfbc374408d16a337cecfa4
2019-05-02 03:28:07 -07:00
Pritesh Nandgaonkar
f47de92117 Build sample app through BUCK
Summary: This diff adds capabilty to build sample app through BUCK.

Reviewed By: passy

Differential Revision: D13697307

fbshipit-source-id: d7008bb4709b13384f65051631b365a0eceddfff
2019-01-17 07:27:33 -08:00
Pritesh Nandgaonkar
5bbfa58909 Setup sdk for background plugin
Summary:
This diff sets up flipper for running plugins in background. This diff does the following

- Adds a function named `runInBackground` to the interface `FlipperPlugin` to make the plugins opt in to be run in background, default is false
- Changes the javascript side of the flipper to store the messages received by the plugins in background
- Process the stored messages when the plugin in background becomes active
- Currently I have just turned on network plugin to be in background mode.

- Remove the buffering from the network plugin, as it will run in background
- Write a batching layer to batch the messages and send to flipper.

Note: I haven't tested the wilde app yet, but the sample app works. I will remove the "[WIP]" from the title once I have tested it in wilde

Reviewed By: danielbuechele

Differential Revision: D10301403

fbshipit-source-id: 034eebf659a545d6b480a4ac1b73b0aa4b2f9797
2018-10-11 15:23:21 -07:00
Pritesh Nandgaonkar
22f37368ce Change the file name of SonarKitNetworkPlugin to FlipperKitNetworkPlugin
Summary: Renames the file name of SonarKitNetworkPlugin to FlipperKitNetworkPlugin

Reviewed By: passy

Differential Revision: D9972211

fbshipit-source-id: c092c75f0e1bab54cd247e3ae69449577453ec07
2018-09-21 03:45:54 -07:00
Pritesh Nandgaonkar
02ac3ff9cd Rename SonarKitNetworkPlugin
Summary: Renames SonarKitNetworkPlugin

Reviewed By: passy

Differential Revision: D9968092

fbshipit-source-id: 6d5b7761405be9b47e679510ce6fc7f2a84c308b
2018-09-21 03:45:54 -07:00