Giter Site home page Giter Site logo

'Reject' definition. about webidl HOT 6 CLOSED

whatwg avatar whatwg commented on May 27, 2024
'Reject' definition.

from webidl.

Comments (6)

bzbarsky avatar bzbarsky commented on May 27, 2024

Oh, this went away with platform array objects, looks like. That's bad.

from webidl.

bzbarsky avatar bzbarsky commented on May 27, 2024

In particular, in #52

from webidl.

bzbarsky avatar bzbarsky commented on May 27, 2024

Oh, but more to the point, we don't need this thing because in ES6 the contract for [[DefineOwnProperty]] doesn't involve throwing at all. You just return false and the caller throws if needed.

@heycam should we just update all out [[DefineOwnProperty]] to the ES6 definition?

from webidl.

heycam avatar heycam commented on May 27, 2024

Yes I think we should update. And to me it looks like all [[DefineOwnProperty]] calls in Web IDL currently can just ignore its return value. Do you agree? Apart from http://heycam.github.io/webidl/#defineownproperty which needs to just return it.

from webidl.

bzbarsky avatar bzbarsky commented on May 27, 2024

@heycam The calls in dictionary and sequence idl-to-es conversion should never return false. Same thing in the unscopeables setup and serializer bits, So ignoring the return value there makes sense.

The call for [Replaceable] attribute setters, however, I think should probably throw if false is returned. Testing this in browsers is a bit of a pain because you can't freeze a Window effectively, but this is a testcase:

var str = "Object.freeze(self); self.console = 5; postMessage(typeof console);"
var blob = new Blob([str]);
var url = URL.createObjectURL(blob);
var w = new Worker(url);
w.onmessage = function (e) {
  alert("OK: " + e.data);
}
w.onerror = function (e) {
  alert("Error: " + e.message);
}

Looks to me like this throws in Firefox but not Chrome (which silently ignores the set instead)... Chrome doesn't throw with use strict there either, of course. In any case, I think we basically want the behavior here to be like Object.defineProperty, which would throw in this situation, so throwing makes sense to me.

from webidl.

ylafon avatar ylafon commented on May 27, 2024

Note that the this was fixed by 8c9b828

from webidl.

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.