Skip to content
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

[Bug]: frame needs a null checking #7749

Closed
kura5 opened this issue Nov 5, 2021 · 2 comments
Closed

[Bug]: frame needs a null checking #7749

kura5 opened this issue Nov 5, 2021 · 2 comments
Labels

Comments

@kura5
Copy link

kura5 commented Nov 5, 2021

Bug description

frame._client || this._client,

If frame is null, it will throw an exception even though it is not necessary.

Puppeteer version

11.0.0

Node.js version

16.13.0

npm version

8.1.2

What operating system are you seeing the problem on?

Windows

Relevant log output

C:\Users\foo\tmp\test\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:334
        const context = new ExecutionContext_js_1.ExecutionContext(frame._client || this._client, contextPayload, world);
                                                                         ^
TypeError: Cannot read properties of null (reading '_client')
    at FrameManager._onExecutionContextCreated (C:\Users\foo\tmp\test\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:334:74)
    at C:\Users\foo\tmp\test\node_modules\puppeteer\lib\cjs\puppeteer\common\FrameManager.js:76:18
    at C:\Users\foo\tmp\test\node_modules\puppeteer\lib\cjs\vendor\mitt\src\index.js:51:62
    at Array.map (<anonymous>)
    at Object.emit (C:\Users\foo\tmp\test\node_modules\puppeteer\lib\cjs\vendor\mitt\src\index.js:51:43)
    at CDPSession.emit (C:\Users\foo\tmp\test\node_modules\puppeteer\lib\cjs\puppeteer\common\EventEmitter.js:72:22)
    at CDPSession._onMessage (C:\Users\foo\tmp\test\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:245:18)
    at Connection._onMessage (C:\Users\foo\tmp\test\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:117:25)
    at WebSocket.<anonymous> (C:\Users\foo\tmp\test\node_modules\puppeteer\lib\cjs\puppeteer\node\NodeWebSocketTransport.js:13:32)
    at WebSocket.onMessage (C:\Users\foo\tmp\test\node_modules\puppeteer\node_modules\ws\lib\event-target.js:199:18)
@kura5 kura5 added the bug label Nov 5, 2021
@yanshiyason
Copy link

yanshiyason commented Nov 12, 2021

I wished this codebase made better use of typescript.. I turned on the "strictNullChecks": true compiler option and the whole codebase lit up.. These kinds of bugs are better left to compilers 🥲

@OrKoN
Copy link
Collaborator

OrKoN commented Nov 15, 2021

Opened #7773 to fix this issue. And we have #6769 to track the progress on the strict mode (we currently have ~400 errors and PRs are always welcome!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment