Closed Bug 1400275 Opened 7 years ago Closed 7 years ago

Assertion failure: givenProto == reflectorProto (How are we supposed to change the proto now?), at dom/bindings/BindingUtils.cpp:3740

Categories

(Core :: DOM: Core & HTML, defect, P1)

57 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox-esr52 --- wontfix
firefox55 --- wontfix
firefox56 --- wontfix
firefox57 --- fixed

People

(Reporter: bc, Assigned: bzbarsky)

References

()

Details

(Keywords: assertion)

Attachments

(2 files)

Attached file Fedora Debug Log
1. https://app.wespeke.com/connect

2. Assertion failure: givenProto == reflectorProto (How are we supposed to change the proto now?), at /builds/worker/workspace/build/src/dom/bindings/BindingUtils.cpp:3740
#01: mozilla::dom::binding_detail::DoGetOrCreateDOMReflector<mozilla::dom::RTCPeerConnection, (mozilla::dom::binding_detail::GetOrCreateReflectorWrapBehavior)0u> [dom/bindings/BindingUtils.h:1100]
#02: mozilla::dom::GetOrCreateDOMReflectorHelper<RefPtr<mozilla::dom::RTCPeerConnection>, true>::GetOrCreate [dom/bindings/BindingUtils.h:1863]
#03: mozilla::dom::RTCPeerConnectionBinding::_constructor [dom/bindings/BindingUtils.h:1885]
#04: js::CallJSNative [js/src/jscntxtinlines.h:294]
#05: js::CallJSNativeConstructor [js/src/jscntxtinlines.h:326]
#06: InternalConstruct [js/src/vm/Interpreter.cpp:599]
#07: js::Construct [js/src/vm/Interpreter.cpp:637]
#08: js::SpreadCallOperation [js/src/vm/Interpreter.cpp:4904]
#09: Interpret [js/src/vm/Interpreter.cpp:3036]

Windows, Linux; Beta/56, Nightly/57
This feels bad (so P1) and I'm guessing you're the best person to fix, Boris, but please correct me on both accounts if needed.
Assignee: nobody → bzbarsky
Flags: needinfo?(bzbarsky)
Priority: -- → P1
Oh, this is exciting.  The page is subclassing RTCPeerConnection.  Specifically, in https://static.opentok.com/v2/js/opentok.min.js we have this bit (somewhat de-minified):

  canUseES6Class = function(e) {
    var t = e.RTCPeerConnection||e.webkitRTCPeerConnection||e.mozRTCPeerConnection,
        n = extendParentClass(t);
    if (n)
      try {
        if (n.prototype.foo="bar","bar"=== new n(null).foo)
          return !0
      } catch(e) {}
    return!1
  }

where extendParentClass is:

  extendParentClass = function extendParentClass(ParentClass){try{var ChildClass=eval('\n      "use strict"; // Chrome<49 requires strict mode\n      class ChildClass extends ParentClass {\n        constructor(...args) {\n          super(...args);\n          try {\n            this.__proto__ = ChildClass.prototype;\n          } catch (e) {}\n        }\n      };\n      ChildClass; // Ensure the final statement is returned in FF\n    ');if(ChildClass&&ChildClass.prototype instanceof ParentClass)return ChildClass}catch(e){}return null}

(not going to even try to prettyprint that).

Anyway, the upshot is that they have an RTCPeerConnection subclass.  This interface is JS-implemented, and for JS-implemented interfaces we create the reflector in the constructor, like so: http://searchfox.org/mozilla-central/rev/184f0c7888dd6abb32235377693b7d1fc0b75ac1/dom/bindings/Codegen.py#15359-15363

The good news is that we control all this code, so it's easy to fix.  ;)
Flags: needinfo?(bzbarsky)
Attachment #8908932 - Flags: review?(kyle) → review+
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/06ee47ac7e4d
Ensure we create reflectors for JS-implemented webidl interfaces with the right prototype when those interfaces are subclassed.  r=qdot
https://hg.mozilla.org/mozilla-central/rev/06ee47ac7e4d
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Component: DOM → DOM: Core & HTML
See Also: → 1659201
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: