Merge pull request #271 from pruiz/xamarin-bug-4108
authorMiguel de Icaza <miguel@gnome.org>
Fri, 25 May 2012 00:11:23 +0000 (17:11 -0700)
committerMiguel de Icaza <miguel@gnome.org>
Fri, 25 May 2012 00:11:23 +0000 (17:11 -0700)
Fix for Xamarin's bug #4108 (BrowserCaps compatibility problem with MS.NET)

mcs/class/System.Web/System.Web.Configuration_2.0/nBrowser/Build.cs
mcs/class/System.Web/System.Web.Configuration_2.0/nBrowser/Node.cs
mcs/class/System.Web/System.Web/BrowserCapabilities.cs
mcs/class/System.Web/System.Web/CapabilitiesLoader.cs

index 727703f494db3606eec780bc912f9c84d4134cb5..4512c998f957958885229f8830a88af3a509c1a3 100644 (file)
@@ -316,7 +316,7 @@ namespace System.Web.Configuration.nBrowser
                public override System.Web.Configuration.CapabilitiesResult Process(System.Collections.Specialized.NameValueCollection header, System.Collections.IDictionary initialCapabilities)
                {
                        if (initialCapabilities == null)
-                               initialCapabilities = new System.Collections.Generic.Dictionary<string, string>(StringComparer.CurrentCultureIgnoreCase);
+                               initialCapabilities = new System.Collections.Generic.Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
                        System.Web.Configuration.nBrowser.Result r = new System.Web.Configuration.nBrowser.Result(initialCapabilities);
 
 #if trace
index daa7abab75578b8a70a2814c13231d9681e6c9dc..e41e10b14065bcd23adc89bca6715fc6a57c29f1 100644 (file)
@@ -262,7 +262,7 @@ namespace System.Web.Configuration.nBrowser
                /// <param name="node"></param>
                private void ProcessCapabilities(System.Xml.XmlNode node)
                {
-                       Capabilities = new System.Collections.Specialized.NameValueCollection(node.ChildNodes.Count);
+                       Capabilities = new System.Collections.Specialized.NameValueCollection(node.ChildNodes.Count, StringComparer.OrdinalIgnoreCase);
 
                        for (int a = 0;a <= node.ChildNodes.Count - 1;a++)
                        {
@@ -1005,7 +1005,7 @@ namespace System.Web.Configuration.nBrowser
                        if (n.Capabilities != null)
                        {
                                if (Capabilities == null)
-                                       Capabilities =  new System.Collections.Specialized.NameValueCollection(n.Capabilities.Count);
+                                       Capabilities =  new System.Collections.Specialized.NameValueCollection(n.Capabilities.Count, StringComparer.OrdinalIgnoreCase);
                                foreach (string capName in n.Capabilities)
                                        Capabilities[capName] = n.Capabilities[capName];
                        }
index e6e5dc08f28a845e2b7bb314e24679ccc70177b8..f86849524e6f1806d0f1063d011143e877ae711c 100644 (file)
@@ -355,7 +355,12 @@ namespace System.Web.Configuration
                public int MajorVersion {
                        get {
                                if (!Get (HaveMajorVersion)) {
-                                       majorVersion = ReadInt32 ("majorver");
+                                       // Try with MS.NET's property name.
+                                       // See: https://bugzilla.xamarin.com/show_bug.cgi?id=4108
+                                       if (this["majorversion"] != null)
+                                               majorVersion = ReadInt32 ("majorversion");
+                                       else 
+                                               majorVersion = ReadInt32 ("majorver");
                                        Set (HaveMajorVersion);
                                }
 
@@ -366,7 +371,12 @@ namespace System.Web.Configuration
                public double MinorVersion {
                        get {
                                if (!Get (HaveMinorVersion)) {
-                                       minorVersion = ReadDouble ("minorver");
+                                       // Try with MS.NET's property name.
+                                       // See: https://bugzilla.xamarin.com/show_bug.cgi?id=4108
+                                       if (this["minorversion"] != null)
+                                               minorVersion = ReadDouble ("minorversion");
+                                       else
+                                               minorVersion = ReadDouble ("minorver");
                                        Set (HaveMinorVersion);
                                }
 
index 89e22ffb7c30248f4cdf1a5c3cf23154454137a4..46ef73cda8714fd5265404622d9a3f9075463283 100644 (file)
@@ -218,7 +218,7 @@ namespace System.Web
 
                static CapabilitiesLoader ()
                {
-                       defaultCaps = new Hashtable ();
+                       defaultCaps = new Hashtable (StringComparer.OrdinalIgnoreCase);
                        defaultCaps.Add ("activexcontrols", "False");
                        defaultCaps.Add ("alpha", "False");
                        defaultCaps.Add ("aol", "False");
@@ -355,7 +355,7 @@ namespace System.Web
                                foreach (BrowserData bd in alldata) {
                                        if (bd.IsMatch (userAgent)) {
                                                Hashtable tbl;
-                                               tbl = new Hashtable (defaultCaps);
+                                               tbl = new Hashtable (defaultCaps, StringComparer.OrdinalIgnoreCase);
                                                userBrowserCaps = bd.GetProperties (tbl);
                                                break;
                                        }
@@ -442,7 +442,7 @@ namespace System.Web
 #endif
                        using (input) {
                        string str;
-                       Hashtable allhash = new Hashtable ();
+                       Hashtable allhash = new Hashtable (StringComparer.OrdinalIgnoreCase);
                        int aux = 0;
                        ArrayList browserData = new ArrayList ();
                        while ((str = input.ReadLine ()) != null) {