Move URL escaping to Inspector layer
Reviewed By: Hypuk Differential Revision: D5967544 fbshipit-source-id: d741e6324aff7583778cb13c862505b61ca02a3d
This commit is contained in:
parent
eae4fe810f
commit
ef2e29f54c
|
@ -328,13 +328,14 @@ struct RCTInstanceCallback : public InstanceCallback {
|
|||
BOOL useCustomJSC =
|
||||
[self.delegate respondsToSelector:@selector(shouldBridgeUseCustomJSC:)] &&
|
||||
[self.delegate shouldBridgeUseCustomJSC:self];
|
||||
NSString *escapedDeviceName = [[[UIDevice currentDevice] name] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
NSString *escapedAppName = [[[NSBundle mainBundle] bundleIdentifier] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
// We use the name of the device and the app for debugging & metrics
|
||||
NSString *deviceName = [[UIDevice currentDevice] name];
|
||||
NSString *appName = [[NSBundle mainBundle] bundleIdentifier];
|
||||
// The arg is a cache dir. It's not used with standard JSC.
|
||||
executorFactory.reset(new JSCExecutorFactory(folly::dynamic::object
|
||||
("OwnerIdentity", "ReactNative")
|
||||
("AppIdentity", [(escapedAppName ?: @"unknown") UTF8String])
|
||||
("DeviceIdentity", [(escapedDeviceName ?: @"unknown") UTF8String])
|
||||
("AppIdentity", [(appName ?: @"unknown") UTF8String])
|
||||
("DeviceIdentity", [(deviceName ?: @"unknown") UTF8String])
|
||||
("UseCustomJSC", (bool)useCustomJSC)
|
||||
#if RCT_PROFILE
|
||||
("StartSamplingProfilerOnInit", (bool)self.devSettings.startSamplingProfilerOnLaunch)
|
||||
|
|
|
@ -6,7 +6,6 @@ import static com.facebook.react.modules.systeminfo.AndroidInfoHelpers.getFriend
|
|||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.bridge.JSBundleLoader;
|
||||
|
@ -266,8 +265,9 @@ public class ReactInstanceManagerBuilder {
|
|||
mUIImplementationProvider = new UIImplementationProvider();
|
||||
}
|
||||
|
||||
String appName = Uri.encode(mApplication.getPackageName());
|
||||
String deviceName = Uri.encode(getFriendlyDeviceName());
|
||||
// We use the name of the device and the app for debugging & metrics
|
||||
String appName = mApplication.getPackageName();
|
||||
String deviceName = getFriendlyDeviceName();
|
||||
|
||||
return new ReactInstanceManager(
|
||||
mApplication,
|
||||
|
|
|
@ -31,7 +31,7 @@ public class AndroidInfoHelpers {
|
|||
return getServerIpAddress(INSPECTOR_PROXY_PORT);
|
||||
}
|
||||
|
||||
// FIXME(festevezga): This method is duplicated in an internal module. Any changes should be applied to both.
|
||||
// WARNING(festevezga): This RN helper method has been copied to another FB-only target. Any changes should be applied to both.
|
||||
public static String getFriendlyDeviceName() {
|
||||
if (isRunningOnGenymotion()) {
|
||||
// Genymotion already has a friendly name by default
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <folly/Exception.h>
|
||||
#include <folly/json.h>
|
||||
#include <folly/Memory.h>
|
||||
#include <folly/String.h>
|
||||
#include <glog/logging.h>
|
||||
#include <jschelpers/InspectorInterfaces.h>
|
||||
#include <jschelpers/JSCHelpers.h>
|
||||
|
@ -295,10 +296,13 @@ namespace facebook {
|
|||
#endif //defined(__ANDROID__)
|
||||
}
|
||||
|
||||
std::string escapedOwner = folly::uriEscape<std::string>(owner, folly::UriEscapeMode::QUERY);
|
||||
std::string escapedApp = folly::uriEscape<std::string>(app, folly::UriEscapeMode::QUERY);
|
||||
std::string escapedDevice = folly::uriEscape<std::string>(device, folly::UriEscapeMode::QUERY);
|
||||
std::string msg = folly::to<std::string>(
|
||||
"GET /autoattach?title=", owner,
|
||||
"&app=" , app,
|
||||
"&device=" , device,
|
||||
"GET /autoattach?title=", escapedOwner,
|
||||
"&app=" , escapedApp,
|
||||
"&device=" , escapedDevice,
|
||||
" HTTP/1.1\r\n\r\n");
|
||||
auto send_resp = ::send(socket_desc, msg.c_str(), msg.length(), 0);
|
||||
if (send_resp < 0) {
|
||||
|
|
Loading…
Reference in New Issue