Fixing RN Debugger

Reviewed By: cwdick, javache

Differential Revision: D4409257

fbshipit-source-id: 062c798d1a1c9ad90884599ed262412c1dd51359
This commit is contained in:
Ashok Menon 2017-01-12 16:21:31 -08:00 committed by Facebook Github Bot
parent 545072b02d
commit 154e183344
1 changed files with 10 additions and 4 deletions

View File

@ -73,10 +73,16 @@ void Instance::loadScriptFromFile(const std::string& filename,
"fileName", filename);
std::unique_ptr<const JSBigFileString> script;
RecoverableError::runRethrowingAsRecoverable<std::system_error>(
[&filename, &script]() {
script = JSBigFileString::fromPath(filename);
});
// This function can be called in order to change the Bridge's Source URL.
// In that case, the filename will be empty, and we should not attempt to
// load it.
if (!filename.empty()) {
RecoverableError::runRethrowingAsRecoverable<std::system_error>(
[&filename, &script]() {
script = JSBigFileString::fromPath(filename);
});
}
nativeToJsBridge_->loadApplication(nullptr, std::move(script), sourceURL);
}