webcompat / web-bugs

A place to report bugs on websites.
https://webcompat.com
Mozilla Public License 2.0
742 stars 65 forks source link

www.nfl.com - Blank page displayed on “Patriots vs Rams” score page #25390

Closed softvision-oana-arbuzov closed 5 years ago

softvision-oana-arbuzov commented 5 years ago

URL: https://www.nfl.com/gamecenter/2019020300/2018/POST22/patriots@rams?icampaign=scoreStrip-globalNav-2019020300

Browser / Version: Firefox Nightly 67.0a1 (2019-02-03) Operating System: Windows 10 Pro Tested Another Browser: Yes

Problem type: Site is not usable Description: Blank page displayed on “Patriots vs Rams” score page Steps to Reproduce:

  1. Navigate to https://www.nfl.com/gamecenter/2019020300/2018/POST22/patriots@rams?icampaign=scoreStrip-globalNav-2019020300
  2. Observe the page.

Expected Behavior: “Patriots vs Rams” score and details page is displayed.

Actual Behavior: Blank page is displayed.

Note

  1. Not reproducible on Chrome 72.0.3626.76.
  2. Screenshot attached. Console:
    TypeError: "CSS2Properties doesn't have an indexed property setter for '0'"
        it https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Qn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Jn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        $n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        mr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        hr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        vr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Yn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Mt https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        nt https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        E https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        A https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        initializer https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        setTimeout handler*o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        A https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        componentWillMount https://static-wildcat.nfl.com/bundles/fcea75ac.bundle.js:1
        hn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        xn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Rn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Jn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        $n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        mr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        hr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        lr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        rr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Tr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Or https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        render https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Pr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Mr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Pr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        hydrate https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        exports https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        r https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/fcea75ac.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        a https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        x https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        u https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        exports https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        webpackJsonp https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
    www.nfl.c05bb186.bundle.js:1:1251381
    TypeError: "CSS2Properties doesn't have an indexed property setter for '0'"
        it https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Qn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Jn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        $n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        mr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        hr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        vr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Yn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Mt https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        nt https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        E https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        A https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        initializer https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        setTimeout handler*o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        A https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        componentWillMount https://static-wildcat.nfl.com/bundles/fcea75ac.bundle.js:1
        hn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        xn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Rn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Jn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        $n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        mr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        hr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        lr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        rr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Tr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Or https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        render https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Pr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Mr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Pr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        hydrate https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        exports https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        r https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/fcea75ac.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        a https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        x https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        u https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        exports https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        webpackJsonp https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
    www.nfl.c05bb186.bundle.js:1:1251381
    TypeError: "CSS2Properties doesn't have an indexed property setter for '0'"
        it https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Qn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Jn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        $n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        mr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        hr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        vr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Yn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Mt https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        nt https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        E https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        A https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        initializer https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        setTimeout handler*o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        A https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        componentWillMount https://static-wildcat.nfl.com/bundles/fcea75ac.bundle.js:1
        hn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        xn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Rn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Jn https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        $n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        mr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        hr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        lr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        rr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Tr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Or https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        render https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Pr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Mr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        Pr https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        hydrate https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        exports https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        r https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        o https://static-wildcat.nfl.com/bundles/fcea75ac.bundle.js:1
        n https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        a https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        x https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        u https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        exports https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
        c https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        webpackJsonp https://static-wildcat.nfl.com/bundles/manifest.b82285ad.bundle.js:1
        <anonymous> https://static-wildcat.nfl.com/bundles/www.nfl.c05bb186.bundle.js:1
    www.nfl.c05bb186.bundle.js:1:1251381
    TypeError: CSS2Properties doesn't have an indexed property setter for '0' www.nfl.c05bb186.bundle.js:1:1222140
    **** gigya.js loaded twice **** socialize.js:19:79

Watchers: @softvision-oana-arbuzov @softvision-sergiulogigan @cipriansv

sv; Screenshot Description

Browser Configuration
  • None

From webcompat.com with ❤️

wisniewskit commented 5 years ago

Searching online, this TypeError: "CSS2Properties doesn't have an indexed property setter for '0'" error seems to be something people run into with React from time to time. Sure enough, that seems to be the case here. It's failing in this initializer:

        }), V = a(p.prototype, "onResize", [Y.action], {
            enumerable: !0,
            initializer: function() {
                var e = this;
                return Object(J.debounce)(250, function() {
                    var t = {
                        desktop: Z.d,
                        largeDesktop: Z.g,
                        mobile: Z.i,
                        mobileOnly: Z.j,
                        tablet: Z.n,
                        tabletLandscape: Z.o
                    };
                    Object.keys(t).forEach(function(e) {
                        var n, r = t[e].replace(/@media\s+/, "");
                        t = oe({}, t, (n = {}, n[e] = window.matchMedia(r).matches, n))
                    }), e.setStateDeprecated({
                        isMediaQueriesSet: !0,
                        viewport: oe({}, e.viewport, {
                            height: window.innerHeight,
                            width: window.innerWidth
                        }),
                        mediaQueries: oe({}, e.mediaQueries, t)
                    })
                })
            }
        })

I noticed that commenting out the two "media queries" lines un-broke the page, but I couldn't find any obvious leads from the top down, so I started from the bottom of the stack trace.

This is the function where it's failing (with an auxiliary function):

    function it(e, t) {
        e = e.style;
        for (var n in t)
            if (t.hasOwnProperty(n)) {
                var r = 0 === n.indexOf("--"),
                    o = ot(n, t[n], r);
                "float" === n && (n = "cssFloat"),
                    r ? e.setProperty(n, o) : e[n] = o
            }
    }

    function ot(e, t, n) {
        return null == t || "boolean" === typeof t ||
               "" === t ? "" : n || "number" !== typeof t ||
               0 === t || Vi.hasOwnProperty(e) &&
               Vi[e] ? ("" + t).trim() : t + "px"
    }

It's bombing on the e[n] = o part (effectively element.style["0"] = undefined)

This is the object where the 0 property comes from:

Object {
  0: undefined
  ​bottom: 0
  ​left: 0
  ​marginBottom: 0
  ​marginLeft: 0
  ​marginRight: 0
  ​marginTop: 0
  ​paddingBottom: 0
  ​paddingLeft: 0
  ​paddingRight: 0
  ​paddingTop: 0
  ​position: "absolute"
  ​right: 0
  ​top: 58
  <prototype>: Object
}

These are the elements it's trying to set the style properties of:

<a data-metrics-event-name="clickAction" data-metrics-link-module="score strip" data-metrics-link-name="2019020300" data-metrics-link-type="global nav" data-metrics-link-url="/gamecenter/2019020300/2018/POST22/patriots@rams" aria-label="Patriots 13">

<a data-metrics-event-name="clickAction" data-metrics-link-module="score strip" data-metrics-link-name="2019020300" data-metrics-link-type="global nav" data-metrics-link-url="/gamecenter/2019020300/2018/POST22/patriots@rams" aria-label="Rams 3">

<a data-metrics-event-name="clickAction" data-metrics-link-module="score strip" data-metrics-link-name="2019020300" data-metrics-link-type="global nav" data-metrics-link-url="/gamecenter/2019020300/2018/POST22/patriots@rams" aria-label="Final">

And all the various objects involved seem to be native objects.

As expected, I can't reproduce the problem in a reduced test-case:

   document.createElement("a").style["0"] = undefined;

   /* or even */

   it(document.createElement("a"), {0: undefined});

Weirder still, Chrome is also running the same element.style[0]=undefined on the same elements without throwing an exception like Firefox. And if I hack it so Firefox uses the setProperty form or skips the 0, it also works.

Frankly I'm stumped as to why certain CSS2Properties objects would selectively reject a 0 index like this. @bzbarsky, you wouldn't happen to have any ideas?

bzbarsky commented 5 years ago

Hmm. So if we are hitting that exception, that means we landed in the [[DefineOwnProperty]] for CSS2Properties. A trivial way to reproduce that is:

Object.defineProperty(document.documentElement.style, 0, {});

To get there via simple assignment, though, I think a few things have to be true:

  1. There is no actual property named "0" on the object. As in, the CSS2Properties involved has no properties set in it. Otherwise it will be assignment to a readonly property, which is not the same thing as the exception we're getting.
  2. The script is in strict mode. Otherwise the failure to set is silent, not an exception.

So here is a simple testcase that reproduces the issue in Firefox:

<script>
  "use strict";
  document.documentElement.style[0] = undefined;
</script>

So I guess a few things to check:

That said, my testcase does NOT throw an exception in Chrome. That seems to be a bug in Chrome, per spec. In particular, per spec the following sequence of events should take place:

  1. https://heycam.github.io/webidl/#legacy-platform-object-set is called. Our object supports indexed properties, but has no property setter, so we fall through to OrdinarySetWithOwnDescriptor.
  2. https://tc39.github.io/ecma262/#sec-ordinarysetwithowndescriptor is called with ownDesc set to undefined, since there is no existing property named 0.
  3. This walks up the proto chain trying to do [[Set]] on ancestors (via step 2.b.i of OrdinarySetWithOwnDescriptor), but never finds an object with a property named 0. Eventually it gets to Object.prototype and reaches step 2.c there, which synthesizes an ownDesc. Since the thing is synthesizes is a data descriptor, we enter step 3, Receiver is the CSS2Properties object, it has no own property named "0", still, so we go to step 3.e.i and call CreateDataProperty.
  4. This lands at https://tc39.github.io/ecma262/#sec-createdataproperty and invokes the receiver's [[DefineOwnProperty]], which then lands us in https://heycam.github.io/webidl/#legacy-platform-object-defineownproperty
  5. We support indexed properties, P is an array index, we have no indexed property setter, so we return false per step 1.2.
  6. This false return propagates back out of the [[Set]]. Our entrypoint to [[Set]] was https://tc39.github.io/ecma262/#sec-putvalue step 6.b in this case, so we go to 6.c and throw in strict mode only.

Chrome does throw if I explicitly do Object.defineProperty(document.documentElement.style, 0, {});. Safari seems to not throw in either case...

@domenic, do you know what Chrome is actually implementing here. :(

domenic commented 5 years ago

Not sure myself, but @yuki3 probably knows.

yuki3 commented 5 years ago

I've not yet carefully followed this thread, however, off the top of my head, the following would be related.

Chrome (Blink) implements CSSStyleDeclaration's camel-cased attributes as named properties knowing it's wrong. document.documentElement.style is a CSSStyleDeclaration, so probably this is related?

bzbarsky commented 5 years ago

I don't see how that would affect indexed property access at all.

yuki3 commented 5 years ago

I'm sorry. I read the thread again. Let me describe what Chrome is doing.

For indexed/named properties, V8 supports several kinds of callback functions, such as getter, setter, descriptor (getOwnPropertyDescriptor), deleter, enumerator, and definer (defineProperty). Blink implements each callback as needed. So, technically we can implement different behaviors for setter and definer. I confirmed that Chrome checks whether it's strict mode or not in definer, but does not check it in setter. This is a problem.

There is another problem in Chrome. Chrome implements camel-cased attributes as named properties (this is wrong), which support both of getter and setter. Despite that the standard says that there is indexed getter but no indexed setter, Chrome actually supports both of indexed getter and indexed setter. The indexed setter falls back to the named setter, like below.

let style = document.documentElement.style;
style.cssText = "...";
// => style's named setter("cssText", "...");
style[0] = "...";
// => style's indexed setter(0, "...");
// => style's named setter("0", "..."); with a conversion from 0 to "0"

This makes Chrome behave weirdly, and this is why assignment doesn't throw but Object.defineProperty throws. Does this explanation (not behavior) makes sense? I agree that Blink's implementation is strange and wrong sadly.

bzbarsky commented 5 years ago

@yuki3 thank you for explaining that.

Next question: where do we go from here? Is Chrome willing to align with the current spec (and we get this site to fix their code as needed)? Or do we need to spec something either like what Chrome does or with at least the same observable effects in this case? If we choose to do the latter, I suspect we can manage with just web idl spec changes and not ES spec changes, presumably by having [[Set]] not fall through to OrdinarySetWithOwnDescriptor when O supports indexed properties but has no indexed property setter.

yuki3 commented 5 years ago

I personally do not have a conplainment in the current spec, and happy to follow it. The problem (for Blink bindings team) is a hack of CSSStyleDeclaration. If the hack is gone (= no named properties), it seems easy to fix the indexed setter to throw an exception in strict mode.

Let me file an issue against Blink CSS team about this tomorrow. I'll cc you.

yuki3 commented 5 years ago

I filed a chromium issue here. Feel free to comment there.

bzbarsky commented 5 years ago

It looks like that got duplicated to a longstanding issue that I had given up on ever being fixed in Chrome...

Is there any way to fix the behavior for names that look like array indices without completely fixing the named property issue?

karlcow commented 5 years ago

The issue in Chrome. (paper trail)

yuki3 commented 5 years ago

I'm now trying to workaround this with this patch.

bzbarsky commented 5 years ago

@yuki3 Thank you!

wisniewskit commented 5 years ago

It appears as though this page is no longer breaking with the CSS2Properties glitch, so since Chromium has also landed a fix to be interoperable here, I think we might as well close this one as fixed.

lock[bot] commented 5 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue at https://webcompat.com/issues/new if you are experiencing a similar problem.