# HG changeset patch # User Atul Varma # Date 1219363235 25200 # Node ID 88b12596346df3ec64f8ed0c6672957c0f3313f0 # Parent 44bcb4975eade12ae28cd9bfbe666cb6b2472e93 Added an about:news handler and made the default page for new tabs about:news. diff -r 44bcb4975ead -r 88b12596346d ambnews/components/about.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ambnews/components/about.js Thu Aug 21 17:00:35 2008 -0700 @@ -0,0 +1,36 @@ +Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); + +const Cc = Components.classes; +const Ci = Components.interfaces; + +function AmbNewsAboutHandler() { +} + +AmbNewsAboutHandler.prototype = { + newChannel : function(aURI) { + var ios = Cc["@mozilla.org/network/io-service;1"]. + getService(Ci.nsIIOService); + + var channel = ios.newChannel( + "chrome://ambnews/content/blank.html", + null, + null + ); + + channel.originalURI = aURI; + return channel; + }, + + getURIFlags: function(aURI) { + return Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT; + }, + + classDescription: "Ambient News Page", + classID: Components.ID("0e6d5f40-6fdc-11dd-ad8b-0800200c9a66"), + contractID: "@mozilla.org/network/protocol/about;1?what=news", + QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]) +}; + +function NSGetModule(aCompMgr, aFileSpec) { + return XPCOMUtils.generateModule([AmbNewsAboutHandler]); +} diff -r 44bcb4975ead -r 88b12596346d ambnews/content/ambnews.js --- a/ambnews/content/ambnews.js Thu Aug 21 15:39:57 2008 -0700 +++ b/ambnews/content/ambnews.js Thu Aug 21 17:00:35 2008 -0700 @@ -92,5 +92,11 @@ annSvc.setPageAnnotation(page, "AmbNews/feed", feed.spec, 0, annSvc.EXPIRE_WEEKS); } + }, + onLoad: function AmbNews_onLoad(aEvent) { + if (aEvent.target.baseURI == "about:blank") { + var doc = aEvent.target; + doc.defaultView.location = "about:news"; + } } }; diff -r 44bcb4975ead -r 88b12596346d ambnews/content/blank.html --- a/ambnews/content/blank.html Thu Aug 21 15:39:57 2008 -0700 +++ b/ambnews/content/blank.html Thu Aug 21 17:00:35 2008 -0700 @@ -2,6 +2,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + diff -r 44bcb4975ead -r 88b12596346d ambnews/content/browser.xul --- a/ambnews/content/browser.xul Thu Aug 21 15:39:57 2008 -0700 +++ b/ambnews/content/browser.xul Thu Aug 21 17:00:35 2008 -0700 @@ -4,6 +4,11 @@