Skip to content

Commit

Permalink
issue #4234: Checking whether '.jsc' file exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Chen committed Mar 5, 2014
1 parent 8f11c3a commit b15ad53
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions frameworks/js-bindings/bindings/manual/ScriptingCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,15 @@ void ScriptingCore::compileScript(const char *path, JSObject* global, JSContext*
// a) check jsc file first
std::string byteCodePath = RemoveFileExt(std::string(path)) + BYTE_CODE_FILE_EXT;

Data data = futil->getDataFromFile(byteCodePath);

if (!data.isNull())
{
script = JS_DecodeScript(cx, data.getBytes(), static_cast<uint32_t>(data.getSize()), nullptr, nullptr);
}
// Check whether '.jsc' files exist to avoid outputing log which says 'couldn't find .jsc file'.
if (futil->isFileExist(byteCodePath))
{
Data data = futil->getDataFromFile(byteCodePath);
if (!data.isNull())
{
script = JS_DecodeScript(cx, data.getBytes(), static_cast<uint32_t>(data.getSize()), nullptr, nullptr);
}
}

// b) no jsc file, check js file
if (!script)
Expand Down

0 comments on commit b15ad53

Please sign in to comment.