DescriptionFeature detection-friendly restrictions for packaged apps.
Packaged apps do not have access to some features of the Web platform
that are deprecated, or that do not make sense in the context of an
app. Currently, accessing most of those features throws an error.
This change makes thse features behave more like missing featurs on the
Web platform. Whenever possible, accessing restricted features returns
undefined and logs an error to the browser console. Features accessible
via non-configurable ES5 properties (e.g. window.alert, document.write)
either become no-ops or throw errors, on a case-by-case basis.
Deprecated events have their "on*" properties return undefined (as
opposed to null, for events with no handlers) to facilitate feature
detection. Using addEventListener for these events used to throw an
error, and now logs an error to the console and turns into a no-op, to
mimic the behavior for undefined events as well as possible.
This change aims to make JavaScript libraries written for browsers work
in packaged apps as seamlessly as possible, while still providing useful
warnings for developers. This creates a couple of warts: (1) properties
are not removed, so the "in" operator will still see them, and (2)
dispatchEvent will never deliver deprecated events, but it normally
delives un-implemented events.
BUG=330487
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=243817
Patch Set 1 : #Patch Set 2 : Updated broken test. #
Total comments: 12
Patch Set 3 : Addressed some feedback. #Patch Set 4 : Addressed feedback. #
Messages
Total messages: 12 (0 generated)
|