forked from mirrors/0ad
SpiderMonkey-related changes in preparation for the upgrade to SpiderMonkey 45, refs #4893.
- Remove JSVAL_ZERO and JSVAL_NULL https://bugzilla.mozilla.org/show_bug.cgi?id=1177825 - Remove *_TO_JSVAL https://bugzilla.mozilla.org/show_bug.cgi?id=1177892 - Drop support for parent object in the deserializer https://bugzilla.mozilla.org/show_bug.cgi?id=1136345, https://bugzilla.mozilla.org/show_bug.cgi?id=805052 - Correctly use boolean values in JS::RuntimeOptionsRef - Use JS_FN instead of JS_FS: in future versions, JS_FS is not public because it isn't supposed to be used in JSAPI code - Allow to select flags for global objects, and correctly mark progress bars in the loading screen as not readonly+permanent - Remove empty JSI_props in IGUIObject Reviewed By: wraitii, elexis Differential Revision: https://code.wildfiregames.com/D1716 This was SVN commit r22052.
This commit is contained in:
+10
-10
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2018 Wildfire Games.
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -328,7 +328,7 @@ JS::Value VisualReplay::LoadReplayData(const ScriptInterface& scriptInterface, c
|
||||
const OsPath replayFile = GetDirectoryName() / directory / L"commands.txt";
|
||||
|
||||
if (!FileExists(replayFile))
|
||||
return JSVAL_NULL;
|
||||
return JS::NullValue();
|
||||
|
||||
// Get file size and modification date
|
||||
CFileInfo fileInfo;
|
||||
@@ -336,7 +336,7 @@ JS::Value VisualReplay::LoadReplayData(const ScriptInterface& scriptInterface, c
|
||||
const off_t fileSize = fileInfo.Size();
|
||||
|
||||
if (fileSize == 0)
|
||||
return JSVAL_NULL;
|
||||
return JS::NullValue();
|
||||
|
||||
std::ifstream* replayStream = new std::ifstream(OsString(replayFile).c_str());
|
||||
|
||||
@@ -345,14 +345,14 @@ JS::Value VisualReplay::LoadReplayData(const ScriptInterface& scriptInterface, c
|
||||
{
|
||||
LOGERROR("Couldn't open %s.", replayFile.string8().c_str());
|
||||
SAFE_DELETE(replayStream);
|
||||
return JSVAL_NULL;
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
if (type != "start")
|
||||
{
|
||||
LOGWARNING("The replay %s doesn't begin with 'start'!", replayFile.string8().c_str());
|
||||
SAFE_DELETE(replayStream);
|
||||
return JSVAL_NULL;
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
// Parse header / first line
|
||||
@@ -365,14 +365,14 @@ JS::Value VisualReplay::LoadReplayData(const ScriptInterface& scriptInterface, c
|
||||
{
|
||||
LOGERROR("Couldn't parse replay header of %s", replayFile.string8().c_str());
|
||||
SAFE_DELETE(replayStream);
|
||||
return JSVAL_NULL;
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
// Ensure "turn" after header
|
||||
if (!(*replayStream >> type).good() || type != "turn")
|
||||
{
|
||||
SAFE_DELETE(replayStream);
|
||||
return JSVAL_NULL; // there are no turns at all
|
||||
return JS::NullValue(); // there are no turns at all
|
||||
}
|
||||
|
||||
// Don't process files of rejoined clients
|
||||
@@ -381,7 +381,7 @@ JS::Value VisualReplay::LoadReplayData(const ScriptInterface& scriptInterface, c
|
||||
if (turn != 0)
|
||||
{
|
||||
SAFE_DELETE(replayStream);
|
||||
return JSVAL_NULL;
|
||||
return JS::NullValue();
|
||||
}
|
||||
|
||||
int duration = getReplayDuration(replayStream, replayFile, fileSize);
|
||||
@@ -390,7 +390,7 @@ JS::Value VisualReplay::LoadReplayData(const ScriptInterface& scriptInterface, c
|
||||
|
||||
// Ensure minimum duration
|
||||
if (duration < minimumReplayDuration)
|
||||
return JSVAL_NULL;
|
||||
return JS::NullValue();
|
||||
|
||||
// Return the actual data
|
||||
JS::RootedValue replayData(cx);
|
||||
@@ -497,7 +497,7 @@ bool VisualReplay::HasReplayMetadata(const OsPath& directoryName)
|
||||
JS::Value VisualReplay::GetReplayMetadata(ScriptInterface::CxPrivate* pCxPrivate, const OsPath& directoryName)
|
||||
{
|
||||
if (!HasReplayMetadata(directoryName))
|
||||
return JSVAL_NULL;
|
||||
return JS::NullValue();
|
||||
|
||||
JSContext* cx = pCxPrivate->pScriptInterface->GetContext();
|
||||
JSAutoRequest rq(cx);
|
||||
|
||||
Reference in New Issue
Block a user