dart-archive / web-components

Dart package providing the web components platform polyfills
https://pub.dartlang.org/packages/web_components
BSD 3-Clause "New" or "Revised" License
18 stars 10 forks source link

Errors on iOS Safari #49

Closed enyo closed 7 years ago

enyo commented 7 years ago

EDIT: This was fixed by webcomponentsjs v0.7.23

So this repo only needs to update the dependencies. PR: #50


Hey, the latest iOS Safari does not work with the latest web-components (0.12.3) version. The -lite version works fine, but due to this issue I need to use the full version.

The line in question is:

The code in question is inside installProperty, specifically this line:

if (typeof descriptor.value === "function") {
  if (allowMethod) {
    target[name] = getMethod(name);
  }
  continue;
}

(And apparently descriptor is undefined)

webcomponents.js Error: TypeError: undefined is not an object (evaluating 'descriptor.value') webcomponents.min.js Error: TypeError: undefined is not an object (evaluating 'd.value')

enyo commented 7 years ago

Additional information: the descriptor comes from var descriptor = getDescriptor(source, name); where name == 'showModalDialog' and source is Window. The installProperty has been invoked with EventTarget as a target.

enyo commented 7 years ago

Ok, so the problem seems to be this:

Safari on iOS includes 'showModalDialog' in the list the you get when you invoke Object.getOwnPropertyNames(window), but returns undefined when you then invoke Object.getOwnPorpertyDescriptor(window, 'showModalDialog') (which seems to be a bug IMO.

Adding this line above works, but I am afraid that this is not the intended behaviour...

if (descriptor == null) continue;

I have alos found this thread: https://www.bountysource.com/issues/37861877-throws-on-ios-10

In that case, they return a dummyDescriptor. Not sure which one of them is better suited.

enyo commented 7 years ago

I just saw that this was fixed by https://github.com/webcomponents/webcomponentsjs/commit/e6a0d18cd338424467eab9622ab064f0d8cb1f54 And has been released 12 days ago as v0.7.23.

Any chance we could upgrade soon? PR is here: #50