[BUG] _checkPrototype function loops indefinitely when calling Invoke-WebRequest cmdlet against a docs.microsoft.com webpage
See original GitHub issueDescription/Screenshot
This is related with the issue described at https://docs.microsoft.com/en-us/answers/questions/329655/powershell-invoke-webrequest-to-httpsdocsmicrosoft.html. Upon debugging the issue, it seems we loop indefinitely in a javascript function from this SDK, hence this issue.
The goal here is to verify that changes have recently been done in this area and if any IE quirk may need to be accounted for.
Steps to Reproduce
- Open a PowerShell command line and type in the following command:
Invoke-WebRequest -Uri https://docs.microsoft.com/en-us/windows-server/remote/remote-desktop-services/clients/windowsdesktop-whatsnew
- The command may never return and you’ll see powershell.exe going 100% CPU indefinitely
From the Invoke-WebRequest documentation:
The Invoke-WebRequest cmdlet sends HTTP and HTTPS requests to a web page or web service. It parses the response and returns collections of links, images, and other significant HTML elements.
This parsing is performed by using IE’s mshtml.dll module, which may be part of the problem. Inspecting the CPU hogging PowerShell process, it seems we loop indefinitely in the following function:
function _checkPrototype(classProto, thisTarget) {
var thisProto = _getObjProto$1(thisTarget);
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto)) {
if (thisProto === classProto) {
return true;
}
thisProto = _getObjProto$1(thisProto);
}
return false;
}
- OS/Browser: Windows 10 20H2
- SDK Version [e.g. 22]: latest stable
- How you initialized the SDK:
Expected behavior
The command returns with the DOM elements parsed. This can be observed by targeting any other URL for the Invoke-WebRequest cmdlet, not matter how complex the page may be.
Additional context
This is affecting enterprise customers that rely on this method to parse docs.microsoft.com content for certain internal processes.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
I’m moving this issue to the dynamic proto project as that is where the issue is occurring https://github.com/microsoft/DynamicProto-JS/issues/31
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.