Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

View File

@@ -55,11 +55,7 @@ using System.Web.UI;
#if !NET_4_0
[assembly: AssemblyTrademark("")]
#endif
#if TARGET_JVM
[assembly: CLSCompliant(false)]
#else
[assembly: CLSCompliant(true)]
#endif
[assembly: ComVisible(false)]
[assembly: AssemblyDefaultAlias("System.Web.dll")]
[assembly: AssemblyInformationalVersion("0.0.0.1")]
@@ -67,7 +63,7 @@ using System.Web.UI;
[assembly: AllowPartiallyTrustedCallers()]
[assembly: TagPrefix("System.Web.UI.WebControls", "asp")]
#if !(TARGET_JVM || TARGET_DOTNET)
#if !(TARGET_DOTNET)
[assembly: AssemblyDelaySign(true)]
[assembly: AssemblyKeyFile("../msfinal.pub")]

View File

@@ -67,11 +67,9 @@ namespace System.Web.Configuration
ConfigurationPropertyOptions.None);
assemblyPostProcessorTypeProp = new ConfigurationProperty ("assemblyPostProcessorType", typeof (string), "");
batchProp = new ConfigurationProperty ("batch", typeof (bool), true);
#if !TARGET_JVM
buildProvidersProp = new ConfigurationProperty ("buildProviders", typeof (BuildProviderCollection), null,
null, PropertyHelper.DefaultValidator,
ConfigurationPropertyOptions.None);
#endif
batchTimeoutProp = new ConfigurationProperty ("batchTimeout", typeof (TimeSpan), new TimeSpan (0, 15, 0),
PropertyHelper.TimeSpanSecondsOrInfiniteConverter,
PropertyHelper.PositiveTimeSpanValidator,
@@ -109,9 +107,7 @@ namespace System.Web.Configuration
properties.Add (assembliesProp);
properties.Add (assemblyPostProcessorTypeProp);
properties.Add (batchProp);
#if !TARGET_JVM
properties.Add (buildProvidersProp);
#endif
properties.Add (batchTimeoutProp);
properties.Add (codeSubDirectoriesProp);
properties.Add (compilersProp);
@@ -171,12 +167,10 @@ namespace System.Web.Configuration
set { base [batchTimeoutProp] = value; }
}
#if !TARGET_JVM
[ConfigurationProperty ("buildProviders")]
public BuildProviderCollection BuildProviders {
get { return (BuildProviderCollection) base [buildProvidersProp]; }
}
#endif
[ConfigurationProperty ("codeSubDirectories")]
public CodeSubDirectoriesCollection CodeSubDirectories {

View File

@@ -65,12 +65,10 @@ namespace System.Web.Configuration
get { return (ClientTargetSection)Sections ["clientTarget"]; }
}
#if !TARGET_JVM
[ConfigurationProperty ("compilation")]
public CompilationSection Compilation {
get { return (CompilationSection)Sections ["compilation"]; }
}
#endif
[ConfigurationProperty ("customErrors")]
public CustomErrorsSection CustomErrors {

View File

@@ -314,16 +314,12 @@ namespace System.Web.Handlers
extra = QueryParamSeparator + "n=" + (notifyScriptLoaded ? "t" : "f");
#endif
#if TARGET_JVM
atime = QueryParamSeparator + "t=" + assemblyName.GetHashCode ();
#else
if (includeTimeStamp) {
if (!String.IsNullOrEmpty (assemblyPath) && File.Exists (assemblyPath))
atime = QueryParamSeparator + "t=" + File.GetLastWriteTimeUtc (assemblyPath).Ticks;
else
atime = QueryParamSeparator + "t=" + DateTime.UtcNow.Ticks;
}
#endif
string d = HttpUtility.UrlEncode (assemblyNameHash + "_" + resourceNameHash + (debug ? "_t" : "_f"));
string href = HandlerFileName + "?d=" + d + atime + extra;
HttpContext ctx = HttpContext.Current;

View File

@@ -126,9 +126,6 @@ namespace System.Web.Hosting {
//
// http://www.west-wind.com/presentations/aspnetruntime/aspnetruntime.asp
//
#if TARGET_JVM
[MonoNotSupported ("")]
#endif
[SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
public static object CreateApplicationHost (Type hostType, string virtualDir, string physicalDir)
{

View File

@@ -68,11 +68,6 @@ namespace System.Web.Mail {
void ChangeToSSLSocket ()
{
#if TARGET_JVM
java.lang.Class c = vmw.common.TypeUtils.ToClass (smtp.Stream);
java.lang.reflect.Method m = c.getMethod ("ChangeToSSLSocket", null);
m.invoke (smtp.Stream, new object[]{});
#else
// Load Mono.Security.dll
Assembly a;
try {
@@ -94,7 +89,6 @@ namespace System.Web.Mail {
if (objSslClientStream != null)
smtp = new SmtpStream ((Stream)objSslClientStream);
#endif
}
void ReadFields (MailMessageWrapper msg)

View File

@@ -114,26 +114,7 @@ namespace System.Web.Security {
}
}
#if TARGET_JVM
static AnonymousIdentificationSection Config
{
get
{
AnonymousIdentificationSection config = (AnonymousIdentificationSection) AppDomain.CurrentDomain.GetData ("Anonymous.Config");
if (config == null) {
lock (typeof (AnonymousIdentificationModule)) {
config = (AnonymousIdentificationSection) AppDomain.CurrentDomain.GetData ("Anonymous.Config");
if (config == null)
config = (AnonymousIdentificationSection) WebConfigurationManager.GetSection ("system.web/anonymousIdentification");
AppDomain.CurrentDomain.SetData ("Anonymous.Config", config);
}
}
return config;
}
}
#else
static AnonymousIdentificationSection Config = (AnonymousIdentificationSection) WebConfigurationManager.GetSection ("system.web/anonymousIdentification");
#endif
}
}
#endif

View File

@@ -35,9 +35,7 @@ namespace System.Web.UI.WebControls
{
[ToolboxItem (false)]
[DesignerAttribute ("System.Web.UI.Design.WebControls.ContentDesigner, " + Consts.AssemblySystem_Design, "System.ComponentModel.Design.IDesigner")]
#if !TARGET_JVM
[ControlBuilder(typeof(ContentBuilderInternal))]
#endif
public class Content: Control, INamingContainer, INonBindingContainer
{
[ThemeableAttribute (false)]

View File

@@ -504,12 +504,7 @@ namespace System.Web.UI.WebControls
public void ToggleExpandState ()
{
#if TARGET_JVM //No support for Nullable<bool>.GetValueOrDefault() yet
bool? value = Expanded;
Expanded = value.HasValue ? !value.Value : true;
#else
Expanded = !Expanded.GetValueOrDefault(false);
#endif
}
void IStateManager.LoadViewState (object savedState)

View File

@@ -133,10 +133,6 @@ namespace System.Web.UI {
protected virtual void AddAttribute (string name, string value, HtmlTextWriterAttribute key)
{
NextAttrStack ();
#if TARGET_JVM
if (attrs [attrs_pos] == null)
attrs [attrs_pos] = new AddedAttr ();
#endif
attrs [attrs_pos].name = name;
attrs [attrs_pos].value = value;
attrs [attrs_pos].key = key;
@@ -146,10 +142,6 @@ namespace System.Web.UI {
protected virtual void AddStyleAttribute (string name, string value, HtmlTextWriterStyle key)
{
NextStyleStack ();
#if TARGET_JVM
if (styles [styles_pos] == null)
styles [styles_pos] = new AddedStyle ();
#endif
styles [styles_pos].name = name;
value = HttpUtility.HtmlAttributeEncode (value);
styles [styles_pos].value = value;
@@ -765,10 +757,6 @@ namespace System.Web.UI {
return tagstack [tagstack_pos].key;
}
set {
#if TARGET_JVM
if (tagstack [tagstack_pos] == null)
tagstack [tagstack_pos] = new AddedTag ();
#endif
tagstack [tagstack_pos].key = value;
tagstack [tagstack_pos].name = GetTagName (value);
}
@@ -782,10 +770,6 @@ namespace System.Web.UI {
return tagstack [tagstack_pos].name;
}
set {
#if TARGET_JVM
if (tagstack [tagstack_pos] == null)
tagstack [tagstack_pos] = new AddedTag ();
#endif
tagstack [tagstack_pos].name = value;
tagstack [tagstack_pos].key = GetTagKey (value);
if (tagstack [tagstack_pos].key != HtmlTextWriterTag.Unknown)
@@ -828,33 +812,21 @@ namespace System.Web.UI {
int styles_pos = -1, attrs_pos = -1, tagstack_pos = -1;
#if TARGET_JVM
class
#else
struct
#endif
AddedTag {
public string name;
public HtmlTextWriterTag key;
public bool ignore;
}
#if TARGET_JVM
class
#else
struct
#endif
AddedStyle {
public string name;
public HtmlTextWriterStyle key;
public string value;
}
#if TARGET_JVM
class
#else
struct
#endif
AddedAttr {
public string name;
public HtmlTextWriterAttribute key;

View File

@@ -34,7 +34,7 @@ using System.Text;
namespace System.Web.UI
{
#if (TARGET_JVM || TARGET_DOTNET)
#if (TARGET_DOTNET)
public
#endif
interface IScriptManager

View File

@@ -115,13 +115,7 @@ namespace System.Web.UI
var req = context.Request;
if (req != null)
masterPageFile = HostingEnvironment.VirtualPathProvider.CombineVirtualPaths (req.CurrentExecutionFilePath, masterPageFile);
#if TARGET_JVM
MasterPage masterPage = MasterPageParser.GetCompiledMasterInstance (masterPageFile,
owner.Page.MapPath (masterPageFile),
context);
#else
MasterPage masterPage = BuildManager.CreateInstanceFromVirtualPath (masterPageFile, typeof (MasterPage)) as MasterPage;
#endif
if (masterPage == null)
throw new HttpException ("Failed to create MasterPage instance for '" + masterPageFile + "'.");

View File

@@ -544,15 +544,11 @@ public partial class Page : TemplateControl, IHttpHandler
if (ps != null)
_styleSheetTheme = ps.StyleSheetTheme;
}
#if TARGET_JVM
if (_styleSheetTheme != null && _styleSheetTheme != "")
_styleSheetPageTheme = ThemeDirectoryCompiler.GetCompiledInstance (_styleSheetTheme, Context);
#else
if (!String.IsNullOrEmpty (_styleSheetTheme)) {
string virtualPath = "~/App_Themes/" + _styleSheetTheme;
_styleSheetPageTheme = BuildManager.CreateInstanceFromVirtualPath (virtualPath, typeof (PageTheme)) as PageTheme;
}
#endif
}
void InitializeTheme ()
@@ -562,19 +558,13 @@ public partial class Page : TemplateControl, IHttpHandler
if (ps != null)
_theme = ps.Theme;
}
#if TARGET_JVM
if (_theme != null && _theme != "") {
_pageTheme = ThemeDirectoryCompiler.GetCompiledInstance (_theme, Context);
_pageTheme.SetPage (this);
}
#else
if (!String.IsNullOrEmpty (_theme)) {
string virtualPath = "~/App_Themes/" + _theme;
_pageTheme = BuildManager.CreateInstanceFromVirtualPath (virtualPath, typeof (PageTheme)) as PageTheme;
if (_pageTheme != null)
_pageTheme.SetPage (this);
}
#endif
}
#if NET_4_0
public Control AutoPostBackControl {
@@ -1298,11 +1288,7 @@ public partial class Page : TemplateControl, IHttpHandler
OnError (EventArgs.Empty);
if (_context.HasError (e)) {
_context.ClearError (e);
#if TARGET_JVM
vmw.common.TypeUtils.Throw (e);
#else
throw new HttpUnhandledException (null, e);
#endif
}
}
@@ -2277,26 +2263,6 @@ public partial class Page : TemplateControl, IHttpHandler
}
if (asyncResults.Count > 0) {
#if TARGET_JVM
TimeSpan timeout = AsyncTimeout;
long t1 = DateTime.Now.Ticks;
bool signalled = true;
for (int i = 0; i < asyncResults.Count; i++) {
if (asyncResults [i].IsCompleted)
continue;
if (signalled)
signalled = asyncResults [i].AsyncWaitHandle.WaitOne (timeout, false);
if (signalled) {
long t2 = DateTime.Now.Ticks;
timeout = AsyncTimeout - TimeSpan.FromTicks (t2 - t1);
if (timeout.Ticks <= 0)
signalled = false;
} else
localParallelTasks [i].TimeoutHandler (asyncResults [i]);
}
#else
WaitHandle [] waitArray = new WaitHandle [asyncResults.Count];
int i = 0;
for (i = 0; i < asyncResults.Count; i++) {
@@ -2311,7 +2277,6 @@ public partial class Page : TemplateControl, IHttpHandler
}
}
}
#endif
}
DateTime endWait = DateTime.Now;
TimeSpan elapsed = endWait - startExecution;

View File

@@ -69,15 +69,11 @@ namespace System.Web
public override string Get (string name)
{
if (!_loaded) {
#if TARGET_JVM
return InternalGet (name);
#else
string s = InternalGet (name);
if (s != null && s.Length > 0)
return s;
LoadInfo ();
#endif
}
return base.Get (name);

View File

@@ -51,11 +51,7 @@ namespace System.Web
BrowserData parent;
string text;
string pattern;
#if TARGET_JVM
java.util.regex.Pattern regex;
#else
Regex regex;
#endif
ListDictionary data;
public BrowserData (string pattern)
@@ -153,17 +149,9 @@ namespace System.Web
lock (this_lock) {
if (regex == null)
#if TARGET_JVM
regex = java.util.regex.Pattern.compile (pattern);
#else
regex = new Regex (pattern);
#endif
}
#if TARGET_JVM
return regex.matcher ((java.lang.CharSequence) (object) expression).matches ();
#else
return regex.Match (expression).Success;
#endif
}
}
@@ -173,46 +161,9 @@ namespace System.Web
static Hashtable defaultCaps;
static readonly object lockobj = new object ();
#if TARGET_JVM
static bool loaded {
get {
return alldata != null;
}
set {
if (alldata == null)
alldata = new ArrayList ();
}
}
const string alldataKey = "System.Web.CapabilitiesLoader.alldata";
static ICollection alldata {
get {
return (ICollection) AppDomain.CurrentDomain.GetData (alldataKey);
}
set {
AppDomain.CurrentDomain.SetData (alldataKey, value);
}
}
const string userAgentsCacheKey = "System.Web.CapabilitiesLoader.userAgentsCache";
static Hashtable userAgentsCache {
get {
lock (typeof (CapabilitiesLoader)) {
Hashtable agentsCache = (Hashtable) AppDomain.CurrentDomain.GetData (userAgentsCacheKey);
if (agentsCache == null) {
agentsCache = Hashtable.Synchronized (new Hashtable (userAgentsCacheSize + 10));
AppDomain.CurrentDomain.SetData (userAgentsCacheKey, agentsCache);
}
return agentsCache;
}
}
}
#else
static volatile bool loaded;
static ICollection alldata;
static Hashtable userAgentsCache = Hashtable.Synchronized(new Hashtable(userAgentsCacheSize+10));
#endif
CapabilitiesLoader () {}

View File

@@ -1277,10 +1277,6 @@ namespace System.Web
context.Handler = handler;
context.PushHandler (handler);
} catch (FileNotFoundException fnf){
#if TARGET_JVM
Console.WriteLine ("$$$$$$$$$$:Sys.Web Pipeline");
Console.WriteLine (fnf.ToString ());
#endif
if (context.Request.IsLocal)
ProcessError (HttpException.NewWithCode (404,
String.Format ("File not found {0}", fnf.FileName),
@@ -1510,9 +1506,7 @@ namespace System.Web
th.CurrentUICulture = new_app_culture;
}
#if !TARGET_JVM
prev_user = Thread.CurrentPrincipal;
#endif
}
void PostDone ()
@@ -1523,10 +1517,8 @@ namespace System.Web
}
Thread th = Thread.CurrentThread;
#if !TARGET_JVM
if (Thread.CurrentPrincipal != prev_user)
Thread.CurrentPrincipal = prev_user;
#endif
if (prev_appui_culture != null && prev_appui_culture != th.CurrentUICulture)
th.CurrentUICulture = prev_appui_culture;
if (prev_app_culture != null && prev_app_culture != th.CurrentCulture)
@@ -1672,11 +1664,7 @@ namespace System.Web
cultures [0] = Thread.CurrentThread.CurrentCulture;
cultures [1] = Thread.CurrentThread.CurrentUICulture;
#if TARGET_JVM
if (true)
#else
if (Thread.CurrentThread.IsThreadPoolThread)
#endif
Start (null);
else
ThreadPool.QueueUserWorkItem (x => {
@@ -1816,7 +1804,6 @@ namespace System.Web
if (type != null)
return type;
#if !TARGET_JVM
Assembly [] assemblies = AppDomain.CurrentDomain.GetAssemblies ();
foreach (Assembly ass in assemblies) {
type = ass.GetType (typeName, false);
@@ -1845,7 +1832,6 @@ namespace System.Web
if (type != null)
return type;
#endif
if (throwOnMissing)
throw new TypeLoadException (String.Format ("Type '{0}' cannot be found", typeName), loadException);

View File

@@ -85,15 +85,7 @@ namespace System.Web
[ThreadStatic]
static Dictionary <string, IResourceProvider> resource_providers;
#if TARGET_JVM
const string app_global_res_key = "HttpContext.app_global_res_key";
internal static Assembly AppGlobalResourcesAssembly {
get { return (Assembly) AppDomain.CurrentDomain.GetData (app_global_res_key); }
set { AppDomain.CurrentDomain.SetData (app_global_res_key, value); }
}
#else
internal static Assembly AppGlobalResourcesAssembly;
#endif
ProfileBase profile = null;
LinkedList<IHttpHandler> handlers;
@@ -178,7 +170,6 @@ namespace System.Web
// The "Current" property is set just after we have constructed it with
// the 'HttpContext (HttpWorkerRequest)' constructor.
//
#if !TARGET_JVM // No remoting CallContext support in Grasshopper
public static HttpContext Current {
get {
return (HttpContext) CallContext.GetData ("c");
@@ -188,7 +179,6 @@ namespace System.Web
CallContext.SetData ("c", value);
}
}
#endif
public Exception Error {
get {
@@ -228,11 +218,9 @@ namespace System.Web
return (cfg.Mode == CustomErrorMode.RemoteOnly) && !Request.IsLocal;
}
}
#if !TARGET_JVM
public bool IsDebuggingEnabled {
get { return RuntimeHelpers.DebuggingEnabled; }
}
#endif
public IDictionary Items {
get {
if (items == null)

View File

@@ -289,11 +289,9 @@ namespace System.Web
}
}
#if !TARGET_JVM
public WindowsIdentity LogonUserIdentity {
get { throw new NotImplementedException (); }
}
#endif
string anonymous_id;
public string AnonymousID {
@@ -580,10 +578,8 @@ namespace System.Web
// GetSubStream returns a 'copy' of the InputStream with Position set to 0.
static Stream GetSubStream (Stream stream)
{
#if !TARGET_JVM
if (stream is IntPtrStream)
return new IntPtrStream (stream);
#endif
if (stream is MemoryStream) {
MemoryStream other = (MemoryStream) stream;
@@ -797,7 +793,6 @@ namespace System.Web
input_stream = new MemoryStream (ms.GetBuffer (), 0, (int) ms.Length, false, true);
}
#if !TARGET_JVM
const int INPUT_BUFFER_SIZE = 32*1024;
TempFileStream GetTempStream ()
@@ -951,7 +946,6 @@ namespace System.Web
if (total < content_length)
throw HttpException.NewWithCode (411, "The request body is incomplete.", WebEventCodes.WebErrorOtherError);
}
#endif
internal void ReleaseResources ()
{
@@ -1563,14 +1557,10 @@ namespace System.Web
if (!isAppVirtualPath && !virtualPath.StartsWith (appVirtualPath, RuntimeHelpers.StringComparison))
throw new InvalidOperationException (String.Format ("Failed to map path '{0}'", virtualPath));
#if TARGET_JVM
return worker_request.MapPath (virtualPath);
#else
string path = worker_request.MapPath (virtualPath);
if (virtualPath [virtualPath.Length - 1] != '/' && path [path.Length - 1] == System.IO.Path.DirectorySeparatorChar)
path = path.TrimEnd (System.IO.Path.DirectorySeparatorChar);
return path;
#endif
}
public void SaveAs (string filename, bool includeHeaders)

View File

@@ -1157,11 +1157,6 @@ namespace System.Web
Flush ();
}
#if TARGET_JVM
public void WriteFile (IntPtr fileHandle, long offset, long size) {
throw new PlatformNotSupportedException("IntPtr not supported");
}
#else
public void WriteFile (IntPtr fileHandle, long offset, long size)
{
if (offset < 0)
@@ -1182,7 +1177,6 @@ namespace System.Web
output_stream.ApplyFilter (false);
Flush ();
}
#endif
public void WriteFile (string filename, long offset, long size)
{

View File

@@ -75,75 +75,6 @@ namespace System.Web
filter = value;
}
}
#if TARGET_JVM
class BlockManager {
const int PreferredLength = 16 * 1024;
static readonly byte[] EmptyBuffer = new byte[0];
byte[] buffer = EmptyBuffer;
int position;
public BlockManager () {
}
public int Position {
get { return position; }
}
void EnsureCapacity (int capacity) {
if (buffer.Length >= capacity)
return;
capacity += PreferredLength;
capacity = (capacity / PreferredLength) * PreferredLength;
byte[] temp = new byte[capacity];
Array.Copy(buffer, 0, temp, 0, buffer.Length);
buffer = temp;
}
public void Write (byte [] buffer, int offset, int count) {
if (count == 0)
return;
EnsureCapacity (position + count);
Array.Copy(buffer, offset, this.buffer, position, count);
position += count;
}
public void Send (HttpWorkerRequest wr, int start, int end) {
int length = end - start;
if (length <= 0)
return;
if (length > buffer.Length - start)
length = buffer.Length - start;
if (start > 0) {
byte[] temp = new byte[length];
Array.Copy(buffer, start, temp, 0, length);
buffer = temp;
}
wr.SendResponseFromMemory(buffer, length);
}
public void Send (Stream stream, int start, int end) {
int length = end - start;
if (length <= 0)
return;
if (length > buffer.Length - start)
length = buffer.Length - start;
stream.Write(buffer, start, length);
}
public void Dispose () {
buffer = null;
}
}
#else // TARGET_JVM
unsafe sealed class BlockManager {
const int PreferredLength = 128 * 1024;
byte *data;
@@ -234,7 +165,6 @@ namespace System.Web
}
}
#endif
abstract class Bucket {
public Bucket Next;
@@ -247,9 +177,7 @@ namespace System.Web
public abstract int Length { get; }
}
#if !TARGET_JVM
unsafe
#endif
class ByteBucket : Bucket {
int start;
int length;
@@ -559,24 +487,12 @@ namespace System.Web
}
}
#if TARGET_JVM
void UnsafeWrite (HttpWorkerRequest wr, byte [] buffer, int offset, int count)
{
if (count <= 0)
return;
byte[] copy = new byte[count];
Array.Copy(buffer, offset, copy, 0, count);
wr.SendResponseFromMemory (copy, count);
}
#else
unsafe void UnsafeWrite (HttpWorkerRequest wr, byte [] buffer, int offset, int count)
{
fixed (byte *ptr = buffer) {
wr.SendResponseFromMemory ((IntPtr) (ptr + offset), count);
}
}
#endif
void AppendBuffer (byte [] buffer, int offset, int count)
{
if (!(cur_bucket is ByteBucket))

Some files were not shown because too many files have changed in this diff Show More