angler-fishThe Vulnerability History Project

Feature 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 &quoton*&quot 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 &quotin&quot operator will still see them, and (2)
dispatchEvent will never deliver deprecated events, but it normally
delives un-implemented events.

BUG=330487

Review URL: https://codereview.chromium.org/120733003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243817 0039d316-1c4b-4281-b951-d872f2087c98
    
commit ac15d83ce856956efeec5cc37f912ea1ce4dcc28
+1 -2
+40 -109
+19 -5
+43 -63
+9 -8
+10 -2
expand_less