Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Detect inspector protocol version #7127

Closed
@jasonsanjose

Description

To fix #6830, PR #7008 uses both the deleted CSS.getAllStylesheetsAPI (for Chrome < 34) and the new styleSheetAdded/styleSheetRemoved events.

Users using Chrome >= 34 may see an inconsequential console error in Brackets' dev tools:

// error code -32601 method not found, see http://www.jsonrpc.org/specification#error_object
'CSS.getAllStylesheets' wasn't found ... code: -32601...

We log all inspector protocol errors to the console, even in this case where we expect it to fail in some versions of Chrome. In this case, once we detect the API is missing, we disable future calls during the session and rely only on the new events.

Here are some options so that we don't log the error:

  • Do not call the API if we could detect the protocol version in use. However, the protocol doesn't expose the version at all or what methods it supports. We would have to detect the Chrome version and map that to a revision of protocol.json from http://src.chromium.org/viewvc/blink/trunk/Source/devtools/protocol.json. We could do this client side with some userAgent sniffing or natively if we can read the Chrome version from the native OS. The drawback here is maintaining this mapping for each Chrome version.
  • Filter known error messages/codes out of the console error handler. The drawback here is possibly missing important errors for future API changes.

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions