Closed Bug 1608047 Opened 6 years ago Closed 2 years ago

Protocol error (Runtime.callFunctionOn): Object is not serializable

Categories

(Remote Protocol :: CDP, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: whimboo, Unassigned)

References

Details

This is from Puppeteer unit tests like 'window.open should use parent tab context' in browsercontext.spec.js. Overall I can see it 16 times in the test log:

    Protocol error (Runtime.callFunctionOn): Object is not serializable _serialize@chrome://remote/content/domains/content/runtime/ExecutionContext.jsm:265:13
callFunctionOn@chrome://remote/content/domains/content/runtime/ExecutionContext.jsm:191:23
callFunctionOn@chrome://remote/content/domains/content/Runtime.jsm:176:20
execute@chrome://remote/content/domains/DomainCache.jsm:99:25
receiveMessage@chrome://remote/content/sessions/ContentProcessSession.jsm:69:45
MessageListener.receiveMessage*ContentProcessSession@chrome://remote/content/sessions/ContentProcessSession.jsm:27:25
@chrome://remote/content/sessions/frame-script.js:12:1

In the above case the failure happens when calling the method like:

  puppeteer:protocol SEND ► {"sessionId":1,"method":"Runtime.callFunctionOn","params":{"functionDeclaration":"url => window.open(url)\n//# sourceURL=__puppeteer_evaluation_script__\n","executionContextId":3,"arguments":[{"value":"http://localhost:8907/empty.html"}],"returnByValue":true,"awaitPromise":true,"userGesture":true},"id":19}

Running the same with Chrome I get:

puppeteer:protocol ◀ RECV {"error":{"code":-32000,"message":"Object reference chain is too long"},"id":19,"sessionId":"7E8ADE5DF74F17AA5095DE11FF5E7511"} +0ms

When I run other tests like for BigInt also Chrome fails but with a clear message:

Unsupported unserializable value: 42n

Looks like we miss a sane fallback value.

Here the details for the last example which doesn't raise an error:

  puppeteer:protocol SEND ► {"sessionId":"40B6E738F1032A86F4AE98F22629F9DE","method":"Runtime.callFunctionOn","params":{"functionDeclaration":"() => BigInt(42)\n//# sourceURL=__puppeteer_evaluation_script__\n","executionContextId":1,"arguments":[],"returnByValue":true,"awaitPromise":true,"userGesture":true},"id":18} +1ms
  puppeteer:protocol ◀ RECV {"id":18,"result":{"result":{"type":"bigint","unserializableValue":"42n","description":"42n"}},"sessionId":"40B6E738F1032A86F4AE98F22629F9DE"} +8ms
Blocks: 1543099
Priority: -- → P3

Interesting is that even Chrome is not using the exceptionDetails property of the returned value to indicate that there was a problem in serializing the value. Andrey, could you have a look if that is expected? I would assume this only happens with silent = true?

Flags: needinfo?(caseq)
Component: CDP: Runtime → CDP

Clear a needinfo that is pending on an inactive user.

For more information, please visit auto_nag documentation.

Flags: needinfo?(caseq)

If we would ever get to this bug the implementation might look similarly to the one for WebDriver BiDi (bug 1770489).

See Also: → 1770489
Severity: normal → S3

We are not going to fix this API for CDP.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.