-rwxr-xr-x | src/chrome/content/foxri.xul | 8 | ||||
-rwxr-xr-x | src/components/xriProtocolHandler.js | 10 | ||||
-rwxr-xr-x | src/install.rdf | 4 |
3 files changed, 8 insertions, 14 deletions
diff --git a/src/chrome/content/foxri.xul b/src/chrome/content/foxri.xul index dc1cc37..785cc0c 100755 --- a/src/chrome/content/foxri.xul +++ b/src/chrome/content/foxri.xul | |||
@@ -1,32 +1,28 @@ | |||
1 | <?xml version="1.0"?> | 1 | <?xml version="1.0"?> |
2 | <?xml-stylesheet href="foxri.css" type="text/css"?> | 2 | <?xml-stylesheet href="foxri.css" type="text/css"?> |
3 | 3 | ||
4 | 4 | ||
5 | <overlay id="foxri" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | 5 | <overlay id="foxri" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
6 | 6 | ||
7 | 7 | ||
8 | <!-- | 8 | <!-- |
9 | <script type="application/x-javascript" src="chrome://foxri/content/xrdsHandler.js"/> | 9 | <script type="application/x-javascript" src="chrome://foxri/content/xrdsHandler.js"/> |
10 | --> | 10 | --> |
11 | 11 | ||
12 | <script> | 12 | <script> |
13 | function xriFix(event) | 13 | function xriFix(event) |
14 | { | 14 | { |
15 | var txt = gURLBar.value; | 15 | var txt = gURLBar.value; |
16 | if (/^(=|@|!)\S+/.test(txt)) { | 16 | if (/^(=|@|!)\S+/.test(txt)) { |
17 | gURLBar.value = "xri://" + txt; | 17 | gURLBar.value = "xri://" + txt; |
18 | } | 18 | } |
19 | } | 19 | } |
20 | </script> | 20 | </script> |
21 | 21 | ||
22 | 22 | ||
23 | <toolbaritem id="urlbar-container"> | 23 | <textbox id="urlbar" ontextentered="xriFix(); return handleURLBarCommand(param);" /> |
24 | <textbox id="urlbar" ontextentered="xriFix(); return handleURLBarCommand(param);" /> | ||
25 | </toolbaritem> | ||
26 | 24 | ||
27 | <toolbaritem id="go-container"> | 25 | <toolbarbutton id="go-button" oncommand="xriFix(); return handleURLBarCommand(event);" /> |
28 | <toolbarbutton id="go-button" oncommand="xriFix(); return handleURLBarCommand(event);" /> | ||
29 | </toolbaritem> | ||
30 | 26 | ||
31 | </overlay> | 27 | </overlay> |
32 | 28 | ||
diff --git a/src/components/xriProtocolHandler.js b/src/components/xriProtocolHandler.js index 7046cde..1105874 100755 --- a/src/components/xriProtocolHandler.js +++ b/src/components/xriProtocolHandler.js | |||
@@ -286,65 +286,65 @@ function renderService(srv, doc, qxri) | |||
286 | } | 286 | } |
287 | 287 | ||
288 | html_uris += "<a href=\""+u.nodeValue+"\">" | 288 | html_uris += "<a href=\""+u.nodeValue+"\">" |
289 | + linkContent + "</a>"; | 289 | + linkContent + "</a>"; |
290 | html_uris += "</div>"; | 290 | html_uris += "</div>"; |
291 | } | 291 | } |
292 | 292 | ||
293 | var html = "<div class=\"service srv_" + getServiceClass(knownServiceType) + "\">\n"; | 293 | var html = "<div class=\"service srv_" + getServiceClass(knownServiceType) + "\">\n"; |
294 | html += html_types; | 294 | html += html_types; |
295 | html += html_paths; | 295 | html += html_paths; |
296 | html += html_mediatypes; | 296 | html += html_mediatypes; |
297 | if (html_uris) { | 297 | if (html_uris) { |
298 | html += "<strong>URI(s):</strong><br/>\n"; | 298 | html += "<strong>URI(s):</strong><br/>\n"; |
299 | html += html_uris; | 299 | html += html_uris; |
300 | } | 300 | } |
301 | html += "</div>"; | 301 | html += "</div>"; |
302 | 302 | ||
303 | return html; | 303 | return html; |
304 | } | 304 | } |
305 | 305 | ||
306 | 306 | ||
307 | 307 | ||
308 | function isKnownServiceType(type) | 308 | function isKnownServiceType(type) |
309 | { | 309 | { |
310 | if (type.toLowerCase() in SERVICE_CLASSES) { | 310 | if (type.toLowerCase() in SERVICE_CLASSES) { |
311 | return true; | 311 | return true; |
312 | } | 312 | } |
313 | return false; | 313 | return false; |
314 | } | 314 | } |
315 | 315 | ||
316 | function getServiceClass(type) | 316 | function getServiceClass(type) |
317 | { | 317 | { |
318 | if (isKnownServiceType(type)) { | 318 | if (type && isKnownServiceType(type)) { |
319 | return SERVICE_CLASSES[type.toLowerCase()]; | 319 | return SERVICE_CLASSES[type.toLowerCase()]; |
320 | } | 320 | } |
321 | return type; | 321 | return type; |
322 | } | 322 | } |
323 | 323 | ||
324 | 324 | ||
325 | function guessServiceTypeByURI(uri) | 325 | function guessServiceTypeByURI(uri) |
326 | { | 326 | { |
327 | if (uri == null || uri == "") { | 327 | if (uri == null || uri == "") { |
328 | return "unknown"; | 328 | return "unknown"; |
329 | } | 329 | } |
330 | if (uri.match(/^https?:/i)) { | 330 | if (uri.match(/^https?:/i)) { |
331 | return "www"; | 331 | return "www"; |
332 | } | 332 | } |
333 | else if (uri.match(/^skype:/i)) { | 333 | else if (uri.match(/^skype:/i)) { |
334 | return "skype"; | 334 | return "skype"; |
335 | } | 335 | } |
336 | else if (uri.match(/^aim:/i)) { | 336 | else if (uri.match(/^aim:/i)) { |
337 | return "aim"; | 337 | return "aim"; |
338 | } | 338 | } |
339 | else if (uri.match(/^xmpp:/i)) { | 339 | else if (uri.match(/^xmpp:/i)) { |
340 | return "jabber"; | 340 | return "jabber"; |
341 | } | 341 | } |
342 | else if (uri.match(/^tel:/i)) { | 342 | else if (uri.match(/^tel:/i)) { |
343 | return "tel"; | 343 | return "tel"; |
344 | } | 344 | } |
345 | else if (uri.match(/^callto:/i)) { | 345 | else if (uri.match(/^callto:/i)) { |
346 | return "callto"; | 346 | return "callto"; |
347 | } | 347 | } |
348 | else if (uri.match(/^telnet:/i)) { | 348 | else if (uri.match(/^telnet:/i)) { |
349 | return "telnet"; | 349 | return "telnet"; |
350 | } | 350 | } |
@@ -768,101 +768,99 @@ XRIChannel.prototype = { | |||
768 | var ioService = Components.classesByID[kIOSERVICE_CID_STR].getService(); | 768 | var ioService = Components.classesByID[kIOSERVICE_CID_STR].getService(); |
769 | ioService = ioService.QueryInterface(nsIIOService); | 769 | ioService = ioService.QueryInterface(nsIIOService); |
770 | var channel = ioService.newChannel(hxri, null, null); | 770 | var channel = ioService.newChannel(hxri, null, null); |
771 | 771 | ||
772 | if (this.scriptableInStream) { | 772 | if (this.scriptableInStream) { |
773 | dump("Hey! You can't possibly be reusing this handler?!\n"); | 773 | dump("Hey! You can't possibly be reusing this handler?!\n"); |
774 | return; | 774 | return; |
775 | } | 775 | } |
776 | 776 | ||
777 | dump("making scriptableInStream\n"); | 777 | dump("making scriptableInStream\n"); |
778 | this.scriptableInStream = Components.classes["@mozilla.org/scriptableinputstream;1"] | 778 | this.scriptableInStream = Components.classes["@mozilla.org/scriptableinputstream;1"] |
779 | .createInstance(Components.interfaces.nsIScriptableInputStream); | 779 | .createInstance(Components.interfaces.nsIScriptableInputStream); |
780 | 780 | ||
781 | this.buf = ''; | 781 | this.buf = ''; |
782 | 782 | ||
783 | dump("notificationCallbacks = " + this.notificationCallbacks + "\n"); | 783 | dump("notificationCallbacks = " + this.notificationCallbacks + "\n"); |
784 | dump("loadFlags = " + this.loadFlags + "\n"); | 784 | dump("loadFlags = " + this.loadFlags + "\n"); |
785 | dump("loadGroup = " + this.loadGroup + "\n"); | 785 | dump("loadGroup = " + this.loadGroup + "\n"); |
786 | dump("owner = " + this.owner + "\n"); | 786 | dump("owner = " + this.owner + "\n"); |
787 | dump("securityInfo = " + this.securityInfo + "\n"); | 787 | dump("securityInfo = " + this.securityInfo + "\n"); |
788 | 788 | ||
789 | // these nsIRequest attributes must be copied to the stub | 789 | // these nsIRequest attributes must be copied to the stub |
790 | // channel that we created | 790 | // channel that we created |
791 | channel.notificationCallbacks = this.notificationCallbacks; | 791 | channel.notificationCallbacks = this.notificationCallbacks; |
792 | channel.loadGroup = this.loadGroup; | 792 | channel.loadGroup = this.loadGroup; |
793 | channel.loadFlags = this.loadFlags; | 793 | channel.loadFlags = this.loadFlags; |
794 | 794 | ||
795 | this.mChannel = channel; | 795 | this.mChannel = channel; |
796 | channel.asyncOpen(this, null); | 796 | channel.asyncOpen(this, null); |
797 | }, | 797 | }, |
798 | 798 | ||
799 | 799 | ||
800 | /* public fields (nsIChannel implmentation) */ | 800 | /* public fields (nsIChannel implementation) */ |
801 | allowPipelining: false, | 801 | allowPipelining: false, |
802 | redirectionLimit: 5, | 802 | redirectionLimit: 5, |
803 | referrer: "", | 803 | referrer: "", |
804 | requestMethod: "GET", | 804 | requestMethod: "GET", |
805 | requestSucceeded: true, | 805 | requestSucceeded: true, |
806 | responseStatus: 200, | 806 | responseStatus: 200, |
807 | responseStatusText: "OK", | 807 | responseStatusText: "OK", |
808 | getRequestHeader: function(header) { | 808 | getRequestHeader: function(header) { |
809 | dump("getRequestHeader(" + header + ")\n"); | 809 | dump("getRequestHeader(" + header + ")\n"); |
810 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); | 810 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); |
811 | 811 | ||
812 | try { | 812 | try { |
813 | var val = httpChannel.getRequestHeader(header); | 813 | var val = httpChannel.getRequestHeader(header); |
814 | dump("getRequestHeader(" + header + ") = " + val + "\n"); | 814 | dump("getRequestHeader(" + header + ") = " + val + "\n"); |
815 | return val; | 815 | return val; |
816 | } | 816 | } |
817 | catch (e) { | 817 | catch (e) { |
818 | dump("getRequestHeader - got exception: " + e + "\n"); | ||
818 | throw e; | 819 | throw e; |
819 | } | 820 | } |
820 | }, | 821 | }, |
821 | getResponseHeader: function(header) { | 822 | getResponseHeader: function(header) { |
822 | dump("getResponseHeader(" + header + ")\n"); | 823 | dump("getResponseHeader(" + header + ")\n"); |
823 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); | 824 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); |
824 | 825 | ||
825 | try { | 826 | try { |
826 | var val = httpChannel.getResponseHeader(header); | 827 | var val = httpChannel.getResponseHeader(header); |
827 | dump("getResponseHeader(" + header + ") = " + val + "\n"); | 828 | dump("getResponseHeader(" + header + ") = " + val + "\n"); |
828 | return val; | 829 | return val; |
829 | } | 830 | } |
830 | catch (e) { | 831 | catch (e) { |
832 | dump("getResponseHeader - got exception: " + e + "\n"); | ||
831 | throw e; | 833 | throw e; |
832 | } | 834 | } |
833 | /* XXX | ||
834 | if (header == "Content-Type") | ||
835 | return "text/html"; | ||
836 | */ | ||
837 | return null; | 835 | return null; |
838 | }, | 836 | }, |
839 | isNoCacheResponse: function() { | 837 | isNoCacheResponse: function() { |
840 | dump("isNoCacheResponse()\n"); | 838 | dump("isNoCacheResponse()\n"); |
841 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); | 839 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); |
842 | return httpChannel.isNoCacheResponse(); | 840 | return httpChannel.isNoCacheResponse(); |
843 | }, | 841 | }, |
844 | isNoStoreResponse: function() { | 842 | isNoStoreResponse: function() { |
845 | dump("isNoStoreResponse()\n"); | 843 | dump("isNoStoreResponse()\n"); |
846 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); | 844 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); |
847 | return httpChannel.isNoStoreResponse(); | 845 | return httpChannel.isNoStoreResponse(); |
848 | return true; | 846 | return true; |
849 | }, | 847 | }, |
850 | setRequestHeader: function(header, value, merge) { | 848 | setRequestHeader: function(header, value, merge) { |
851 | dump("setRequestHeader(" + header + ", " + value + ")\n"); | 849 | dump("setRequestHeader(" + header + ", " + value + ")\n"); |
852 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); | 850 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); |
853 | return httpChannel.setRequestHeader(header, value, merge); | 851 | return httpChannel.setRequestHeader(header, value, merge); |
854 | }, | 852 | }, |
855 | setResponseHeader: function(header, value, merge) { | 853 | setResponseHeader: function(header, value, merge) { |
856 | dump("setResponseHeader(" + header + ", " + value + ")\n"); | 854 | dump("setResponseHeader(" + header + ", " + value + ")\n"); |
857 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); | 855 | var httpChannel = this.mChannel.QueryInterface(nsIHttpChannel); |
858 | return httpChannel.setResponseHeader(header, value, merge); | 856 | return httpChannel.setResponseHeader(header, value, merge); |
859 | }, | 857 | }, |
860 | visitRequestHeaders: function(visitor) { | 858 | visitRequestHeaders: function(visitor) { |
861 | dump("visitRequestHeaders()\n"); | 859 | dump("visitRequestHeaders()\n"); |
862 | }, | 860 | }, |
863 | visitResponseHeaders: function(visitor) { | 861 | visitResponseHeaders: function(visitor) { |
864 | dump("visitResponseHeaders()\n"); | 862 | dump("visitResponseHeaders()\n"); |
865 | }, | 863 | }, |
866 | 864 | ||
867 | QueryInterface: function(iid) | 865 | QueryInterface: function(iid) |
868 | { | 866 | { |
diff --git a/src/install.rdf b/src/install.rdf index a482755..507420c 100755 --- a/src/install.rdf +++ b/src/install.rdf | |||
@@ -1,40 +1,40 @@ | |||
1 | <?xml version="1.0"?> | 1 | <?xml version="1.0"?> |
2 | 2 | ||
3 | <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | 3 | <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
4 | xmlns:em="http://www.mozilla.org/2004/em-rdf#"> | 4 | xmlns:em="http://www.mozilla.org/2004/em-rdf#"> |
5 | 5 | ||
6 | <Description about="urn:mozilla:install-manifest"> | 6 | <Description about="urn:mozilla:install-manifest"> |
7 | <em:id>foxri@foxri.net</em:id> | 7 | <em:id>foxri@foxri.net</em:id> |
8 | <em:version>1.1.1</em:version> | 8 | <em:version>1.1.2</em:version> |
9 | <em:type>2</em:type> | 9 | <em:type>2</em:type> |
10 | 10 | ||
11 | <!-- Target Application this extension can install into, | 11 | <!-- Target Application this extension can install into, |
12 | with minimum and maximum supported versions. --> | 12 | with minimum and maximum supported versions. --> |
13 | <em:targetApplication> | 13 | <em:targetApplication> |
14 | <Description> | 14 | <Description> |
15 | <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> | 15 | <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> |
16 | <em:minVersion>1.0</em:minVersion> | 16 | <em:minVersion>1.0</em:minVersion> |
17 | <em:maxVersion>1.5.0.*</em:maxVersion> | 17 | <em:maxVersion>2.0.*</em:maxVersion> |
18 | </Description> | 18 | </Description> |
19 | </em:targetApplication> | 19 | </em:targetApplication> |
20 | 20 | ||
21 | <em:targetApplication> | 21 | <em:targetApplication> |
22 | <Description> | 22 | <Description> |
23 | <em:id>{a463f10c-3994-11da-9945-000d60ca027b}</em:id> | 23 | <em:id>{a463f10c-3994-11da-9945-000d60ca027b}</em:id> |
24 | <em:minVersion>0.5</em:minVersion> | 24 | <em:minVersion>0.5</em:minVersion> |
25 | <em:maxVersion>0.8</em:maxVersion> | 25 | <em:maxVersion>0.8</em:maxVersion> |
26 | </Description> | 26 | </Description> |
27 | </em:targetApplication> | 27 | </em:targetApplication> |
28 | 28 | ||
29 | 29 | ||
30 | <!-- Front End MetaData --> | 30 | <!-- Front End MetaData --> |
31 | <em:name>FoXRI</em:name> | 31 | <em:name>FoXRI</em:name> |
32 | <em:description>XRI Extension</em:description> | 32 | <em:description>XRI Extension</em:description> |
33 | <em:creator>William Tan</em:creator> | 33 | <em:creator>William Tan</em:creator> |
34 | <em:homepageURL>http://dready.org/projects/foxri</em:homepageURL> | 34 | <em:homepageURL>http://dready.org/projects/foxri</em:homepageURL> |
35 | <!-- | 35 | <!-- |
36 | <em:updateURL>http://dready.org/projects/foxri/update.rdf</em:updateURL> | 36 | <em:updateURL>http://dready.org/projects/foxri/update.rdf</em:updateURL> |
37 | --> | 37 | --> |
38 | </Description> | 38 | </Description> |
39 | </RDF> | 39 | </RDF> |
40 | 40 | ||