annotate ambnews/components/about.js @ 20:aa3ccc022d07

If displaying a feed throws an unexpected exception, we just log the error and move on to the next one.
author Atul Varma <varmaa@toolness.com>
date Mon, 08 Sep 2008 15:59:53 -0700
parents f259d52d361e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
1 /* ***** BEGIN LICENSE BLOCK *****
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
3 *
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
4 * The contents of this file are subject to the Mozilla Public License Version
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
5 * 1.1 (the "License"); you may not use this file except in compliance with
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
6 * the License. You may obtain a copy of the License at
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
7 * http://www.mozilla.org/MPL/
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
8 *
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
9 * Software distributed under the License is distributed on an "AS IS" basis,
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
11 * for the specific language governing rights and limitations under the
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
12 * License.
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
13 *
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
14 * The Original Code is Ambient News.
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
15 *
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
16 * The Initial Developer of the Original Code is Mozilla.
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
17 * Portions created by the Initial Developer are Copyright (C) 2007
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
18 * the Initial Developer. All Rights Reserved.
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
19 *
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
20 * Contributor(s):
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
21 * Atul Varma <avarma@mozilla.com>
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
22 *
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
23 * Alternatively, the contents of this file may be used under the terms of
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
24 * either the GNU General Public License Version 2 or later (the "GPL"), or
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
26 * in which case the provisions of the GPL or the LGPL are applicable instead
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
27 * of those above. If you wish to allow use of your version of this file only
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
28 * under the terms of either the GPL or the LGPL, and not to allow others to
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
29 * use your version of this file under the terms of the MPL, indicate your
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
30 * decision by deleting the provisions above and replace them with the notice
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
31 * and other provisions required by the GPL or the LGPL. If you do not delete
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
32 * the provisions above, a recipient may use your version of this file under
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
33 * the terms of any one of the MPL, the GPL or the LGPL.
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
34 *
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
35 * ***** END LICENSE BLOCK ***** */
f259d52d361e Added tri-license headers to JS files.
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
36
2
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
37 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
38
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
39 const Cc = Components.classes;
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
40 const Ci = Components.interfaces;
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
41
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
42 function AmbNewsAboutHandler() {
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
43 }
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
44
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
45 AmbNewsAboutHandler.prototype = {
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
46 newChannel : function(aURI) {
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
47 var ios = Cc["@mozilla.org/network/io-service;1"].
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
48 getService(Ci.nsIIOService);
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
49
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
50 var channel = ios.newChannel(
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
51 "chrome://ambnews/content/blank.html",
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
52 null,
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
53 null
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
54 );
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
55
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
56 channel.originalURI = aURI;
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
57 return channel;
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
58 },
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
59
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
60 getURIFlags: function(aURI) {
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
61 return Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT;
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
62 },
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
63
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
64 classDescription: "Ambient News Page",
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
65 classID: Components.ID("0e6d5f40-6fdc-11dd-ad8b-0800200c9a66"),
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
66 contractID: "@mozilla.org/network/protocol/about;1?what=news",
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
67 QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule])
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
68 };
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
69
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
70 function NSGetModule(aCompMgr, aFileSpec) {
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
71 return XPCOMUtils.generateModule([AmbNewsAboutHandler]);
88b12596346d Added an about:news handler and made the default page for new tabs about:news.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
72 }