OSDN Git Service

Version 0.6.176, add X.Script.
[pettanr/clientJs.git] / 0.6.x / js / 06_net / 10_XOAuth2.js
index 86d1584..6d28665 100644 (file)
@@ -1,7 +1,6 @@
 
 //{+oauth2"OAuth2 サービスの定義"(OAuth2外部サービスを定義し、認可プロセス・xhrの署名を自動化します)[+xhr]
-var X_NET_OAUTH2_detection      = new Function( 'w', 'try{return w.location.search}catch(e){}' ),
-       X_NET_OAUTH2_authorizationWindow,
+var X_NET_OAUTH2_authorizationWindow,
        X_NET_OAUTH2_authorizationTimerID;
 
 /**
@@ -236,7 +235,7 @@ function X_Net_OAuth2_detectAuthPopup(){
 
                this[ 'asyncDispatch' ]( X_EVENT_CANCELED );
        } else
-       if( search = X_NET_OAUTH2_detection( X_NET_OAUTH2_authorizationWindow ) ){
+       if( search = X_Script_try( X_Object_find, [ X_NET_OAUTH2_authorizationWindow, 'location>search' ] ) ){
                pair      = X_Pair_get( this );
                pair.code = X_URL_paramToObj( search.slice( 1 ) )[ 'code' ];
 
@@ -394,7 +393,7 @@ function X_OAuth2_getAccessTokenExpiry( that ){ return parseInt( X_OAuth2_update
 function X_OAuth2_getAuthMechanism( that ){
                // TODO use gadget | flash ...
                // IE's XDomainRequest doesn't support sending headers, so don't try.
-               return ( X_NET_currentWrapper === X_NET_XHRWrapper ) && X_Net_XHR_createXDR ? 'param' : X_OAuth2_updateLocalStorage( '', that, 'AuthMechanism' );
+               return ( X_NET_currentWrapper === X_XHR ) && X_XHR_createXDR ? 'param' : X_OAuth2_updateLocalStorage( '', that, 'AuthMechanism' );
        }
 function X_OAuth2_setAccessToken( that, value ){ X_OAuth2_updateLocalStorage( '+', that, 'accessToken' , value); }
 function X_OAuth2_setRefreshToken( that, value ){ X_OAuth2_updateLocalStorage( '+', that, 'refreshToken', value); }