Fix bug 383991. Full SSL support for (Google) Calendars. r=ctalbert

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@229347 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mozilla%kewis.ch
2007-07-05 11:08:19 +00:00
parent f8db9e9355
commit 1e6205ea3e
3 changed files with 20 additions and 24 deletions

View File

@@ -14,7 +14,7 @@
* The Original Code is Google Calendar Provider code.
*
* The Initial Developer of the Original Code is
* Philipp Kewisch (mozilla@kewis.ch)
* Philipp Kewisch <mozilla@kewis.ch>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
@@ -99,7 +99,7 @@ calGoogleCalendar.prototype = {
/**
* readonly attribute googleCalendarName
* Google's Calendar name. This represents the <calendar name> in
* http://www.google.com/calendar/feeds/<calendar name>/private/full
* http[s]://www.google.com/calendar/feeds/<calendar name>/private/full
*/
get googleCalendarName() {
return this.mCalendarName;
@@ -227,17 +227,9 @@ calGoogleCalendar.prototype = {
// Set internal Calendar Name
this.mCalendarName = decodeURIComponent(matches[2]);
var ioService = Cc["@mozilla.org/network/io-service;1"].
getService(Ci.nsIIOService);
// Set normalized url. We need the full xml stream and private
// access. We need private visibility and full projection
this.mFullUri = ioService.newURI("http://www.google.com" +
"/calendar/feeds/" +
matches[2] +
"/private/full",
null,
null);
// Set normalized url. We need private visibility and full projection
this.mFullUri = aUri.clone();
this.mFullUri.path = "/calendar/feeds/" + matches[2] + "/private/full";
// Remember the uri as it was passed, in case the calendar manager
// relies on it.
@@ -682,7 +674,7 @@ calGoogleCalendar.prototype = {
// Parse all <entry> tags
for each (var entry in xml.entry) {
var item = XMLEntryToItem(entry, timezone);
var item = XMLEntryToItem(entry, timezone, this);
if (item) {
var itemReturnOccurrences =
@@ -769,7 +761,7 @@ calGoogleCalendar.prototype = {
var timezone = getPrefSafe("calendar.timezone.local");
// Parse the Item with the given timezone
var item = XMLEntryToItem(xml, timezone);
var item = XMLEntryToItem(xml, timezone, this);
LOGitem(item);
item.calendar = this;

View File

@@ -14,7 +14,7 @@
* The Original Code is Google Calendar Provider code.
*
* The Initial Developer of the Original Code is
* Philipp Kewisch (mozilla@kewis.ch)
* Philipp Kewisch <mozilla@kewis.ch>
* Portions created by the Initial Developer are Copyright (C) 2006
* the Initial Developer. All Rights Reserved.
*
@@ -97,8 +97,6 @@ calGoogleRequest.prototype = {
this.mUriString = "https://www.google.com/accounts/ClientLogin";
break;
case this.META:
this.uri = "http://www.google.com/calendar/feeds/" +
encodeURIComponent(this.mSession.googleUser);
// Fall through
case this.GET:
this.mMethod = "GET";
@@ -229,7 +227,7 @@ calGoogleRequest.prototype = {
if (aSession) {
this.mSession = aSession;
if (this.mType == this.META) {
this.mUriString = "http://www.google.com/calendar/feeds/"
this.mUriString = aSession.uri.prePath + "/calendar/feeds/"
+ encodeURIComponent(aSession.googleUser);
}
}

View File

@@ -14,8 +14,8 @@
* The Original Code is Google Calendar Provider code.
*
* The Initial Developer of the Original Code is
* Philipp Kewisch (mozilla@kewis.ch)
* Portions created by the Initial Developer are Copyright (C) 2006
* Philipp Kewisch <mozilla@kewis.ch>
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
@@ -642,9 +642,10 @@ function getItemEditURI(aItem) {
*
* @param aXMLEntry The xml data of the item
* @param aTimezone The timezone the event is most likely in
* @param aCalendar The calendar this item will belong to.
* @return The calIEvent with the item data.
*/
function XMLEntryToItem(aXMLEntry, aTimezone) {
function XMLEntryToItem(aXMLEntry, aTimezone, aCalendar) {
if (aXMLEntry == null) {
throw new Components.Exception("", Cr.NS_ERROR_DOM_SYNTAX_ERR);
@@ -664,8 +665,13 @@ function XMLEntryToItem(aXMLEntry, aTimezone) {
item.id = id.substring(id.lastIndexOf('/')+1);
// link
item.setProperty("X-GOOGLE-EDITURL",
aXMLEntry.link.(@rel == 'edit').@href.toString());
// Since Google doesn't set the edit url to be https if the request is
// https, we need to work around this here.
var editUrl = aXMLEntry.link.(@rel == 'edit').@href.toString();
if (aCalendar.uri.schemeIs("https")) {
editUrl = editUrl.replace(/^http:/, "https:");
}
item.setProperty("X-GOOGLE-EDITURL", editUrl);
// title
item.title = aXMLEntry.title.(@type == 'text');