Re: [webidl] 'Reject' definition. (#73)

@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.



---
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/73#issuecomment-157463063

Received on Tuesday, 17 November 2015 18:35:19 UTC