Author: igorz
Date: 2006-11-02 09:06:43 -0500 (Thu, 02 Nov 2006)
New Revision: 67267

Modified:
   trunk/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs
   trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs
   trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog
   trunk/mcs/class/System.Web/Test/System.Web.UI/ClientScriptManagerTest.cs
Log:
2006-11-02 Igor Zelmanovich <[EMAIL PROTECTED]>

        * ClientScriptManager.cs: 
        fixed: checks arguments for null in public methods,
        fixed public interface.



Modified: 
trunk/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs    
2006-11-02 13:42:54 UTC (rev 67266)
+++ trunk/mcs/class/System.Web/System.Web.Handlers/AssemblyResourceLoader.cs    
2006-11-02 14:06:43 UTC (rev 67267)
@@ -50,11 +50,17 @@
                                atime = "&t=" + File.GetLastWriteTimeUtc 
(apath).Ticks;
                        }
 
-                       return "WebResource.axd?a=" 
-                               + aname 
-                               + "&r=" 
-                               + HttpUtility.UrlEncode (resourceName)
-                               + atime;
+                       string href = "WebResource.axd?a=" + aname + "&r=" + 
HttpUtility.UrlEncode (resourceName) + atime;
+                       
+                       if (HttpContext.Current != null && 
HttpContext.Current.Request != null) {
+                               string appPath = 
HttpContext.Current.Request.ApplicationPath;
+                               if (!appPath.EndsWith ("/"))
+                                       appPath += "/";
+
+                               href = appPath + href;
+                       }
+                       
+                       return href;
                }
 
        

Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2006-11-02 13:42:54 UTC 
(rev 67266)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2006-11-02 14:06:43 UTC 
(rev 67267)
@@ -1,3 +1,9 @@
+2006-11-02 Igor Zelmanovich <[EMAIL PROTECTED]>
+
+       * ClientScriptManager.cs: 
+       fixed: checks arguments for null in public methods,
+       fixed public interface.
+
 2006-10-23 Igor Zelmanovich <[EMAIL PROTECTED]>
 
        * PostBackOptions.cs: fixed: default values of properties 

Modified: trunk/mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs     
2006-11-02 13:42:54 UTC (rev 67266)
+++ trunk/mcs/class/System.Web/System.Web.UI/ClientScriptManager.cs     
2006-11-02 14:06:43 UTC (rev 67267)
@@ -116,16 +116,21 @@
                
                public string GetCallbackEventReference (Control control, 
string argument, string clientCallback, string context)
                {
-                       return GetCallbackEventReference (control.UniqueID, 
argument, clientCallback, context, null, false);
+                       return GetCallbackEventReference (control, argument, 
clientCallback, context, null, false);
                }
 
                public string GetCallbackEventReference (Control control, 
string argument, string clientCallback, string context, bool useAsync)
                {
-                       return GetCallbackEventReference (control.UniqueID, 
argument, clientCallback, context, null, useAsync);
+                       return GetCallbackEventReference (control, argument, 
clientCallback, context, null, useAsync);
                }
 
                public string GetCallbackEventReference (Control control, 
string argument, string clientCallback, string context, string 
clientErrorCallback, bool useAsync)
                {
+                       if (control == null)
+                               throw new ArgumentNullException ("control");
+                       if(!(control is ICallbackEventHandler))
+                               throw new InvalidOperationException ("The 
control must implement the ICallbackEventHandler interface and provide a 
RaiseCallbackEvent method.");
+
                        return GetCallbackEventReference (control.UniqueID, 
argument, clientCallback, context, clientErrorCallback, useAsync);
                }
 
@@ -136,7 +141,7 @@
                        if (!IsClientScriptIncludeRegistered (typeof(Page), 
"callback"))
                                RegisterClientScriptInclude (typeof(Page), 
"callback", GetWebResourceUrl (typeof(Page), "callback.js"));
                        
-                       return string.Format ("WebForm_DoCallback ('{0}', {1}, 
{2}, {3}, {4})", target, argument, clientCallback, context, 
clientErrorCallback);
+                       return string.Format 
("WebForm_DoCallback('{0}',{1},{2},{3},{4},{5})", target, argument, 
clientCallback, context, ((clientErrorCallback == null) ? "null" : 
clientErrorCallback), (useAsync ? "true" : "false"));
                }
 #endif
                
@@ -246,11 +251,14 @@
        
                public void RegisterClientScriptBlock (Type type, string key, 
string script)
                {
-                       RegisterScript (ref clientScriptBlocks, type, key, 
script, false);
+                       RegisterClientScriptBlock (type, key, script, false);
                }
        
                public void RegisterClientScriptBlock (Type type, string key, 
string script, bool addScriptTags)
                {
+                       if (type == null)
+                               throw new ArgumentNullException ("type");
+
                        RegisterScript (ref clientScriptBlocks, type, key, 
script, addScriptTags);
                }
        
@@ -270,6 +278,9 @@
        
                public void RegisterOnSubmitStatement (Type type, string key, 
string script)
                {
+                       if (type == null)
+                               throw new ArgumentNullException ("type");
+                       
                        RegisterScript (ref submitStatements, type, key, 
script, false);
                }
        
