Skip to content

Commit

Permalink
Prevent exception when loading the WCS sandbox.
Browse files Browse the repository at this point in the history
OAUTH2_REDIRECT_URL gets substituted at build-time by an expression that includes
a chrome API call. Since this file is loaded in the WCS sandbox, which doesn't have
access to these APIs, it mustn't happen at global scope.

Review URL: https://codereview.chromium.org/728953002

Cr-Commit-Position: refs/heads/master@{#304290}
  • Loading branch information
jamiewalch authored and Commit bot committed Nov 14, 2014
1 parent b7b3525 commit 06d56c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion remoting/webapp/crd/js/oauth2.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ remoting.OAuth2.prototype.SCOPE_ =
* @return {string} OAuth2 redirect URI.
*/
remoting.OAuth2.prototype.getRedirectUri_ = function() {
return remoting.settings.OAUTH2_REDIRECT_URL;
return remoting.settings.OAUTH2_REDIRECT_URL();
};

/** @private
Expand Down
12 changes: 10 additions & 2 deletions remoting/webapp/crd/js/plugin_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ remoting.Settings.prototype.OAUTH2_API_BASE_URL = 'OAUTH2_API_BASE_URL';
remoting.Settings.prototype.DIRECTORY_API_BASE_URL = 'DIRECTORY_API_BASE_URL';
/** @type {string} URL for the talk gadget web service. */
remoting.Settings.prototype.TALK_GADGET_URL = 'TALK_GADGET_URL';
/** @type {string} OAuth2 redirect URI. */
remoting.Settings.prototype.OAUTH2_REDIRECT_URL = 'OAUTH2_REDIRECT_URL';

/**
* @return {string} OAuth2 redirect URI. Note that this needs to be a function
* because it gets expanded at compile-time to an expression that involves
* a chrome API. Since this file is loaded into the WCS sandbox, which has
* no access to these APIs, we can't call it at global scope.
*/
remoting.Settings.prototype.OAUTH2_REDIRECT_URL = function() {
return 'OAUTH2_REDIRECT_URL';
}

/** @type {string} XMPP JID for the remoting directory server bot. */
remoting.Settings.prototype.DIRECTORY_BOT_JID = 'DIRECTORY_BOT_JID';
Expand Down

0 comments on commit 06d56c2

Please sign in to comment.