Please read first!
Please use discuss-webrtc for general technical discussions and questions.
Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed.
Versions affected
Browser name including version (e.g. Chrome 64.0.3282.119)
Any browser I believes, as long as it is a wix site (I reproduced with firefox/chrome/safari)
adapter.js (e.g. 6.1.0)
9.0.4
Description
wrapPeerConnectionEvent in src/js/utils.js crashes when EventTarget.prototype.addEventListener is made non-writable by the host environment (e.g. Wix's site). Since adapterFactory() runs all shims immediately on import, this crashes the application at load time if they import this package.
We are currently have a working around by patching with a try-catch guard before the assignment
const nativeAddEventListener = proto.addEventListener;
try { proto.addEventListener = nativeAddEventListener; }
catch (e) { return; }
Steps to reproduce
- Open DevTools console on any page
- Go to one of the wix's example site (https://www.wix.com/explore/websites)
- Load adapter.js:
var s = document.createElement('script');
s.src = 'https://unpkg.com/webrtc-adapter@9.0.4/out/adapter.js';
document.head.appendChild(s);
// → TypeError: Cannot assign to read only property 'addEventListener'
Expected results
adapter.js loads without error, gracefully skipping patches it cannot apply.
Actual results
TypeError: Cannot assign to read only property 'addEventListener' of object '#'
Crashes at module initialization, prevents any library that bundles adapter.js from loading.
Please read first!
Please use discuss-webrtc for general technical discussions and questions.
Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed.
Versions affected
Browser name including version (e.g. Chrome 64.0.3282.119)
Any browser I believes, as long as it is a wix site (I reproduced with firefox/chrome/safari)
adapter.js (e.g. 6.1.0)
9.0.4
Description
wrapPeerConnectionEventinsrc/js/utils.jscrashes whenEventTarget.prototype.addEventListeneris made non-writable by the host environment (e.g. Wix's site). SinceadapterFactory()runs all shims immediately on import, this crashes the application at load time if they import this package.We are currently have a working around by patching with a try-catch guard before the assignment
Steps to reproduce
Expected results
adapter.js loads without error, gracefully skipping patches it cannot apply.
Actual results
TypeError: Cannot assign to read only property 'addEventListener' of object '#'
Crashes at module initialization, prevents any library that bundles adapter.js from loading.