Bug 306108 - Use type=chrome <browser> in FF 1.4+/XULRunner to escape XPCNativeWrappers. Also bump the XPI compat level for Firefox to 1.6.

ChatZilla only.
r=silver
p=gijskruitbosch+bugs@gmail.com (Gijs Kruitbosch)
This commit is contained in:
silver%warwickcompsoc.co.uk 2005-11-26 20:56:30 +00:00
Родитель ac25f5bdc6
Коммит 5b921ea993
2 изменённых файлов: 40 добавлений и 8 удалений

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

@ -14,12 +14,12 @@
</Description>
</em:targetApplication>
<!-- target: Mozilla Firefox, version 0.9 to 1.0+ -->
<!-- target: Mozilla Firefox, version 0.9 to 1.6 -->
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>0.9</em:minVersion>
<em:maxVersion>1.0+</em:maxVersion>
<em:maxVersion>1.6</em:maxVersion>
</Description>
</em:targetApplication>

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

@ -111,6 +111,7 @@ client.CONFERENCE_LOW_PASS = 10;
client.viewsArray = new Array();
client.activityList = new Object();
client.hostCompat = new Object();
client.inputHistory = new Array();
client.lastHistoryReferenced = -1;
client.incompleteLine = "";
@ -352,9 +353,40 @@ function initApplicationCompatibility()
// This routine does nothing more than tweak the UI based on the host
// application.
/* client.hostCompat.typeChromeBrowser indicates whether we should use
* type="chrome" <browser> elements for the output window documents.
* Using these is necessary to work properly with xpcnativewrappers, but
* broke selection in older builds.
*/
client.hostCompat.typeChromeBrowser = false;
// Set up simple host and platform information.
client.host = "Unknown";
if ("getBrowserURL" in window)
var app = getService("@mozilla.org/xre/app-info;1", "nsIXULAppInfo");
if (app)
{
// Use the XULAppInfo.ID to find out what host we run on.
switch (app.ID)
{
case "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}":
client.host = "Firefox";
if (compareVersions(app.version, "1.4") <= 0)
client.hostCompat.typeChromeBrowser = true;
break;
case "{" + __cz_guid + "}":
// We ARE the app, in other words, we're running in XULrunner.
client.host = "XULrunner";
client.hostCompat.typeChromeBrowser = true;
break;
case "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}": // SeaMonkey
client.host = "Mozilla";
client.hostCompat.typeChromeBrowser = true;
break;
default:
client.host = ""; // Unknown host, show an error later.
}
}
else if ("getBrowserURL" in window)
{
var url = getBrowserURL();
if (url == "chrome://navigator/content/navigator.xul")
@ -364,10 +396,6 @@ function initApplicationCompatibility()
else
client.host = ""; // We don't know this host. Show an error later.
}
else
{
client.host = "XULrunner";
}
client.platform = "Unknown";
if (navigator.platform.search(/mac/i) > -1)
@ -3056,7 +3084,11 @@ function getTabForObject (source, create)
var browser = document.createElement ("browser");
browser.setAttribute("class", "output-container");
browser.setAttribute("type", "content");
// Only use type="chrome" if the host app supports it properly:
if (client.hostCompat.typeChromeBrowser)
browser.setAttribute("type", "chrome");
else
browser.setAttribute("type", "content");
browser.setAttribute("flex", "1");
browser.setAttribute("tooltip", "html-tooltip-node");
browser.setAttribute("context", "context:messages");