Summary:
This diff addresses two problems:
1. Since clients plugins can be active beyond having a connection, we have to make it possible for plugin authors to check if they are connected before they make a call.
2. if there is a custom `exportPersistedState`, plugins should be able to skip making calls if the device has disconnected.
Introducing this change makes it possible to interact with a reasonable level with disconnected clients, and makes it possible to create Flipper traces for disconnected clients.
Note that both items were already problems before supporting offline clients; as there can be a noticeable delay between disconnecting and Flipper detecting that (i've seen up to 30 secs). What happend previously in those cases is that the export would simply hang, as would other user interactions, as loosing the connection in the middle of a process would cause the promise chains to be neither rejected or resolved, which is pretty iffy.
Before this diff, trying to export a disconnected device would hang forever like:
{F369600601}
Reviewed By: nikoant
Differential Revision: D26250895
fbshipit-source-id: 177624a116883c3cba14390cd0fe164e243bb97c
Summary:
It should be possible to exported disconnected devices, so that flipper traces / support form reports can be created from them. This diff introduces this functionality. Support for plugins with custom export logic is introduced in a later diff.
Issues fixed in this diff:
- don't try to take a screenshot for a disconnected device (this would hang forever)
- device plugins were always exported, regardless whether the user did select them or not
- sandy plugins were never part of exported disconnected clients
- increased the amount of data exported for device logs to ~10 MB. This makes more sense now as the logs will no longer be included in all cases
- fixed issue where are plugins would appear to be enabled after the client disconnected (this bug is the result of some unfortunate naming of `isArchived` vs `isConnected` semantics. Will clean up those names in a later diff.
Changelog: It is now possible to create a Flipper trace for disconnected devices and apps
Reviewed By: nikoant
Differential Revision: D26250894
fbshipit-source-id: 4dd0ec0cb152b1a8f649c31913e80efc25bcc5dd
Summary:
Changelog: CPU plugin will no longer show up for archived devices
CPU plugin did show up on imported devices, but would always result in exceptions as no `adb` connection is available for them.
Reviewed By: jknoxville
Differential Revision: D26249575
fbshipit-source-id: c4fa7b3fec895f9c4ab9e31dce2f61fb23e9195b
Summary: Crash reporter generated React errors because the different lines in a stack trace are not per definition unique
Reviewed By: jknoxville
Differential Revision: D26201941
fbshipit-source-id: 084e0157b1fa3b8216d35f62f0dc17b0d6414b8e
Summary:
Unlike non-sandy plugins, non-sandy plugins weren't serialized using our serialization utility yet. This diff addresses that, meaning that users don't have to bother about how to serialize maps, sets and dates.
Unlike the old fashioned plugins, the `makeObjectSerialize` utility is used, rather than `serialize`. This normalizes the objects, but doesn't serialize them, which is done at the end of the export data process anyway for the whole tree. This avoids creating a double JSON serialization which is fully of ugly escape characters.
This makes the onImport / onExport definition of the logs plugin nicer.
Also improved the docs.
Reviewed By: nikoant
Differential Revision: D26146421
fbshipit-source-id: 6abfb6ee2e3312e2a13a11832ff103dc62fd844c
Summary:
Logs were stored hardcoded on the Device object first, this diff makes it normal plugin state.
This makes sure that we can use the same abstractions as in all plugins that store large data sets, and that we can leverage the upcoming DataSource abstraction.
Reviewed By: nikoant
Differential Revision: D26127243
fbshipit-source-id: 7c386a615fa7989f35ba0df5b7c1d218d37b57a2
Summary:
Provide a more robust technique for exporting the mocks to a file.
The current technique for exporting mocks to a file seems to fail under some scenarios. The correct format is an array of objects:
```
[
{
"requestUrl": "https://api.github.com/repos/facebook/yoga",
"requestMethod": "GET",
```
However, the following format is sometimes exported instead:
```
{
"10": {
"requestUrl": "https://demo9512366.mockable.io/SonarPost",
```
Using `Object.values` provides a more robust technique that has been successful during subsequent testing.
## Changelog
Network Plugin - new technique for exporting mocks
Pull Request resolved: https://github.com/facebook/flipper/pull/1872
Test Plan:
Create mocks in the network plugin
Export mocks
Manually examine file for correct format
Import mocks and verify that the file has been imported correctly
Reviewed By: nikoant
Differential Revision: D26172954
Pulled By: mweststrate
fbshipit-source-id: bdfa3ba7dfe656f30ef17df001fc83dd8ea18ece
Summary:
Continue with cleanup of Network plugin mock screens. This mostly consists of replacing FlexColumn, FlexRow and FlexBox with equivalent Sandy components.
Here is the new screen:
- replace text buttons with Button
- add NUX info to "Copy Highlighted Calls" button
- add message when no calls have been highlighted
- in routes list remove padding on line items

Here is the prior screen:

## Changelog
Network Plugin - Additional cleanup of UI on mock screen
Pull Request resolved: https://github.com/facebook/flipper/pull/1873
Test Plan:
Create and modify mocks
Verify that the functionality has not been affected by UI changes
Reviewed By: passy
Differential Revision: D26172915
Pulled By: mweststrate
fbshipit-source-id: f0af143d8509b53585076737832657fb095e75a6
Summary:
Made UI fixes to Network Plugin (mostly to Route screens) to continue migration to the new design framework. This consisted mostly of replacing FlexColumn and FlexRow with Layout.Container and Layout.Horizontal.
Also, contains some cosmetic changes to "Mock Network Response" page.
Here is the screenshot with UI changes:

This was the old screen for comparison:

## Changelog
Network Plugin - UI changes to continue migration to Sandy design framework
Pull Request resolved: https://github.com/facebook/flipper/pull/1864
Test Plan: Manual testing to ensure that all data still displayed with new UI changes (especially the Data and Headers info in the "Route Info" section)
Reviewed By: passy
Differential Revision: D26125656
Pulled By: mweststrate
fbshipit-source-id: a25104274ed25788e5c0738ac0a9609f2cead751
Summary: Plugin metadata format extended to include type of each plugin (client / device) and list of supported devices (android/ios/..., emulator/physical, etc). This will allow to detect plugins supported by device even if they are not installed and only available on Marketplace.
Reviewed By: mweststrate
Differential Revision: D26073531
fbshipit-source-id: e331f1be1af1046cd4220a286a1d52378c26cc53
Summary:
In the network plugin, add features to import and export routes as described in issue https://github.com/facebook/flipper/issues/1651
Primary use case is that external testers (such as QA teams) would be able to create test data, convert it to mocks and save the mocks to make bug fixes easier for devs.
Here is a screenshot showing location of buttons to perform import/export (and clearing) of mock routes:

Here is another screenshot showing export dialog:

Changelog: [Network] Mock routes can now be imported and exported. Thanks bizzguy!
Pull Request resolved: https://github.com/facebook/flipper/pull/1855
Test Plan:
Performed manual testing
- create new mocks
- export mocks
- clear mocks
- import mocks
- verify that mocks still work by making GET/POST requests in sample app
Performed various permutations of above manual tests, including restarting Flipper at various points to ensure that test plan still worked. Also performed visual inspection of exported files to verify correctness.
Would be very interested in learning how to create automated tests for this functionality.
Reviewed By: passy
Differential Revision: D26072928
Pulled By: mweststrate
fbshipit-source-id: 51bd5e19e78d830b94add850d5dc9b9e45fa6fad
Summary:
The Network Plugin does not properly handle network requests that return an empty body (because of the body actually being empty or because the network call returns something like a 404 status).
Also, the creation of mocks using the "Copy Highlighted" command when the original response returns an empty body is not handled properly.
## Fix
The Android plugin now returns a response when the body length is 0.
The client plugin creates a body containing an empty string instead of null when the body is empty.
## Changelog
Fix problem in Network Plugin when original call or mock has an empty body in the response.
Pull Request resolved: https://github.com/facebook/flipper/pull/1776
Test Plan:
The following screen output for the Network Plugin shows that the call is now being handled correctly. The fields for "status", "size" and "duration" are now populated.
Also, the mock calls are properly defined and shown in yellow.

Reviewed By: mweststrate
Differential Revision: D25804212
Pulled By: passy
fbshipit-source-id: b31cc87619c604b4df76e05bca5c86554a1cabff
Summary:
Bumps [react-devtools-core](https://github.com/facebook/react/tree/HEAD/packages/react-devtools-core) from 4.9.0 to 4.10.1.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/facebook/react/commits/HEAD/packages/react-devtools-core">compare view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Pull Request resolved: https://github.com/facebook/flipper/pull/1795
Reviewed By: mweststrate
Differential Revision: D25802076
Pulled By: passy
fbshipit-source-id: 142dabcc0a7e688309cc4fc5ced8abde6914879e
Summary:
Bumps [pako](https://github.com/nodeca/pako) from 1.0.11 to 2.0.2.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/nodeca/pako/blob/master/CHANGELOG.md">pako's changelog</a>.</em></p>
<blockquote>
<h2>[2.0.2] - 2020-11-19</h2>
<h3>Fixed</h3>
<ul>
<li>Fix esm build named exports.</li>
</ul>
<h2>[2.0.1] - 2020-11-17</h2>
<h3>Changed</h3>
<ul>
<li>Changed esm build <code>.js</code> => <code>.mjs</code> to fix node.js <code>import</code>.</li>
<li>Added <code>module</code> entry in package.json for some bundlers.</li>
</ul>
<h2>[2.0.0] - 2020-11-17</h2>
<h3>Changed</h3>
<ul>
<li>Removed binary strings and <code>Array</code> support.</li>
<li>Removed fallbacks for TypedArray methods (<code>.set()</code>, <code>.subarray()</code>).</li>
<li>Rewritten top-level wrappers.</li>
<li>Removed support of <code>Inflate</code> & <code>Deflate</code> instance create without <code>new</code>.</li>
<li><code>Inflate.push()</code> no longer needs second param (end is auto-detected).</li>
<li>Increased default inflate chunk size to 64K.</li>
<li>Moved exported constants to <code>.constants</code>.</li>
<li>Switched to es6. Legacy es5 builds available in <code>/dist</code>.</li>
<li>Added esm build.</li>
<li>Structure of <code>/dist</code> folder changed.</li>
<li>Upgraded build tools to modern ones.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="45cce9f4d6"><code>45cce9f</code></a> 2.0.2 released</li>
<li><a href="b3861d9a66"><code>b3861d9</code></a> dist rebuild</li>
<li><a href="d0382badcc"><code>d0382ba</code></a> Fix esm build named exports</li>
<li><a href="8d5f9c70f8"><code>8d5f9c7</code></a> 2.0.1 released</li>
<li><a href="70ee7697ac"><code>70ee769</code></a> dist rebuild</li>
<li><a href="bd90fca738"><code>bd90fca</code></a> Add <code>module</code> entry for some bundlers</li>
<li><a href="84d6931fe8"><code>84d6931</code></a> Rename module build .js => .mjs to fix node import (<a href="https://github-redirect.dependabot.com/nodeca/pako/issues/200">https://github.com/facebook/flipper/issues/200</a>)</li>
<li><a href="52df0c510f"><code>52df0c5</code></a> 2.0.0 released</li>
<li><a href="a8faeffc94"><code>a8faeff</code></a> dist rebuild</li>
<li><a href="b4d9a94488"><code>b4d9a94</code></a> Added esm build, <a href="https://github-redirect.dependabot.com/nodeca/pako/issues/97">https://github.com/facebook/flipper/issues/97</a></li>
<li>Additional commits viewable in <a href="https://github.com/nodeca/pako/compare/1.0.11...2.0.2">compare view</a></li>
</ul>
</details>
<br />
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Pull Request resolved: https://github.com/facebook/flipper/pull/1786
Reviewed By: passy
Differential Revision: D25664507
Pulled By: cekkaewnumchai
fbshipit-source-id: bd33a7a11ef38b54675cde31d1243742476263d9
Summary: App match patterns are not available for all apps, there is no reason to treat this as an error, currently errors are printed for apps like "Flipper".
Reviewed By: nikoant
Differential Revision: D25369648
fbshipit-source-id: a63aadbf14745310501565b00081602e44852398
Summary:
This diff sets all package version to "0.0.0" except of the root package and changes the bump script to only bump version in the root package. This should reduce possibility of conflicts on release diffs. Anyway we always use the same version for all of our packages, so we can only set it to the root.
Before npm publishing we will set all package versions to the same number as in the root package (we actually already do that) so there will be no differences except we won't need to bump version in more than 100 packages each release.
Reviewed By: mweststrate
Differential Revision: D25162373
fbshipit-source-id: 02fe401bee72845339c67925c130027bdaee559d
Summary: To control bundle size and the amount of different versions used, we want plugins to use emotion's styled and immer's produce from flipper-plugin, rather than bringing their own
Reviewed By: passy
Differential Revision: D25087286
fbshipit-source-id: d2cc8b2cb1a17c520d05d99048cd94338984a913
Summary:
This diff will enabling freezing (making immutable) of all data we receive from the device. This prevents dev mistakes causing components not to update or logic being hard to reason about. Also this makes Immer's `produce` faster in the typical case
Since this is potentially a risky change, that might break existing plugin logic, it has been put behind a GK https://www.internalfb.com/intern/gatekeeper/projects/flipper_frozen_data/
I did some quick exploratory testing on all plugins available for Facebook iOS / Android, and the only plugin that caused trouble was Fresco, which is fixed in this diff as well.
Reviewed By: nikoant
Differential Revision: D25055056
fbshipit-source-id: 8525511f4a8a0221740a6e1371ce7f2b757a203e
Summary: See https://github.com/facebook/flipper/issues/1680, the sections plugin was exposed publicly, even though we don't have a publicly available client plugin
Reviewed By: passy
Differential Revision: D24993552
fbshipit-source-id: 788ecc29ec64048b3077dea89e492ddbf1ea7d84
Summary: The plugin seems to miss the train to version 0.65. This diff gives it a ride to the current version
Reviewed By: nikoant
Differential Revision: D24950948
fbshipit-source-id: 3132a3baf0a41d8ec0de5cf8c55c0561126b038f
Summary:
This diff adds support for finding appPatterns (not sure how the feature is called) in the device, and auto completing on it.
Also improved the styling of bookmark sections.
This diff also adds support of showing a dialog in which params an be filled out if needed.
The behavior around optional arguments seems buggy, as in, no dialog will show up, but since I didn't want to change the logic around this unilaterally, left it as-is for now.
Updated the dialog to Ant so that the renderReactRoot utility could be used safely
Reviewed By: cekkaewnumchai
Differential Revision: D24889855
fbshipit-source-id: 6af264abec2e9e5b921ef7da6deb1d0021615e9e
Summary:
Converted the Navigation plugin to Sandy, and updated Locations bookmark accordingly.
This is a prerequisite step of supporting the bookmarkswidgetin the new AppInspect tab.
Updated LocationsButton accordingly, and overal simplified implementation a bit; locationsbutton now reuses the logic of the NavigationPlugin, rather than reimplemting it. This reduces code duplication and also makes sure the state between plugin and location button stays in sync.
Made sure that search providers are derived and cached rather than stored, again simplifying logic
That being said, the navigation plugin is buggy, but all these things failed before this diff as well:
* No events happening when using iOS, despite the plugin being enabled. But these seems to be a long time know issue, looks like it was never implemented
* Not sure if the parameterized bookmarks is working correctly
* screenshots not always happening at the right time (but fixed a race condition where the wrong bookmark might get updated)
* Locations button doesn't show up if the navigation plugin is supported but not enabled (will try to fix in next diff)
Would be great if bnelo12 could do some exploratory testing to verify what ought to be working, but currently isn't.
Reviewed By: cekkaewnumchai
Differential Revision: D24860757
fbshipit-source-id: e4b56072de8c42af2ada0f5bb022cb9f8c04bb47
Summary:
devices not always being readily available is causes a lot of complication in the api,
figured to resolve devices first before construction clients,
since clients not attached to a device are shown uncategorized anyway, making them practically un-interactable.
For more background info, see following chat.
{F344388883}
This diff will make it possible to only expose a synchronous api in Sandy
n.b. didn't update Navigation plugin, as that is done in a next diff
Reviewed By: jknoxville
Differential Revision: D24858332
fbshipit-source-id: 8339f831fbbc9c219add56a199364fde67adafc7
Summary: It's easier to scan the same header value of multiple requests when it's in roughly the same place for each one.
Reviewed By: mweststrate
Differential Revision: D24885172
fbshipit-source-id: 7be02903d2f9f79c8ba618e57c74169392f6244b
Summary:
* Removed Flow compilation step
* Removed all `flow` annotations
* Removed all FlowFixMe's
* Removed flow typings for Flipper
* Left flow transpilation (stripping) in babel, in case there is any external user using Flow in his plugin
* Left `eslint-plugin-flowtype` dependencies, as `eslint-config-fbjs` requires it
Reviewed By: passy
Differential Revision: D24755545
fbshipit-source-id: 9c0a7910657fd1cba88294e041bf2bfdf7b565bf
Summary: For RN Debugger an ugly hack is used that roars its head now again; to make sure that the embedded debugger state isn't lost when switching to a different plugin, the chrome devtools are rendered _outside_ the domNode where they should normally appeared, and made invisible rather than removed when becoming invisible. Since at this moment this is the only place where we apply the trick, figured for now to condone it, rather than making a neater abstraction out of it (or kiling it all together)
Reviewed By: passy
Differential Revision: D24786771
fbshipit-source-id: 726617899bc620fc8b9db677d9413b31d5ad7653
Summary:
When creating the plugin overview (https://docs.google.com/spreadsheets/d/181jKpsUHO3q8I1G-bMcu-O7Hr3f4GCDVXKMVY2beOuQ/edit?usp=sharing) found some plugins with inactive points of contact
Per title, having no PoC entry makes it more clear there is none, rather than having an ex-employee in there that can't be reached
Reviewed By: nikoant
Differential Revision: D24783043
fbshipit-source-id: a852f87f42350476558bc9fc67cb3ad427268a2f
Summary: Encountered while debugging. Seems that the id was incorrect. This diff changes the id back to `"Example"`
Reviewed By: nikoant
Differential Revision: D24782578
fbshipit-source-id: ad1c6d6fe4962179ad609728c8641adc2063e929
Summary:
Split container had a convenient property `scrollable`, that automatically applies a Scroll container to the main content.
But I noticed it leads to bad design choices because it is so convenient. So sometimes scrolling would be unnecessarily in two directions because of this.
Or, since the scroll container wraps around the whole content, toolbars would scroll out of view. By forcing scrolling to be put explicitly in the component tree, we encourage plugin developers to think about where they actually want to have that scroll, and in which direction.
Also added options to use the Container padding properties on ScrollContainer, which is great since we can keep the scrollbars outside the padding, and apply it to the content only, to prevent an accidental mistake where people would put a scroll container in a padded container, that would put the scrollbar inside the padding.
Reviewed By: cekkaewnumchai
Differential Revision: D24502546
fbshipit-source-id: 524004a1c5f33a185f9b959251b72875dd623cb3
Summary:
per title
In addition, this diff adds `startUnactivated` option to allow setting up `onSend` mock implementation.
Reviewed By: mweststrate
Differential Revision: D24477989
fbshipit-source-id: f913574ebacdd436e8511baa43744249a014e90b
Summary:
Some exploratory testing on all iOS and Android plugins, to see how they behave inside Sandy, and fixed some layout glitches (some were also present without Sandy)
General fixes:
* Introduced some niceties like searchbox resizing properly, and toolbars wrapping automatically in Sandy, rather than buttons becoming invisible
* Containers don't grow anymore by default, but take size of contents
* ScrollContainer child is now a Layout.Vertical. Layout.Vertical should be used as default container everywhere (e.g. Tabs, Panels) in the future
* Fixed layout issue if a split container had only 1 visible child
* DetailsSidebar now scrolls vertically by default
* Details sidebar would sometimes render content in-place rather than in the reserved area
* AppSelector dropdown and Plugin list will now properly ellipse (...) if there is not enough space
Plugin fixes:
* Long database / table names in Database plugin would break layout
Also fixes https://github.com/facebook/flipper/issues/1611
Reviewed By: passy
Differential Revision: D24454188
fbshipit-source-id: c60c867270900a1d4f28587d47067c6ec1072ede
Summary:
Restore sidebar functionality for Sandy plugins
Also needed to fix some circular dependency issues as fallout.
Reviewed By: cekkaewnumchai
Differential Revision: D24362215
fbshipit-source-id: 0a09ac35ba981322ae0793edc3aa79ffddf2ce73
Summary: Recreation of D22118786, which was so old rebasing died on some lacking meta data. Lands https://github.com/facebook/flipper/pull/1256
Reviewed By: passy
Differential Revision: D24331424
fbshipit-source-id: 65fc5d8bf0242d4266e269716a319d71ce2e2826
Summary:
Changelog: [Network] Non-binary request are not properly utf-8 decoded on both iOS and Android, both when gzipped and when not gzipped
This diff fixes a long standing / ping-pong issue regarding network decoding differences between
* iOS vs Android
* binary vs utf-8
* gzipped vs uncompressed
The changes aren't too big, but the underlying investigating is :)
The primary contribution to this diff is:
First, adding test cases for know problematic cases. This is done by grabbing the messages that are send from the flipper client to flipper using the flipper messages plugin. This is the base64 data that is stored in the `.txt` files. Beyond that, for all tests public endpoints are used, so that we can both get a hold of the raw original files, and how we expect them to be displayed in flipper.
For testing a simple RN app was build, with a button that fires a bunch requests. The first 3 are captured in unit tests, the last one is not idempotent, but a case reported in #1466, so just left it there as manual verification.
```
const fetchData = async () => {
await fetch(
'https://raw.githubusercontent.com/SangKa/MobX-Docs-CN/master/docs/donating.md',
{
headers: {
'Accept-Encoding': 'identity', // signals that we don't want gzip
},
},
);
await fetch('https://reactnative.dev/img/tiny_logo.png?x=' + Math.random());
await fetch(
'https://raw.githubusercontent.com/SangKa/MobX-Docs-CN/master/docs/donating.md',
);
await fetch(
'https://ex.ke.com/sdk/recommend/html/100001314?hdicCityId=110000¶mMap[source]=&id=100001314&mediumId=100000037&elementId=&resblockId=1111027381003&templateConfig=%5Bobject%20Object%5D&fbExpoId=346620976471638017&fbQueryId=&required400=true&unique=1111027381003&parentSceneId=',
);
};
```
The second contribution of this diff is that it doesn't use weird URLencoder hacks to convert base64 to utf8, but rather a proper library. The problem with our original solution, using `atob` is that it converts to ASCII, not to utf-8, which is the source of the original bugs. See for more background on this: https://www.npmjs.com/package/js-base64#decode-vs-atob-and-encode-vs-btoa-
Solves:
https://github.com/facebook/flipper/issues/1466https://github.com/facebook/flipper/pull/1541https://github.com/facebook/flipper/issues/1458
Supersedes D23837750
Future work: we don't inspect the `content-type=xxx;charset` header yet, which we should do for less common encodings, to make sure that they get displayed correctly as well
Future work: in feature like copy data and curl, we always call decode body, without check if we are actually dealing with non-binary data. Probably it is better to keep binary data in base64, rather than decoding it, as that will assume the data is an utf-8 string, which might fail.
An assumption in these changes is that binary data is never gzipped, which is generally correct; gzip is not applied by webserver to things like images, as it would increase, not decrease their size, and waste a lot of computation power.
Reviewed By: cekkaewnumchai
Differential Revision: D23403095
fbshipit-source-id: 5099cc4a7503f0f63bd10585dc6590ba893f3dde