Summary:
Previously, requests were passed to process first in an interceptor, and it is responsibility of an interceptor to process requests for responses. In FlipperOkhttpInterceptor, we did read data from request body before processing it. This caused a bug when the network process itself wants to also read that data, but the stream has been closed because the interceptor has just read. The fix is to report request body after we have triggered network call so that we can just drop request body if we cannot read.
This diff tries to bring back the same functionality while not cause the bug to occur by cloning the content to be read by Flipper and using the same one for the request.
Reviewed By: jknoxville
Differential Revision: D21279679
fbshipit-source-id: 47f8b29a1896705d8d2d601661cd485db572d251
Summary:
Original Issue: https://github.com/facebook/flipper/issues/993
The exception occurs when OkHttp and we try to read request body twice, while it can be only read once.
Hence, we will read request body after it is processed by OkHttp.
Tradeoff for this is requests on Flipper will not appear immediately after fired, but they will appear together with their responses.
There are ways we can get rid of the tradeoff. For example, as demonstrated in D21167308, OkHttp ^3.14.0 contains method `isOneShot`, which can be used to check if we can read request body more than once. Another example is to change server side to accept nullable variable so that we can send request body and others separately.
Reviewed By: passy
Differential Revision: D21175341
fbshipit-source-id: 053789a2c2f28cd8149ea1bb36fd0cfe1c668df7
Summary:
Tracks images in disk cache. It seems performant even with 500+ images in disk cache. Sidebar displays the local path for an image when that image is selected. Shows total size of images in disk cache. 'Clear Cache' clears the disk cache.
For now we unpack the async cache request in the plugin, should implement a `getSync()` method on `bufferedDiskCache` in the future. For some reason Flipper doesn't work with a blocking call (https://fburl.com/smj0s4li).
Reviewed By: defHLT
Differential Revision: D20001062
fbshipit-source-id: 1e7a7900e9f42d05e3bf30472e57cd643caa5aca
Summary: Flipper should never crash the mobile app. This is a plugin entry point, so it's understandable that it can, but we should avoid it whenever possible.
Reviewed By: passy
Differential Revision: D20648373
fbshipit-source-id: f32b428cccdd0c78eb15e9e95a64ecf3f4e10429
Summary:
This is the change made by Pascal at D19813495. to clean up the file
Shouldn't really change how it works but makes it
safer and brings it in line with our coding standards.
Reviewed By: passy
Differential Revision: D20474258
fbshipit-source-id: 67d77316a5b7efd7258072b4f35a2d9c50de408e
Summary:
Add logic on client side
# How it works (from the code)
1. Server side sends request url and method to response data and headers to client side
1.1. This will happen every time server update **any** mock response (add, edit, and remove)
2. Client stores those in map
3. For every network request,
3.1. Check if there is a matching url and method
3.2. If so, create a new response with the data and headers and drop the request
3.3. If not, proceed and send the request and wait for a response
`addNetworkInterceptor` is changed to `addInterceptor` to allow short-circuit and proceed without fetching anything. More info can be found at https://square.github.io/okhttp/interceptors/
Note:
- This is an original PR.
- The content below is from original PR
Add network response mocking for Network plugin. See discussion [here](https://github.com/facebook/flipper/issues/475)
## Changelog
- Add Network response mocking, currently support Android clients only
- Change the Android example app to use `addInterceptor()` instead of `addNetworkInterceptor()`
Pull Request resolved: https://github.com/facebook/flipper/pull/488
Test Plan:
{F231673798}

- Connect an Android device
- Tap on Network plugin
- Click on the Mock button
- Click on Add Route button, and specify the URL
- Edit the mock data in the text area
- Optionally, click the Headers tab to edit the headers data
- Click close button to close the dialog
- Send some network data in your application. You should be able to see the mock data appears in the Network table in those rows highlighted in yellow
Reviewed By: passy
Differential Revision: D16580291
Pulled By: cekkaewnumchai
fbshipit-source-id: fc391f5e7efebc6f51a72b00d16263e009e1fdb0
Summary:
per title
Note:
- This is a part of this PR: https://github.com/facebook/flipper/pull/488
Reviewed By: jknoxville
Differential Revision: D20474257
fbshipit-source-id: d2ac79d03ac67453bd67ecc46ace973be1590c04
Summary: Adds the theme information relating to a Litho component in the layout inspector
Reviewed By: sjkirby
Differential Revision: D20133889
fbshipit-source-id: 93acb745f47c1ff9ce37be35a05b4a6269193a47
Summary:
## Summary
Resolves https://github.com/facebook/flipper/issues/607
This removes stetho dependencies directly in favor of just copying in the used classes. This removes the last non-androidx dependency from the project, and is useful as stetho appears to be unmaintained. The fresco stetho dependency appeared to be completely unused.
## Changelog
Remove stetho dependencies. It was unused other than a few utility methods, but came at the cost of preventing Flipper consumers from completely removing dependencies that hadn't updated to Androidx yet.
Pull Request resolved: https://github.com/facebook/flipper/pull/762
Test Plan: Existing tests still pass with no regressions. Functionally this should be no difference.
Reviewed By: jknoxville
Differential Revision: D19577969
Pulled By: passy
fbshipit-source-id: b277ddf97a9d2c846dd0b9227c02bb46c1ecd930
Summary:
When debugging closeable reference leaks, I found that the Flipper plugin doesn't properly close one:
```
2020-01-17 10:45:29.346 27038-27053/com.facebook.wakizashi D/YOLO: LEAK!!:
java.lang.Throwable
at com.facebook.common.references.CloseableReference.<init>(CloseableReference.java:158)
at com.facebook.common.references.DefaultCloseableReference.<init>(DefaultCloseableReference.java:29)
at com.facebook.common.references.CloseableReference.of(CloseableReference.java:237)
at com.facebook.common.references.CloseableReference.of(CloseableReference.java:203)
at com.facebook.common.references.CloseableReference.of(CloseableReference.java:176)
at com.facebook.imagepipeline.cache.CountingMemoryCache.newClientReference(CountingMemoryCache.java:221)
at com.facebook.imagepipeline.cache.CountingMemoryCache.get(CountingMemoryCache.java:209)
at com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin$4.onReceive(FrescoFlipperPlugin.java:204)
at com.facebook.flipper.android.EventBase.loopForever(Native Method)
at com.facebook.flipper.android.FlipperThread.run(FlipperThread.java:31)
```
Second leak:
```
2020-01-17 11:04:16.503 28855-28869/com.facebook.wakizashi D/YOLO: LEAK!!:
java.lang.Throwable
at com.facebook.common.references.CloseableReference.<init>(CloseableReference.java:147)
at com.facebook.common.references.DefaultCloseableReference.<init>(DefaultCloseableReference.java:21)
at com.facebook.common.references.DefaultCloseableReference.clone(DefaultCloseableReference.java:35)
at com.facebook.common.references.CloseableReference.cloneOrNull(CloseableReference.java:258)
at com.facebook.common.references.CloseableReference.cloneOrNull(CloseableReference.java:326)
at com.facebook.imagepipeline.cache.CountingMemoryCacheInspector$DumpInfoEntry.<init>(CountingMemoryCacheInspector.java:32)
at com.facebook.imagepipeline.cache.CountingMemoryCacheInspector.dumpCacheContent(CountingMemoryCacheInspector.java:101)
at com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin$3.onReceive(FrescoFlipperPlugin.java:171)
at com.facebook.flipper.android.EventBase.loopForever(Native Method)
at com.facebook.flipper.android.FlipperThread.run(FlipperThread.java:31)
```
Reviewed By: passy
Differential Revision: D19445902
fbshipit-source-id: 12a513d9e34fcac0d546a4eac55932956e4e4d5b
Summary:
As previously reported in https://github.com/facebook/flipper/issues/457, I immediately started to see crashes with Flipper integrated due to large responses (e.g., >= 100MB). This will only write the first 100KB of the response or request body into `RequestInfo` objects.
## Changelog
- Limits request/response body in network request info to 100KB max.
Pull Request resolved: https://github.com/facebook/flipper/pull/617
Test Plan:
- Make a network request which has a response size of < 100kb, verify that it is visible in its entirety
- Make a network request w/ response size > 100kb, verify that it is truncated
- Ideally, use your application with the Network plugin running, and do not see OOMs
Reviewed By: mweststrate
Differential Revision: D19412075
Pulled By: passy
fbshipit-source-id: c93662dba7a5f24820287e56e889576b5bcb5a72
Summary: On Android, the stack trace looks different so we don't need to use the Regex we use on iOS. We can simply display all the lines in the trace.
Reviewed By: pasqualeanatriello
Differential Revision: D17181400
fbshipit-source-id: e471da17b89806a161edc7edcf05ac6faed44bf0
Summary: This will correctly show all view children instead of reverting to the non-ax default behavior. Fixes bug where recycler views showed no children.
Reviewed By: jknoxville
Differential Revision: D18574220
fbshipit-source-id: f22606fb582e0bfd1a171dc4497e1d1613e800d1
Summary:
Base64 encoding can easily cause OOMs for large payloads.
In the long-term, it would be great to have a way of streaming these
responses so we don't allocate 50MB chunks of memory at once.
Reviewed By: jknoxville
Differential Revision: D17951353
fbshipit-source-id: a5d7b8242892518590ac95c1d9751f24d20dc40e
Summary:
I missed these. :(
Open source CI is unhappy about this - for good reasons.
Reviewed By: jknoxville
Differential Revision: D17500071
fbshipit-source-id: 96106f660dee59985c51e2635321ab4ad00a795a
Summary:
Setting up the necessary metadata to publish the separate plugins
to Maven/Bintray.
Reviewed By: danielbuechele
Differential Revision: D17480263
fbshipit-source-id: 1772cee5b3744ce52fc6e2510a27cb7f500e72bf
Summary:
Breaking Litho/Sections off. Doesn't really make sense to have
two deps for this especially since they're pretty tightly coupled.
This makes our core already quite slim.
Reviewed By: jknoxville
Differential Revision: D17420118
fbshipit-source-id: 9a03911f4af6410745b9aefd0e6a75bdf106660f
Summary:
Pull Request resolved: https://github.com/facebook/flipper/pull/548
First project to pull out of the "fat distribution" we currently have.
Still needs setup for Maven and registration in Bintray.
Reviewed By: jknoxville
Differential Revision: D17395660
fbshipit-source-id: 6244495a2e25d705dd930ef87c7e5e1f038eb921
Summary:
This is a big one. Moves all oss plugins to a new place and leaves
stub targets in place. No logic changes. Everything apart from
BUCK files should be unchanged.
Reviewed By: jknoxville
Differential Revision: D8951045
fbshipit-source-id: 8054fb4028181d5cc4a240b1908dab6471cf0a27
Summary: Switches the tree to use the view hierarchy for Litho nodes rather than Litho component hierarchy since Accessibility services interact with the views rendered. Includes a few more properties in the accessibility sidebar and updates to the segmented sidebar based on derived/non-derived properties for all views. Also adds functions to the AccessibilityUtil to be able to work on the accessibility sidebar while still leaving the non-accessibility sidebar unchanged. Eventually the accessibility panel will be removed from 'normal' mode and the original functions will no longer be necessary.
Reviewed By: blavalla
Differential Revision: D8881739
fbshipit-source-id: 9ce37e8f18025538cba2c86c0895ee38d13d024b
Summary:
Fixed issue with DebugComponentDescriptors being left out of accessibility tree so the AX tree now includes all Litho view nodes (not Litho accessibility nodes yet). Litho drawables have no accessibility properties so these are not included. Also changed default for getAXChildAt to do whatever the original view tree does for that node and added a getAXChildCount function to better customize the accessibility tree.
Segmented the ax sidebar into properties directly form the view and properties derived from the AccessibilityNodeInfo.
Differential Revision: D8861129
fbshipit-source-id: 987683ef45188aa9cb587cc0e5ffba8fbf40136d
Summary: The second tree has access to all AX NodeInfo properties (they are not in the sidebar yet). Infrastructure set up to customize displayed information bassed on what is most useful. Descriptors for views updated to include AX functionality and non-view descriptors AX functions defaulted to null/empty. Non-view nodes (like Fragments, Window, Appication) no longer included in AX tree. Corresponding nodes will be highlighted (although not expanded) on click in either tree.
Differential Revision: D8795800
fbshipit-source-id: cf2333f69bfecca3ff84aae62681c684dfa14bf3
Summary:
This saved the state of the network plugin even when switching between plugins using persistedState.
A bug in the Android implementation didn't clear the events that were already sent to the desktop.
Reviewed By: jknoxville
Differential Revision: D8752098
fbshipit-source-id: 152ec5da83958ad8124686f780d39983cbce563f
Summary: This diff is mainly moving diffs around to open source the Sandbox plugin. I created the MD file writing some docs. The rest is just making our own FB implementation work
Reviewed By: danielbuechele
Differential Revision: D8731839
fbshipit-source-id: 27ac67223c6de9d1be406ab8c06b71b82d5407bc
Summary:
This mirrors the extension support added to the desktop plugin and allows people to dynamically
add extension commands
Reviewed By: danielbuechele
Differential Revision: D8691167
fbshipit-source-id: 60136b960f8bbdfa42b2077d1f5f7b391fc44443
Summary:
You don't necessarily need / have your shared preferences defined in a file that is your package
name. This adds the ability to pass in the name + mode you need to read the correct shared
preferences file.
Reviewed By: sjkirby
Differential Revision: D8661573
fbshipit-source-id: 49e57b0371228eca7fc4f06e8ba65ff8cc059b11
Summary:
I'm sure there's a better way to describe what this does in the Javadoc, but I
can't really come up with one.
Also inlined one method which made another call which is now redundant.
I'd also really like to make this call entirely unnecessary by moving the logic
to `resolve()` so that overriding it automatically implies `canResolve` but the
edge cases for commonProps and treeProps make this rather unpleasant.
Reviewed By: IanChilds
Differential Revision: D8476911
fbshipit-source-id: 33c6a20da03e50cd1c1d4994e64ef8b43b2c68bc