Addressing code review comments about the mshtml isolation work.

This commit is contained in:
Francisco Gamino
2016-07-24 16:20:46 -07:00
committed by Andrew Schwartzmeyer
parent 46f8e0d60d
commit 3a898cb888
4 changed files with 30 additions and 27 deletions
@@ -1,18 +1,17 @@
#if !CORECLR
/********************************************************************++
Copyright(c) Microsoft Corporation. All rights reserved.
Copyright (c) Microsoft Corporation. All rights reserved.
--********************************************************************/
using System;
using System.Management.Automation;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using mshtml;
using System.Diagnostics;
using System.Threading;
using ExecutionContext = System.Management.Automation.ExecutionContext;
#if !CORECLR
using mshtml;
#endif
namespace Microsoft.PowerShell.Commands
{
@@ -28,7 +27,6 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
public new string Content { get; private set; }
#if !CORECLR
// The HTML document
private IHTMLDocument2 _parsedHtml;
@@ -43,10 +41,10 @@ namespace Microsoft.PowerShell.Commands
// The exception thrown during the parsing
private Exception _parsingException;
#endif
// The current execution context
private readonly ExecutionContext _executionContext;
#if !CORECLR
// The flag that notifies the worker thread to stop loading the document
private bool _stopWorkerThread;
@@ -221,19 +219,19 @@ namespace Microsoft.PowerShell.Commands
return _allElements;
}
}
#endif
#endregion Properties
#endregion Properties
#region Private Fields
#if !CORECLR
private static Regex _tagRegex;
private static Regex _attribsRegex;
private static Regex _attribNameValueRegex;
#endif
#endregion Private Fields
#region Methods
#if !CORECLR
// The "onreadystatechange" event handler
private void ReadyStateChanged(IHTMLEventObj obj)
{
@@ -454,7 +452,7 @@ namespace Microsoft.PowerShell.Commands
{
return (null == element ? null : element.id);
}
#endif
/// <summary>
/// Reads the response content from the web response.
/// </summary>
@@ -472,9 +470,8 @@ namespace Microsoft.PowerShell.Commands
this.Content = string.Empty;
}
}
#endregion Methods
#if !CORECLR
/// <summary>
/// Dispose the the instance of the class.
/// </summary>
@@ -509,6 +506,6 @@ namespace Microsoft.PowerShell.Commands
System.Runtime.InteropServices.Marshal.ReleaseComObject(_parsedHtml);
}
}
#endif
}
}
#endif
@@ -226,7 +226,7 @@ namespace Microsoft.PowerShell.Commands
content = psBody.BaseObject;
}
/*
/* TODO: This needs to be enable after the dependency on mshtml is resolved.
var html = content as HtmlWebResponseObject;
if (html != null)
{
@@ -236,8 +236,10 @@ namespace Microsoft.PowerShell.Commands
SetRequestContent(request, html.Forms[0].Fields);
}
}
*/
else if (content is FormObject)
*/
if (content is FormObject)
{
FormObject form = content as FormObject;
SetRequestContent(request, form.Fields);
@@ -533,7 +535,7 @@ namespace Microsoft.PowerShell.Commands
}
#endregion Helper Methods
#endregion Helper Methods
}
}
#endif
@@ -17,14 +17,17 @@ namespace Microsoft.PowerShell.Commands
WebResponseObject output;
if (WebResponseHelper.IsText(response))
{
if (useBasicParsing)
{
output = new BasicHtmlWebResponseObject(response, responseStream);
}
else
{
output = new HtmlWebResponseObject(response, responseStream, executionContext);
}
output = new BasicHtmlWebResponseObject(response, responseStream);
// TODO: This code needs to be enable after the dependency on mshtml is resolved.
//if (useBasicParsing)
//{
// output = new BasicHtmlWebResponseObject(response, responseStream);
//}
//else
//{
// output = new HtmlWebResponseObject(response, responseStream, executionContext);
//}
}
else
{
@@ -54,6 +54,7 @@
"commands/utility/WebCmdlet/FullClr/WebResponseHelper.FullClr.cs",
"commands/utility/WebCmdlet/FullClr/WebResponseObject.FullClr.cs",
"commands/utility/WebCmdlet/FullClr/WebResponseObjectFactory.FullClr.cs",
"commands/utility/WebCmdlet/CoreCLR/HtmlWebResponseObject.CoreClr.cs",
"gen/FormatAndOut_out_gridview.cs",
"gen/ImplicitRemotingStrings.cs",