Closed GoogleCodeExporter closed 9 years ago
The patch for this bug included in the comments above will be addressed in the
next build of the Facebook API.
Original comment by edwar...@gmail.com
on 9 Nov 2010 at 9:03
When I click the cancel button, the value of html.location is equal to
"http://www.facebook.com/connect/login_success.html". Hence there are no
parameters which creates a null pointer exception when the function
loginCallback(getURLVariables(), null); is called.
To get around this, I added a check on the params variable in the
AbstractWindow class. If null, I return. Then in LoginWindow, I check if the
URLVariables is null and, if so, call the corresponding close functions:
LoginWindow.as
override protected function handleLocationChange(event:Event):void {
super.handleLocationChange(event);
if (html.location.indexOf(
'http://www.facebook.com/connect/login_success.html?error_reason'
) == 0) {
loginCallback(null, getURLVariables().error_reason);
} else if (html.location.indexOf (
'http://www.facebook.com/connect/login_success.html'
) == 0)
{
//SS fix - added check for null parms
var parms:URLVariables = getURLVariables();
if(parms != null) {
loginCallback(getURLVariables(), null);
}
userClosedWindow = false;
html.stage.nativeWindow.close();
} else if (html.location.indexOf(
'https://login.facebook.com/login.php'
) == 0)
{
showDistractor();
} else if (html.location.indexOf(
'https://graph.facebook.com/oauth/authorize_cancel'
) == 0)
{
loginCallback(false, 'user-canceled');
html.stage.nativeWindow.close();
}
}
AbstractWindow.as
protected function getURLVariables():URLVariables {
var params:String;
if (html.location.indexOf('#') != -1) {
params = html.location.slice(html.location.indexOf('#')+1);
} else if (html.location.indexOf('?') != -1) {
params = html.location.slice(html.location.indexOf('?')+1);
}
//SS fix: added check for null parms and then returns if true
if(params == null) {
return null;
}
var vars:URLVariables = new URLVariables();
vars.decode(params);
return vars;
}
Original comment by john.ant...@gmail.com
on 15 Nov 2010 at 11:59
Original comment by edwar...@gmail.com
on 6 Dec 2010 at 10:24
Hey ive used the code you have provided but yet i still have the problem , when
i click cancel the login window still stays on the screen i have to force quit
the program to get it off the screen
LoginWindow.as
override protected function handleLocationChange(event:Event):void {
super.handleLocationChange(event);
if (html.location.indexOf(
'http://www.facebook.com/connect/login_success.html?error_reason') == 0) {
loginCallback(null, getURLVariables().error_reason);
}
else if (html.location.indexOf ('http://www.facebook.com/connect/login_success.html') == 0)
{
//SS fix - added check for null parms
var parms:URLVariables = getURLVariables();
if(parms != null) {
loginCallback(getURLVariables(), null);
}
userClosedWindow = false;
html.stage.nativeWindow.close();
}
else if (html.location.indexOf('https://login.facebook.com/login.php') == 0)
{
showDistractor();
}
else if (html.location.indexOf('https://graph.facebook.com/oauth/authorize_cancel') == 0)
{
loginCallback(false, 'user-canceled');
html.stage.nativeWindow.close();
}
}
AbstractWindow.as
protected function getURLVariables():URLVariables {
var params:String;
if (html.location.indexOf('#') != -1) {
params = html.location.slice(html.location.indexOf('#')+1);
} else if (html.location.indexOf('?') != -1) {
params = html.location.slice(html.location.indexOf('?')+1);
}
//SS fix: added check for null parms and then returns if true
if(params == null) {
return null;
}
var vars:URLVariables = new URLVariables();
vars.decode(params);
if (params) {
vars.decode(params);
}
return vars;
}
Original comment by sarah.de...@gmail.com
on 7 Feb 2011 at 9:24
It sounds like you may be using an older build of the SDK, this issue should
already be resolved using the latest version (1.6)
Original comment by edwar...@gmail.com
on 9 Mar 2011 at 9:11
Original issue reported on code.google.com by
yourpalm...@gmail.com
on 12 Oct 2010 at 3:15Attachments: