Added RCTInspectorDevServerHelper call in FBReactJSExecutor. Added UTF8StringForSourceURL

Reviewed By: javache

Differential Revision: D5246399

fbshipit-source-id: 179ff0b69886c4ff71911fc7b1d3491ff4d5967d
This commit is contained in:
Viacheslav Radchenko
2017-06-14 14:06:26 -07:00
committed by Facebook Github Bot
parent c9a39b3bd3
commit 879edf0d05
3 changed files with 21 additions and 6 deletions

View File

@@ -48,5 +48,6 @@ struct ValueEncoder<NSArray *> {
};
NSError *tryAndReturnError(const std::function<void()>& func);
NSString *deriveSourceURL(NSURL *url);
} }

View File

@@ -133,4 +133,16 @@ NSError *tryAndReturnError(const std::function<void()>& func) {
}
}
NSString *deriveSourceURL(NSURL *url) {
NSString *sourceUrl;
if (url.isFileURL) {
// Url will contain only path to resource (i.g. file:// will be removed)
sourceUrl = url.path;
} else {
// Url will include protocol (e.g. http://)
sourceUrl = url.absoluteString;
}
return sourceUrl ?: @"";
}
} }