OK then I will report here.
This issue totally crashed my production app and I think the change happened in the last 24-48 hours:
Steps to reproduce (see also example HTML code below):
- Replace native global
Promise with another implementation (bluebird in my case).
- Load twitter
widgets.js script.
- Try to use global
Promise.delay.
Expected result: Promise.delay is a function from the bluebird API.
Actual result: global Promise variable is replaced with some twitter specific implementation so Promise.delay is undefined - app crashes.
See example code:
<html>
<body>
<script>
self.nativePromise = self.Promise;
console.log("Before replacing:");
console.log("Is native:", self.Promise === self.nativePromise);
console.log("Is Bluebird:", self.Promise === "Bluebird");
self.Promise = "Bluebird";
console.log("After replacing:");
console.log("Is native:", self.Promise === self.nativePromise);
console.log("Is Bluebird:", self.Promise === "Bluebird");
</script>
<script src="https://platform.twitter.com/widgets.js"></script>
<script>
console.log("After twitter:");
console.log("Is native:", self.Promise === self.nativePromise);
console.log("Is Bluebird:", self.Promise === "Bluebird");
</script>
</body>
</html>
Output:
Before replacing:
Is native: true
Is Bluebird: false
After replacing:
Is native: false
Is Bluebird: true
After twitter:
Is native: false
Is Bluebird: false
All I wanted was for twitter to style a follow link as a nice looking button and it ended up crashing my app entirely - since there is no versioning my temporary fix was to simply remove widgets.js from the page.