Bug 1365419 - Allow to apply manifest entries for all non-(Darwin,Windows,Android) OSes. r=bsmedberg

Manifest entries can contain flags, one of which allows to match on the
os running Gecko. The match is performed against the value returned by
nsIXULRuntime.getOS, which itself comes from the build-system's
OS_TARGET.

In practice, this means that things like os=WINNT, os=Darwin,
os=Android, os=Linux are valid filters, but the latter is too specific,
and most of the time, one would want something that is "any OS but
WINNT, Darwin, Android", which can't be expressed with manifest entry
flags (there is no "and" for them, only "or").

For convenience, we add the keyword "LikeUnix", which has that meaning.

--HG--
extra : rebase_source : ce2549fab96cb1df3f984e43cb08413cad49479e
This commit is contained in:
Mike Hommey 2017-05-26 08:56:18 +09:00
Родитель e36ce0e346
Коммит 6a0f9240a2
1 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -319,6 +319,19 @@ CheckStringFlag(const nsSubstring& aFlag, const nsSubstring& aData,
return true;
}
static bool
CheckOsFlag(const nsSubstring& aFlag, const nsSubstring& aData,
const nsSubstring& aValue, TriState& aResult)
{
bool result = CheckStringFlag(aFlag, aData, aValue, aResult);
#if defined(XP_UNIX) && !defined(XP_DARWIN) && !defined(ANDROID)
if (result && aResult == eBad) {
result = CheckStringFlag(aFlag, aData, NS_LITERAL_STRING("likeunix"), aResult);
}
#endif
return result;
}
/**
* Check for a modifier flag of the following form:
* "flag=version"
@ -665,7 +678,7 @@ ParseManifest(NSLocationType aType, FileLocation& aFile, char* aBuf,
NS_ConvertASCIItoUTF16 wtoken(token);
if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
CheckOsFlag(kOs, wtoken, osTarget, stOs) ||
CheckStringFlag(kABI, wtoken, abi, stABI) ||
CheckStringFlag(kProcess, wtoken, process, stProcess) ||
CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||