@@ -280,21 +291,29 @@
                
                public void RegisterStartupScript (Type type, string key, 
string script)
                {
-                       RegisterScript (ref startupScriptBlocks, type, key, 
script, false);
+                       RegisterStartupScript (type, key, script, false);
                }
                
                public void RegisterStartupScript (Type type, string key, 
string script, bool addScriptTags)
                {
+                       if (type == null)
+                               throw new ArgumentNullException ("type");
+
                        RegisterScript (ref startupScriptBlocks, type, key, 
script, addScriptTags);
                }
 
                public void RegisterClientScriptInclude (string key, string url)
                {
-                       RegisterScript (ref scriptIncludes, GetType(), key, 
url, false);
+                       RegisterClientScriptInclude (GetType (), key, url);
                }
                
                public void RegisterClientScriptInclude (Type type, string key, 
string url)
                {
+                       if (type == null)
+                               throw new ArgumentNullException ("type");
+                       if (url == null || url.Length == 0)
+                               throw new ArgumentException ("url");
+
                        RegisterScript (ref scriptIncludes, type, key, url, 
false);
                }
 
@@ -320,6 +339,36 @@
                {
                        throw new NotImplementedException ();
                }
+
+               [MonoTODO]
+               public void RegisterForEventValidation (PostBackOptions options)
+               {
+                       throw new NotImplementedException ();
+               }
+               
+               [MonoTODO]
+               public void RegisterForEventValidation (string uniqueId)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void RegisterForEventValidation (string uniqueId, string 
argument)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void ValidateEvent (string uniqueId)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               [MonoTODO]
+               public void ValidateEvent (string uniqueId, string argument)
+               {
+                       throw new NotImplementedException ();
+               }
 #endif
                void WriteScripts (HtmlTextWriter writer, ScriptEntry 
scriptList)
                {

Modified: trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog     2006-11-02 
13:42:54 UTC (rev 67266)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI/ChangeLog     2006-11-02 
14:06:43 UTC (rev 67267)
@@ -1,3 +1,7 @@
+2006-11-02  Igor Zelmanovich   <[EMAIL PROTECTED]>
+
+       * ClientScriptManagerTest.cs: removed NotWorking attributes, fixed 
tests.
+
 2006-10-26 Yoni Klain <[EMAIL PROTECTED]>
        
        * Changed tests for to be runned on run-tests-ondotnet,

Modified: 
trunk/mcs/class/System.Web/Test/System.Web.UI/ClientScriptManagerTest.cs
===================================================================
--- trunk/mcs/class/System.Web/Test/System.Web.UI/ClientScriptManagerTest.cs    
2006-11-02 13:42:54 UTC (rev 67266)
+++ trunk/mcs/class/System.Web/Test/System.Web.UI/ClientScriptManagerTest.cs    
2006-11-02 14:06:43 UTC (rev 67267)
@@ -39,7 +39,7 @@
 using System.Text;
 using System.Threading;
 
-namespace MonoTests.System.Web.UI.WebControls
+namespace MonoTests.System.Web.UI
 {
 
        public class MyPage : Page, ICallbackEventHandler
@@ -81,7 +81,6 @@
                }
 
                [Test]
-               [Category("NotWorking")]
                public void ClientScriptManager_GetCallbackEventReference_1 ()
                {
                        MyPage p = new MyPage ();
@@ -100,7 +99,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void ClientScriptManager_GetCallbackEventReference_2 ()
                {
                        MyPage p = new MyPage ();
@@ -119,7 +117,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void ClientScriptManager_GetCallbackEventReference_3 ()
                {
                        MyPage p = new MyPage ();
@@ -138,7 +135,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void ClientScriptManager_GetPostBackEventReference_1 ()
                {
                        MyPage p = new MyPage ();
@@ -167,7 +163,6 @@
 
                [Test]
                [Category("NunitWeb")]
-               [Category ("NotWorking")]
                public void ClientScriptManager_GetWebResourceUrl ()
                {
                        string html = new WebTest (PageInvoker.CreateOnLoad 
(GetWebResourceUrlLoad)).Run();
@@ -176,13 +171,12 @@
                public static void GetWebResourceUrlLoad (Page p)
                {
                        ClientScriptManager cs = p.ClientScript;
-                       String cbReference = cs.GetWebResourceUrl (typeof 
(MonoTests.System.Web.UI.WebControls.ClientScriptManagerTest), 
"ClientScript.js");
+                       String cbReference = cs.GetWebResourceUrl (typeof 
(MonoTests.System.Web.UI.ClientScriptManagerTest), "ClientScript.js");
                        if (cbReference.IndexOf("/NunitWeb/WebResource.axd?")<0)
                                Assert.Fail ("GetWebResourceUrlFail");
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void ClientScriptManager_IsClientScriptBlockRegistered ()
                {
                        Page p = new Page ();
@@ -194,11 +188,10 @@
                        cstext2.Append ("alert('Text from client script.')} 
</");
                        cstext2.Append ("script>");
                        cs.RegisterClientScriptBlock (cstype, csname2, 
cstext2.ToString ());
-                       Assert.AreEqual (true, cs.IsClientScriptBlockRegistered 
(csname2), "ClientScriptBlockRegisterFail#1");
+                       Assert.AreEqual (true, cs.IsClientScriptBlockRegistered 
(cstype, csname2), "ClientScriptBlockRegisterFail#1");
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void ClientScriptManager_IsRegisterClientScriptInclude ()
                {
                        Page p = new Page ();
@@ -207,12 +200,11 @@
                        Type cstype = p.GetType ();
                        ClientScriptManager cs = p.ClientScript;
                        cs.RegisterClientScriptInclude (cstype, csname, csurl);
-                       bool registry = cs.IsClientScriptIncludeRegistered 
(csname);
+                       bool registry = cs.IsClientScriptIncludeRegistered 
(cstype, csname);
                        Assert.AreEqual (true, registry, 
"RegisterClientScriptIncludeFail");
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void ClientScriptManager_IsRegisterOnSubmitStatement ()
                {
                        Page p = new Page ();
@@ -220,13 +212,13 @@
                        Type cstype = p.GetType ();
                        ClientScriptManager cs = p.ClientScript;
                        cs.RegisterClientScriptInclude (cstype, csname, 
"document.write('Text from OnSubmit statement');");
-                       bool registry = cs.IsClientScriptIncludeRegistered 
(csname);
+                       bool registry = cs.IsClientScriptIncludeRegistered 
(cstype, csname);
                        Assert.AreEqual (true, registry, 
"RegisterClientScriptIncludeFail");
                }
 
                [Test]
                [Category ("NunitWeb")]
-               [Category ("NotWorking")]
+               [Category ("NotWorking")] // implementation specific
                public void ClientScriptManager_RegisterOnSubmitStatement ()
                {
                        WebTest t = new WebTest (PageInvoker.CreateOnLoad 
(RegisterOnSubmitStatement));
@@ -286,8 +278,6 @@
                }
 
                [Test]
-               [Category ("NunitWeb")]
-               [Category ("NotWorking")]
                public void ClientScriptManager_IsRegisterStartupScript ()
                {
                        Page p = new Page ();
@@ -296,7 +286,7 @@
                        ClientScriptManager cs = p.ClientScript;
                        String cstext1 = "alert('Hello World');";
                        cs.RegisterStartupScript (cstype, csname1, cstext1);
-                       Assert.AreEqual 
(true,cs.IsStartupScriptRegistered(csname1) , "StartupScriptRegisteredFail");   
+                       Assert.AreEqual (true, cs.IsStartupScriptRegistered 
(cstype, csname1), "StartupScriptRegisteredFail");  
                }
 
                [Test]
@@ -342,7 +332,7 @@
 
                [Test]
                [Category ("NunitWeb")]
-               [Category ("NotWorking")]
+               [Category ("NotWorking")] // Not Implemented
                public void ClientScriptManager_RegisterExpandAttribute ()
                {
                        WebTest t = new WebTest (PageInvoker.CreateOnLoad 
(RegisterExpandAttribute));
@@ -462,7 +452,6 @@
 
 
                [Test]
-               [Category ("NotWorking")]
                [ExpectedException (typeof (ArgumentNullException))]
                public void 
ClientScriptManager_IsRegisterStartupScriptException ()
                {
@@ -473,7 +462,6 @@
                }
                
                [Test]
-               [Category ("NotWorking")]
                [ExpectedException (typeof (ArgumentNullException))]
                public void 
ClientScriptManager_RegisterOnSubmitStatementException ()
                {
@@ -485,7 +473,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                [ExpectedException (typeof (ArgumentNullException))]
                public void 
ClientScriptManager_RegisterClientScriptIncludeException_1 ()
                {
@@ -499,7 +486,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                [ExpectedException (typeof (ArgumentNullException))]
                public void 
ClientScriptManager_RegisterClientScriptIncludeException_2 ()
                {
@@ -512,7 +498,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                [ExpectedException (typeof (ArgumentNullException))]
                public void 
ClientScriptManager_ClientScriptBlockRegisterException_2 ()
                {
@@ -520,7 +505,6 @@
                        ClientScriptManager cs = p.ClientScript;
                        String csname2 = "ButtonClickScript";
                        cs.RegisterClientScriptBlock (null, csname2, "");
-                       Assert.AreEqual (true, cs.IsClientScriptBlockRegistered 
(csname2), "ClientScriptBlockRegisterFail");
                }
 
 
@@ -543,7 +527,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                [ExpectedException (typeof (InvalidOperationException))]
                public void 
ClientScriptManager_GetCallbackEventReferenceException_1 ()
                {
@@ -556,7 +539,6 @@
                }
 
                [Test]
-               [Category ("NotWorking")]
                [ExpectedException (typeof (ArgumentNullException))]
                public void 
ClientScriptManager_GetCallbackEventReferenceException_2 ()
                {
@@ -578,3 +560,4 @@
 #endif
 
 
+

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to