Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Getting exception on Android when mutation events aren't supported #204

Closed
mmariano opened this issue Jul 16, 2015 · 1 comment
Closed
Milestone

Comments

@mmariano
Copy link
Contributor

We are getting an error on Android when mutation events are not supported. The problem is located in the Installer class in the watchSubtree function. The if check targeting.canTarget(target) is returning true but the observer object is null this.observer.observe(target, OBSERVER_INIT);. The target in this case seems to be the document. And the canTarget function is checking if the property document.elementFromPoint exists (which it does).

Installer.prototype = {
    watchSubtree: function(target) {

      // Only watch scopes that can target find, as these are top-level.
      // Otherwise we can see duplicate additions and removals that add noise.
      //
      // TODO(dfreedman): For some instances with ShadowDOMPolyfill, we can see
      // a removal without an insertion when a node is redistributed among
      // shadows. Since it all ends up correct in the document, watching only
      // the document will yield the correct mutations to watch.
      if (targeting.canTarget(target)) {
        this.observer.observe(target, OBSERVER_INIT);
      }
    },

This issue is happening for apps that use the older webview renderer (so not Chrome). In this case we are using Android 4.1-4.3 (e.x., webkit 534.30).

I am not sure what the fix should be. But at the very least if we can check if this.observer is true before running the code it would help our issues. There is most likely something else going on higher up that needs to be addresses, but I am not sure what that is. Thanks.

@mmariano
Copy link
Contributor Author

Do you have any feedback on the PR that I submitted? Let me know if you needed any other info. Thanks.

@scottgonzalez scottgonzalez added this to the 0.4.0 milestone Nov 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants