We hope that the vast majority of features we add to WebKit will become widely implemented by other web rendering engines and enjoyed by authors and users for years to come. However, if we avoided landing code for a feature until we were sure that feature would be successful, we would be perpetually following rather than leading, and the web platform would not advance as quickly. This wiki page explains how to handle those cases in which we wish to remove a feature from WebKit.

Balancing costs and benefits

The guiding principle in our approach is to balance net costs of removing the feature against the net costs of retaining the feature. In many cases, evaluating these costs is a value judgement, but, whenever possible, we should strive to replace opinion with data. The following are some factors we ought to consider when removing a feature:

  • Compatibility. The more a given feature is used, particularly on the web at large but also in "walled gardens" of content, the larger the compatibility cost of removing the feature. For example, we have not removed our implementation of SQLDatabase even though other browser vendors have refused to implement the feature and the W3C has removed the specification from the standards track. We've kept SQLDatabase because removing this API would break compatibility with a large number of consumers of WebKit that use this API.
  • Interoperability. If a feature fails to garner wide-spread implementation, then web sites that use that feature might work in one user agent but not in another. This lack of interoperability fractures the web platform, making it more difficult for users to switch from one user agent to another. Removing WebKit-proprietary features, or at least hiding them from the web platform, often improves interoperability.
  • Complexity. Each feature we include in WebKit increases WebKit's complexity, slowing down development of the engine. We try to reduce the complexity cost of features (e.g., by using Modules), but each feature still adds a non-zero cost (e.g., for project-wide improvements, like EfficientStrings). Removing some features (e.g., Workers) would reduce the complexity of WebKit greatly, whereas removing others (e.g., Blob.webkitSlice) would have little impact on WebKit's overall complexity.

This list is certainly not exhaustive. For example, some feature might have security or stability costs that we should also consider. Ultimately, we need to balance the costs and benefits on a feature-by-feature basis.

Approaches for removing features

There are a number of different approaches you can use to remove a feature from WebKit. Similar to adding features, it's important to communicate clearly and broadly with the WebKit community. Often emailing webkit-dev is a good place to start. In your email, you will likely want to outline which feature you'd like to remove, the relative costs and benefits of removing the feature, and which of the following approaches you intend to take.

Cold turkey

Perhaps the crudest approach to removing a feature is to simply delete it, cold turkey. We might use this approach when we're sure we understand the costs of removing a feature. For example, we removed the first iteration of the PeerConnection API cold turkey because we knew that the API was not in wide use and that the working group standardizing PeerConnection had redesigned the API.

Removing a feature cold turkey is also appropriate if the feature is actively causing security or stability problems for WebKit. For example, we removed support for magic iframes cold turkey because they were an ongoing source of security vulnerabilities.

A port-specific experiment

A more controlled approach to removing a feature is to remove the feature from a single port as an experiment. In this approach, one port removes the feature (e.g., via an ENABLE macro or a run-time setting) and gathers feedback from its release cycle. If the port succeeds in removing the feature, we can then remove the feature from the remaining ports with greater confidence that they will also avoid problems.

This approach has two main benefits:

  • The risks associated with removing a feature are concentrated on a single port. If you're passionate about removing a feature, you might have more luck convincing one port to experiment with removing a feature than convincing all the ports at once. That port can bear the risks, and the project as a whole can learn about the costs of removing the feature.
  • Actually removing a feature is the only way to really know what problems will arise when you remove a feature. We can estimate the risks by searching for uses of a feature or by measuring how often a feature is used, but those are only estimates. For example, many web sites detect which features are enabled and then take different code paths depending on what they're able to detect, adding noise both to code searches and to runtime measurements.

Measure, deprecate, and remove

The most data-driven way to remove a feature is to quantify the compatibility costs of removing the feature by collecting usage metrics. Typically, this approach proceeds in three steps:

  1. Use FeatureObserver to measure how often a given feature is used. This webkit-dev post contains instructions for using FeatureObserver. (Currently only the Chromium? port implements the backend for FeatureObserver, but hopefully other ports will add support in the future.)
  1. Log a deprecation message to the console whenever the feature is used. This message lets web developers know that this feature is deprecated and that they should use another feature instead. Ideally the deprecation message will let developers know what they should use instead of the deprecated feature. For example, a deprecation message for window.webkitIndexedDB might suggest that developers use the unprefixed window.indexedDB API instead.
  1. Once usage of the feature drops low enough, remove the feature. Currently, we do not have any guidelines for what constitutes "low enough" usage because we don't have much experience removing features based on metrics. Hopefully, as we use this approach more, we'll gain experience and have a better sense for how much pain will be caused by removing features with varying levels of usage.

Special considerations for vendor prefixes

Generally speaking, removing vendor prefixes is similar to remove support for a feature. However, there are two additional considerations:

  • Clear path forward. When we remove a vendor prefix, web developers have a clear path forward: use the unprefixed version of the API. This clear path forward means that we won't strand developers when we remove a vendor-prefixed version of an API.
Last modified 4 years ago Last modified on Dec 5, 2012 12:14:34 PM