Is it possible to reference remote content from chrome.manifest? (XULRunner)
I have a xulrunner application and I've been trying to reference remote content from chrome.manifest file. Tt's an application for the company I work in; it's run on a number of computers (most of them are used by other employees as well) as a kind of an internet monitoring service. The problem I'd like to solve is this: updating the code of such application usually requires me to manually copy the modified files to every computer that the application is running on (I've had no luck trying to make automatic updates via xulrunner platform). This process has become very tedious. What I'd like to have is a web server, where all of the xul and js files would be accessible, so that every application could reference them from there. This would require me only to update the code on that server, and the applications (when restarted) would automatically get the latest code.
What I managed to do:
I can reference js scripts from a xul file using http based urls and everything works fine (I can use local, binary components etc.), a开发者_JAVA技巧lthough the xul file has to be local - that I'd like to change. But when I write in chrome.manifest a line like:
content my_app http://path/to/app/files/
and then use the line in default/preferences/pref.js
pref("toolkit.defaultChromeURI", "chrome://my_app/content/my_app.xul");
it just opens a console window (to test I manually run the application with the -console option) and no code gets executed. The file can be downloaded remotely using wget so I guess this isn't the web server issue.
The applications work on Windows machines.
Is there some kind of security issue causing such behavior or am I doing something wrong? Is it even possible to register remote, http based content as chrome?
Short answer:
It is possible to run a remote XUL app, but requires lots of structure changes across your application.
In detail:
We use a similar concept like you want to introduce in your company since 3 weeks in our product.
You can manage XUL-Runner to get XUL-files from a remote location AND execute them. You can have all relevant stuff like XUL-files, bindings an js- files on a server :)
BUT: it doesn't work with "chrome://..." paths because of security restrictions meaning: you will HAVE TO change all referece containing chrome-paths across your application :(
change all src specifications in xul-files, bindings and js-files from "chrome://dir/somefile" to relative paths like "../dir/somefile" or "dir/somefile"
to start app from remote add a line like following to your prefs file
pref("toolkit.defaultChromeURI", "http://"LOCATION"/bla.xul"); (XUL-Runner will promt a securuty warning after starting app)
20 mins ago I tested some stuff and found out (after deleting nearly all stuff on client, especially the chrome folder which is on server now) that you even do not need the chrome.manifest anymore and wanted to know WHY by looking for "remote XUL chrome.manifest" on google (thats why I found your question here).
All I needed on client is: the XUL-Runner and in app-path the appication.ini and the defaults/prefs.js
good luck
first, yes, XPCOM works, binaries from server: not tested, access to local binaries works but you have to add that monster of code in first line or one line before you need one or more of the following access methods IN NEARLY EACH function (whenever XUL-Runner complains about security stuff) :/
netscape.security.PrivilegeManager.enablePrivilege(" here one or more of the following ");
UniversalBrowserRead UniversalBrowserWrite UniversalXPConnect UniversalPreferencesRead UniversalPreferencesWrite UniversalFileRead
If you are worried about security, I recommend you to read it on Mozilla Development Network/Center to learn what exactly that stuff does. One of my workmates posted me that code and I did not yet have time to investigate :P
But thats's not all, you will have more access problems (at least I still have after that architecture change). You won't have that easily have access to js- stuff (functions...) like before.
Often you will have to modify your invokations like
parent.YOURFUNCTION or window.parent.YOURFUNCTION or similar
in order you have an idea what I mean with "not that easily", here is an example of code after architecture change (which used to be less of half of that...):
document.getElementById("mainIframe").contentDocument.getElementById("UrlBar").value = getSelectedBrowser().contentWindow.location.href;
Here's a link to what you may find usefull: http://fixunix.com/mozilla/575473-re-remote-xul.html. Read the original message as well for hints how to achieve what you want.
精彩评论