Closed Bug 1615260 Opened 4 years ago Closed 4 years ago

Response for Runtime.callFunctionOn with returnbyValue shouldn't return value when it's not serializable

Categories

(Remote Protocol :: CDP, defect, P1)

defect

Tracking

(firefox75 fixed)

RESOLVED FIXED
Firefox 75
Tracking Status
firefox75 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

(Whiteboard: [puppeteer-beta-mvp])

Attachments

(1 file)

See the difference between Chrome and Firefox when evaluating a non-serializable value:

Chrome:

  puppeteer:protocol SEND ► {"sessionId":"FDC196D1DD11938503876AB4D0C44BA5","method":"Runtime.callFunctionOn","params":{"functionDeclaration":"a => a\n//# sourceURL=__puppeteer_evaluation_script__\n","executionContextId":1,"arguments":[{"unserializableValue":"NaN"}],"returnByValue":true,"awaitPromise":true,"userGesture":true},"id":18} +1ms
  puppeteer:protocol ◀ RECV {"id":18,"result":{"result":{"type":"number","unserializableValue":"NaN","description":"NaN"}},"sessionId":"FDC196D1DD11938503876AB4D0C44BA5"} +1ms

Firefox:

puppeteer:protocol SEND ► {"sessionId":1,"method":"Runtime.callFunctionOn","params":{"functionDeclaration":"a => a\n//# sourceURL=__puppeteer_evaluation_script__\n","executionContextId":1,"arguments":[{"unserializableValue":"NaN"}],"returnByValue":true,"awaitPromise":true,"userGesture":true},"id":18} +2ms
  puppeteer:protocol ◀ RECV {"sessionId":1,"id":18,"result":{"result":{"value":null}}} +6ms

The problem here is that we always return a value property, and in cases like NaN a call to JSON.stringify()will returnnull` instead. As such we have to special-case certain values, and return immediately if the obj is of that type.

Blocks: 1615360
Blocks: 1615364
Blocks: 1615368

Values like NaN, Infinity, -Infinity are not serializable and have
to be returned via the unserializable property and not as value.

This patch also adds the type and description properties as
Puppeteer tests require, but leaves out support for -0 (bug 1615364)
and BigInt (bug 1615360).

Whiteboard: [puppeteer-beta-mvp]
Blocks: 1597343
Pushed by hskupin@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/afc658d2dd3a
[remote] Return correct properties for unserializable values in Runtime.callFunctionOn. r=remote-protocol-reviewers,maja_zf
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 75
Component: CDP: Runtime → CDP
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: