Coder Social home page Coder Social logo

Geolocation data is wrong about confluence HOT 3 OPEN

bzbarsky avatar bzbarsky commented on August 14, 2024
Geolocation data is wrong

from confluence.

Comments (3)

foolip avatar foolip commented on August 14, 2024

I think this is probably caused by the interface object being found in Chrome via navigator.geolocation.constructor, and for example navigator.geolocation.constructor.prototype.clearWatch can be found via that object.

In Firefox, navigator.geolocation.constructor == Object. This is different from a similar case, navigator.permissions.constructor === Permissions.

In other words, it looks like in Chrome, [NoInterfaceObject] caused the interface object to not be exposed, where in Firefox there actually is no interface object, just the interface prototype object?

Starting from https://heycam.github.io/webidl/#NoInterfaceObject, I think step 12.3 of https://heycam.github.io/webidl/#interface-prototype-object is what accounts for Firefox's behavior, i.e. Firefox is correct.

Given that [NoInterfaceObject] is going away I doubt any engine is going to change, but what would a good workaround in Confluence be?

It's a bit odd IMHO to pick up any interface object however it is found, and I think this also explains why Chrome is claimed to support SpeechRecognition#start even though SpeechRecognition isn't exposed. webkitSpeechRecognition is, and I'm guessing the same mechanism explains this as why Geolocation#clearWatch appears to be supported in Chrome.

from confluence.

foolip avatar foolip commented on August 14, 2024

#200 is related to this, but the usual manifestation of [NoInterfaceObject] is that if we can't find an instance we just don't know about its support. For Geolocation, an instance is easily found at navigator.geolocation, but if we don't what kind of thing navigator.geolocation is, nothing ends up in the API catalog.

from confluence.

bzbarsky avatar bzbarsky commented on August 14, 2024

I think this is probably caused by the interface object being found in Chrome via navigator.geolocation.constructor

Why not just find the proto (which is what you are really looking for here) via Object.getPrototypeOf(navigator.geolocation)?

i.e. Firefox is correct.

Yep. Safari also gets this right. Is there a Chrome bindings bug tracking this?

Given that [NoInterfaceObject] is going away

It is? That is, is there a concrete plan for it to go away for non-mixins where it's used without causing webcompat issues?

what would a good workaround in Confluence be?

Use Object.getPrototypeOf instead of looking at constructor.

For the general case of [NoInterfaceObject] and no instance, I agree that it's hard to do anything sane...

from confluence.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.