diff --git a/third_party/firefox_sendtophone/chrome/content/about.xul b/third_party/firefox_sendtophone/chrome/content/about.xul index 49123ed..b81e1a7 100644 --- a/third_party/firefox_sendtophone/chrome/content/about.xul +++ b/third_party/firefox_sendtophone/chrome/content/about.xul @@ -8,7 +8,7 @@ - + diff --git a/third_party/firefox_sendtophone/chrome/content/overlay.js b/third_party/firefox_sendtophone/chrome/content/overlay.js index 613793d..92ff389 100644 --- a/third_party/firefox_sendtophone/chrome/content/overlay.js +++ b/third_party/firefox_sendtophone/chrome/content/overlay.js @@ -2,8 +2,8 @@ var sendtophone = { baseUrl : '', req : null, apiVersion : 3, - loggedInUrl : "http://code.google.com/p/chrometophone/logo?cct=1275941464", - loggedOutUrl : "chrome://sendtophone/loggedOut", + loggedInUrl : "http://code.google.com/p/chrometophone/logo?login", + loggedOutUrl : "http://code.google.com/p/chrometophone/logo?logout", apkUrl : "http://code.google.com/p/chrometophone/downloads/detail?name=chrometophone-android-v1.1.apk", init: function() @@ -179,6 +179,18 @@ var sendtophone = { } }; + // To send correctly cookies. + // Force the request to include cookies even though this chrome code + // is seen as a third-party, so the server knows the user for which we are + // requesting favorites (or anything else user-specific in the future). + // This only works in Firefox 3.6; in Firefox 3.5 the request will instead + // fail to send cookies if the user has disabled third-party cookies. + try { + req.channel.QueryInterface(Ci.nsIHttpChannelInternal). + forceAllowThirdPartyCookie = true; + } + catch(ex) { /* user is using Firefox 3.5 */ } + req.send( data ); }, @@ -243,11 +255,31 @@ var sendtophone = { logout: function() { + var lastTab = gBrowser.tabContainer.selectedIndex; + var tab = gBrowser.addTab(this.logOutUrl); + // Open Google logout page + gBrowser.selectedTab = tab; + var c2pTab = gBrowser.getBrowserForTab(tab); + //Add listener for callback URL + c2pTab.addEventListener("load", function () { + if(sendtophone.loggedOutUrl==c2pTab.currentURI.spec){ + sendtophone.logoutSuccessful(); + + // Close logout tab + gBrowser.removeCurrentTab(); + // ReFocus on tab being sent + gBrowser.selectedTab = gBrowser.tabContainer.childNodes[lastTab]; + } + }, true); + +/* + // This doesn't work if third party cookies are bloqued. Why??? this.processXHR(this.logOutUrl, 'GET', null, function(req) { // This will be called only if there's a problem this.alert(this.strings.getString("LogoutError") + '\r\n' + req.responseText ); }); + */ }, logoutSuccessful: function() diff --git a/third_party/firefox_sendtophone/install.rdf b/third_party/firefox_sendtophone/install.rdf index 58c5a11..752254c 100644 --- a/third_party/firefox_sendtophone/install.rdf +++ b/third_party/firefox_sendtophone/install.rdf @@ -4,7 +4,7 @@ sendtophone@martinezdelizarrondo.com 2 Send To Phone - 0.9.1 + 0.9.2 Alfonso Martínez de Lizarrondo Patrick O'Reilly Send links to your Android 2.2 phone using the new C2DM service. Based on the ChromeToPhone extension.