-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Harden playwright against core object manipulation #34443
Comments
So your app (I understand that it is not your fault) breaks Map type and you can't use it in your |
When exposing a callback function, the exception happens within the playwright sources:
So when use the html below and expose a function <html>
<body>
<script language="javascript">
function Map( )
{
this.valueArray = new Array( );
this.keyArray = new Array( );
this.keyCount = 0;
}
myExposedFunction();
</script>
</body>
</html> |
@hakito I tried to see what we can do without using // Save it before the page can tamper with it.
await page.addInitScript(() => { window.__Map = window.Map });
// Restore it before accessing your exposed function.
await page.evaluate(() => { window.Map = window.__Map; }); Let me know whether that helps. |
🚀 Feature Request
See #34328
Sorry, I could not reply earlier, as I was very busy the last week.
The tested target application is on SAP systems. We are not part of SAP. Even if SAP would provide a patch for it, it takes a lot of time until the fix is deployed to all our customers.
We saw the map replacement in 2 files on the server:
sap(====)/bc/bsp/sap/ic_base/scripts/common/ic_base_utils_map.js
sap(====)/bc/bsp/sap/crmcmp_ic_frame/crmcmp_ic_frame_utils_map.js
I am probably not allowed to share the actual sources, but i don't think it is some part of any public library.
We call for example
BrowserContext.AddInitScript
andPage.EvaluateAsync
and need to work with some Map objects within the called scripts. The Init script might still work, as it is executed early enough. But EvaluateAsync might fail when the sap scripts have been evaluated before.Example
No response
Motivation
The text was updated successfully, but these errors were encountered: