2011-05-31 141 views
3

我想在Mac OS X中创建一个XUL“Hello World”应用程序。我从here下载XULRunner,然后this tutorial,然后this tutorial,然后this tutorial ...没有工作。所以,我更好地看了看,发现this section,我遵循了他的指示。不幸的是,它还没有工作。我甚至可以用命令运行应用程序如何在Mac OS X Snow Leopard中运行XUL应用程序?

/Library/Frameworks/XUL.framework/xulrunner-bin $PWD/application.ini 

但是,没有窗口显示,也没有打印错误。当我尝试运行firefox -app的应用程序时也会发生这种情况。

什么可能是错的?另外,有人知道一些将起作用的教程吗?这也是一个可以接受的答案:)

在此先感谢!

文件内容

application.ini文件的内容是:

[App] 
Vendor=Me 
Name=Zull 
Version=1.0 
BuildID=31052011 
[email protected] 

[Gecko] 
MinVersion=2.0 
MaxVersion=2.* 

chrome/chrome.manifest内容是:

content zull file:content/ 

chrome/content/main.xul内容是:

<?xml version="1.0"?> 
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> 
<window id="main" title="My App" width="300" height="300" 
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 
    <caption label="Hello World"/> 
</window> 

最后,defaults/preferences/prefs.js内容是:

pref("toolkit.defaultChromeURI", "chrome://zull/content/main.xul"); 

回答

1

继弗拉基米尔Palant的建议,我改变了chrome/chrome.manifest内容从

content zull file:content/ 

content zull content/ 

然后,以下these instructions,我创建了一个chrome.manifest文件中的根应用程序目录,其内容是

manifest chrome/chrome.manifest 

这是必需的,因为XULRunner 2.0中chrome.manifest的默认位置是根应用程序目录。

但是,错误No chrome package registered for chrome:///User/brandizzi/sandbox/zull/main.xul仍然存在。于是,我知道了:试图解决这个问题,我经历了使用defaults/preferences/prefs.js的完整路径main.xul文件:

pref("toolkit.defaultChromeURI", "chrome:///User/brandizzi/sandbox/zull/main.xul"); 

我只是改成了镀铬路径...

pref("toolkit.defaultChromeURI", "chrome://zull/content/main.xul"); 

...它的工作。

这是一堆愚蠢的错误,但它现在解决了。 This thread对我很有帮助。此外,有关使用XULRunner的-jsconsole选项(例如/Library/Frameworks/XUL.framework/xulrunner-bin ~/sandbox/zull/application.ini -jsconsole)的弗拉基米尔建议非常有用。

2

我可以在这里看到只有一个明显的错误。您chrome.manifest用于文件的内容应该是:

content zull content/ 

一般来说,你可以在-jsconsole标志随时添加到命令行。这将打开错误控制台,并且经常会向您显示错误信息。

+0

我更新了'chrome.manifest',并用'-jsconsole'运行了xulrunner。控制台显示消息“无法读取chrome清单文件.../zull/chrome.manifest”。我将'chrome.manifest'复制到应用程序根目录,然后得到消息'没有注册chrome:chrome:.../main.xul'。我认为这是另一个问题,所以我会将您的问题标记为答案并询问另一个问题,因为'-jsconsole'在某种程度上是我所寻找的。 – brandizzi 2011-06-06 21:35:50

相关问题