-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Extension Error from running Lighthouse on a github page #5798
Comments
I'm not certain what this bug is exactly. However, can anyone else run the extension on github pages? (e.g. this page) They run fine in the CLI (master) and devtools (3.0.3) for me, but in the extension they're failing with
The driver then times out and I get |
@brendankenny Spot checked some github pages with extension, wasn't able to duplicate. |
thanks for checking! @wardpeet mentioned it may be new behavior in Chrome 69+, but haven't verified |
@wardpeet is spot on; I can duplicate that with M69+ and the extension. |
Ok so I did a lot of investigation here. The problem lies with Chrome detaching the debugger when a Chrome page is shown (offline dinosaur, chrome:// page, ...). When a website is ran without offline support we hit the Chrome offline page. This moment the extension detaches from the protocol (this wasn't happening before 69). We can fix this by trying to reattach each second until we move back to online mode in the next pass.
Another idea I had but not sure if it will work is to try using the intercept api of the protocol to intercept the page and always respond with a valid page, this only works if the Service Worker logic will still be executed even when we intercept. I could try this with an example page and puppeteer. @paulirish could you maybe try to make a crbug out of this? This is the tricky part, why does paulirish.com work without a service worker and github doesn't? Well paulirish.com is served from the network disk cache and github is not. I believe this happens because of the Cache-Control header. When looking at the extension logs I see the following: paulirish.com:
The reason why we don't die here is that paulirish serves a valid 200 page. In our audit we explicit check for the fromServiceWorker field which still marks the audit as false. github.com:
Here we don't get any response back which is why we detach. we can make paulirish.com fail with the same message if we remove the
|
Thanks for investigating @wardpeet this sounds sticky! This definitely sounds crbug worthy, especially if re-attaching works, and it wasn't some blanket security concern that prompted the no debugger on |
reattaching only works when we go back online and load a page. This behaviour is new in chrome 69 but not sure how to actually explain this in a crbug honestly. |
Wait how are we able to send commands to go back online while we're detached 🤔 |
Why we go online I have no idea but could it be when we detach unexpectedly chrome tries to get back online? When network changes, chrome refreshes. You can test yourself using devtools and offline checkbox |
@wardpeet can you make a reduced repro extension with |
Looking at the extension debugger API changes from this year, the only really relevant ones I see are |
Thank you everyone for the help and support, |
I've created a repro extension which we might use for other bugs later on. |
https://chromium-review.googlesource.com/c/chromium/src/+/1217599 is going to land which will resolve this. im asking to merge back to 69.
@wardpeet you wanna take these? update: looks like we wont do the extension ID safelisting, so no need to do this key/id thing. :) |
@paulirish I missed this thanks, will take this one |
update: https://chromium-review.googlesource.com/c/chromium/src/+/1217599 has landed and we'll merge to 70. 69 is stable and hypothetically should have this bug, however me and @dgozman were unable to reproduce it yesterday. (we could reproduce fine in 70) However the 3 issues i just duped into here were all on 69. Can anyone repro this problem on 69? LH repro steps:
Or the more isolated repro:
In both cases, the extension should disconnect when the "your page is offline" error page comes up. the root issue is that chrome.debugger API isn't being given permission to inspect error pages as they are isolated in their own process. |
@paulirish this is weird, it works again but it was definitely broken in 69. I just tested lighthouse and my extension on Version 69.0.3497.100. And both work fine |
update: https://chromium-review.googlesource.com/1240865 landed and fixes the second half of the chromium bug that was a problem. we're trying to get them merged to 70 now. not sure about 69. |
This is fixed in m70+; https://bugs.chromium.org/p/chromium/issues/detail?id=882589#c21 sorry 69. |
Lighthouse Version: 3.0.3
Lighthouse Commit: d1cae24
Chrome Version: 70.0.3510.2
Initial URL: Jeremip11/thimble.mozilla.org#4
Error Message: Cannot attach to this target.
Stack Trace:
The text was updated successfully, but these errors were encountered: