diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-25 16:41:16 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-11-25 16:41:16 -0800 |
commit | 2cf93a7bd656a177953acf6c1101b04d440c65ed (patch) | |
tree | 5d0106d19c31a4c9fd162fe7e900190ae226778c /src | |
parent | d7775f79425abc2c581eba629618cf23afd1484a (diff) | |
download | DotNetOpenAuth-2cf93a7bd656a177953acf6c1101b04d440c65ed.zip DotNetOpenAuth-2cf93a7bd656a177953acf6c1101b04d440c65ed.tar.gz DotNetOpenAuth-2cf93a7bd656a177953acf6c1101b04d440c65ed.tar.bz2 |
Fixed js error when Yahoo widget fails to download.
Diffstat (limited to 'src')
-rw-r--r-- | src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs index 2c8d947..4249834 100644 --- a/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs +++ b/src/DotNetOpenAuth/OpenId/RelyingParty/OpenIdAjaxTextBox.cs @@ -705,13 +705,19 @@ namespace DotNetOpenAuth.OpenId.RelyingParty { base.OnPreRender(e); if (this.DownloadYahooUILibrary) { - string yuiLoadScript = @"var loader = new YAHOO.util.YUILoader({ - require: ['button', 'menu'], - loadOptional: false, - combine: true -}); - -loader.insert();"; + // Although we'll add the <script> tag to download the YAHOO component, + // a download failure may have occurred, so protect ourselves from a + // script error using an if (YAHOO) block. But apparently at least in IE + // that's not even enough, so we use a try/catch. + string yuiLoadScript = @"try { if (YAHOO) { + var loader = new YAHOO.util.YUILoader({ + require: ['button', 'menu'], + loadOptional: false, + combine: true + }); + + loader.insert(); +} } catch (e) { }"; this.Page.ClientScript.RegisterClientScriptInclude("yuiloader", this.Page.Request.Url.IsTransportSecure() ? YuiLoaderHttps : YuiLoaderHttp); this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "requiredYuiComponents", yuiLoadScript, true); } |