Web Inspector: add explicit version checking for legacy backends
https://bugs.webkit.org/show_bug.cgi?id=148680
Summary Web Inspector: add explicit version checking for legacy backends
Blaze Burg
Reported 2015-09-01 09:41:19 PDT
In several places we do awkward things like the following since we can't directly test protocol version or supported features. // COMPATIBILITY (iOS 9): Legacy backends don't support breakpoint ignore count. Since support // can't be tested directly, check for CSS.getSupportedSystemFontFamilyNames. if (CSSAgent.getSupportedSystemFontFamilyNames) { In cases where we can't use Agent.command.supports(...), it would be better if we had checks against the shipped protocol version, like: if (WebInspector.backendVersion.builtBefore(WebInspector.BackendVersions.iOS9)) if (WebInspector.backendVersion.equalTo(WebInspector.BackendVersions.iOS8)) if (WebInspector.backendVersion.builtAfter(WebInspector.BackendVersions.iOS6)) Feel free to suggest better comparison operator names, these are clunky. I believe WebKit uses "builtOnOrAfter(10, 10, 0)" or similar. In the legacy protocol versions, we can embed a top-level "version" field and parse it in the frontend. And, going forward, we can use a version string of iOS9+ once a legacy copy of iOS9 has been copied over. We could also implement fine-grained feature checking, like WebInspector.backendVersion.supports("Debugger.BreakpointIgnoreCounts"), which will return false for old versions; once that specific feature support lands in trunk, we add the feature key "Debugger.BreakpointIgnoreCounts" in a file somewhere that feeds into backendVersion.supports(). Once the next legacy protocol version is created, we delete all the old feature key checks and replace them with backendVersion.equalOrLaterThan(new-version).
Attachments
Radar WebKit Bug Importer
Comment 1 2015-09-01 09:41:32 PDT
Timothy Hatcher
Comment 2 2015-09-01 10:01:07 PDT
iOS 9 was added to the Legacy folder last week.
Joseph Pecoraro
Comment 3 2015-09-01 11:49:50 PDT
I think we could just give the Inspector domain a version number. And bump it whenever we want/need to. { "domain": "Inspector", "constants": [ { "name": "Version", "value": 1000 } ] } Would generate: InspectorBackend.registerConstant("Inspector.Version", 1000); We could retroactively add it to Legacy Inspector-iOS-*.json files. And add WebInspector.BackendVersions.iOS7-9 constants (700, 800, 900) to the frontend. That said, I still think we should be feature checking the protocol when possible. This would only be used for when we can't easily do that (like new properties in types).
Note You need to log in before you can comment on or make changes to this bug.