mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
fix(getProperties): return empty map for non-objects (#470)
This commit is contained in:
parent
98bf9ac1d5
commit
88a11a3fbd
@ -113,9 +113,12 @@ export class FFExecutionContext implements js.ExecutionContextDelegate {
|
||||
}
|
||||
|
||||
async getProperties(handle: js.JSHandle): Promise<Map<string, js.JSHandle>> {
|
||||
const objectId = handle._remoteObject.objectId;
|
||||
if (!objectId)
|
||||
return new Map();
|
||||
const response = await this._session.send('Runtime.getObjectProperties', {
|
||||
executionContextId: this._executionContextId,
|
||||
objectId: handle._remoteObject.objectId,
|
||||
objectId,
|
||||
});
|
||||
const result = new Map();
|
||||
for (const property of response.properties)
|
||||
|
@ -115,6 +115,11 @@ module.exports.describe = function({testRunner, expect, CHROMIUM, FFOX, WEBKIT})
|
||||
expect(foo).toBeTruthy();
|
||||
expect(await foo.jsonValue()).toBe('bar');
|
||||
});
|
||||
it('should return empty map for non-objects', async({page, server}) => {
|
||||
const aHandle = await page.evaluateHandle(() => 123);
|
||||
const properties = await aHandle.getProperties();
|
||||
expect(properties.size).toBe(0);
|
||||
});
|
||||
it('should return even non-own properties', async({page, server}) => {
|
||||
const aHandle = await page.evaluateHandle(() => {
|
||||
class A {
|
||||
|
Loading…
Reference in New Issue
Block a user