mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 568691 - Add an ABI chrome registration modifier so that platform-specific directories can be implemented directly in chrome.manifest.
This commit is contained in:
parent
c16cf0f0c5
commit
6669ee04a8
4
chrome/test/unit/data/test_abi.manifest
Normal file
4
chrome/test/unit/data/test_abi.manifest
Normal file
@ -0,0 +1,4 @@
|
||||
category abitest test1 found ABI=XPCShell_noarch-spidermonkey
|
||||
category abitest test2 notfound ABI=WINNT_noarch-spidermonkey
|
||||
category abitest test3 found ABI!=WINNT_noarch-spidermonkey
|
||||
category abitest test4 notfound ABI!=XPCShell_noarch-spidermonkey
|
60
chrome/test/unit/test_abi.js
Normal file
60
chrome/test/unit/test_abi.js
Normal file
@ -0,0 +1,60 @@
|
||||
const XULAppInfo = {
|
||||
vendor: "Mozilla",
|
||||
name: "XPCShell",
|
||||
ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
|
||||
version: "5",
|
||||
appBuildID: "2007010101",
|
||||
platformVersion: "1.9",
|
||||
platformBuildID: "2007010101",
|
||||
inSafeMode: false,
|
||||
logConsoleErrors: true,
|
||||
OS: "XPCShell",
|
||||
XPCOMABI: "noarch-spidermonkey",
|
||||
|
||||
QueryInterface: function QueryInterface(iid) {
|
||||
if (iid.equals(Ci.nsIXULAppInfo)
|
||||
|| iid.equals(Ci.nsIXULRuntime)
|
||||
|| iid.equals(Ci.nsISupports))
|
||||
return this;
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
};
|
||||
|
||||
const XULAppInfoFactory = {
|
||||
// These two are used when we register all our factories (and unregister)
|
||||
CID: XULAPPINFO_CID,
|
||||
scheme: "XULAppInfo",
|
||||
contractID: XULAPPINFO_CONTRACTID,
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||
return XULAppInfo.QueryInterface(iid);
|
||||
}
|
||||
};
|
||||
|
||||
var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
registrar.registerFactory(XULAPPINFO_CID, "XULAppInfo",
|
||||
XULAPPINFO_CONTRACTID, XULAppInfoFactory);
|
||||
|
||||
registerManifests([do_get_file("data/test_abi.manifest")]);
|
||||
|
||||
const catman = Components.classes["@mozilla.org/categorymanager;1"].
|
||||
getService(Components.interfaces.nsICategoryManager);
|
||||
|
||||
function is_registered(name) {
|
||||
try {
|
||||
var d = catman.getCategoryEntry("abitest", name);
|
||||
return d == "found";
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
do_check_true(is_registered("test1"));
|
||||
do_check_false(is_registered("test2"));
|
||||
do_check_true(is_registered("test3"));
|
||||
do_check_false(is_registered("test4"));
|
||||
}
|
@ -360,10 +360,13 @@ ParseManifest(NSLocationType aType, nsILocalFile* aFile, char* buf,
|
||||
NS_NAMED_LITERAL_STRING(kAppVersion, "appversion");
|
||||
NS_NAMED_LITERAL_STRING(kOs, "os");
|
||||
NS_NAMED_LITERAL_STRING(kOsVersion, "osversion");
|
||||
NS_NAMED_LITERAL_STRING(kABI, "abi");
|
||||
|
||||
nsAutoString appID;
|
||||
nsAutoString appVersion;
|
||||
nsAutoString osTarget;
|
||||
nsAutoString abi;
|
||||
|
||||
nsCOMPtr<nsIXULAppInfo> xapp (do_GetService(XULAPPINFO_SERVICE_CONTRACTID));
|
||||
if (xapp) {
|
||||
nsCAutoString s;
|
||||
@ -382,6 +385,14 @@ ParseManifest(NSLocationType aType, nsILocalFile* aFile, char* buf,
|
||||
CopyUTF8toUTF16(s, osTarget);
|
||||
ToLowerCase(osTarget);
|
||||
}
|
||||
|
||||
rv = xruntime->GetXPCOMABI(s);
|
||||
if (NS_SUCCEEDED(rv) && osTarget.Length()) {
|
||||
CopyUTF8toUTF16(s, abi);
|
||||
ToLowerCase(abi);
|
||||
abi.Insert(PRUnichar('_'), 0);
|
||||
abi.Insert(osTarget, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -459,6 +470,7 @@ ParseManifest(NSLocationType aType, nsILocalFile* aFile, char* buf,
|
||||
TriState stApp = eUnspecified;
|
||||
TriState stOsVersion = eUnspecified;
|
||||
TriState stOs = eUnspecified;
|
||||
TriState stABI = eUnspecified;
|
||||
bool platform = false;
|
||||
bool contentAccessible = false;
|
||||
|
||||
@ -468,6 +480,7 @@ ParseManifest(NSLocationType aType, nsILocalFile* aFile, char* buf,
|
||||
|
||||
if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
|
||||
CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
|
||||
CheckStringFlag(kABI, wtoken, abi, stABI) ||
|
||||
CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
|
||||
CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion))
|
||||
continue;
|
||||
@ -481,7 +494,12 @@ ParseManifest(NSLocationType aType, nsILocalFile* aFile, char* buf,
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (!ok || stApp == eBad || stAppVersion == eBad || stOs == eBad || stOsVersion == eBad)
|
||||
if (!ok ||
|
||||
stApp == eBad ||
|
||||
stAppVersion == eBad ||
|
||||
stOs == eBad ||
|
||||
stOsVersion == eBad ||
|
||||
stABI == eBad)
|
||||
continue;
|
||||
|
||||
if (directive->ischrome) {
|
||||
@ -510,7 +528,7 @@ ParseManifest(NSLocationType aType, nsILocalFile* aFile, char* buf,
|
||||
}
|
||||
}
|
||||
|
||||
for (PRInt32 i = 0; i < contracts.Length(); ++i) {
|
||||
for (PRUint32 i = 0; i < contracts.Length(); ++i) {
|
||||
CachedDirective& d = contracts[i];
|
||||
nsComponentManagerImpl::gComponentManager->ManifestContract
|
||||
(mgrcx, d.lineno, d.argv);
|
||||
|
Loading…
Reference in New Issue
Block a user